Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

RS_FilterDxf Class Reference

This format filter class can import and export DXF files. More...

#include <rs_filterdxf.h>

Inheritance diagram for RS_FilterDxf:

RS_FilterInterface List of all members.

Public Member Functions

 RS_FilterDxf ()
 Default constructor.
 ~RS_FilterDxf ()
 Destructor.
virtual bool fileImport (RS_Graphic &g, const RS_String &file, RS2::FormatType)
 Implementation of the method used for RS_Import to communicate with this filter.
virtual void addLayer (const DL_LayerData &data)
 Implementation of the method which handles layers.
virtual void addBlock (const DL_BlockData &data)
 Implementation of the method which handles blocks.
virtual void endBlock ()
 Implementation of the method which closes blocks.
virtual void addPoint (const DL_PointData &data)
 Implementation of the method which handles point entities.
virtual void addLine (const DL_LineData &data)
 Implementation of the method which handles line entities.
virtual void addArc (const DL_ArcData &data)
 Implementation of the method which handles arc entities.
virtual void addEllipse (const DL_EllipseData &data)
 Implementation of the method which handles ellipse entities.
virtual void addCircle (const DL_CircleData &data)
 Implementation of the method which handles circle entities.
virtual void addPolyline (const DL_PolylineData &data)
 Implementation of the method which handles polyline entities.
virtual void addVertex (const DL_VertexData &data)
 Implementation of the method which handles polyline vertices.
virtual void addSpline (const DL_SplineData &data)
 Implementation of the method which handles splines.
virtual void addKnot (const DL_KnotData &)
virtual void addControlPoint (const DL_ControlPointData &data)
 Implementation of the method which handles spline control points.
virtual void addInsert (const DL_InsertData &data)
 Implementation of the method which handles inserts.
virtual void addTrace (const DL_TraceData &)
virtual void addSolid (const DL_SolidData &)
virtual void addMTextChunk (const char *text)
 Implementation of the method which handles text chunks for MText entities.
virtual void addMText (const DL_MTextData &data)
 Implementation of the method which handles multi texts (MTEXT).
virtual void addText (const DL_TextData &data)
 Implementation of the method which handles texts (TEXT).
RS_DimensionData convDimensionData (const DL_DimensionData &data)
 Implementation of the method which handles dimensions (DIMENSION).
virtual void addDimAlign (const DL_DimensionData &data, const DL_DimAlignedData &edata)
 Implementation of the method which handles aligned dimensions (DIMENSION).
virtual void addDimLinear (const DL_DimensionData &data, const DL_DimLinearData &edata)
 Implementation of the method which handles linear dimensions (DIMENSION).
virtual void addDimRadial (const DL_DimensionData &data, const DL_DimRadialData &edata)
 Implementation of the method which handles radial dimensions (DIMENSION).
virtual void addDimDiametric (const DL_DimensionData &data, const DL_DimDiametricData &edata)
 Implementation of the method which handles diametric dimensions (DIMENSION).
virtual void addDimAngular (const DL_DimensionData &data, const DL_DimAngularData &edata)
 Implementation of the method which handles angular dimensions (DIMENSION).
virtual void addDimAngular3P (const DL_DimensionData &data, const DL_DimAngular3PData &edata)
 Implementation of the method which handles angular dimensions (DIMENSION).
virtual void addLeader (const DL_LeaderData &data)
 Implementation of the method which handles leader entities.
virtual void addLeaderVertex (const DL_LeaderVertexData &data)
 Implementation of the method which handles leader vertices.
virtual void addHatch (const DL_HatchData &data)
 Implementation of the method which handles hatch entities.
virtual void addHatchLoop (const DL_HatchLoopData &data)
 Implementation of the method which handles hatch loops.
virtual void addHatchEdge (const DL_HatchEdgeData &data)
 Implementation of the method which handles hatch edge entities.
virtual void addImage (const DL_ImageData &data)
 Implementation of the method which handles image entities.
virtual void linkImage (const DL_ImageDefData &data)
 Implementation of the method which links image entities to image files.
virtual void endEntity ()
 Finishes a hatch entity.
virtual void endSequence ()
virtual void setVariableVector (const char *key, double v1, double v2, double v3, int code)
 Sets a vector variable from the DXF file.
virtual void setVariableString (const char *key, const char *value, int code)
 Sets a string variable from the DXF file.
virtual void setVariableInt (const char *key, int value, int code)
 Sets an int variable from the DXF file.
