Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_dxf_point.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_point.h"
17 #include "a_dxf_group.h"
18 
19 //---------------------------------------------------------------------------
20 a_dxf_point::a_dxf_point(std::istream * file) : a_dxf_entity(file)
21 {
22  x_ok = false; y_ok = false; z_ok = false;
23 }
24 //---------------------------------------------------------------------------
26 {
27  a_dxf_group group(file_);
28  layer_ = "0";
29  for (;;)
30  {
31  group.read();
32  if (group.code()==8)
33  layer_ = group.data();
34  if (group.code()==10)
35  {
36  x_ = group.data_double();
37  x_ok = true;
38  }
39  if (group.code()==20)
40  {
41  y_ = group.data_double();
42  y_ok = true;
43  }
44  if (group.code()==30)
45  {
46  z_ = group.data_double();
47  z_ok = true;
48  }
49  if (group.code()==0)
50  break;
51  }
52  group.putback();
53  if (x_ok && y_ok && z_ok)
54  return true;
55  else
56  return false;
57 }
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
double z_
Definition: a_dxf_point.h:41
double x_
Definition: a_dxf_point.h:39
a_dxf_point(std::istream *file)
Definition: a_dxf_point.cxx:20
double y_
Definition: a_dxf_point.h:40