Points&Forces (core)
Software tools facilitating the task of surveying architecture
dxf
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
//---------------------------------------------------------------------------
25
void
a_dxf_hatch::init
()
26
{
27
x_
.clear();
28
y_
.clear();
29
z_
.clear();
30
}
31
//---------------------------------------------------------------------------
32
bool
a_dxf_hatch::read
()
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_dxf_group.h
a_dxf_hatch.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::data_int
int data_int()
Definition:
a_dxf_group.cxx:81
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_hatch::y_
std::vector< double > y_
Definition:
a_dxf_hatch.h:42
a_dxf_hatch::init
void init()
Definition:
a_dxf_hatch.cxx:25
a_dxf_hatch::a_dxf_hatch
a_dxf_hatch(std::istream *file)
Definition:
a_dxf_hatch.cxx:20
a_dxf_hatch::x_
std::vector< double > x_
Definition:
a_dxf_hatch.h:41
a_dxf_hatch::read
bool read()
Definition:
a_dxf_hatch.cxx:32
a_dxf_hatch::z_
std::vector< double > z_
Definition:
a_dxf_hatch.h:43
Generated on Tue Sep 6 2022 18:50:16 for Points&Forces (core) by
1.9.1