![]() |
QCAD
Open Source 2D CAD
|
Reading and writing of DXF files. More...
#include <dl_dxf.h>
Public Member Functions | |
void | add3dFace (DL_CreationInterface *creationInterface) |
Adds a 3dface 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 | addArcAlignedText (DL_CreationInterface *creationInterface) |
Adds an arc aligned text entity that was read from the file via the creation interface. | |
void | addAttribute (DL_CreationInterface *creationInterface) |
Adds an attrib entity 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 | addCircle (DL_CreationInterface *creationInterface) |
Adds a circle entity that was read from the file via the creation interface. | |
void | addComment (DL_CreationInterface *creationInterface, const std::string &comment) |
Adds a comment from the DXF file. | |
void | addDictionary (DL_CreationInterface *creationInterface) |
void | addDictionaryEntry (DL_CreationInterface *creationInterface) |
void | addDimAligned (DL_CreationInterface *creationInterface) |
Adds an aligned 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 | addDimDiametric (DL_CreationInterface *creationInterface) |
Adds a diametric dimension entity that was read from the file via the creation interface. | |
void | addDimLinear (DL_CreationInterface *creationInterface) |
Adds a linear dimension entity that was read from the file via the creation interface. | |
void | addDimOrdinate (DL_CreationInterface *creationInterface) |
Adds an ordinate 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 | addEllipse (DL_CreationInterface *creationInterface) |
Adds an ellipse 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 | addHatchEdge () |
void | addHatchLoop () |
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 | addInsert (DL_CreationInterface *creationInterface) |
Adds an insert entity that was read from the file via the creation interface. | |
void | addLayer (DL_CreationInterface *creationInterface) |
Adds a layer 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 | addLine (DL_CreationInterface *creationInterface) |
Adds a line entity that was read from the file via the creation interface. | |
void | addLinetype (DL_CreationInterface *creationInterface) |
Adds a linetype 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. | |
void | addPoint (DL_CreationInterface *creationInterface) |
Adds a point 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 | addRay (DL_CreationInterface *creationInterface) |
Adds a ray entity that was read from the file via the creation interface. | |
void | addSetting (DL_CreationInterface *creationInterface) |
Adds a variable from the DXF file. | |
void | addSolid (DL_CreationInterface *creationInterface) |
Adds a solid entity (filled trace) 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 | addText (DL_CreationInterface *creationInterface) |
Adds an text entity that was read from the file via the creation interface. | |
void | addTextStyle (DL_CreationInterface *creationInterface) |
void | addTrace (DL_CreationInterface *creationInterface) |
Adds a trace entity (4 edge closed polyline) 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 | addXLine (DL_CreationInterface *creationInterface) |
Adds an xline entity that was read from the file via the creation interface. | |
DL_Dxf () | |
Default constructor. | |
void | endBlock (DL_CreationInterface *creationInterface) |
Ends a block 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. | |
DL_DimensionData | getDimData () |
int | getInt16Value (int code, int def) |
int | getIntValue (int code, int def) |
int | getLibVersion (const std::string &str) |
double | getRealValue (int code, double def) |
std::string | getStringValue (int code, const std::string &def) |
DL_Codes::version | getVersion () |
bool | handleDictionaryData (DL_CreationInterface *creationInterface) |
Handles all dictionary data. | |
bool | handleHatchData (DL_CreationInterface *creationInterface) |
Handles all hatch data. | |
bool | handleLeaderData (DL_CreationInterface *creationInterface) |
Handles additional leader data. | |
bool | handleLinetypeData (DL_CreationInterface *creationInterface) |
Handles all dashes in linetype pattern. | |
bool | handleLWPolylineData (DL_CreationInterface *creationInterface) |
Handles additional polyline data. | |
bool | handleMTextData (DL_CreationInterface *creationInterface) |
Handles additional MText data. | |
bool | handleSplineData (DL_CreationInterface *creationInterface) |
Handles additional spline data. | |
bool | handleXData (DL_CreationInterface *creationInterface) |
Handles XData for all object types. | |
bool | handleXRecordData (DL_CreationInterface *creationInterface) |
Handles all XRecord data. | |
bool | hasValue (int code) |
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 entity found in the file. | |
bool | in (std::istream &stream, DL_CreationInterface *creationInterface) |
Reads a DXF file from an existing stream. | |
DL_WriterA * | out (const char *file, DL_Codes::version version=DL_VERSION_2000) |
Converts the given string into an int. | |
bool | processDXFGroup (DL_CreationInterface *creationInterface, int groupCode, const std::string &groupValue) |
Processes a group (pair of group code and value). | |
bool | readDxfGroups (FILE *fp, DL_CreationInterface *creationInterface) |
Reads a group couplet from a DXF file. | |
bool | readDxfGroups (std::istream &stream, DL_CreationInterface *creationInterface) |
Same as above but for input streams. | |
bool | toBool (const std::string &str) |
int | toInt (const std::string &str) |
int | toInt16 (const std::string &str) |
double | toReal (const std::string &str) |
void | write3dFace (DL_WriterA &dw, const DL_3dFaceData &data, const DL_Attributes &attrib) |
Writes a 3d face entity to the file. | |
void | writeAppDictionary (DL_WriterA &dw) |
void | writeAppid (DL_WriterA &dw, const std::string &name) |
Writes the APPID section to the DXF file. | |
void | writeArc (DL_WriterA &dw, const DL_ArcData &data, const DL_Attributes &attrib) |
Writes an arc entity to the file. | |
void | writeAttribute (DL_WriterA &dw, const DL_AttributeData &data, const DL_Attributes &attrib) |
void | writeBlock (DL_WriterA &dw, const DL_BlockData &data) |
Writes a block's definition (no entities) to the DXF file. | |
void | writeBlockRecord (DL_WriterA &dw) |
Writes a blockrecord section. | |
void | writeBlockRecord (DL_WriterA &dw, const std::string &name) |
Writes a single block record with the given name. | |
void | writeCircle (DL_WriterA &dw, const DL_CircleData &data, const DL_Attributes &attrib) |
Writes a circle entity to the file. | |
void | writeComment (DL_WriterA &dw, const std::string &comment) |
Writes a comment to the DXF file. | |
void | writeControlPoint (DL_WriterA &dw, const DL_ControlPointData &data) |
Writes a single control point of a spline to the file. | |
unsigned long | writeDictionaryEntry (DL_WriterA &dw, const std::string &name) |
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 | writeDimAngular2L (DL_WriterA &dw, const DL_DimensionData &data, const DL_DimAngular2LData &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 | 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 | 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 | writeDimOrdinate (DL_WriterA &dw, const DL_DimensionData &data, const DL_DimOrdinateData &edata, const DL_Attributes &attrib) |
Writes an ordinate 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 | writeDimStyle (DL_WriterA &dw, double dimasz, double dimexe, double dimexo, double dimgap, double dimtxt, int dimtad=1, bool dimtih=false) |
Writes a dimstyle section. | |
void | writeDimStyleOverrides (DL_WriterA &dw, const DL_DimensionData &data) |
void | writeEllipse (DL_WriterA &dw, const DL_EllipseData &data, const DL_Attributes &attrib) |
Writes an ellipse entity to the file. | |
void | writeEndBlock (DL_WriterA &dw, const std::string &name) |
Writes a block end. | |
void | writeFitPoint (DL_WriterA &dw, const DL_FitPointData &data) |
Writes a single fit point of a spline 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 | writeHatchEdge (DL_WriterA &dw, const DL_HatchEdgeData &data) |
Writes the beginning 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 | writeHeader (DL_WriterA &dw) |
Writes a DXF header to the file currently opened by the given DXF writer object. | |
unsigned long | 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 | writeInsert (DL_WriterA &dw, const DL_InsertData &data, const DL_Attributes &attrib) |
Writes an insert to the file. | |
void | writeKnot (DL_WriterA &dw, const DL_KnotData &data) |
Writes a single knot of a spline to the file. | |
void | writeLayer (DL_WriterA &dw, const DL_LayerData &data, const DL_Attributes &attrib) |
Writes a layer to the file. | |
void | writeLeader (DL_WriterA &dw, const DL_LeaderData &data, const DL_Attributes &attrib) |
Writes a leader entity to the file. | |
void | writeLeaderEnd (DL_WriterA &dw, const DL_LeaderData &data) |
void | writeLeaderVertex (DL_WriterA &dw, const DL_LeaderVertexData &data) |
Writes a single vertex of a leader to the file. | |
void | writeLine (DL_WriterA &dw, const DL_LineData &data, const DL_Attributes &attrib) |
Writes a line entity to the file. | |
void | writeLinetype (DL_WriterA &dw, const DL_LinetypeData &data) |
Writes a line type 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 | writeObjects (DL_WriterA &dw, const std::string &appDictionaryName="") |
Writes a objects section. | |
void | writeObjectsEnd (DL_WriterA &dw) |
Writes the end of the objects section. | |
void | writePoint (DL_WriterA &dw, const DL_PointData &data, const DL_Attributes &attrib) |
Writes a point 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 | writePolylineEnd (DL_WriterA &dw) |
Writes the polyline end. | |
void | writeRay (DL_WriterA &dw, const DL_RayData &data, const DL_Attributes &attrib) |
Writes a ray entity to the file. | |
void | writeSolid (DL_WriterA &dw, const DL_SolidData &data, const DL_Attributes &attrib) |
Writes a solid entity to the file. | |
void | writeSpline (DL_WriterA &dw, const DL_SplineData &data, const DL_Attributes &attrib) |
Writes a spline entity to the file. | |
void | writeStyle (DL_WriterA &dw, const DL_StyleData &style) |
Writes a style section. | |
void | writeText (DL_WriterA &dw, const DL_TextData &data, const DL_Attributes &attrib) |
Writes a text entity to the file. | |
void | writeTrace (DL_WriterA &dw, const DL_TraceData &data, const DL_Attributes &attrib) |
Writes a trace entity to the file. | |
void | writeUcs (DL_WriterA &dw) |
Writes a ucs section. | |
void | writeVertex (DL_WriterA &dw, const DL_VertexData &data) |
Writes a single vertex of a polyline to the file. | |
void | writeView (DL_WriterA &dw) |
Writes a view section. | |
void | writeVPort (DL_WriterA &dw) |
Writes a viewport section. | |
void | writeXLine (DL_WriterA &dw, const DL_XLineData &data, const DL_Attributes &attrib) |
Writes an x line entity to the file. | |
void | writeXRecord (DL_WriterA &dw, int handle, bool value) |
void | writeXRecord (DL_WriterA &dw, int handle, const std::string &value) |
void | writeXRecord (DL_WriterA &dw, int handle, double value) |
void | writeXRecord (DL_WriterA &dw, int handle, int value) |
~DL_Dxf () | |
Destructor. | |
Static Public Member Functions | |
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 empty. | |
static bool | getStrippedLine (std::string &s, FILE *stream, bool stripSpace=true) |
Reads line from file & strips whitespace at start and newline at end. | |
static bool | getStrippedLine (std::string &s, unsigned int size, std::istream &stream, bool stripSpace=true) |
Same as above but for input streams. | |
static bool | stripWhiteSpace (char **s, bool stripSpaces=true) |
Strips leading whitespace and trailing Carriage Return (CR) and Line Feed (LF) from NULL terminated string. | |
static void | test () |
Converts the given string into a double or returns the given default valud (def) if value is NULL or empty. | |
Private Attributes | |
unsigned long | appDictionaryHandle |
DL_Attributes | attrib |
int | controlPointIndex |
double * | controlPoints |
int | currentObjectType |
bool | firstCall |
bool | firstHatchLoop |
int | fitPointIndex |
double * | fitPoints |
unsigned int | groupCode |
std::string | groupCodeTmp |
std::string | groupValue |
DL_HatchEdgeData | hatchEdge |
std::vector< std::vector< DL_HatchEdgeData > > | hatchEdges |
int | knotIndex |
double * | knots |
int | leaderVertexIndex |
double * | leaderVertices |
int | libVersion |
int | maxControlPoints |
int | maxFitPoints |
int | maxKnots |
int | maxLeaderVertices |
int | maxVertices |
std::string | polylineLayer |
std::string | settingKey |
char | settingValue [DL_DXF_MAXLINE+1] |
unsigned long | styleHandleStd |
std::map< int, std::string > | values |
DL_Codes::version | version |
int | vertexIndex |
double * | vertices |
int | weightIndex |
double * | weights |
std::string | xRecordHandle |
bool | xRecordValues |
Reading and writing of DXF files.
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".
DL_Dxf::DL_Dxf | ( | ) |
Default constructor.
DL_Dxf::~DL_Dxf | ( | ) |
Destructor.
void DL_Dxf::add3dFace | ( | DL_CreationInterface * | creationInterface | ) |
Adds a 3dface entity that was read from the file via the creation interface.
void DL_Dxf::addArc | ( | DL_CreationInterface * | creationInterface | ) |
Adds an arc entity that was read from the file via the creation interface.
void DL_Dxf::addArcAlignedText | ( | DL_CreationInterface * | creationInterface | ) |
Adds an arc aligned text entity that was read from the file via the creation interface.
void DL_Dxf::addAttribute | ( | DL_CreationInterface * | creationInterface | ) |
Adds an attrib entity that was read from the file via the creation interface.
void DL_Dxf::addBlock | ( | DL_CreationInterface * | creationInterface | ) |
Adds a block that was read from the file via the creation interface.
void DL_Dxf::addCircle | ( | DL_CreationInterface * | creationInterface | ) |
Adds a circle entity that was read from the file via the creation interface.
void DL_Dxf::addComment | ( | DL_CreationInterface * | creationInterface, |
const std::string & | comment ) |
Adds a comment from the DXF file.
void DL_Dxf::addDictionary | ( | DL_CreationInterface * | creationInterface | ) |
void DL_Dxf::addDictionaryEntry | ( | DL_CreationInterface * | creationInterface | ) |
void DL_Dxf::addDimAligned | ( | DL_CreationInterface * | creationInterface | ) |
Adds an aligned dimension entity that was read from the file via the creation interface.
void DL_Dxf::addDimAngular | ( | DL_CreationInterface * | creationInterface | ) |
Adds an angular dimension entity that was read from the file via the creation interface.
void DL_Dxf::addDimAngular3P | ( | DL_CreationInterface * | creationInterface | ) |
Adds an angular dimension entity that was read from the file via the creation interface.
void DL_Dxf::addDimDiametric | ( | DL_CreationInterface * | creationInterface | ) |
Adds a diametric dimension entity that was read from the file via the creation interface.
void DL_Dxf::addDimLinear | ( | DL_CreationInterface * | creationInterface | ) |
Adds a linear dimension entity that was read from the file via the creation interface.
void DL_Dxf::addDimOrdinate | ( | DL_CreationInterface * | creationInterface | ) |
Adds an ordinate dimension entity that was read from the file via the creation interface.
void DL_Dxf::addDimRadial | ( | DL_CreationInterface * | creationInterface | ) |
Adds a radial dimension entity that was read from the file via the creation interface.
void DL_Dxf::addEllipse | ( | DL_CreationInterface * | creationInterface | ) |
Adds an ellipse entity that was read from the file via the creation interface.
void DL_Dxf::addHatch | ( | DL_CreationInterface * | creationInterface | ) |
Adds a hatch entity that was read from the file via the creation interface.
void DL_Dxf::addHatchEdge | ( | ) |
void DL_Dxf::addHatchLoop | ( | ) |
void DL_Dxf::addImage | ( | DL_CreationInterface * | creationInterface | ) |
Adds an image entity that was read from the file via the creation interface.
void DL_Dxf::addImageDef | ( | DL_CreationInterface * | creationInterface | ) |
Adds an image definition that was read from the file via the creation interface.
void DL_Dxf::addInsert | ( | DL_CreationInterface * | creationInterface | ) |
Adds an insert entity that was read from the file via the creation interface.
void DL_Dxf::addLayer | ( | DL_CreationInterface * | creationInterface | ) |
Adds a layer that was read from the file via the creation interface.
void DL_Dxf::addLeader | ( | DL_CreationInterface * | creationInterface | ) |
Adds a leader entity that was read from the file via the creation interface.
void DL_Dxf::addLine | ( | DL_CreationInterface * | creationInterface | ) |
Adds a line entity that was read from the file via the creation interface.
void DL_Dxf::addLinetype | ( | DL_CreationInterface * | creationInterface | ) |
Adds a linetype that was read from the file via the creation interface.
void DL_Dxf::addMText | ( | DL_CreationInterface * | creationInterface | ) |
Adds an MText entity that was read from the file via the creation interface.
void DL_Dxf::addPoint | ( | DL_CreationInterface * | creationInterface | ) |
Adds a point entity that was read from the file via the creation interface.
void DL_Dxf::addPolyline | ( | DL_CreationInterface * | creationInterface | ) |
Adds a polyline entity that was read from the file via the creation interface.
void DL_Dxf::addRay | ( | DL_CreationInterface * | creationInterface | ) |
Adds a ray entity that was read from the file via the creation interface.
void DL_Dxf::addSetting | ( | DL_CreationInterface * | creationInterface | ) |
Adds a variable from the DXF file.
void DL_Dxf::addSolid | ( | DL_CreationInterface * | creationInterface | ) |
Adds a solid entity (filled trace) that was read from the file via the creation interface.
void DL_Dxf::addSpline | ( | DL_CreationInterface * | creationInterface | ) |
Adds a spline entity that was read from the file via the creation interface.
void DL_Dxf::addText | ( | DL_CreationInterface * | creationInterface | ) |
Adds an text entity that was read from the file via the creation interface.
void DL_Dxf::addTextStyle | ( | DL_CreationInterface * | creationInterface | ) |
void DL_Dxf::addTrace | ( | DL_CreationInterface * | creationInterface | ) |
Adds a trace entity (4 edge closed polyline) that was read from the file via the creation interface.
void DL_Dxf::addVertex | ( | DL_CreationInterface * | creationInterface | ) |
Adds a polyline vertex entity that was read from the file via the creation interface.
void DL_Dxf::addXLine | ( | DL_CreationInterface * | creationInterface | ) |
Adds an xline entity that was read from the file via the creation interface.
|
static |
Converts the given string into a double or returns the given default valud (def) if value is NULL or empty.
Checks if the given variable is known by the given DXF version.
Converts the given string into an int or returns the given default valud (def) if value is NULL or empty. Converts the given string into a string or returns the given default valud (def) if value is NULL or empty.
void DL_Dxf::endBlock | ( | DL_CreationInterface * | creationInterface | ) |
Ends a block that was read from the file via the creation interface.
void DL_Dxf::endEntity | ( | DL_CreationInterface * | creationInterface | ) |
Ends some special entities like hatches or old style polylines.
void DL_Dxf::endSequence | ( | DL_CreationInterface * | creationInterface | ) |
Ends a sequence and notifies the creation interface.
DL_DimensionData DL_Dxf::getDimData | ( | ) |
|
inline |
|
inline |
int DL_Dxf::getLibVersion | ( | const std::string & | str | ) |
|
inline |
|
inline |
|
static |
Reads line from file & strips whitespace at start and newline at end.
s | Output Pointer to character array that chopped line will be returned in. |
size | Size of s . (Including space for NULL.) |
fp | Input Handle of input file. |
true | if line could be read |
false | if fp is already at end of file |
Change function to use safer FreeBSD strl* functions
Is it a problem if line is blank (i.e., newline only)? Then, when function returns, (s==NULL).
|
static |
Same as above but for input streams.
|
inline |
bool DL_Dxf::handleDictionaryData | ( | DL_CreationInterface * | creationInterface | ) |
Handles all dictionary data.
bool DL_Dxf::handleHatchData | ( | DL_CreationInterface * | creationInterface | ) |
Handles all hatch data.
bool DL_Dxf::handleLeaderData | ( | DL_CreationInterface * | creationInterface | ) |
Handles additional leader data.
bool DL_Dxf::handleLinetypeData | ( | DL_CreationInterface * | creationInterface | ) |
Handles all dashes in linetype pattern.
bool DL_Dxf::handleLWPolylineData | ( | DL_CreationInterface * | creationInterface | ) |
Handles additional polyline data.
bool DL_Dxf::handleMTextData | ( | DL_CreationInterface * | creationInterface | ) |
Handles additional MText data.
bool DL_Dxf::handleSplineData | ( | DL_CreationInterface * | creationInterface | ) |
Handles additional spline data.
bool DL_Dxf::handleXData | ( | DL_CreationInterface * | creationInterface | ) |
Handles XData for all object types.
bool DL_Dxf::handleXRecordData | ( | DL_CreationInterface * | creationInterface | ) |
Handles all XRecord data.
|
inline |
bool DL_Dxf::in | ( | const std::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.
file | Input Path and name of file to read |
creationInterface | Pointer to the class which takes care of the entities in the file. |
true | If file could be opened. |
false | If file could not be opened. |
bool DL_Dxf::in | ( | std::istream & | stream, |
DL_CreationInterface * | creationInterface ) |
Reads a DXF file from an existing stream.
stream | The input stream. |
creationInterface | Pointer to the class which takes care of the entities in the file. |
true | If file could be opened. |
false | If file could not be opened. |
DL_WriterA * DL_Dxf::out | ( | const char * | file, |
DL_Codes::version | version = DL_VERSION_2000 ) |
Converts the given string into an int.
ok is set to false if there was an error.
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.
file | Full path of the file to open. |
bool DL_Dxf::processDXFGroup | ( | DL_CreationInterface * | creationInterface, |
int | groupCode, | ||
const std::string & | groupValue ) |
Processes a group (pair of group code and value).
creationInterface | Handle to class that creates entities and other CAD data from DXF group codes |
groupCode | Constant indicating the data type of the group. |
groupValue | The data value. |
true | if done processing current entity and new entity begun |
false | if not done processing current entity |
bool DL_Dxf::readDxfGroups | ( | FILE * | fp, |
DL_CreationInterface * | creationInterface ) |
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 creationInterface
.
fp
is advanced so that the next call to readDXFGroups()
reads the next couplet in the file.
fp | Handle of input file |
creationInterface | Handle of class which processes entities in the file |
true | If EOF not reached. |
false | If EOF reached. |
bool DL_Dxf::readDxfGroups | ( | std::istream & | stream, |
DL_CreationInterface * | creationInterface ) |
Same as above but for input streams.
|
static |
Strips leading whitespace and trailing Carriage Return (CR) and Line Feed (LF) from NULL terminated string.
s | Input and output. NULL terminates string. |
true | if s is non-NULL |
false | if s is NULL |
|
static |
Converts the given string into a double or returns the given default valud (def) if value is NULL or empty.
Some test routines.
|
inline |
|
inline |
|
inline |
|
inline |
void DL_Dxf::write3dFace | ( | DL_WriterA & | dw, |
const DL_3dFaceData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a 3d face entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeAppDictionary | ( | DL_WriterA & | dw | ) |
void DL_Dxf::writeAppid | ( | DL_WriterA & | dw, |
const std::string & | name ) |
Writes the APPID section to the DXF file.
name | Application name |
void DL_Dxf::writeArc | ( | DL_WriterA & | dw, |
const DL_ArcData & | data, | ||
const DL_Attributes & | attrib ) |
Writes an arc entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeAttribute | ( | DL_WriterA & | dw, |
const DL_AttributeData & | data, | ||
const DL_Attributes & | attrib ) |
void DL_Dxf::writeBlock | ( | DL_WriterA & | dw, |
const DL_BlockData & | data ) |
Writes a block's definition (no entities) to the DXF file.
void DL_Dxf::writeBlockRecord | ( | DL_WriterA & | dw | ) |
Writes a blockrecord section.
This section is needed in DL_VERSION_R13. Note that this method currently only writes a faked BLOCKRECORD section to make the file readable by Aut*cad.
void DL_Dxf::writeBlockRecord | ( | DL_WriterA & | dw, |
const std::string & | name ) |
Writes a single block record with the given name.
void DL_Dxf::writeCircle | ( | DL_WriterA & | dw, |
const DL_CircleData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a circle entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeComment | ( | DL_WriterA & | dw, |
const std::string & | comment ) |
Writes a comment to the DXF file.
void DL_Dxf::writeControlPoint | ( | DL_WriterA & | dw, |
const DL_ControlPointData & | data ) |
Writes a single control point of a spline to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
unsigned long DL_Dxf::writeDictionaryEntry | ( | DL_WriterA & | dw, |
const std::string & | name ) |
void DL_Dxf::writeDimAligned | ( | DL_WriterA & | dw, |
const DL_DimensionData & | data, | ||
const DL_DimAlignedData & | edata, | ||
const DL_Attributes & | attrib ) |
Writes an aligned dimension entity to the file.
dw | DXF writer |
data | Generic dimension data for from the file |
data | Specific aligned dimension data from the file |
attrib | Attributes |
void DL_Dxf::writeDimAngular2L | ( | DL_WriterA & | dw, |
const DL_DimensionData & | data, | ||
const DL_DimAngular2LData & | edata, | ||
const DL_Attributes & | attrib ) |
Writes an angular dimension entity to the file.
dw | DXF writer |
data | Generic dimension data for from the file |
data | Specific angular dimension data from the file |
attrib | Attributes |
void DL_Dxf::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.
dw | DXF writer |
data | Generic dimension data for from the file |
data | Specific angular dimension data from the file |
attrib | Attributes |
void DL_Dxf::writeDimDiametric | ( | DL_WriterA & | dw, |
const DL_DimensionData & | data, | ||
const DL_DimDiametricData & | edata, | ||
const DL_Attributes & | attrib ) |
Writes a diametric dimension entity to the file.
dw | DXF writer |
data | Generic dimension data for from the file |
data | Specific diametric dimension data from the file |
attrib | Attributes |
void DL_Dxf::writeDimLinear | ( | DL_WriterA & | dw, |
const DL_DimensionData & | data, | ||
const DL_DimLinearData & | edata, | ||
const DL_Attributes & | attrib ) |
Writes a linear dimension entity to the file.
dw | DXF writer |
data | Generic dimension data for from the file |
data | Specific linear dimension data from the file |
attrib | Attributes |
void DL_Dxf::writeDimOrdinate | ( | DL_WriterA & | dw, |
const DL_DimensionData & | data, | ||
const DL_DimOrdinateData & | edata, | ||
const DL_Attributes & | attrib ) |
Writes an ordinate dimension entity to the file.
dw | DXF writer |
data | Generic dimension data for from the file |
data | Specific ordinate dimension data from the file |
attrib | Attributes |
void DL_Dxf::writeDimRadial | ( | DL_WriterA & | dw, |
const DL_DimensionData & | data, | ||
const DL_DimRadialData & | edata, | ||
const DL_Attributes & | attrib ) |
Writes a radial dimension entity to the file.
dw | DXF writer |
data | Generic dimension data for from the file |
data | Specific radial dimension data from the file |
attrib | Attributes |
void DL_Dxf::writeDimStyle | ( | DL_WriterA & | dw, |
double | dimasz, | ||
double | dimexe, | ||
double | dimexo, | ||
double | dimgap, | ||
double | dimtxt, | ||
int | dimtad = 1, | ||
bool | dimtih = false ) |
Writes a dimstyle section.
This section is needed in DL_VERSION_R13. Note that this method currently only writes a faked DIMSTYLE section to make the file readable by Aut*cad.
void DL_Dxf::writeDimStyleOverrides | ( | DL_WriterA & | dw, |
const DL_DimensionData & | data ) |
void DL_Dxf::writeEllipse | ( | DL_WriterA & | dw, |
const DL_EllipseData & | data, | ||
const DL_Attributes & | attrib ) |
Writes an ellipse entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeEndBlock | ( | DL_WriterA & | dw, |
const std::string & | name ) |
Writes a block end.
name | Block name |
void DL_Dxf::writeFitPoint | ( | DL_WriterA & | dw, |
const DL_FitPointData & | data ) |
Writes a single fit point of a spline to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeHatch1 | ( | DL_WriterA & | dw, |
const DL_HatchData & | data, | ||
const DL_Attributes & | attrib ) |
Writes the beginning of a hatch entity to the file.
This must be followed by one or more writeHatchLoop() calls and a writeHatch2() call.
dw | DXF writer |
data | Entity data. |
attrib | Attributes |
void DL_Dxf::writeHatch2 | ( | DL_WriterA & | dw, |
const DL_HatchData & | data, | ||
const DL_Attributes & | attrib ) |
Writes the end of a hatch entity to the file.
dw | DXF writer |
data | Entity data. |
attrib | Attributes |
void DL_Dxf::writeHatchEdge | ( | DL_WriterA & | dw, |
const DL_HatchEdgeData & | data ) |
Writes the beginning of a hatch entity to the file.
dw | DXF writer |
data | Entity data. |
attrib | Attributes |
void DL_Dxf::writeHatchLoop1 | ( | DL_WriterA & | dw, |
const DL_HatchLoopData & | data ) |
Writes the beginning of a hatch loop to the file.
This must happen after writing the beginning of a hatch entity.
dw | DXF writer |
data | Entity data. |
attrib | Attributes |
void DL_Dxf::writeHatchLoop2 | ( | DL_WriterA & | dw, |
const DL_HatchLoopData & | data ) |
Writes the end of a hatch loop to the file.
dw | DXF writer |
data | Entity data. |
attrib | Attributes |
void DL_Dxf::writeHeader | ( | DL_WriterA & | dw | ) |
Writes a DXF header to the file currently opened by the given DXF writer object.
unsigned long DL_Dxf::writeImage | ( | DL_WriterA & | dw, |
const DL_ImageData & | data, | ||
const DL_Attributes & | attrib ) |
Writes an image entity.
void DL_Dxf::writeImageDef | ( | DL_WriterA & | dw, |
int | handle, | ||
const DL_ImageData & | data ) |
Writes an image definiition entity.
void DL_Dxf::writeInsert | ( | DL_WriterA & | dw, |
const DL_InsertData & | data, | ||
const DL_Attributes & | attrib ) |
Writes an insert to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeKnot | ( | DL_WriterA & | dw, |
const DL_KnotData & | data ) |
Writes a single knot of a spline to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeLayer | ( | DL_WriterA & | dw, |
const DL_LayerData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a layer to the file.
Layers are stored in the tables section of a DXF file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeLeader | ( | DL_WriterA & | dw, |
const DL_LeaderData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a leader entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeLeaderEnd | ( | DL_WriterA & | dw, |
const DL_LeaderData & | data ) |
void DL_Dxf::writeLeaderVertex | ( | DL_WriterA & | dw, |
const DL_LeaderVertexData & | data ) |
Writes a single vertex of a leader to the file.
dw | DXF writer |
data | Entity data |
void DL_Dxf::writeLine | ( | DL_WriterA & | dw, |
const DL_LineData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a line entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeLinetype | ( | DL_WriterA & | dw, |
const DL_LinetypeData & | data ) |
Writes a line type to the file.
Line types are stored in the tables section of a DXF file.
void DL_Dxf::writeMText | ( | DL_WriterA & | dw, |
const DL_MTextData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a multi text entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeObjects | ( | DL_WriterA & | dw, |
const std::string & | appDictionaryName = "" ) |
Writes a objects section.
This section is needed in DL_VERSION_R13. Note that this method currently only writes a faked OBJECTS section to make the file readable by Aut*cad.
void DL_Dxf::writeObjectsEnd | ( | DL_WriterA & | dw | ) |
Writes the end of the objects section.
This section is needed in DL_VERSION_R13. Note that this method currently only writes a faked OBJECTS section to make the file readable by Aut*cad.
void DL_Dxf::writePoint | ( | DL_WriterA & | dw, |
const DL_PointData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a point entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writePolyline | ( | DL_WriterA & | dw, |
const DL_PolylineData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a polyline entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writePolylineEnd | ( | DL_WriterA & | dw | ) |
Writes the polyline end.
Only needed for DXF R12.
void DL_Dxf::writeRay | ( | DL_WriterA & | dw, |
const DL_RayData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a ray entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeSolid | ( | DL_WriterA & | dw, |
const DL_SolidData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a solid entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeSpline | ( | DL_WriterA & | dw, |
const DL_SplineData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a spline entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeStyle | ( | DL_WriterA & | dw, |
const DL_StyleData & | style ) |
Writes a style section.
This section is needed in DL_VERSION_R13.
void DL_Dxf::writeText | ( | DL_WriterA & | dw, |
const DL_TextData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a text entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeTrace | ( | DL_WriterA & | dw, |
const DL_TraceData & | data, | ||
const DL_Attributes & | attrib ) |
Writes a trace entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeUcs | ( | DL_WriterA & | dw | ) |
Writes a ucs section.
This section is needed in DL_VERSION_R13. Note that this method currently only writes a faked UCS section to make the file readable by Aut*cad.
void DL_Dxf::writeVertex | ( | DL_WriterA & | dw, |
const DL_VertexData & | data ) |
Writes a single vertex of a polyline to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeView | ( | DL_WriterA & | dw | ) |
Writes a view section.
This section is needed in DL_VERSION_R13. Note that this method currently only writes a faked VIEW section to make the file readable by Aut*cad.
void DL_Dxf::writeVPort | ( | DL_WriterA & | dw | ) |
Writes a viewport section.
This section is needed in DL_VERSION_R13. Note that this method currently only writes a faked VPORT section to make the file readable by Aut*cad.
void DL_Dxf::writeXLine | ( | DL_WriterA & | dw, |
const DL_XLineData & | data, | ||
const DL_Attributes & | attrib ) |
Writes an x line entity to the file.
dw | DXF writer |
data | Entity data from the file |
attrib | Attributes |
void DL_Dxf::writeXRecord | ( | DL_WriterA & | dw, |
int | handle, | ||
bool | value ) |
void DL_Dxf::writeXRecord | ( | DL_WriterA & | dw, |
int | handle, | ||
const std::string & | value ) |
void DL_Dxf::writeXRecord | ( | DL_WriterA & | dw, |
int | handle, | ||
double | value ) |
void DL_Dxf::writeXRecord | ( | DL_WriterA & | dw, |
int | handle, | ||
int | value ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |