Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_dxf_3dface.cxx
Go to the documentation of this file.
1 /*
2 Copyright 2002-2011 Pierre SMARS (smars@yuntech.edu.tw)
3 This program is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 #include "a_dxf_3dface.h"
17 #include "a_dxf_group.h"
18 
19 //---------------------------------------------------------------------------
20 a_dxf_3dface::a_dxf_3dface(std::istream * file) : a_dxf_entity(file)
21 {
22  x1_ok = false; y1_ok = false; z1_ok = false;
23  x2_ok = false; y2_ok = false; z2_ok = false;
24  x3_ok = false; y3_ok = false; z3_ok = false;
25 }
26 //---------------------------------------------------------------------------
28 {
29  a_dxf_group group(file_);
30  layer_ = "0";
31  for (;;)
32  {
33  group.read();
34  if (group.code()==8)
35  layer_ = group.data();
36  if (group.code()==10)
37  {
38  x1_ = group.data_double();
39  x1_ok = true;
40  }
41  if (group.code()==20)
42  {
43  y1_ = group.data_double();
44  y1_ok = true;
45  }
46  if (group.code()==30)
47  {
48  z1_ = group.data_double();
49  z1_ok = true;
50  }
51  if (group.code()==11)
52  {
53  x2_ = group.data_double();
54  x2_ok = true;
55  }
56  if (group.code()==21)
57  {
58  y2_ = group.data_double();
59  y2_ok = true;
60  }
61  if (group.code()==31)
62  {
63  z2_ = group.data_double();
64  z2_ok = true;
65  }
66  if (group.code()==12)
67  {
68  x3_ = group.data_double();
69  x3_ok = true;
70  }
71  if (group.code()==22)
72  {
73  y3_ = group.data_double();
74  y3_ok = true;
75  }
76  if (group.code()==32)
77  {
78  z3_ = group.data_double();
79  z3_ok = true;
80  }
81  if (group.code()==0)
82  break;
83  }
84  group.putback();
85  if (x1_ok && y1_ok && z1_ok && x2_ok && y2_ok && z2_ok && x3_ok && y3_ok && z3_ok)
86  return true;
87  else
88  return false;
89 }
a_dxf_3dface(std::istream *file)
a generic dxf entity
Definition: a_dxf_entity.h:29
std::string layer_
Definition: a_dxf_entity.h:38
std::istream * file_
Definition: a_dxf_entity.h:37
a dxf group
Definition: a_dxf_group.h:30
double data_double()
Definition: a_dxf_group.cxx:90
int code()
Definition: a_dxf_group.h:36
void putback()
Definition: a_dxf_group.cxx:68
std::string data()
Definition: a_dxf_group.h:37