Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_dxf_polyline.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_polyline.h"
17 #include "a_dxf_group.h"
18 
19 //---------------------------------------------------------------------------
20 a_dxf_polyline::a_dxf_polyline(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  this->init();
35  a_dxf_group group(file_);
36  layer_ = "0";
37  bool stop = false;
38  do
39  {
40  group.read();
41  if (group.code()==8)
42  layer_ = group.data();
43  if ((group.code()==0)&&(group.data()=="VERTEX"))
44  {
45  do
46  {
47  group.read();
48  if (group.code()==10)
49  x_.push_back(group.data_double());
50  else if (group.code()==20)
51  y_.push_back(group.data_double());
52  else if (group.code()==30)
53  z_.push_back(group.data_double());
54  else if (group.data()=="SEQEND")
55  {
56  do
57  {
58  group.read();
59  if (group.code()==0)
60  stop = true;
61  } while (!stop);
62  }
63  } while (!stop);
64  }
65  } while (!stop);
66  group.putback();
67  return true;
68 }
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
std::vector< double > y_
a_dxf_polyline(std::istream *file)
std::vector< double > z_
std::vector< double > x_