Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_dxf_hatch.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_hatch.h"
17 #include "a_dxf_group.h"
18 
19 //---------------------------------------------------------------------------
20 a_dxf_hatch::a_dxf_hatch(std::istream * file) : a_dxf_entity(file)
21 {
22 
23 }
24 //---------------------------------------------------------------------------
26 {
27  x_.clear();
28  y_.clear();
29  z_.clear();
30 }
31 //---------------------------------------------------------------------------
33 {
34  a_dxf_group group(file_);
35  layer_ = "0";
36  bool stop = false;
37  for (;;)
38  {
39  group.read();
40  if (group.code()==8)
41  layer_ = group.data();
42  else if (group.code()==93)
43  {
44  int n_edge = group.data_int();
45  int ix = 0, iy = 0;
46  do
47  {
48  group.read();
49  if (group.code()==10)
50  {
51  x_.push_back(group.data_double());
52  ix++;
53  }
54  else if (group.code()==20)
55  {
56  y_.push_back(group.data_double());
57  z_.push_back(0.);
58  iy++;
59  }
60  } while ((ix<n_edge)||(iy<n_edge));
61  }
62  else if (group.code()==0)
63  break;
64  }
65  group.putback();
66  return true;
67 }
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
int data_int()
Definition: a_dxf_group.cxx:81
void putback()
Definition: a_dxf_group.cxx:68
std::string data()
Definition: a_dxf_group.h:37
std::vector< double > y_
Definition: a_dxf_hatch.h:42
a_dxf_hatch(std::istream *file)
Definition: a_dxf_hatch.cxx:20
std::vector< double > x_
Definition: a_dxf_hatch.h:41
std::vector< double > z_
Definition: a_dxf_hatch.h:43