QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RDwgExporter Class Reference

Exporter for the DWG format, based on the OpenDesign libraries. More...

#include <RDwgExporter.h>

Inheritance diagram for RDwgExporter:
RFileExporter RExporter

List of all members.

Public Member Functions

virtual void exportArc (const RArc &arc, double offset=RNANDOUBLE)
virtual void exportArcSegment (const RArc &arc)
virtual void exportBlock (RBlock &block)
virtual void exportCircle (const RCircle &circle)
 Exports a circle with the current attributes.
virtual void exportDocumentSetting (const QString &key, const QVariant &value)
virtual bool exportDocumentSettings ()
virtual void exportEntity (REntity &e, bool preview=false, bool allBlocks=true)
 Sets the current entity to the given entity and calls exportEntity().
virtual bool exportFile (const QString &fileName, const QString &nameFilter, bool setFileName=true)
 Must be implemented by file exporters to export the document into the given file.
virtual void exportLayer (RLayer &layer)
virtual void exportLine (const RLine &line, double offset=RNANDOUBLE)
 Exports a line with the current attributes.
virtual void exportLineSegment (const RLine &line)
 Exports a line segment (a line without pattern).
virtual void exportLinetype (RLinetype &linetype)
virtual void exportPoint (const RPoint &point)
 Exports a point with the current attributes.
virtual void exportPolyline (const RPolyline &polyline)
virtual void exportTriangle (const RTriangle &triangle)
 Exports a triangle with the current attributes.
virtual void exportView (RView &view)
virtual QString getCorrectedFileName (const QString &fileName, const QString &nameFilter)
 Must be implemented by file exporters to correct the given file name if necesary (add extension based on chosen name filter).
 RDwgExporter (RDocument &document)
virtual void setColor (const QColor &c)
virtual ~RDwgExporter ()
- Public Member Functions inherited from RFileExporter
 RFileExporter ()
 RFileExporter (RDocument &document)
virtual ~RFileExporter ()
- Public Member Functions inherited from RExporter
virtual void endEntity ()
virtual void endExport ()
 Called at the end of a completed export.
virtual void exportBlock (RBlock::Id blockId)
virtual void exportBlocks ()
virtual void exportBoundingBoxPaths (const QList< RPainterPath > &paths)
virtual void exportBox (const RBox &box)
 Exports the surfaces of the given box.
virtual void exportCurrentEntity (bool preview=false)
 The default implementation calls the REntity::exportEntity() function of the entity.
virtual bool exportDocument ()
 Exports the visual representation of all objects (including entities) of the document->
virtual void exportEllipse (const REllipse &ellipse, double offset=RNANDOUBLE)
 Exports an ellipse with the current attributes.
virtual void exportEntities (bool allBlocks=true, bool undone=false)
virtual void exportEntities (const RBox &box)
 Exports the visual representation of all entities that are completely or partly inside the given area.
virtual void exportEntities (QSet< REntity::Id > &entityIds, bool allBlocks=true)
 Calls exportEntity() for all given entities.
virtual void exportEntity (REntity::Id entityId, bool allBlocks=true)
 Calls exportEntity(REntity*) for the entity with the given ID.
virtual void exportExplodable (const RExplodable &explodable, double offset=RNANDOUBLE)
virtual void exportImage (const RImageData &image)
virtual void exportLayer (RLayer::Id layerId)
virtual void exportLayers ()
virtual void exportLinetypes ()
virtual void exportPainterPaths (const QList< RPainterPath > &paths)
virtual void exportPainterPathSource (const RPainterPathSource &pathSource)
virtual void exportPolyline (const RPolyline &polyline, double offset=RNANDOUBLE)
virtual void exportQuad (const RVector &p1, const RVector &p2, const RVector &p3, const RVector &p4)
 Exports a quadrilateral with the current attributes.
virtual void exportRectangle (const RVector &p1, const RVector &p2)
 Exports a rectangle with the current attributes.
virtual void exportShape (QSharedPointer< RShape > shape)
 Exports the given shapes as part of the geometry of the current entity.
virtual void exportShapes (const QList< QSharedPointer< RShape > > &shapes)
 Exports the given shapes as part of the geometry of the current entity.
virtual void exportSpline (const RSpline &spline, double offset=RNANDOUBLE)
virtual void exportTrialEntities ()
virtual void exportVerticalQuad (const RVector &p1, const RVector &p2, double height)
 Exports a vertical quadrilateral with the two given base points and the given height.
virtual void exportView (RView::Id viewId)
virtual void exportViews ()
virtual REntitygetBlockRefOrEntity ()
virtual QBrush getBrush (const RPainterPath &path)
virtual QBrush getBrush ()
RDocumentgetDocument () const
 
