Horizon
Loading...
Searching...
No Matches
dl_dxf.h
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_DXF_H
26#define DL_DXF_H
27
28#include "dl_global.h"
29
30#include <limits>
31#include <stdio.h>
32#include <stdlib.h>
33#include <string>
34#include <sstream>
35#include <map>
36
37#include "dl_attributes.h"
38#include "dl_codes.h"
39#include "dl_entities.h"
40#include "dl_writer_ascii.h"
41
42#ifdef _WIN32
43#undef M_PI
44#define M_PI 3.14159265358979323846
45#pragma warning(disable : 4800)
46#endif
47
48#ifndef M_PI
49#define M_PI 3.1415926535897932384626433832795
50#endif
51
52#ifndef DL_NANDOUBLE
53#define DL_NANDOUBLE std::numeric_limits<double>::quiet_NaN()
54#endif
55
57class DL_WriterA;
58
59
60#define DL_VERSION "3.26.4.0"
61
62#define DL_VERSION_MAJOR 3
63#define DL_VERSION_MINOR 26
64#define DL_VERSION_REV 4
65#define DL_VERSION_BUILD 0
66
67#define DL_UNKNOWN 0
68#define DL_LAYER 10
69#define DL_BLOCK 11
70#define DL_ENDBLK 12
71#define DL_LINETYPE 13
72#define DL_STYLE 20
73#define DL_SETTING 50
74#define DL_ENTITY_POINT 100
75#define DL_ENTITY_LINE 101
76#define DL_ENTITY_POLYLINE 102
77#define DL_ENTITY_LWPOLYLINE 103
78#define DL_ENTITY_VERTEX 104
79#define DL_ENTITY_SPLINE 105
80#define DL_ENTITY_KNOT 106
81#define DL_ENTITY_CONTROLPOINT 107
82#define DL_ENTITY_ARC 108
83#define DL_ENTITY_CIRCLE 109
84#define DL_ENTITY_ELLIPSE 110
85#define DL_ENTITY_INSERT 111
86#define DL_ENTITY_TEXT 112
87#define DL_ENTITY_MTEXT 113
88#define DL_ENTITY_DIMENSION 114
89#define DL_ENTITY_LEADER 115
90#define DL_ENTITY_HATCH 116
91#define DL_ENTITY_ATTRIB 117
92#define DL_ENTITY_IMAGE 118
93#define DL_ENTITY_IMAGEDEF 119
94#define DL_ENTITY_TRACE 120
95#define DL_ENTITY_SOLID 121
96#define DL_ENTITY_3DFACE 122
97#define DL_ENTITY_XLINE 123
98#define DL_ENTITY_RAY 124
99#define DL_ENTITY_ARCALIGNEDTEXT 125
100#define DL_ENTITY_SEQEND 126
101#define DL_XRECORD 200
102#define DL_DICTIONARY 210
103
104
122class DXFLIB_EXPORT DL_Dxf {
123public:
124 DL_Dxf();
125 ~DL_Dxf();
126
127 bool in(const std::string& file,
128 DL_CreationInterface* creationInterface);
129 bool readDxfGroups(FILE* fp,
130 DL_CreationInterface* creationInterface);
131 static bool getStrippedLine(std::string& s, unsigned int size,
132 FILE* stream, bool stripSpace = true);
133
134 bool readDxfGroups(std::istream& stream,
135 DL_CreationInterface* creationInterface);
136 bool in(std::istream &stream,
137 DL_CreationInterface* creationInterface);
138 static bool getStrippedLine(std::string& s, unsigned int size,
139 std::istream& stream, bool stripSpace = true);
140
141 static bool stripWhiteSpace(char** s, bool stripSpaces = true);
142
143 bool processDXFGroup(DL_CreationInterface* creationInterface,
144 int groupCode, const std::string& groupValue);
145 void addSetting(DL_CreationInterface* creationInterface);
146 void addLayer(DL_CreationInterface* creationInterface);
147 void addLinetype(DL_CreationInterface *creationInterface);
148 void addBlock(DL_CreationInterface* creationInterface);
149 void endBlock(DL_CreationInterface* creationInterface);
150 void addTextStyle(DL_CreationInterface* creationInterface);
151
152 void addPoint(DL_CreationInterface* creationInterface);
153 void addLine(DL_CreationInterface* creationInterface);
154 void addXLine(DL_CreationInterface* creationInterface);
155 void addRay(DL_CreationInterface* creationInterface);
156
157 void addPolyline(DL_CreationInterface* creationInterface);
158 void addVertex(DL_CreationInterface* creationInterface);
159
160 void addSpline(DL_CreationInterface* creationInterface);
161
162 void addArc(DL_CreationInterface* creationInterface);
163 void addCircle(DL_CreationInterface* creationInterface);
164 void addEllipse(DL_CreationInterface* creationInterface);
165 void addInsert(DL_CreationInterface* creationInterface);
166
167 void addTrace(DL_CreationInterface* creationInterface);
168 void add3dFace(DL_CreationInterface* creationInterface);
169 void addSolid(DL_CreationInterface* creationInterface);
170
171 void addMText(DL_CreationInterface* creationInterface);
172 void addText(DL_CreationInterface* creationInterface);
173 void addArcAlignedText(DL_CreationInterface* creationInterface);
174
175 void addAttribute(DL_CreationInterface* creationInterface);
176
178 void addDimLinear(DL_CreationInterface* creationInterface);
179 void addDimAligned(DL_CreationInterface* creationInterface);
180 void addDimRadial(DL_CreationInterface* creationInterface);
181 void addDimDiametric(DL_CreationInterface* creationInterface);
182 void addDimAngular(DL_CreationInterface* creationInterface);
183 void addDimAngular3P(DL_CreationInterface* creationInterface);
184 void addDimOrdinate(DL_CreationInterface* creationInterface);
185
186 void addLeader(DL_CreationInterface* creationInterface);
187
188 void addHatch(DL_CreationInterface* creationInterface);
189 void addHatchLoop();
190 void addHatchEdge();
191 bool handleHatchData(DL_CreationInterface* creationInterface);
192
193 void addImage(DL_CreationInterface* creationInterface);
194 void addImageDef(DL_CreationInterface* creationInterface);
195
196 void addComment(DL_CreationInterface* creationInterface, const std::string& comment);
197
198 void addDictionary(DL_CreationInterface* creationInterface);
199 void addDictionaryEntry(DL_CreationInterface* creationInterface);
200
201 bool handleXRecordData(DL_CreationInterface* creationInterface);
202 bool handleDictionaryData(DL_CreationInterface* creationInterface);
203
204 bool handleXData(DL_CreationInterface *creationInterface);
205 bool handleMTextData(DL_CreationInterface* creationInterface);
206 bool handleLWPolylineData(DL_CreationInterface* creationInterface);
207 bool handleSplineData(DL_CreationInterface* creationInterface);
208 bool handleLeaderData(DL_CreationInterface* creationInterface);
209 bool handleLinetypeData(DL_CreationInterface* creationInterface);
210
211 void endEntity(DL_CreationInterface* creationInterface);
212
213 void endSequence(DL_CreationInterface* creationInterface);
214
215 //int stringToInt(const char* s, bool* ok=NULL);
216
217 DL_WriterA* out(const char* file,
218 DL_Codes::version version=DL_VERSION_2000);
219
220 void writeHeader(DL_WriterA& dw);
221
222 void writePoint(DL_WriterA& dw,
223 const DL_PointData& data,
224 const DL_Attributes& attrib);
225 void writeLine(DL_WriterA& dw,
226 const DL_LineData& data,
227 const DL_Attributes& attrib);
228 void writeXLine(DL_WriterA& dw,
229 const DL_XLineData& data,
230 const DL_Attributes& attrib);
231 void writeRay(DL_WriterA& dw,
232 const DL_RayData& data,
233 const DL_Attributes& attrib);
234 void writePolyline(DL_WriterA& dw,
235 const DL_PolylineData& data,
236 const DL_Attributes& attrib);
237 void writeVertex(DL_WriterA& dw,
238 const DL_VertexData& data);
240 void writeSpline(DL_WriterA& dw,
241 const DL_SplineData& data,
242 const DL_Attributes& attrib);
244 const DL_ControlPointData& data);
245 void writeFitPoint(DL_WriterA& dw,
246 const DL_FitPointData& data);
247 void writeKnot(DL_WriterA& dw,
248 const DL_KnotData& data);
249 void writeCircle(DL_WriterA& dw,
250 const DL_CircleData& data,
251 const DL_Attributes& attrib);
252 void writeArc(DL_WriterA& dw,
253 const DL_ArcData& data,
254 const DL_Attributes& attrib);
255 void writeEllipse(DL_WriterA& dw,
256 const DL_EllipseData& data,
257 const DL_Attributes& attrib);
258 void writeSolid(DL_WriterA& dw,
259 const DL_SolidData& data,
260 const DL_Attributes& attrib);
261 void writeTrace(DL_WriterA& dw,
262 const DL_TraceData& data,
263 const DL_Attributes& attrib);
264 void write3dFace(DL_WriterA& dw,
265 const DL_3dFaceData& data,
266 const DL_Attributes& attrib);
267 void writeInsert(DL_WriterA& dw,
268 const DL_InsertData& data,
269 const DL_Attributes& attrib);
270 void writeMText(DL_WriterA& dw,
271 const DL_MTextData& data,
272 const DL_Attributes& attrib);
273 void writeText(DL_WriterA& dw,
274 const DL_TextData& data,
275 const DL_Attributes& attrib);
276 void writeAttribute(DL_WriterA& dw,
277 const DL_AttributeData& data,
278 const DL_Attributes& attrib);
279 void writeDimStyleOverrides(DL_WriterA& dw,
280 const DL_DimensionData& data);
282 const DL_DimensionData& data,
283 const DL_DimAlignedData& edata,
284 const DL_Attributes& attrib);
285 void writeDimLinear(DL_WriterA& dw,
286 const DL_DimensionData& data,
287 const DL_DimLinearData& edata,
288 const DL_Attributes& attrib);
289 void writeDimRadial(DL_WriterA& dw,
290 const DL_DimensionData& data,
291 const DL_DimRadialData& edata,
292 const DL_Attributes& attrib);
294 const DL_DimensionData& data,
295 const DL_DimDiametricData& edata,
296 const DL_Attributes& attrib);
298 const DL_DimensionData& data,
299 const DL_DimAngular2LData& edata,
300 const DL_Attributes& attrib);
302 const DL_DimensionData& data,
303 const DL_DimAngular3PData& edata,
304 const DL_Attributes& attrib);
306 const DL_DimensionData& data,
307 const DL_DimOrdinateData& edata,
308 const DL_Attributes& attrib);
309 void writeLeader(DL_WriterA& dw,
310 const DL_LeaderData& data,
311 const DL_Attributes& attrib);
313 const DL_LeaderVertexData& data);
314 void writeLeaderEnd(DL_WriterA& dw,
315 const DL_LeaderData& data);
316 void writeHatch1(DL_WriterA& dw,
317 const DL_HatchData& data,
318 const DL_Attributes& attrib);
319 void writeHatch2(DL_WriterA& dw,
320 const DL_HatchData& data,
321 const DL_Attributes& attrib);
323 const DL_HatchLoopData& data);
325 const DL_HatchLoopData& data);
326 void writeHatchEdge(DL_WriterA& dw,
327 const DL_HatchEdgeData& data);
328
329 unsigned long writeImage(DL_WriterA& dw,
330 const DL_ImageData& data,
331 const DL_Attributes& attrib);
332
333 void writeImageDef(DL_WriterA& dw, int handle,
334 const DL_ImageData& data);
335
336 void writeLayer(DL_WriterA& dw,
337 const DL_LayerData& data,
338 const DL_Attributes& attrib);
339
340 void writeLinetype(DL_WriterA& dw,
341 const DL_LinetypeData& data);
342
343 void writeAppid(DL_WriterA& dw, const std::string& name);
344
345 void writeBlock(DL_WriterA& dw,
346 const DL_BlockData& data);
347 void writeEndBlock(DL_WriterA& dw, const std::string& name);
348
349 void writeVPort(DL_WriterA& dw);
350 void writeStyle(DL_WriterA& dw, const DL_StyleData& style);
351 void writeView(DL_WriterA& dw);
352 void writeUcs(DL_WriterA& dw);
353 void writeDimStyle(DL_WriterA& dw,
354 double dimasz, double dimexe, double dimexo,
355 double dimgap, double dimtxt);
357 void writeBlockRecord(DL_WriterA& dw, const std::string& name);
358 void writeObjects(DL_WriterA& dw, const std::string& appDictionaryName = "");
359 void writeAppDictionary(DL_WriterA& dw);
360 unsigned long writeDictionaryEntry(DL_WriterA& dw, const std::string& name);
361 void writeXRecord(DL_WriterA& dw, int handle, int value);
362 void writeXRecord(DL_WriterA& dw, int handle, double value);
363 void writeXRecord(DL_WriterA& dw, int handle, bool value);
364 void writeXRecord(DL_WriterA& dw, int handle, const std::string& value);
365 void writeObjectsEnd(DL_WriterA& dw);
366
367 void writeComment(DL_WriterA& dw, const std::string& comment);
368
373 //static double toReal(const char* value, double def=0.0);
374
379// static int toInt(const char* value, int def=0) {
380// if (value!=NULL && value[0] != '\0') {
381// return atoi(value);
382// }
383
384// return def;
385// }
386
391// static const char* toString(const char* value, const char* def="") {
392// if (value!=NULL && value[0] != '\0') {
393// return value;
394// } else {
395// return def;
396// }
397// }
398
399 static bool checkVariable(const char* var, DL_Codes::version version);
400
401 DL_Codes::version getVersion() {
402 return version;
403 }
404
405 int getLibVersion(const std::string &str);
406
407 static void test();
408
409 bool hasValue(int code) {
410 return values.count(code)==1;
411 }
412
413 int getIntValue(int code, int def) {
414 if (!hasValue(code)) {
415 return def;
416 }
417 return toInt(values[code]);
418 }
419
420 int toInt(const std::string& str) {
421 char* p;
422 return strtol(str.c_str(), &p, 10);
423 }
424
425 int getInt16Value(int code, int def) {
426 if (!hasValue(code)) {
427 return def;
428 }
429 return toInt16(values[code]);
430 }
431
432 int toInt16(const std::string& str) {
433 char* p;
434 return strtol(str.c_str(), &p, 16);
435 }
436
437 bool toBool(const std::string& str) {
438 char* p;
439 return (bool)strtol(str.c_str(), &p, 10);
440 }
441
442 std::string getStringValue(int code, const std::string& def) {
443 if (!hasValue(code)) {
444 return def;
445 }
446 return values[code];
447 }
448
449 double getRealValue(int code, double def) {
450 if (!hasValue(code)) {
451 return def;
452 }
453 return toReal(values[code]);
454 }
455
456 double toReal(const std::string& str) {
457 double ret;
458 // make sure the real value uses '.' not ',':
459 std::string str2 = str;
460 std::replace(str2.begin(), str2.end(), ',', '.');
461 // make sure c++ expects '.' not ',':
462 std::istringstream istr(str2);
463 //istr.imbue(std::locale("C"));
464 istr >> ret;
465 return ret;
466 }
467
468private:
469 DL_Codes::version version;
470
471 std::string polylineLayer;
472 double* vertices;
473 int maxVertices;
474 int vertexIndex;
475
476 double* knots;
477 int maxKnots;
478 int knotIndex;
479
480 double* weights;
481 int weightIndex;
482
483 double* controlPoints;
484 int maxControlPoints;
485 int controlPointIndex;
486
487 double* fitPoints;
488 int maxFitPoints;
489 int fitPointIndex;
490
491 double* leaderVertices;
492 int maxLeaderVertices;
493 int leaderVertexIndex;
494
495 bool firstHatchLoop;
496 DL_HatchEdgeData hatchEdge;
497 std::vector<std::vector<DL_HatchEdgeData> > hatchEdges;
498
499 std::string xRecordHandle;
500 bool xRecordValues;
501
502 // Only the useful part of the group code
503 std::string groupCodeTmp;
504 // ...same as integer
505 unsigned int groupCode;
506 // Only the useful part of the group value
507 std::string groupValue;
508 // Current entity type
509 int currentObjectType;
510 // Value of the current setting
511 char settingValue[DL_DXF_MAXLINE+1];
512 // Key of the current setting (e.g. "$ACADVER")
513 std::string settingKey;
514 // Stores the group codes
515 std::map<int, std::string> values;
516 // First call of this method. We initialize all group values in
517 // the first call.
518 bool firstCall;
519 // Attributes of the current entity (layer, color, width, line type)
520 DL_Attributes attrib;
521 // library version. hex: 0x20003001 = 2.0.3.1
522 int libVersion;
523 // app specific dictionary handle:
524 unsigned long appDictionaryHandle;
525 // handle of standard text style, referenced by dimstyle:
526 unsigned long styleHandleStd;
527};
528
529#endif
530
531// EOF
Storing and passing around attributes.
Definition dl_attributes.h:41
version
Version numbers for the DXF Format.
Definition dl_codes.h:96
Abstract class (interface) for the creation of new entities.
Definition dl_creationinterface.h:47
void addComment(DL_CreationInterface *creationInterface, const std::string &comment)
Adds a comment from the DXF file.
Definition dl_dxf.cpp:760
void writeXLine(DL_WriterA &dw, const DL_XLineData &data, const DL_Attributes &attrib)
Writes an x line entity to the file.
Definition dl_dxf.cpp:2426
void writeView(DL_WriterA &dw)
Writes a view section.
Definition dl_dxf.cpp:4153
void writeDimAligned(DL_WriterA &dw, const DL_DimensionData &data, const DL_DimAlignedData &edata, const DL_Attributes &attrib)
Writes an aligned dimension entity to the file.
Definition dl_dxf.cpp:2991
void addMText(DL_CreationInterface *creationInterface)
Adds an MText entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1248
void writeObjects(DL_WriterA &dw, const std::string &appDictionaryName="")
Writes a objects section.
Definition dl_dxf.cpp:4384
unsigned long writeImage(DL_WriterA &dw, const DL_ImageData &data, const DL_Attributes &attrib)
Writes an image entity.
Definition dl_dxf.cpp:3700
void writeTrace(DL_WriterA &dw, const DL_TraceData &data, const DL_Attributes &attrib)
Writes a trace entity to the file.
Definition dl_dxf.cpp:2731
void addPolyline(DL_CreationInterface *creationInterface)
Adds a polyline entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1019
void writeArc(DL_WriterA &dw, const DL_ArcData &data, const DL_Attributes &attrib)
Writes an arc entity to the file.
Definition dl_dxf.cpp:2647
void addSpline(DL_CreationInterface *creationInterface)
Adds a spline entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1065
bool handleDictionaryData(DL_CreationInterface *creationInterface)
Handles all dictionary data.
Definition dl_dxf.cpp:1359
void write3dFace(DL_WriterA &dw, const DL_3dFaceData &data, const DL_Attributes &attrib)
Writes a 3d face entity to the file.
Definition dl_dxf.cpp:2758
void writeImageDef(DL_WriterA &dw, int handle, const DL_ImageData &data)
Writes an image definiition entity.
Definition dl_dxf.cpp:3761
void writeLeaderVertex(DL_WriterA &dw, const DL_LeaderVertexData &data)
Writes a single vertex of a leader to the file.
Definition dl_dxf.cpp:3476
void writeHatchEdge(DL_WriterA &dw, const DL_HatchEdgeData &data)
Writes the beginning of a hatch entity to the file.
Definition dl_dxf.cpp:3614
void endBlock(DL_CreationInterface *creationInterface)
Ends a block that was read from the file via the creation interface.
Definition dl_dxf.cpp:924
bool handleHatchData(DL_CreationInterface *creationInterface)
Handles all hatch data.
Definition dl_dxf.cpp:2001
void writeStyle(DL_WriterA &dw, const DL_StyleData &style)
Writes a style section.
Definition dl_dxf.cpp:4091
void addLinetype(DL_CreationInterface *creationInterface)
Adds a linetype that was read from the file via the creation interface.
Definition dl_dxf.cpp:856
DL_Dxf()
Default constructor.
Definition dl_dxf.cpp:43
void writeObjectsEnd(DL_WriterA &dw)
Writes the end of the objects section.
Definition dl_dxf.cpp:4783
void addEllipse(DL_CreationInterface *creationInterface)
Adds an ellipse entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1140
void writePolyline(DL_WriterA &dw, const DL_PolylineData &data, const DL_Attributes &attrib)
Writes a polyline entity to the file.
Definition dl_dxf.cpp:2475
void writeFitPoint(DL_WriterA &dw, const DL_FitPointData &data)
Writes a single fit point of a spline to the file.
Definition dl_dxf.cpp:2591
bool handleSplineData(DL_CreationInterface *creationInterface)
Handles additional spline data.
Definition dl_dxf.cpp:1467
void writeDimStyle(DL_WriterA &dw, double dimasz, double dimexe, double dimexo, double dimgap, double dimtxt)
Writes a dimstyle section.
Definition dl_dxf.cpp:4195
void addBlock(DL_CreationInterface *creationInterface)
Adds a block that was read from the file via the creation interface.
Definition dl_dxf.cpp:900
void endSequence(DL_CreationInterface *creationInterface)
Ends a sequence and notifies the creation interface.
Definition dl_dxf.cpp:2268
void writeRay(DL_WriterA &dw, const DL_RayData &data, const DL_Attributes &attrib)
Writes a ray entity to the file.
Definition dl_dxf.cpp:2450
void writeVPort(DL_WriterA &dw)
Writes a viewport section.
Definition dl_dxf.cpp:4011
void writeDimRadial(DL_WriterA &dw, const DL_DimensionData &data, const DL_DimRadialData &edata, const DL_Attributes &attrib)
Writes a radial dimension entity to the file.
Definition dl_dxf.cpp:3123
void writePoint(DL_WriterA &dw, const DL_PointData &data, const DL_Attributes &attrib)
Writes a point entity to the file.
Definition dl_dxf.cpp:2379
void addArc(DL_CreationInterface *creationInterface)
Adds an arc entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1110
void writeDimDiametric(DL_WriterA &dw, const DL_DimensionData &data, const DL_DimDiametricData &edata, const DL_Attributes &attrib)
Writes a diametric dimension entity to the file.
Definition dl_dxf.cpp:3184
void addSetting(DL_CreationInterface *creationInterface)
Adds a variable from the DXF file.
Definition dl_dxf.cpp:777
void writeCircle(DL_WriterA &dw, const DL_CircleData &data, const DL_Attributes &attrib)
Writes a circle entity to the file.
Definition dl_dxf.cpp:2623
bool handleLWPolylineData(DL_CreationInterface *creationInterface)
Handles additional polyline data.
Definition dl_dxf.cpp:1422
void addVertex(DL_CreationInterface *creationInterface)
Adds a polyline vertex entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1044
void addDimOrdinate(DL_CreationInterface *creationInterface)
Adds an ordinate dimension entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1907
void writeDimAngular2L(DL_WriterA &dw, const DL_DimensionData &data, const DL_DimAngular2LData &edata, const DL_Attributes &attrib)
Writes an angular dimension entity to the file.
Definition dl_dxf.cpp:3245
void writeHeader(DL_WriterA &dw)
Writes a DXF header to the file currently opened by the given DXF writer object.
Definition dl_dxf.cpp:2336
void addLeader(DL_CreationInterface *creationInterface)
Adds a leader entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1930
void writeText(DL_WriterA &dw, const DL_TextData &data, const DL_Attributes &attrib)
Writes a text entity to the file.
Definition dl_dxf.cpp:2890
void writeSpline(DL_WriterA &dw, const DL_SplineData &data, const DL_Attributes &attrib)
Writes a spline entity to the file.
Definition dl_dxf.cpp:2546
bool handleXData(DL_CreationInterface *creationInterface)
Handles XData for all object types.
Definition dl_dxf.cpp:1381
bool handleXRecordData(DL_CreationInterface *creationInterface)
Handles all XRecord data.
Definition dl_dxf.cpp:1306
bool readDxfGroups(FILE *fp, DL_CreationInterface *creationInterface)
Reads a group couplet from a DXF file.
Definition dl_dxf.cpp:175
void writeEndBlock(DL_WriterA &dw, const std::string &name)
Writes a block end.
Definition dl_dxf.cpp:3989
void addXLine(DL_CreationInterface *creationInterface)
Adds an xline entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:989
void addLine(DL_CreationInterface *creationInterface)
Adds a line entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:975
bool handleMTextData(DL_CreationInterface *creationInterface)
Handles additional MText data.
Definition dl_dxf.cpp:1409
void writeVertex(DL_WriterA &dw, const DL_VertexData &data)
Writes a single vertex of a polyline to the file.
Definition dl_dxf.cpp:2504
void addHatch(DL_CreationInterface *creationInterface)
Adds a hatch entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1965
static bool getStrippedLine(std::string &s, unsigned int size, FILE *stream, bool stripSpace=true)
Reads line from file & strips whitespace at start and newline at end.
Definition dl_dxf.cpp:234
void writeSolid(DL_WriterA &dw, const DL_SolidData &data, const DL_Attributes &attrib)
Writes a solid entity to the file.
Definition dl_dxf.cpp:2706
void writeLayer(DL_WriterA &dw, const DL_LayerData &data, const DL_Attributes &attrib)
Writes a layer to the file.
Definition dl_dxf.cpp:3805
void writeDimOrdinate(DL_WriterA &dw, const DL_DimensionData &data, const DL_DimOrdinateData &edata, const DL_Attributes &attrib)
Writes an ordinate dimension entity to the file.
Definition dl_dxf.cpp:3380
void addDimAligned(DL_CreationInterface *creationInterface)
Adds an aligned dimension entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1796
void addSolid(DL_CreationInterface *creationInterface)
Adds a solid entity (filled trace) that was read from the file via the creation interface.
Definition dl_dxf.cpp:1233
void addTrace(DL_CreationInterface *creationInterface)
Adds a trace entity (4 edge closed polyline) that was read from the file via the creation interface.
Definition dl_dxf.cpp:1199
void addRay(DL_CreationInterface *creationInterface)
Adds a ray entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1003
void writeBlock(DL_WriterA &dw, const DL_BlockData &data)
Writes a block's definition (no entities) to the DXF file.
Definition dl_dxf.cpp:3956
void writeAppid(DL_WriterA &dw, const std::string &name)
Writes the APPID section to the DXF file.
Definition dl_dxf.cpp:3932
void addImageDef(DL_CreationInterface *creationInterface)
Adds an image definition that was read from the file via the creation interface.
Definition dl_dxf.cpp:2245
DL_DimensionData getDimData()
Definition dl_dxf.cpp:1736
void addDimDiametric(DL_CreationInterface *creationInterface)
Adds a diametric dimension entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1835
void addDimRadial(DL_CreationInterface *creationInterface)
Adds a radial dimension entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1817
void writeControlPoint(DL_WriterA &dw, const DL_ControlPointData &data)
Writes a single control point of a spline to the file.
Definition dl_dxf.cpp:2574
void writeLeader(DL_WriterA &dw, const DL_LeaderData &data, const DL_Attributes &attrib)
Writes a leader entity to the file.
Definition dl_dxf.cpp:3444
void writeHatchLoop1(DL_WriterA &dw, const DL_HatchLoopData &data)
Writes the beginning of a hatch loop to the file.
Definition dl_dxf.cpp:3583
void addLayer(DL_CreationInterface *creationInterface)
Adds a layer that was read from the file via the creation interface.
Definition dl_dxf.cpp:828
void addDimAngular(DL_CreationInterface *creationInterface)
Adds an angular dimension entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1854
void writeUcs(DL_WriterA &dw)
Writes a ucs section.
Definition dl_dxf.cpp:4174
void endEntity(DL_CreationInterface *creationInterface)
Ends some special entities like hatches or old style polylines.
Definition dl_dxf.cpp:2260
void addImage(DL_CreationInterface *creationInterface)
Adds an image entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:2212
void addCircle(DL_CreationInterface *creationInterface)
Adds a circle entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1126
static bool stripWhiteSpace(char **s, bool stripSpaces=true)
Strips leading whitespace and trailing Carriage Return (CR) and Line Feed (LF) from NULL terminated s...
Definition dl_dxf.cpp:299
bool handleLeaderData(DL_CreationInterface *creationInterface)
Handles additional leader data.
Definition dl_dxf.cpp:1581
static bool checkVariable(const char *var, DL_Codes::version version)
Converts the given string into a double or returns the given default valud (def) if value is NULL or ...
Definition dl_dxf.cpp:4800
void addPoint(DL_CreationInterface *creationInterface)
Adds a point entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:963
void writeDimLinear(DL_WriterA &dw, const DL_DimensionData &data, const DL_DimLinearData &edata, const DL_Attributes &attrib)
Writes a linear dimension entity to the file.
Definition dl_dxf.cpp:3054
static void test()
Converts the given string into a double or returns the given default valud (def) if value is NULL or ...
Definition dl_dxf.cpp:5311
void writeEllipse(DL_WriterA &dw, const DL_EllipseData &data, const DL_Attributes &attrib)
Writes an ellipse entity to the file.
Definition dl_dxf.cpp:2676
void writeHatch2(DL_WriterA &dw, const DL_HatchData &data, const DL_Attributes &attrib)
Writes the end of a hatch entity to the file.
Definition dl_dxf.cpp:3544
void writeLinetype(DL_WriterA &dw, const DL_LinetypeData &data)
Writes a line type to the file.
Definition dl_dxf.cpp:3863
void writeHatch1(DL_WriterA &dw, const DL_HatchData &data, const DL_Attributes &attrib)
Writes the beginning of a hatch entity to the file.
Definition dl_dxf.cpp:3507
void writeLine(DL_WriterA &dw, const DL_LineData &data, const DL_Attributes &attrib)
Writes a line entity to the file.
Definition dl_dxf.cpp:2402
int getLibVersion(const std::string &str)
Definition dl_dxf.cpp:5240
bool processDXFGroup(DL_CreationInterface *creationInterface, int groupCode, const std::string &groupValue)
Processes a group (pair of group code and value).
Definition dl_dxf.cpp:335
void addDimAngular3P(DL_CreationInterface *creationInterface)
Adds an angular dimension entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1882
void writeDimAngular3P(DL_WriterA &dw, const DL_DimensionData &data, const DL_DimAngular3PData &edata, const DL_Attributes &attrib)
Writes an angular dimension entity (3 points version) to the file.
Definition dl_dxf.cpp:3314
void addText(DL_CreationInterface *creationInterface)
Adds an text entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1626
DL_WriterA * out(const char *file, DL_Codes::version version=DL_VERSION_2000)
Converts the given string into an int.
Definition dl_dxf.cpp:2314
void writePolylineEnd(DL_WriterA &dw)
Writes the polyline end.
Definition dl_dxf.cpp:2530
void addDimLinear(DL_CreationInterface *creationInterface)
Adds a linear dimension entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1771
void writeInsert(DL_WriterA &dw, const DL_InsertData &data, const DL_Attributes &attrib)
Writes an insert to the file.
Definition dl_dxf.cpp:2784
void writeHatchLoop2(DL_WriterA &dw, const DL_HatchLoopData &data)
Writes the end of a hatch loop to the file.
Definition dl_dxf.cpp:3600
bool handleLinetypeData(DL_CreationInterface *creationInterface)
Handles all dashes in linetype pattern.
Definition dl_dxf.cpp:887
void writeBlockRecord(DL_WriterA &dw)
Writes a blockrecord section.
Definition dl_dxf.cpp:4301
bool in(const std::string &file, DL_CreationInterface *creationInterface)
Reads the given file and calls the appropriate functions in the given creation interface for every en...
Definition dl_dxf.cpp:110
void writeKnot(DL_WriterA &dw, const DL_KnotData &data)
Writes a single knot of a spline to the file.
Definition dl_dxf.cpp:2608
void add3dFace(DL_CreationInterface *creationInterface)
Adds a 3dface entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1215
void addInsert(DL_CreationInterface *creationInterface)
Adds an insert entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1159
void writeMText(DL_WriterA &dw, const DL_MTextData &data, const DL_Attributes &attrib)
Writes a multi text entity to the file.
Definition dl_dxf.cpp:2838
void writeComment(DL_WriterA &dw, const std::string &comment)
Writes a comment to the DXF file.
Definition dl_dxf.cpp:4792
void addArcAlignedText(DL_CreationInterface *creationInterface)
Adds an arc aligned text entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1660
void addAttribute(DL_CreationInterface *creationInterface)
Adds an attrib entity that was read from the file via the creation interface.
Definition dl_dxf.cpp:1699
Implements functions defined in DL_Writer for writing low level DXF constructs to an ASCII format DXF...
Definition dl_writer_ascii.h:49
Arc Data.
Definition dl_entities.h:315
Block attribute data.
Definition dl_entities.h:950
Block Data.
Definition dl_entities.h:59
Circle Data.
Definition dl_entities.h:352
Spline control point data.
Definition dl_entities.h:575
Aligned Dimension Data.
Definition dl_entities.h:1102
Angular Dimension Data.
Definition dl_entities.h:1243
Angular Dimension Data (3 points version).
Definition dl_entities.h:1303
Diametric Dimension Data.
Definition dl_entities.h:1214
Linear (rotated) Dimension Data.
Definition dl_entities.h:1139
Ordinate Dimension Data.
Definition dl_entities.h:1352
Radial Dimension Data.
Definition dl_entities.h:1185
Generic Dimension Data.
Definition dl_entities.h:990
Ellipse Data.
Definition dl_entities.h:622
Spline fit point data.
Definition dl_entities.h:602
Hatch data.
Definition dl_entities.h:1470
Hatch edge data.
Definition dl_entities.h:1539
Hatch boundary path (loop) data.
Definition dl_entities.h:1517
Image Data.
Definition dl_entities.h:1709
Insert Data.
Definition dl_entities.h:669
Spline knot data.
Definition dl_entities.h:556
Layer Data.
Definition dl_entities.h:36
Leader (arrow).
Definition dl_entities.h:1395
Leader Vertex Data.
Definition dl_entities.h:1446
Line Data.
Definition dl_entities.h:221
Line Type Data.
Definition dl_entities.h:90
MText Data.
Definition dl_entities.h:719
Point Data.
Definition dl_entities.h:197
Polyline Data.
Definition dl_entities.h:382
Ray Data.
Definition dl_entities.h:284
Spline Data.
Definition dl_entities.h:511
Text style data.
Definition dl_entities.h:130
Text Data.
Definition dl_entities.h:800
Trace Data / solid data / 3d face data.
Definition dl_entities.h:444
Vertex Data.
Definition dl_entities.h:416
XLine Data.
Definition dl_entities.h:255