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.26.4.0"
62#define DL_VERSION_MAJOR 3
63#define DL_VERSION_MINOR 26
64#define DL_VERSION_REV 4
65#define DL_VERSION_BUILD 0
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::istream& stream,
136 bool in(std::istream &stream,
138 static bool getStrippedLine(std::string& s,
unsigned int size,
139 std::istream& stream,
bool stripSpace =
true);
141 static bool stripWhiteSpace(
char** s,
bool stripSpaces =
true);
144 int groupCode,
const std::string& groupValue);
333 void writeImageDef(
DL_WriterA& dw,
int handle,
343 void writeAppid(
DL_WriterA& dw,
const std::string& name);
347 void writeEndBlock(
DL_WriterA& dw,
const std::string& name);
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 =
"");
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);
367 void writeComment(
DL_WriterA& dw,
const std::string& comment);
405 int getLibVersion(
const std::string &str);
409 bool hasValue(
int code) {
410 return values.count(code)==1;
413 int getIntValue(
int code,
int def) {
414 if (!hasValue(code)) {
417 return toInt(values[code]);
420 int toInt(
const std::string& str) {
422 return strtol(str.c_str(), &p, 10);
425 int getInt16Value(
int code,
int def) {
426 if (!hasValue(code)) {
429 return toInt16(values[code]);
432 int toInt16(
const std::string& str) {
434 return strtol(str.c_str(), &p, 16);
437 bool toBool(
const std::string& str) {
439 return (
bool)strtol(str.c_str(), &p, 10);
442 std::string getStringValue(
int code,
const std::string& def) {
443 if (!hasValue(code)) {
449 double getRealValue(
int code,
double def) {
450 if (!hasValue(code)) {
453 return toReal(values[code]);
456 double toReal(
const std::string& str) {
459 std::string str2 = str;
460 std::replace(str2.begin(), str2.end(),
',',
'.');
462 std::istringstream istr(str2);
471 std::string polylineLayer;
483 double* controlPoints;
484 int maxControlPoints;
485 int controlPointIndex;
491 double* leaderVertices;
492 int maxLeaderVertices;
493 int leaderVertexIndex;
497 std::vector<std::vector<DL_HatchEdgeData> > hatchEdges;
499 std::string xRecordHandle;
503 std::string groupCodeTmp;
505 unsigned int groupCode;
507 std::string groupValue;
509 int currentObjectType;
511 char settingValue[DL_DXF_MAXLINE+1];
513 std::string settingKey;
515 std::map<int, std::string> values;
524 unsigned long appDictionaryHandle;
526 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: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