28 #include "dl_global.h"
37 #include "dl_attributes.h"
39 #include "dl_entities.h"
40 #include "dl_writer_ascii.h"
44 #define M_PI 3.14159265358979323846
45 #pragma warning(disable : 4800)
49 #define M_PI 3.1415926535897932384626433832795
53 #define DL_NANDOUBLE std::numeric_limits<double>::quiet_NaN()
60 #define DL_VERSION "3.17.0.0"
62 #define DL_VERSION_MAJOR 3
63 #define DL_VERSION_MINOR 17
64 #define DL_VERSION_REV 0
65 #define DL_VERSION_BUILD 0
71 #define DL_LINETYPE 13
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
127 bool in(
const std::string& file,
129 bool readDxfGroups(FILE* fp,
131 static bool getStrippedLine(std::string& s,
unsigned int size,
132 FILE* stream,
bool stripSpace =
true);
134 bool readDxfGroups(std::stringstream& stream,
136 bool in(std::stringstream &stream,
138 static bool getStrippedLine(std::string& s,
unsigned int size,
139 std::stringstream& stream,
bool stripSpace =
true);
141 static bool stripWhiteSpace(
char** s,
bool stripSpaces =
true);
144 int groupCode,
const std::string& groupValue);
331 void writeImageDef(
DL_WriterA& dw,
int handle,
341 void writeAppid(
DL_WriterA& dw,
const std::string& name);
345 void writeEndBlock(
DL_WriterA& dw,
const std::string& name);
352 double dimasz,
double dimexe,
double dimexo,
353 double dimgap,
double dimtxt);
355 void writeBlockRecord(
DL_WriterA& dw,
const std::string& name);
356 void writeObjects(
DL_WriterA& dw,
const std::string& appDictionaryName =
"");
358 int writeDictionaryEntry(
DL_WriterA& dw,
const std::string& name);
359 void writeXRecord(
DL_WriterA& dw,
int handle,
int value);
360 void writeXRecord(
DL_WriterA& dw,
int handle,
double value);
361 void writeXRecord(
DL_WriterA& dw,
int handle,
bool value);
362 void writeXRecord(
DL_WriterA& dw,
int handle,
const std::string& value);
365 void writeComment(
DL_WriterA& dw,
const std::string& comment);
403 int getLibVersion(
const std::string &str);
407 bool hasValue(
int code) {
408 return values.count(code)==1;
411 int getIntValue(
int code,
int def) {
412 if (!hasValue(code)) {
415 return toInt(values[code]);
418 int toInt(
const std::string& str) {
420 return strtol(str.c_str(), &p, 10);
423 int getInt16Value(
int code,
int def) {
424 if (!hasValue(code)) {
427 return toInt16(values[code]);
430 int toInt16(
const std::string& str) {
432 return strtol(str.c_str(), &p, 16);
435 bool toBool(
const std::string& str) {
437 return (
bool)strtol(str.c_str(), &p, 10);
440 std::string getStringValue(
int code,
const std::string& def) {
441 if (!hasValue(code)) {
447 double getRealValue(
int code,
double def) {
448 if (!hasValue(code)) {
451 return toReal(values[code]);
454 double toReal(
const std::string& str) {
457 std::string str2 = str;
458 std::replace(str2.begin(), str2.end(),
',',
'.');
460 std::istringstream istr(str2);
469 std::string polylineLayer;
481 double* controlPoints;
482 int maxControlPoints;
483 int controlPointIndex;
489 double* leaderVertices;
490 int maxLeaderVertices;
491 int leaderVertexIndex;
495 std::vector<std::vector<DL_HatchEdgeData> > hatchEdges;
497 std::string xRecordHandle;
501 std::string groupCodeTmp;
503 unsigned int groupCode;
505 std::string groupValue;
507 int currentObjectType;
509 char settingValue[DL_DXF_MAXLINE+1];
511 std::string settingKey;
513 std::map<int, std::string> values;
522 unsigned long appDictionaryHandle;
524 unsigned long styleHandleStd;
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
Reading and writing of DXF files.
Definition: dl_dxf.h:122
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:1100
Angular Dimension Data (3 points version).
Definition: dl_entities.h:1301
Angular Dimension Data.
Definition: dl_entities.h:1241
Diametric Dimension Data.
Definition: dl_entities.h:1212
Linear (rotated) Dimension Data.
Definition: dl_entities.h:1137
Ordinate Dimension Data.
Definition: dl_entities.h:1350
Radial Dimension Data.
Definition: dl_entities.h:1183
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:1464
Hatch edge data.
Definition: dl_entities.h:1533
Hatch boundary path (loop) data.
Definition: dl_entities.h:1511
Image Data.
Definition: dl_entities.h:1703
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:1393
Leader Vertex Data.
Definition: dl_entities.h:1440
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