virtual void setVariableDouble (const char *key, double value, int code)
 Sets a double variable from the DXF file.
virtual bool fileExport (RS_Graphic &g, const RS_String &file, RS2::FormatType formatType)
 Implementation of the method used for RS_Export to communicate with this filter.
void writeVariables (DL_WriterA &dw)
 Writes all known variable settings to the DXF file.
void writeLayer (DL_WriterA &dw, RS_Layer *l)
 Writes one layer to the DXF file.
void writeLineType (DL_WriterA &dw, RS2::LineType t)
 Writes a line type to the DXF file.
void writeAppid (DL_WriterA &dw, const char *appid)
 Writes an application id to the DXF file.
void writeBlock (DL_WriterA &dw, RS_Block *blk)
 Writes a block (just the definition, not the entities in it).
void writeEntity (DL_WriterA &dw, RS_Entity *e)
 Writes the given entity to the DXF file.
void writeEntity (DL_WriterA &dw, RS_Entity *e, const DL_Attributes &attrib)
 Writes the given entity to the DXF file.
void writePoint (DL_WriterA &dw, RS_Point *p, const DL_Attributes &attrib)
 Writes the given Point entity to the file.
void writeLine (DL_WriterA &dw, RS_Line *l, const DL_Attributes &attrib)
 Writes the given Line( entity to the file.
void writePolyline (DL_WriterA &dw, RS_Polyline *l, const DL_Attributes &attrib)
 Writes the given polyline entity to the file.
void writeSpline (DL_WriterA &dw, RS_Spline *s, const DL_Attributes &attrib)
 Writes the given spline entity to the file.
void writeCircle (DL_WriterA &dw, RS_Circle *c, const DL_Attributes &attrib)
 Writes the given circle entity to the file.
void writeArc (DL_WriterA &dw, RS_Arc *a, const DL_Attributes &attrib)
void writeEllipse (DL_WriterA &dw, RS_Ellipse *s, const DL_Attributes &attrib)
void writeInsert (DL_WriterA &dw, RS_Insert *i, const DL_Attributes &attrib)
void writeText (DL_WriterA &dw, RS_Text *t, const DL_Attributes &attrib)
void writeDimension (DL_WriterA &dw, RS_Dimension *d, const DL_Attributes &attrib)
void writeLeader (DL_WriterA &dw, RS_Leader *l, const DL_Attributes &attrib)
void writeHatch (DL_WriterA &dw, RS_Hatch *h, const DL_Attributes &attrib)
void writeSolid (DL_WriterA &dw, RS_Solid *s, const DL_Attributes &attrib)
void writeImage (DL_WriterA &dw, RS_Image *i, const DL_Attributes &attrib)
void writeEntityContainer (DL_WriterA &dw, RS_EntityContainer *con, const DL_Attributes &attrib)
void writeAtomicEntities (DL_WriterA &dw, RS_EntityContainer *c, const DL_Attributes &attrib, RS2::ResolveLevel level)
 Writes the atomic entities of the given cotnainer to the file.
void writeImageDef (DL_WriterA &dw, RS_Image *i)
 Writes an IMAGEDEF object into an OBJECT section.
void setEntityAttributes (RS_Entity *entity, const DL_Attributes &attrib)
 Sets the entities attributes according to the attributes that come from a DXF file.
DL_Attributes getEntityAttributes (RS_Entity *entity)
 Gets the entities attributes as a DL_Attributes object.
RS_Pen attributesToPen (const DL_Attributes &attrib) const

Static Public Member Functions

static RS_String toDxfString (const RS_String &string, RS2::FormatType formatType=RS2::FormatDxf)
 Converts a native unicode string into a DXF encoded string.
static RS_String toNativeString (const RS_String &string)
 Converts a DXF encoded string into a native Unicode string.
static RS_Color numberToColor (int num, bool comp=false)
 Converts a color index (num) into a RS_Color object.
static int colorToNumber (const RS_Color &col)
 Converts a color into a color number in the DXF palette.
static RS2::LineType nameToLineType (const RS_String &name)
 Converts a line type name (e.g.
static RS_String lineTypeToName (RS2::LineType lineType)
 Converts a RS_LineType into a name for a line type.
static RS2::LineWidth numberToWidth (int num)
 Converts a line width number (e.g.
static int widthToNumber (RS2::LineWidth width)
 Converts a RS2::LineWidth into an int width.
static RS2::AngleFormat numberToAngleFormat (int num)
 Converts the given number from a DXF file into an AngleFormat enum.
static int angleFormatToNumber (RS2::AngleFormat af)
 Converts AngleFormat enum to DXF number.
static RS2::Unit numberToUnit (int num)
 converts a DXF unit setting (e.g.
static int unitToNumber (RS2::Unit unit)
 Converst a unit enum into a DXF unit number e.g.
static bool isVariableTwoDimensional (const RS_String &var)
 Checks if the given variable is two-dimensional (e.g.

Detailed Description

This format filter class can import and export DXF files.

It depends on the dxflib library.

Author:
Andrew Mustun


Member Function Documentation

void RS_FilterDxf::addArc const DL_ArcData &  data  )  [virtual]
 

Implementation of the method which handles arc entities.

Parameters:
angle1 Start angle in deg (!)
angle2 End angle in deg (!)

void RS_FilterDxf::addBlock const DL_BlockData &  data  )  [virtual]
 

Implementation of the method which handles blocks.

Todo:
Adding blocks to blocks (stack for currentContainer)

void RS_FilterDxf::addEllipse const DL_EllipseData &  data  )  [virtual]
 

Implementation of the method which handles ellipse entities.

Parameters:
angle1 Start angle in rad (!)
angle2 End angle in rad (!)

RS_Pen RS_FilterDxf::attributesToPen const DL_Attributes &  attrib  )  const
 

Returns:
Pen with the same attributes as 'attrib'.

int RS_FilterDxf::colorToNumber const RS_Color col  )  [static]
 