bool getDraftMode () const
virtual REntitygetEntity ()
 Sets the current export color for entities.
virtual const REntitygetEntity () const
QStack< REntity * > getEntityStack ()
QString getErrorMessage () const
RLinetypePattern getLinetypePattern ()
virtual double getPatternFactor ()
double getPatternOffset (double length, const RLinetypePattern &pattern)
double getPatternOffset (double length, const RLinetypePattern &pattern, int index, double *gap=NULL)
virtual QPen getPen (const RPainterPath &path)
virtual QPen getPen ()
RS::ProjectionRenderingHint getProjectionRenderingHint ()
virtual bool isEntitySelected ()
bool isVisualExporter () const
 RExporter ()
 RExporter (RDocument &document)
void setBlockSource (RDocument *bs)
virtual void setBrush (const QBrush &brush)
virtual void setBrushStyle (Qt::BrushStyle brushStyle)
virtual void setColor (float r, float g, float b, float a=1.0f)
 Sets the current export color in RGB and Alpha.
virtual void setColor (const RColor &color)
virtual void setDashPattern (const QVector< qreal > &dashes)
void setDraftMode (bool on)
virtual void setEntityAttributes ()
void setLayerSource (RDocument *ls)
virtual void setLinetypeId (RLinetype::Id ltId)
virtual void setLinetypePattern (const RLinetypePattern &ltPattern)
virtual void setLineweight (RLineweight::Lineweight weight)
virtual void setPen (const QPen &pen)
 Sets the current pen (currentPen).
void setProjectionRenderingHint (RS::ProjectionRenderingHint p)
 Sets a rendering hint for the current projection used for exports.
virtual void setStyle (Qt::PenStyle penStyle)
void setVisualExporter (bool on)
virtual void startEntity (bool)
virtual void startExport ()
 Called to start a new, complete export.
virtual void unexportEntity (REntity::Id entityId)
 This is called for entities for which an export was requested but which cannot be instantiated because they either do not exist (anymore) in the DB or they are currently undone.
virtual ~RExporter ()

Protected Member Functions

OdDbObjectId addDimStyle (const QString &styleName)
OdDbObjectId addTextStyle (const QString &styleName, double textSize, double xScale, double priorSize, double obliquing, const QString &fileName, bool isShapeFile, const QString &ttFaceName, bool bold, bool italic, int charset, int pitchAndFamily)
void addXData (const QString &key, const QVariant &value)
 Adds the given key / value pair as XData to the exported document.
OdResBufPtr appendXDataPair (OdResBufPtr pCurr, int code)
OdDbEntityPtr exportArcEntity (OdDbBlockTableRecordPtr bBTR, RArcEntity &e)
OdDbEntityPtr exportBlockReferenceEntity (OdDbBlockTableRecordPtr bBTR, OdDbBlockTablePtr pTable, RBlockReferenceEntity &e)
OdDbEntityPtr exportCircleEntity (OdDbBlockTableRecordPtr bBTR, RCircleEntity &e)
OdDbEntityPtr exportDimAlignedEntity (OdDbBlockTableRecordPtr bBTR, RDimAlignedEntity &e)
OdDbEntityPtr exportDimAngularEntity (OdDbBlockTableRecordPtr bBTR, RDimAngularEntity &e)
void exportDimCommon (OdDbDimensionPtr pDimension, RDimensionEntity &e)
OdDbEntityPtr exportDimDiametricEntity (OdDbBlockTableRecordPtr bBTR, RDimDiametricEntity &e)
OdDbEntityPtr exportDimOrdinateEntity (OdDbBlockTableRecordPtr bBTR, RDimOrdinateEntity &e)
OdDbEntityPtr exportDimRadialEntity (OdDbBlockTableRecordPtr bBTR, RDimRadialEntity &e)
OdDbEntityPtr exportDimRotatedEntity (OdDbBlockTableRecordPtr bBTR, RDimRotatedEntity &e)
OdDbEntityPtr exportEllipseEntity (OdDbBlockTableRecordPtr bBTR, REllipseEntity &e)
OdDbEntityPtr exportHatchEntity (OdDbBlockTableRecordPtr bBTR, RHatchEntity &e)
OdDbEntityPtr exportImageEntity (OdDbBlockTableRecordPtr bBTR, RImageEntity &e)
OdDbEntityPtr exportLeaderEntity (OdDbBlockTableRecordPtr bBTR, RLeaderEntity &e)
OdDbEntityPtr exportLineEntity (OdDbBlockTableRecordPtr bBTR, RLineEntity &e)
OdDbEntityPtr exportMTextEntity (OdDbBlockTableRecordPtr bBTR, RTextEntity &e)
OdDbEntityPtr exportPointEntity (OdDbBlockTableRecordPtr bBTR, RPointEntity &e)
OdDbEntityPtr exportPolylineEntity (OdDbBlockTableRecordPtr bBTR, RPolylineEntity &e)
OdDbEntityPtr exportSimpleTextEntity (OdDbBlockTableRecordPtr bBTR, RTextEntity &e)
OdDbEntityPtr exportSolidEntity (OdDbBlockTableRecordPtr bBTR, RSolidEntity &e)
OdDbEntityPtr exportSplineEntity (OdDbBlockTableRecordPtr bBTR, RSplineEntity &e)
OdDbEntityPtr exportTextEntity (OdDbBlockTableRecordPtr bBTR, RTextEntity &e)
void exportXData (REntity &e, OdDbEntity *odEntity)
 Exports the XData of the given entity.
int getCode (const QVariant &value, int offset=0)
template<typename T >
void initOdObject (OdDbBlockTableRecordPtr bBTR, T odObject, RObject &obj)
bool setXData (OdResBufPtr &pCurr, const QVariant &value)
 Sets the XData for the given resource to the given value.

Private Attributes

OdDbObjectId dimStyleId
OdDbDatabasePtr odDb
OdDb::DwgVersion odExportVersion
int textStyleCounter

Detailed Description

Exporter for the DWG format, based on the OpenDesign libraries.

Scriptable:
This class is wrapped for script environments.

Constructor & Destructor Documentation

RDwgExporter::RDwgExporter ( RDocument document)
RDwgExporter::~RDwgExporter ( )
virtual

Member Function Documentation

OdDbObjectId RDwgExporter::addDimStyle ( const QString &  styleName)
protected
OdDbObjectId RDwgExporter::addTextStyle ( const QString &  styleName,
double  textSize,
double  xScale,
double  priorSize,
double  obliquing,
const QString &  fileName,
bool  isShapeFile,
const QString &  ttFaceName,
bool  bold,
bool  italic,
int  charset,
int  pitchAndFamily 
)
protected
void RDwgExporter::addXData ( const QString &  key,
const QVariant &  value 
)
protected

Adds the given key / value pair as XData to the exported document.

OdResBufPtr RDwgExporter::appendXDataPair ( OdResBufPtr  pCurr,
int  code 
)
protected
virtual void RDwgExporter::exportArc ( const RArc arc,
double  offset = RNANDOUBLE 
)
inlinevirtual

Reimplemented from RExporter.

OdDbEntityPtr RDwgExporter::exportArcEntity ( OdDbBlockTableRecordPtr  bBTR,
RArcEntity e 
)
protected
virtual void RDwgExporter::exportArcSegment ( const RArc arc)
inlinevirtual

Implements RExporter.

void RDwgExporter::exportBlock ( RBlock block)
virtual

Reimplemented from RExporter.

OdDbEntityPtr RDwgExporter::exportBlockReferenceEntity ( OdDbBlockTableRecordPtr  bBTR,
OdDbBlockTablePtr  pTable,
RBlockReferenceEntity e 
)
protected
virtual void RDwgExporter::exportCircle ( const RCircle circle)
inlinevirtual

Exports a circle with the current attributes.

The default implementation calls exportArc with a full circle arc.

Reimplemented from RExporter.

OdDbEntityPtr RDwgExporter::exportCircleEntity ( OdDbBlockTableRecordPtr  bBTR,
RCircleEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportDimAlignedEntity ( OdDbBlockTableRecordPtr  bBTR,
RDimAlignedEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportDimAngularEntity ( OdDbBlockTableRecordPtr  bBTR,
RDimAngularEntity e 
)
protected
void RDwgExporter::exportDimCommon ( OdDbDimensionPtr  pDimension,
RDimensionEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportDimDiametricEntity ( OdDbBlockTableRecordPtr  bBTR,
RDimDiametricEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportDimOrdinateEntity ( OdDbBlockTableRecordPtr  bBTR,
RDimOrdinateEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportDimRadialEntity ( OdDbBlockTableRecordPtr  bBTR,
RDimRadialEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportDimRotatedEntity ( OdDbBlockTableRecordPtr  bBTR,
RDimRotatedEntity e 
)
protected
void RDwgExporter::exportDocumentSetting ( const QString &  key,
const QVariant &  value 
)
virtual

Reimplemented from RExporter.

bool RDwgExporter::exportDocumentSettings ( )
virtual

Reimplemented from RExporter.

OdDbEntityPtr RDwgExporter::exportEllipseEntity ( OdDbBlockTableRecordPtr  bBTR,
REllipseEntity e 
)
protected
void RDwgExporter::exportEntity ( REntity entity,
bool  preview = false,
bool  allBlocks = true 
)
virtual

Sets the current entity to the given entity and calls exportEntity().

Note that entity is a temporary clone.

Reimplemented from RExporter.

bool RDwgExporter::exportFile ( const QString &  fileName,
const QString &  nameFilter,
bool  setFileName = true 
)
virtual

Must be implemented by file exporters to export the document into the given file.

Implements RFileExporter.

OdDbEntityPtr RDwgExporter::exportHatchEntity ( OdDbBlockTableRecordPtr  bBTR,
RHatchEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportImageEntity ( OdDbBlockTableRecordPtr  bBTR,
RImageEntity e 
)
protected
void RDwgExporter::exportLayer ( RLayer layer)
virtual

Reimplemented from RExporter.

OdDbEntityPtr RDwgExporter::exportLeaderEntity ( OdDbBlockTableRecordPtr  bBTR,
RLeaderEntity e 
)
protected
virtual void RDwgExporter::exportLine ( const RLine line,
double  offset = RNANDOUBLE 
)
inlinevirtual

Exports a line with the current attributes.

Reimplemented from RExporter.

OdDbEntityPtr RDwgExporter::exportLineEntity ( OdDbBlockTableRecordPtr  bBTR,
RLineEntity e 
)
protected
virtual void RDwgExporter::exportLineSegment ( const RLine line)
inlinevirtual

Exports a line segment (a line without pattern).

This is called from the standard implementation of exportLine for every dash in a dashed line.

Implements RExporter.

void RDwgExporter::exportLinetype ( RLinetype linetype)
virtual

Reimplemented from RExporter.

OdDbEntityPtr RDwgExporter::exportMTextEntity ( OdDbBlockTableRecordPtr  bBTR,
RTextEntity e 
)
protected
virtual void RDwgExporter::exportPoint ( const RPoint point)
inlinevirtual

Exports a point with the current attributes.

Implements RExporter.

OdDbEntityPtr RDwgExporter::exportPointEntity ( OdDbBlockTableRecordPtr  bBTR,
RPointEntity e 
)
protected
virtual void RDwgExporter::exportPolyline ( const RPolyline polyline)
inlinevirtual
OdDbEntityPtr RDwgExporter::exportPolylineEntity ( OdDbBlockTableRecordPtr  bBTR,
RPolylineEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportSimpleTextEntity ( OdDbBlockTableRecordPtr  bBTR,
RTextEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportSolidEntity ( OdDbBlockTableRecordPtr  bBTR,
RSolidEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportSplineEntity ( OdDbBlockTableRecordPtr  bBTR,
RSplineEntity e 
)
protected
OdDbEntityPtr RDwgExporter::exportTextEntity ( OdDbBlockTableRecordPtr  bBTR,
RTextEntity e 
)
protected
virtual void RDwgExporter::exportTriangle ( const RTriangle triangle)
inlinevirtual

Exports a triangle with the current attributes.

Implements RExporter.

void RDwgExporter::exportView ( RView view)
virtual

Reimplemented from RExporter.

void RDwgExporter::exportXData ( REntity e,
OdDbEntity *  odEntity 
)
protected

Exports the XData of the given entity.

int RDwgExporter::getCode ( const QVariant &  value,
int  offset = 0 
)
protected
Returns:
An acceptable DXF code to store as key for the given variant value.
QString RDwgExporter::getCorrectedFileName ( const QString &  fileName,
const QString &  nameFilter 
)
virtual

Must be implemented by file exporters to correct the given file name if necesary (add extension based on chosen name filter).

Implements RFileExporter.

template<typename T >
void RDwgExporter::initOdObject ( OdDbBlockTableRecordPtr  bBTR,
odObject,
RObject obj 
)
inlineprotected
virtual void RDwgExporter::setColor ( const QColor &  c)
inlinevirtual
bool RDwgExporter::setXData ( OdResBufPtr &  pCurr,
const QVariant &  value 
)
protected

Sets the XData for the given resource to the given value.


Member Data Documentation

OdDbObjectId RDwgExporter::dimStyleId
private
OdDbDatabasePtr RDwgExporter::odDb
private
OdDb::DwgVersion RDwgExporter::odExportVersion
private
int RDwgExporter::textStyleCounter
private

The documentation for this class was generated from the following files: