-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_creationclass.cpp
140 lines (118 loc) · 3.94 KB
/
test_creationclass.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
* @file test_creationclass.cpp
*/
/*****************************************************************************
** $Id: test_creationclass.cpp 8865 2008-02-04 18:54:02Z andrew $
**
** This is part of the dxflib library
** Copyright (C) 2001 Andrew Mustun
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Library General Public License as
** published by the Free Software Foundation.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Library General Public License for more details.
**
** You should have received a copy of the GNU Library General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#include "test_creationclass.h"
#include <iostream>
#include <stdio.h>
/**
* Default constructor.
*/
Test_CreationClass::Test_CreationClass() {}
/**
* Sample implementation of the method which handles layers.
*/
void Test_CreationClass::addLayer(const DL_LayerData& data) {
printf("LAYER: %s flags: %d\n", data.name.c_str(), data.flags);
printAttributes();
}
/**
* Sample implementation of the method which handles point entities.
*/
void Test_CreationClass::addPoint(const DL_PointData& data) {
printf("POINT (%6.3f, %6.3f, %6.3f)\n",
data.x, data.y, data.z);
printAttributes();
}
/**
* Sample implementation of the method which handles line entities.
*/
void Test_CreationClass::addLine(const DL_LineData& data) {
printf("LINE (%6.3f, %6.3f, %6.3f) (%6.3f, %6.3f, %6.3f)\n",
data.x1, data.y1, data.z1, data.x2, data.y2, data.z2);
printAttributes();
}
/**
* Sample implementation of the method which handles arc entities.
*/
void Test_CreationClass::addArc(const DL_ArcData& data) {
printf("ARC (%6.3f, %6.3f, %6.3f) %6.3f, %6.3f, %6.3f\n",
data.cx, data.cy, data.cz,
data.radius, data.angle1, data.angle2);
printAttributes();
}
/**
* Sample implementation of the method which handles circle entities.
*/
void Test_CreationClass::addCircle(const DL_CircleData& data) {
printf("CIRCLE (%6.3f, %6.3f, %6.3f) %6.3f\n",
data.cx, data.cy, data.cz,
data.radius);
printAttributes();
}
/**
* Sample implementation of the method which handles polyline entities.
*/
void Test_CreationClass::addPolyline(const DL_PolylineData& data) {
printf("POLYLINE \n");
printf("flags: %d\n", (int)data.flags);
printAttributes();
}
/**
* Sample implementation of the method which handles vertices.
*/
void Test_CreationClass::addVertex(const DL_VertexData& data) {
printf("VERTEX (%6.3f, %6.3f, %6.3f) %6.3f\n",
data.x, data.y, data.z,
data.bulge);
printAttributes();
}
void Test_CreationClass::add3dFace(const DL_3dFaceData& data) {
printf("3DFACE\n");
for (int i=0; i<4; i++) {
printf(" corner %d: %6.3f %6.3f %6.3f\n",
i, data.x[i], data.y[i], data.z[i]);
}
printAttributes();
}
void Test_CreationClass::printAttributes() {
printf(" Attributes: Layer: %s, ", attributes.getLayer().c_str());
printf(" Color: ");
if (attributes.getColor()==256) {
printf("BYLAYER");
} else if (attributes.getColor()==0) {
printf("BYBLOCK");
} else {
printf("%d", attributes.getColor());
}
printf(" Width: ");
if (attributes.getWidth()==-1) {
printf("BYLAYER");
} else if (attributes.getWidth()==-2) {
printf("BYBLOCK");
} else if (attributes.getWidth()==-3) {
printf("DEFAULT");
} else {
printf("%d", attributes.getWidth());
}
//printf(" Type: %s\n", attributes.getLineType().c_str());
}
// EOF