#include <dl_dxf.h>
Public Member Functions | |
| DL_Dxf () | |
| Default constructor. | |
| ~DL_Dxf () | |
| Destructor. | |
| bool | in (const string &file, DL_CreationInterface *creationInterface) |
| Reads the given file and calls the appropriate functions in the given creation interface for every entity found in the file. | |
| bool | readDxfGroups (FILE *fp, DL_CreationInterface *creationInterface, int *errorCounter=NULL) |
| Reads a group couplet from a DXF file. | |
| bool | readDxfGroups (std::stringstream &stream, DL_CreationInterface *creationInterface, int *errorCounter=NULL) |
| Same as above but for stringstreams. | |
| bool | in (std::stringstream &stream, DL_CreationInterface *creationInterface) |
| Reads a DXF file from an existing stream. | |
| bool | processDXFGroup (DL_CreationInterface *creationInterface, int groupCode, const char *groupValue) |
| Processes a group (pair of group code and value). | |
| void | addSetting (DL_CreationInterface *creationInterface) |
| Adds a variable from the DXF file. | |
| void | addLayer (DL_CreationInterface *creationInterface) |
| Adds a layer that was read from the file via the creation interface. | |
| void | addBlock (DL_CreationInterface *creationInterface) |
| Adds a block that was read from the file via the creation interface. | |
| void | endBlock (DL_CreationInterface *creationInterface) |
| Ends a block that was read from the file via the creation interface. | |
| void | addPoint (DL_CreationInterface *creationInterface) |
| Adds a point entity that was read from the file via the creation interface. | |
| void | addLine (DL_CreationInterface *creationInterface) |
| Adds a line entity that was read from the file via the creation interface. | |
| void | addPolyline (DL_CreationInterface *creationInterface) |
| Adds a polyline entity that was read from the file via the creation interface. | |
| void | addVertex (DL_CreationInterface *creationInterface) |
| Adds a polyline vertex entity that was read from the file via the creation interface. | |
| void | addSpline (DL_CreationInterface *creationInterface) |
| Adds a spline entity that was read from the file via the creation interface. | |
| void | addArc (DL_CreationInterface *creationInterface) |
| Adds an arc entity that was read from the file via the creation interface. | |
| void | addCircle (DL_CreationInterface *creationInterface) |
| Adds a circle entity that was read from the file via the creation interface. | |
| void | addEllipse (DL_CreationInterface *creationInterface) |
| Adds an ellipse entity that was read from the file via the creation interface. | |
| void | addInsert (DL_CreationInterface *creationInterface) |
| Adds an insert entity that was read from the file via the creation interface. | |
| void | addTrace (DL_CreationInterface *creationInterface) |
| Adds a trace entity (4 edge closed polyline) that was read from the file via the creation interface. | |
| void | addSolid (DL_CreationInterface *creationInterface) |
| Adds a solid entity (filled trace) that was read from the file via the creation interface. | |
| void | addMText (DL_CreationInterface *creationInterface) |
| Adds an MText entity that was read from the file via the creation interface. | |
| bool | handleMTextData (DL_CreationInterface *creationInterface) |
| Handles additional MText data. | |
| bool | handleLWPolylineData (DL_CreationInterface *creationInterface) |
| Handles additional polyline data. | |
| bool | handleSplineData (DL_CreationInterface *creationInterface) |
| Handles additional spline data. | |
| bool | handleLeaderData (DL_CreationInterface *creationInterface) |
| Handles additional leader data. | |
| bool | handleHatchData (DL_CreationInterface *creationInterface) |
| Handles additional hatch data. | |
| void | addText (DL_CreationInterface *creationInterface) |
| Adds an text entity that was read from the file via the creation interface. | |
| void | addAttrib (DL_CreationInterface *creationInterface) |
| Adds an attrib entity that was read from the file via the creation interface. | |
| DL_DimensionData | getDimData () |
| void | addDimLinear (DL_CreationInterface *creationInterface) |
| Adds a linear dimension entity that was read from the file via the creation interface. | |
| void | addDimAligned (DL_CreationInterface *creationInterface) |
| Adds an aligned dimension entity that was read from the file via the creation interface. | |
| void | addDimRadial (DL_CreationInterface *creationInterface) |
| Adds a radial dimension entity that was read from the file via the creation interface. | |
| void | addDimDiametric (DL_CreationInterface *creationInterface) |
| Adds a diametric dimension entity that was read from the file via the creation interface. | |
| void | addDimAngular (DL_CreationInterface *creationInterface) |
| Adds an angular dimension entity that was read from the file via the creation interface. | |
| void | addDimAngular3P (DL_CreationInterface *creationInterface) |
| Adds an angular dimension entity that was read from the file via the creation interface. | |
| void | addLeader (DL_CreationInterface *creationInterface) |
| Adds a leader entity that was read from the file via the creation interface. | |
| void | addHatch (DL_CreationInterface *creationInterface) |
| Adds a hatch entity that was read from the file via the creation interface. | |
| void | addImage (DL_CreationInterface *creationInterface) |
| Adds an image entity that was read from the file via the creation interface. | |
| void | addImageDef (DL_CreationInterface *creationInterface) |
| Adds an image definition that was read from the file via the creation interface. | |
| void | endEntity (DL_CreationInterface *creationInterface) |
| Ends some special entities like hatches or old style polylines. | |
| void | endSequence (DL_CreationInterface *creationInterface) |
| Ends a sequence and notifies the creation interface. | |
| int | stringToInt (const char *s, bool *ok=NULL) |
| Converts the given string into an int. | |
| DL_WriterA * | out (const char *file, DL_Codes::version version=VER_2000) |
| Opens the given file for writing and returns a pointer to the dxf writer. | |
| void | writeHeader (DL_WriterA &dw) |
| Writes a DXF header to the file currently opened by the given DXF writer object. | |
| void | writePoint (DL_WriterA &dw, const DL_PointData &data, const DL_Attributes &attrib) |
| Writes a point entity to the file. | |
| void | writeLine (DL_WriterA &dw, const DL_LineData &data, const DL_Attributes &attrib) |
| Writes a line entity to the file. | |
| void | writePolyline (DL_WriterA &dw, const DL_PolylineData &data, const DL_Attributes &attrib) |
| Writes a polyline entity to the file. | |
| void | writeVertex (DL_WriterA &dw, const DL_VertexData &data) |
| Writes a single vertex of a polyline to the file. | |
| void | writePolylineEnd (DL_WriterA &dw) |
| Writes the polyline end. | |
| void | writeSpline (DL_WriterA &dw, const DL_SplineData &data, const DL_Attributes &attrib) |
| Writes a spline entity to the file. | |
| void | writeControlPoint (DL_WriterA &dw, const DL_ControlPointData &data) |
| Writes a single control point of a spline to the file. | |
| void | writeKnot (DL_WriterA &dw, const DL_KnotData &data) |
| Writes a single knot of a spline to the file. | |
| void | writeCircle (DL_WriterA &dw, const DL_CircleData &data, const DL_Attributes &attrib) |
| Writes a circle entity to the file. | |
| void | writeArc (DL_WriterA &dw, const DL_ArcData &data, const DL_Attributes &attrib) |
| Writes an arc entity to the file. | |
| void | writeEllipse (DL_WriterA &dw, const DL_EllipseData &data, const DL_Attributes &attrib) |
| Writes an ellipse entity to the file. | |
| void | writeInsert (DL_WriterA &dw, const DL_InsertData &data, const DL_Attributes &attrib) |
| Writes an insert to the file. | |
| void | writeMText (DL_WriterA &dw, const DL_MTextData &data, const DL_Attributes &attrib) |
| Writes a multi text entity to the file. | |
| void | writeText (DL_WriterA &dw, const DL_TextData &data, const DL_Attributes &attrib) |
| Writes a text entity to the file. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| void | writeDimAngular (DL_WriterA &dw, const DL_DimensionData &data, const DL_DimAngularData &edata, const DL_Attributes &attrib) |
| Writes an angular dimension entity to the file. | |
| 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. | |
| void | writeLeader (DL_WriterA &dw, const DL_LeaderData &data, const DL_Attributes &attrib) |
| Writes a leader entity to the file. | |
| void | writeLeaderVertex (DL_WriterA &dw, const DL_LeaderVertexData &data) |
| Writes a single vertex of a leader to the file. | |
| void | writeHatch1 (DL_WriterA &dw, const DL_HatchData &data, const DL_Attributes &attrib) |
| Writes the beginning of a hatch entity to the file. | |
| void | writeHatch2 (DL_WriterA &dw, const DL_HatchData &data, const DL_Attributes &attrib) |
| Writes the end of a hatch entity to the file. | |
| void | writeHatchLoop1 (DL_WriterA &dw, const DL_HatchLoopData &data) |
| Writes the beginning of a hatch loop to the file. | |
| void | writeHatchLoop2 (DL_WriterA &dw, const DL_HatchLoopData &data) |
| Writes the end of a hatch loop to the file. | |
| void | writeHatchEdge (DL_WriterA &dw, const DL_HatchEdgeData &data) |
| Writes the beginning of a hatch entity to the file. | |
| int | writeImage (DL_WriterA &dw, const DL_ImageData &data, const DL_Attributes &attrib) |
| Writes an image entity. | |
| void | writeImageDef (DL_WriterA &dw, int handle, const DL_ImageData &data) |
| Writes an image definiition entity. | |
| void | writeLayer (DL_WriterA &dw, const DL_LayerData &data, const DL_Attributes &attrib) |
| Writes a layer to the file. | |
| void | writeLineType (DL_WriterA &dw, const DL_LineTypeData &data) |
| Writes a line type to the file. | |
| void | writeAppid (DL_WriterA &dw, const string &name) |
| Writes the APPID section to the DXF file. | |
| void | writeBlock (DL_WriterA &dw, const DL_BlockData &data) |
| Writes a block's definition (no entities) to the DXF file. | |
| void | writeEndBlock (DL_WriterA &dw, const string &name) |
| Writes a block end. | |
| void | writeVPort (DL_WriterA &dw) |
| Writes a viewport section. | |
| void | writeStyle (DL_WriterA &dw) |
| Writes a style section. | |
| void | writeView (DL_WriterA &dw) |
| Writes a view section. | |
| void | writeUcs (DL_WriterA &dw) |
| Writes a ucs section. | |
| void | writeDimStyle (DL_WriterA &dw, double dimasz, double dimexe, double dimexo, double dimgap, double dimtxt) |
| Writes a dimstyle section. | |
| void | writeBlockRecord (DL_WriterA &dw) |
| Writes a blockrecord section. | |
| void | writeBlockRecord (DL_WriterA &dw, const string &name) |
| Writes a single block record with the given name. | |
| void | writeObjects (DL_WriterA &dw) |
| Writes a objects section. | |
| void | writeObjectsEnd (DL_WriterA &dw) |
| Writes the end of the objects section. | |
| DL_Codes::version | getVersion () |
| int | getLibVersion (const char *str) |
Static Public Member Functions | |
| static bool | getChoppedLine (char *s, unsigned int size, FILE *stream) |
| Reads line from file & strips whitespace at start and newline at end. | |
| static bool | getChoppedLine (char *s, unsigned int size, std::stringstream &stream) |
| Same as above but for stringstreams. | |
| static bool | stripWhiteSpace (char **s) |
| Strips leading whitespace and trailing Carriage Return (CR) and Line Feed (LF) from NULL terminated string. | |
| static double | toReal (const char *value, double def=0.0) |
| Converts the given string into a double or returns the given default valud (def) if value is NULL or empty. | |
| static int | toInt (const char *value, int def=0) |
| Converts the given string into an int or returns the given default valud (def) if value is NULL or empty. | |
| static const char * | toString (const char *value, const char *def="") |
| Converts the given string into a string or returns the given default valud (def) if value is NULL or empty. | |
| static bool | checkVariable (const char *var, DL_Codes::version version) |
| Checks if the given variable is known by the given DXF version. | |
| static void | test () |
| Some test routines. | |
This class can read in a DXF file and calls methods from the interface DL_EntityContainer to add the entities to the contianer provided by the user of the library.
It can also be used to write DXF files to a certain extent.
When saving entities, special values for colors and linetypes can be used:
Special colors are 0 (=BYBLOCK) and 256 (=BYLAYER). Special linetypes are "BYLAYER" and "BYBLOCK".
|
|
Adds an attrib entity that was read from the file via the creation interface.
|
|
|
Adds a solid entity (filled trace) that was read from the file via the creation interface.
|
|
|
Adds a trace entity (4 edge closed polyline) that was read from the file via the creation interface.
|
|
||||||||||||||||
|
Reads line from file & strips whitespace at start and newline at end.
|
|
|
|
|
|
|
|
||||||||||||
|
Reads a DXF file from an existing stream.
|
|
||||||||||||
|
Reads the given file and calls the appropriate functions in the given creation interface for every entity found in the file.
|
|
||||||||||||
|
Opens the given file for writing and returns a pointer to the dxf writer. This pointer needs to be passed on to other writing functions.
|
|
||||||||||||||||
|
Processes a group (pair of group code and value).
|
|
||||||||||||||||
|
Reads a group couplet from a DXF file. Calls another function to process it.
A group couplet consists of two lines that represent a single piece of data. An integer constant on the first line indicates the type of data. The value is on the next line.
This function reads a couplet, determines the type of data, and passes the value to the the appropriate handler function of
|
|
||||||||||||
|
Converts the given string into an int. ok is set to false if there was an error. |
|
|
Strips leading whitespace and trailing Carriage Return (CR) and Line Feed (LF) from NULL terminated string.
|
|
||||||||||||
|
Writes the APPID section to the DXF file.
|
|
||||||||||||||||
|
Writes an arc entity to the file.
|
|
||||||||||||
|
Writes a block's definition (no entities) to the DXF file. strcasecmp(name, "*paper_space0"); |
|
|
Writes a blockrecord section. This section is needed in VER_R13. Note that this method currently only writes a faked BLOCKRECORD section to make the file readable by Aut*cad. |
|
||||||||||||||||
|
Writes a circle entity to the file.
|
|
||||||||||||
|
Writes a single control point of a spline to the file.
|
|
||||||||||||||||||||
|
Writes an aligned dimension entity to the file.
|
|
||||||||||||||||||||
|
Writes an angular dimension entity to the file.
|
|
||||||||||||||||||||
|
Writes an angular dimension entity (3 points version) to the file.
|
|
||||||||||||||||||||
|
Writes a diametric dimension entity to the file.
|
|
||||||||||||||||||||
|
Writes a linear dimension entity to the file.
|
|
||||||||||||||||||||
|
Writes a radial dimension entity to the file.
|
|
||||||||||||||||||||||||||||
|
Writes a dimstyle section. This section is needed in VER_R13. Note that this method currently only writes a faked DIMSTYLE section to make the file readable by Aut*cad. |
|
||||||||||||||||
|
Writes an ellipse entity to the file.
|
|
||||||||||||
|
Writes a block end.
|
|
||||||||||||||||
|
Writes the beginning of a hatch entity to the file. This must be followed by one or more writeHatchLoop() calls and a writeHatch2() call.
|
|
||||||||||||||||
|
Writes the end of a hatch entity to the file.
|
|
||||||||||||
|
Writes the beginning of a hatch entity to the file.
|
|
||||||||||||
|
Writes the beginning of a hatch loop to the file. This must happen after writing the beginning of a hatch entity.
|
|
||||||||||||
|
Writes the end of a hatch loop to the file.
|
|
||||||||||||||||
|
Writes an image entity.
|
|
||||||||||||||||
|
Writes an insert to the file.
|
|
||||||||||||
|
Writes a single knot of a spline to the file.
|
|
||||||||||||||||
|
Writes a layer to the file. Layers are stored in the tables section of a DXF file.
|
|
||||||||||||||||
|
Writes a leader entity to the file.
|
|
||||||||||||
|
Writes a single vertex of a leader to the file.
|
|
||||||||||||||||
|
Writes a line entity to the file.
|
|
||||||||||||
|
Writes a line type to the file. Line types are stored in the tables section of a DXF file. |
|
||||||||||||||||
|
Writes a multi text entity to the file.
|
|
|
Writes a objects section. This section is needed in VER_R13. Note that this method currently only writes a faked OBJECTS section to make the file readable by Aut*cad. |
|
|
Writes the end of the objects section. This section is needed in VER_R13. Note that this method currently only writes a faked OBJECTS section to make the file readable by Aut*cad. |
|
||||||||||||||||
|
Writes a point entity to the file.
|
|
||||||||||||||||
|
Writes a polyline entity to the file.
|
|
|
Writes the polyline end. Only needed for DXF R12. |
|
||||||||||||||||
|
Writes a spline entity to the file.
|
|
|
Writes a style section. This section is needed in VER_R13. Note that this method currently only writes a faked STYLE section to make the file readable by Aut*cad. |
|
||||||||||||||||
|
Writes a text entity to the file.
|
|
|
Writes a ucs section. This section is needed in VER_R13. Note that this method currently only writes a faked UCS section to make the file readable by Aut*cad. |
|
||||||||||||
|
Writes a single vertex of a polyline to the file.
|
|
|
Writes a view section. This section is needed in VER_R13. Note that this method currently only writes a faked VIEW section to make the file readable by Aut*cad. |
|
|
Writes a viewport section. This section is needed in VER_R13. Note that this method currently only writes a faked VPORT section to make the file readable by Aut*cad. |
1.4.4