QCAD
Open Source 2D CAD
dl_creationinterface.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2013 RibbonSoft, GmbH. All rights reserved.
3 **
4 ** This file is part of the dxflib project.
5 **
6 ** This file is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU General Public License as published by
8 ** the Free Software Foundation; either version 2 of the License, or
9 ** (at your option) any later version.
10 **
11 ** Licensees holding valid dxflib Professional Edition licenses may use
12 ** this file in accordance with the dxflib Commercial License
13 ** Agreement provided with the Software.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** See http://www.ribbonsoft.com for further details.
19 **
20 ** Contact info@ribbonsoft.com if any conditions of this licensing are
21 ** not clear to you.
22 **
23 **********************************************************************/
24 
25 #ifndef DL_CREATIONINTERFACE_H
26 #define DL_CREATIONINTERFACE_H
27 
28 #include "dl_global.h"
29 
30 #include <string.h>
31 
32 #include "dl_attributes.h"
33 #include "dl_codes.h"
34 #include "dl_entities.h"
35 #include "dl_extrusion.h"
36 
48 public:
50  extrusion = new DL_Extrusion;
51  }
53  delete extrusion;
54  }
55 
60  virtual void processCodeValuePair(unsigned int groupCode, const std::string& groupValue) = 0;
61 
65  virtual void endSection() = 0;
66 
70  virtual void addLayer(const DL_LayerData& data) = 0;
71 
75  virtual void addLinetype(const DL_LinetypeData& data) = 0;
76 
80  virtual void addLinetypeDash(double length) = 0;
81 
88  virtual void addBlock(const DL_BlockData& data) = 0;
89 
91  virtual void endBlock() = 0;
92 
94  virtual void addTextStyle(const DL_StyleData& data) = 0;
95 
97  virtual void addPoint(const DL_PointData& data) = 0;
98 
100  virtual void addLine(const DL_LineData& data) = 0;
101 
103  virtual void addXLine(const DL_XLineData& data) = 0;
104 
106  virtual void addRay(const DL_RayData& data) = 0;
107 
109  virtual void addArc(const DL_ArcData& data) = 0;
110 
112  virtual void addCircle(const DL_CircleData& data) = 0;
113 
115  virtual void addEllipse(const DL_EllipseData& data) = 0;
116 
118  virtual void addPolyline(const DL_PolylineData& data) = 0;
119 
121  virtual void addVertex(const DL_VertexData& data) = 0;
122 
124  virtual void addSpline(const DL_SplineData& data) = 0;
125 
127  virtual void addControlPoint(const DL_ControlPointData& data) = 0;
128 
130  virtual void addFitPoint(const DL_FitPointData& data) = 0;
131 
133  virtual void addKnot(const DL_KnotData& data) = 0;
134 
136  virtual void addInsert(const DL_InsertData& data) = 0;
137 
139  virtual void addTrace(const DL_TraceData& data) = 0;
140 
142  virtual void add3dFace(const DL_3dFaceData& data) = 0;
143 
145  virtual void addSolid(const DL_SolidData& data) = 0;
146 
147 
149  virtual void addMText(const DL_MTextData& data) = 0;
150 
156  virtual void addMTextChunk(const std::string& text) = 0;
157 
159  virtual void addText(const DL_TextData& data) = 0;
160 
162  virtual void addArcAlignedText(const DL_ArcAlignedTextData& data) = 0;
163 
165  virtual void addAttribute(const DL_AttributeData& data) = 0;
166 
170  virtual void addDimAlign(const DL_DimensionData& data,
171  const DL_DimAlignedData& edata) = 0;
175  virtual void addDimLinear(const DL_DimensionData& data,
176  const DL_DimLinearData& edata) = 0;
177 
181  virtual void addDimRadial(const DL_DimensionData& data,
182  const DL_DimRadialData& edata) = 0;
183 
187  virtual void addDimDiametric(const DL_DimensionData& data,
188  const DL_DimDiametricData& edata) = 0;
189 
193  virtual void addDimAngular(const DL_DimensionData& data,
194  const DL_DimAngularData& edata) = 0;
195 
199  virtual void addDimAngular3P(const DL_DimensionData& data,
200  const DL_DimAngular3PData& edata) = 0;
201 
205  virtual void addDimOrdinate(const DL_DimensionData& data,
206  const DL_DimOrdinateData& edata) = 0;
207 
211  virtual void addLeader(const DL_LeaderData& data) = 0;
212 
216  virtual void addLeaderVertex(const DL_LeaderVertexData& data) = 0;
217 
221  virtual void addHatch(const DL_HatchData& data) = 0;
222 
226  virtual void addImage(const DL_ImageData& data) = 0;
227 
231  virtual void linkImage(const DL_ImageDefData& data) = 0;
232 
236  virtual void addHatchLoop(const DL_HatchLoopData& data) = 0;
237 
241  virtual void addHatchEdge(const DL_HatchEdgeData& data) = 0;
242 
246  virtual void addXRecord(const std::string& handle) = 0;
247 
251  virtual void addXRecordString(int code, const std::string& value) = 0;
252 
256  virtual void addXRecordReal(int code, double value) = 0;
257 
261  virtual void addXRecordInt(int code, int value) = 0;
262 
266  virtual void addXRecordBool(int code, bool value) = 0;
267 
271  virtual void addXDataApp(const std::string& appId) = 0;
272 
276  virtual void addXDataString(int code, const std::string& value) = 0;
277 
281  virtual void addXDataReal(int code, double value) = 0;
282 
286  virtual void addXDataInt(int code, int value) = 0;
287 
291  virtual void addDictionary(const DL_DictionaryData& data) = 0;
292 
296  virtual void addDictionaryEntry(const DL_DictionaryEntryData& data) = 0;
297 
301  virtual void endEntity() = 0;
302 
306  virtual void addComment(const std::string& comment) = 0;
307 
311  virtual void setVariableVector(const std::string& key, double v1, double v2, double v3, int code) = 0;
312 
316  virtual void setVariableString(const std::string& key, const std::string& value, int code) = 0;
317 
321  virtual void setVariableInt(const std::string& key, int value, int code) = 0;
322 
326  virtual void setVariableDouble(const std::string& key, double value, int code) = 0;
327 
328 #ifdef DL_COMPAT
329  virtual void setVariableVector(const char* key, double v1, double v2, double v3, int code) = 0;
330  virtual void setVariableString(const char* key, const char* value, int code) = 0;
331  virtual void setVariableInt(const char* key, int value, int code) = 0;
332  virtual void setVariableDouble(const char* key, double value, int code) = 0;
333  virtual void processCodeValuePair(unsigned int groupCode, char* groupValue) = 0;
334  virtual void addComment(const char* comment) = 0;
335  virtual void addMTextChunk(const char* text) = 0;
336 #endif
337 
341  virtual void endSequence() = 0;
342 
344  void setAttributes(const DL_Attributes& attrib) {
345  attributes = attrib;
346  }
347 
350  return attributes;
351  }
352 
354  void setExtrusion(double dx, double dy, double dz, double elevation) {
355  extrusion->setDirection(dx, dy, dz);
356  extrusion->setElevation(elevation);
357  }
358 
361  return extrusion;
362  }
363 
364 protected:
367 };
368 
369 #endif
virtual ~DL_CreationInterface()
Definition: dl_creationinterface.h:52
Dictionary entry data.
Definition: dl_entities.h:1803
Radial Dimension Data.
Definition: dl_entities.h:1183
Hatch data.
Definition: dl_entities.h:1464
Generic Dimension Data.
Definition: dl_entities.h:990
Ordinate Dimension Data.
Definition: dl_entities.h:1350
Abstract class (interface) for the creation of new entities.
Definition: dl_creationinterface.h:47
void addPoint(void position)
Adds a point to the drawing.
Definition: simple_create.js:63
void addLine(void startPoint, void endPoint)
Adds a line to the drawing.
Definition: simple_create.js:51
Aligned Dimension Data.
Definition: dl_entities.h:1100
Extrusion direction.
Definition: dl_extrusion.h:38
DL_CreationInterface()
Definition: dl_creationinterface.h:49
Circle Data.
Definition: dl_entities.h:352
Storing and passing around attributes.
Definition: dl_attributes.h:41
Text Data.
Definition: dl_entities.h:800
Line Data.
Definition: dl_entities.h:221
Text style data.
Definition: dl_entities.h:130
Linear (rotated) Dimension Data.
Definition: dl_entities.h:1137
Spline knot data.
Definition: dl_entities.h:556
#define DXFLIB_EXPORT
Definition: dl_global.h:12
void setAttributes(const DL_Attributes &attrib)
Sets the current attributes for entities.
Definition: dl_creationinterface.h:344
void addArc(void center, void radius, void startAngle, void endAngle, void reversed)
Adds an arc to the drawing.
Definition: simple_create.js:96
void addLayer(void name, void colorName, void linetypeName, void lineWeight)
Adds a layer to the drawing.
Definition: simple_create.js:107
DL_Extrusion * extrusion
Definition: dl_creationinterface.h:366
void addSpline(void points, void closed)
Adds a spline to the drawing.
Definition: simple_create.js:143
Hatch edge data.
Definition: dl_entities.h:1533
Spline fit point data.
Definition: dl_entities.h:602
Polyline Data.
Definition: dl_entities.h:382
Point Data.
Definition: dl_entities.h:197
Line Type Data.
Definition: dl_entities.h:90
Block Data.
Definition: dl_entities.h:59
MText Data.
Definition: dl_entities.h:719
Arc Data.
Definition: dl_entities.h:315
XLine Data.
Definition: dl_entities.h:255
Trace Data / solid data / 3d face data.
Definition: dl_entities.h:444
void addCircle(void center, void radius)
Adds a circle to the drawing.
Definition: simple_create.js:84
void addPolyline(void points, void closed, void relative)
Adds a polyline to the drawing.
Definition: simple_create.js:30
Image Data.
Definition: dl_entities.h:1703
Angular Dimension Data (3 points version).
Definition: dl_entities.h:1301
DL_Extrusion * getExtrusion()
Definition: dl_creationinterface.h:360
Ray Data.
Definition: dl_entities.h:284
DL_Attributes getAttributes()
Definition: dl_creationinterface.h:349
void setExtrusion(double dx, double dy, double dz, double elevation)
Sets the current attributes for entities.
Definition: dl_creationinterface.h:354
Insert Data.
Definition: dl_entities.h:669
Spline control point data.
Definition: dl_entities.h:575
Leader (arrow).
Definition: dl_entities.h:1393
Layer Data.
Definition: dl_entities.h:36
Angular Dimension Data.
Definition: dl_entities.h:1241
Diametric Dimension Data.
Definition: dl_entities.h:1212
Vertex Data.
Definition: dl_entities.h:416
Ellipse Data.
Definition: dl_entities.h:622
DL_Attributes attributes
Definition: dl_creationinterface.h:365
Block attribute data.
Definition: dl_entities.h:950
Dictionary data.
Definition: dl_entities.h:1793
Image Definition Data.
Definition: dl_entities.h:1769
Hatch boundary path (loop) data.
Definition: dl_entities.h:1511
Spline Data.
Definition: dl_entities.h:511
Arc Aligned Text Data.
Definition: dl_entities.h:870
Leader Vertex Data.
Definition: dl_entities.h:1440