Converts a color into a color number in the DXF palette.

The color that fits best is chosen.

bool RS_FilterDxf::fileExport RS_Graphic g,
const RS_String &  file,
RS2::FormatType  formatType
[virtual]
 

Implementation of the method used for RS_Export to communicate with this filter.

Parameters:
file Full path to the DXF file that will be written.

Implements RS_FilterInterface.

bool RS_FilterDxf::fileImport RS_Graphic g,
const RS_String &  file,
RS2::FormatType 
[virtual]
 

Implementation of the method used for RS_Import to communicate with this filter.

Parameters:
g The graphic in which the entities from the file will be created or the graphics from which the entities are taken to be stored in a file.

Implements RS_FilterInterface.

bool RS_FilterDxf::isVariableTwoDimensional const RS_String &  var  )  [static]
 

Checks if the given variable is two-dimensional (e.g.

$LIMMIN).

RS2::LineType RS_FilterDxf::nameToLineType const RS_String &  name  )  [static]
 

Converts a line type name (e.g.

"CONTINUOUS") into a RS2::LineType object.

RS2::AngleFormat RS_FilterDxf::numberToAngleFormat int  num  )  [static]
 

Converts the given number from a DXF file into an AngleFormat enum.

Parameters:
num $DIMAUNIT from DXF (0: decimal deg, 1: deg/min/sec, 2: gradians, 3: radians, 4: surveyor's units)
Matching AngleFormat enum value.

RS_Color RS_FilterDxf::numberToColor int  num,
bool  comp = false
[static]
 

Converts a color index (num) into a RS_Color object.

Please refer to the dxflib documentation for details.

Parameters:
num Color number.
comp Compatibility with older QCad versions (1.5.3 and older)

RS2::Unit RS_FilterDxf::numberToUnit int  num  )  [static]
 

converts a DXF unit setting (e.g.

INSUNITS) to a unit enum.

RS2::LineWidth RS_FilterDxf::numberToWidth int  num  )  [static]
 

Converts a line width number (e.g.

1) into a RS2::LineWidth.

RS_String RS_FilterDxf::toDxfString const RS_String &  string,
RS2::FormatType  formatType = RS2::FormatDxf
[static]
 

Converts a native unicode string into a DXF encoded string.

DXF endoding includes the following special sequences:

  • %%c for a diameter sign
  • %%d for a degree sign
  • %%p for a plus/minus sign

int RS_FilterDxf::unitToNumber RS2::Unit  unit  )  [static]
 

Converst a unit enum into a DXF unit number e.g.

for INSUNITS.

void RS_FilterDxf::writeAppid DL_WriterA &  dw,
const char *  appid
 

Writes an application id to the DXF file.

Parameters:
appid Application ID (e.g. "QCad").

void RS_FilterDxf::writeLayer DL_WriterA &  dw,
RS_Layer l
 

Writes one layer to the DXF file.

Todo:
Add support for unicode layer names


The documentation for this class was generated from the following files:
Generated on Sat Jan 6 13:48:23 2007 for qcadlib by  doxygen 1.4.4