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