Points&Forces (core)
Software tools facilitating the task of surveying architecture
dxf
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
//---------------------------------------------------------------------------
25
void
a_dxf_polyline::init
()
26
{
27
x_
.clear();
28
y_
.clear();
29
z_
.clear();
30
}
31
//---------------------------------------------------------------------------
32
bool
a_dxf_polyline::read
()
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_dxf_group.h
a_dxf_polyline.h
a_dxf_entity
a generic dxf entity
Definition:
a_dxf_entity.h:29
a_dxf_entity::layer_
std::string layer_
Definition:
a_dxf_entity.h:38
a_dxf_entity::file_
std::istream * file_
Definition:
a_dxf_entity.h:37
a_dxf_group
a dxf group
Definition:
a_dxf_group.h:30
a_dxf_group::data_double
double data_double()
Definition:
a_dxf_group.cxx:90
a_dxf_group::code
int code()
Definition:
a_dxf_group.h:36
a_dxf_group::putback
void putback()
Definition:
a_dxf_group.cxx:68
a_dxf_group::read
bool read()
Definition:
a_dxf_group.cxx:21
a_dxf_group::data
std::string data()
Definition:
a_dxf_group.h:37
a_dxf_polyline::y_
std::vector< double > y_
Definition:
a_dxf_polyline.h:41
a_dxf_polyline::init
void init()
Definition:
a_dxf_polyline.cxx:25
a_dxf_polyline::a_dxf_polyline
a_dxf_polyline(std::istream *file)
Definition:
a_dxf_polyline.cxx:20
a_dxf_polyline::z_
std::vector< double > z_
Definition:
a_dxf_polyline.h:42
a_dxf_polyline::read
bool read()
Definition:
a_dxf_polyline.cxx:32
a_dxf_polyline::x_
std::vector< double > x_
Definition:
a_dxf_polyline.h:40
Generated on Tue Sep 6 2022 18:50:16 for Points&Forces (core) by
1.9.1