QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RExporter Class Reference

Abstract base class for exporters. More...

#include <RExporter.h>

Inheritance diagram for RExporter:
RFileExporter RGraphicsScene RPainterPathExporter RDxfExporter RGraphicsSceneQt

List of all members.

Public Member Functions

virtual void endEntity ()
virtual void endExport ()
 Called at the end of a completed export.
virtual void exportArc (const RArc &arc, double offset=RNANDOUBLE)
virtual void exportArcSegment (const RArc &arc)
virtual void exportBlock (RBlock &)
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 exportCircle (const RCircle &circle)
 Exports a circle with the current attributes.
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 exportDocumentSetting (const QString &, const QVariant &)
virtual bool exportDocumentSettings ()
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 &e, bool preview=false, bool allBlocks=true)
 Sets the current entity to the given entity and calls exportEntity().
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 &)
virtual void exportLayer (RLayer::Id layerId)
virtual void exportLayers ()
virtual void exportLine (const RLine &line, double offset=RNANDOUBLE)
 Exports a line with the current attributes.
virtual void exportLineSegment (const RLine &line)=0
 Exports a line segment (a line without pattern).
virtual void exportLinetype (RLinetype &)
virtual void exportLinetypes ()
virtual void exportPainterPaths (const QList< RPainterPath > &paths)
virtual void exportPainterPathSource (const RPainterPathSource &pathSource)
virtual void exportPoint (const RPoint &point)=0
 Exports a point with the current attributes.
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 exportRay (const RRay &ray)=0
 Exports an infinite ray.
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 exportTriangle (const RTriangle &triangle)=0
 Exports a triangle with the current attributes.
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 &)
virtual void exportView (RView::Id viewId)
virtual void exportViews ()
virtual void exportXLine (const RXLine &xLine)=0
 Exports an infinite line.
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 ()
double getPixelSizeHint () const
RS::ProjectionRenderingHint getProjectionRenderingHint ()
bool getScreenBasedLinetypes () const
virtual bool isEntitySelected ()
bool isVisualExporter () const
 RExporter ()
 RExporter (RDocument &document, RMessageHandler *messageHandler=NULL, RProgressHandler *progressHandler=NULL)
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 setPixelSizeHint (double v)
void setProjectionRenderingHint (RS::ProjectionRenderingHint p)
 Sets a rendering hint for the current projection used for exports.
void setScreenBasedLinetypes (bool on)
virtual void setStyle (Qt::PenStyle penStyle)
void setVisualExporter (bool on)
virtual void startEntity (bool)
virtual void startExport ()
 Called to start a new, complete export.
void toggleDraftMode ()
void toggleScreenBasedLinetypes ()
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 Attributes

QStack< RBlockReferenceEntity * > blockRefStack
RDocumentblockSource
QBrush currentBrush
RLayercurrentLayer
RLinetypePattern currentLinetypePattern
QPen currentPen
RDocumentdocument
bool draftMode
QStack< REntity * > entityStack
QString errorMessage
RDocumentlayerSource
double pixelSizeHint
bool screenBasedLinetypes
bool visualExporter

Private Attributes

RS::ProjectionRenderingHint projectionRenderingHint

Detailed Description

Abstract base class for exporters.

Exporters export documents into files, views, etc.

Scriptable:
This class is wrapped for script environments.

Constructor & Destructor Documentation

RExporter::RExporter ( )
RExporter::RExporter ( RDocument document,
RMessageHandler messageHandler = NULL,
RProgressHandler progressHandler = NULL 
)
RExporter::~RExporter ( )
virtual

Member Function Documentation

virtual void RExporter::endEntity ( )
inlinevirtual
void RExporter::endExport ( )
virtual

Called at the end of a completed export.

The default implementation does nothing.

void RExporter::exportArc ( const RArc arc,
double  offset = RNANDOUBLE 
)
virtual

Reimplemented in RGraphicsSceneQt.

void RExporter::exportArcSegment ( const RArc arc)
virtual
virtual void RExporter::exportBlock ( RBlock )
inlinevirtual
void RExporter::exportBlock ( RBlock::Id  blockId)
virtual
void RExporter::exportBlocks ( )
virtual
void RExporter::exportBoundingBoxPaths ( const QList< RPainterPath > &  paths)
virtual
void RExporter::exportBox ( const RBox box)
virtual

Exports the surfaces of the given box.

This is a convenience function that exports 12 triangles but may also be re-implemented to do something else.

void RExporter::exportCircle ( const RCircle circle)
virtual

Exports a circle with the current attributes.

The default implementation calls exportArc with a full circle arc.

void RExporter::exportCurrentEntity ( bool  preview = false)
virtual

The default implementation calls the REntity::exportEntity() function of the entity.

This method may use the currentEntity stack to access the entity that is currently being exported. Exporters can choose to reimplement this function to export an entity in a target platform specific manner (e.g. to optimize things for a specific platform).

Reimplemented in RGraphicsScene.

bool RExporter::exportDocument ( )
virtual

Exports the visual representation of all objects (including entities) of the document->

virtual void RExporter::exportDocumentSetting ( const QString &  ,
const QVariant &   
)
inlinevirtual
bool RExporter::exportDocumentSettings ( )
virtual

Reimplemented in RGraphicsScene.

void RExporter::exportEllipse ( const REllipse ellipse,
double  offset = RNANDOUBLE 
)
virtual

Exports an ellipse with the current attributes.

Todo:
switch from line based interpolation to arcs.

Reimplemented in RGraphicsSceneQt.

void RExporter::exportEntities ( bool  allBlocks = true,
bool  undone = false 
)
virtual
void RExporter::exportEntities ( const RBox box)
virtual

Exports the visual representation of all entities that are completely or partly inside the given area.

void RExporter::exportEntities ( QSet< REntity::Id > &  entityIds,
bool  allBlocks = true 
)
virtual

Calls exportEntity() for all given entities.

void RExporter::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.

void RExporter::exportEntity ( REntity::Id  entityId,
bool  allBlocks = true 
)
virtual

Calls exportEntity(REntity*) for the entity with the given ID.

void RExporter::exportExplodable ( const RExplodable explodable,
double  offset = RNANDOUBLE 
)
virtual
   \par Non-Scriptable:

This function is not available in script environments.

void RExporter::exportImage ( const RImageData image)
virtual

Reimplemented in RGraphicsSceneQt.

virtual void RExporter::exportLayer ( RLayer )
inlinevirtual
void RExporter::exportLayer ( RLayer::Id  layerId)
virtual
void RExporter::exportLayers ( )
virtual
void RExporter::exportLine ( const RLine line,
double  offset = RNANDOUBLE 
)
virtual

Exports a line with the current attributes.

Reimplemented in RGraphicsSceneQt.

virtual void RExporter::exportLineSegment ( const RLine line)
pure virtual

Exports a line segment (a line without pattern).

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

Implemented in RDxfExporter, RGraphicsSceneQt, and RPainterPathExporter.

virtual void RExporter::exportLinetype ( RLinetype )
inlinevirtual
void RExporter::exportLinetypes ( )
virtual
void RExporter::exportPainterPaths ( const QList< RPainterPath > &  paths)
virtual

Reimplemented in RGraphicsSceneQt.

void RExporter::exportPainterPathSource ( const RPainterPathSource pathSource)
virtual
   \par Non-Scriptable:

This function is not available in script environments.

Reimplemented in RGraphicsSceneQt.

virtual void RExporter::exportPoint ( const RPoint point)
pure virtual

Exports a point with the current attributes.

Implemented in RDxfExporter, RGraphicsSceneQt, and RPainterPathExporter.

void RExporter::exportPolyline ( const RPolyline polyline,
double  offset = RNANDOUBLE 
)
virtual

Reimplemented in RGraphicsSceneQt.

void RExporter::exportQuad ( const RVector p1,
const RVector p2,
const RVector p3,
const RVector p4 
)
virtual

Exports a quadrilateral with the current attributes.

This is a convenience function that exports two triangles but may also be re-implemented to do something else.

virtual void RExporter::exportRay ( const RRay ray)
pure virtual

Exports an infinite ray.

Used for rays.

Implemented in RDxfExporter, RGraphicsSceneQt, and RPainterPathExporter.

void RExporter::exportRectangle ( const RVector p1,
const RVector p2 
)
virtual

Exports a rectangle with the current attributes.

This is a convenience function that exports two triangles but may also be re-implemented to do something else.

Reimplemented in RGraphicsSceneQt.

void RExporter::exportShape ( QSharedPointer< RShape shape)
virtual

Exports the given shapes as part of the geometry of the current entity.

void RExporter::exportShapes ( const QList< QSharedPointer< RShape > > &  shapes)
virtual

Exports the given shapes as part of the geometry of the current entity.

Todo:
support more shapes.
void RExporter::exportSpline ( const RSpline spline,
double  offset = RNANDOUBLE 
)
virtual

Reimplemented in RGraphicsSceneQt.

virtual void RExporter::exportTriangle ( const RTriangle triangle)
pure virtual

Exports a triangle with the current attributes.

Implemented in RDxfExporter, RGraphicsSceneQt, and RPainterPathExporter.

void RExporter::exportVerticalQuad ( const RVector p1,
const RVector p2,
double  height 
)
virtual

Exports a vertical quadrilateral with the two given base points and the given height.

virtual void RExporter::exportView ( RView )
inlinevirtual
void RExporter::exportView ( RView::Id  viewId)
virtual
void RExporter::exportViews ( )
virtual
virtual void RExporter::exportXLine ( const RXLine xLine)
pure virtual

Exports an infinite line.

Used for xlines (construction lines).

Implemented in RDxfExporter, RGraphicsSceneQt, and RPainterPathExporter.

REntity * RExporter::getBlockRefOrEntity ( )
virtual
Returns:
Block reference that is currently being exported or if no block reference is being exported, the current entity that is being exported.
QBrush RExporter::getBrush ( const RPainterPath path)
virtual
QBrush RExporter::getBrush ( )
virtual
RDocument & RExporter::getDocument ( ) const

Returns:
The document that is currently being exported.
bool RExporter::getDraftMode ( ) const
inline
REntity * RExporter::getEntity ( )
virtual

Sets the current export color for entities.

The default implementation calls setColor. Exporter implementations may choose to re-implement this method for example to display entities in a different color when they are selected.

Todo:
remove or refactor

Overrides any calls to setColor or setEntityColor. All color changes that are made between a call to this function and a call to unsetOverrideColor have no effect.

Todo:
remove or refactor

Allows setting of colors after a section of exports with a fixed color. void RExporter::unsetFixedColor() { fixedColor = false; }

Returns:
True if this exporter is currently using a fixed export color (setFixedColor has been called), false otherwise. bool RExporter::isColorFixed() { return fixedColor; }
Pointer to the entity that is currently being exported.
const REntity * RExporter::getEntity ( ) const
virtual
   \par Non-Scriptable:

This function is not available in script environments.

Returns:
Pointer to the entity that is currently being exported.
QStack< REntity * > RExporter::getEntityStack ( )
QString RExporter::getErrorMessage ( ) const
RLinetypePattern RExporter::getLinetypePattern ( )
double RExporter::getPatternFactor ( )
virtual

Reimplemented in RGraphicsSceneQt.

double RExporter::getPatternOffset ( double  length,
const RLinetypePattern pattern 
)
Returns:
Offset to use to apply the given pattern to an entity of the given length that the pattern is symmetrical.
double RExporter::getPatternOffset ( double  length,
const RLinetypePattern pattern,
int  index,
double *  gap = NULL 
)
   \par Non-Scriptable:

This function is not available in script environments.

QPen RExporter::getPen ( const RPainterPath path)
virtual
QPen RExporter::getPen ( )
virtual
Returns:
Current pen.
double RExporter::getPixelSizeHint ( ) const
inline
RS::ProjectionRenderingHint RExporter::getProjectionRenderingHint ( )
Returns:
The current projection for exports.
bool RExporter::getScreenBasedLinetypes ( ) const
inline
bool RExporter::isEntitySelected ( )
virtual
Returns:
True if there is a current entity and it is selected, false otherwise.
bool RExporter::isVisualExporter ( ) const
inline
Returns:
True if this exporter exports only visible entities (on visible layers).
void RExporter::setBlockSource ( RDocument bs)
void RExporter::setBrush ( const QBrush &  brush)
virtual
void RExporter::setBrushStyle ( Qt::BrushStyle  brushStyle)
virtual
void RExporter::setColor ( float  r,
float  g,
float  b,
float  a = 1.0f 
)
virtual

Sets the current export color in RGB and Alpha.

All components are in the range of 0.0 <= component <= 1.0. If isColorFixed is true, this function does nothing.

void RExporter::setColor ( const RColor color)
virtual
void RExporter::setDashPattern ( const QVector< qreal > &  dashes)
virtual
void RExporter::setDraftMode ( bool  on)
void RExporter::setEntityAttributes ( )
virtual
void RExporter::setLayerSource ( RDocument ls)
void RExporter::setLinetypeId ( RLinetype::Id  ltId)
virtual
void RExporter::setLinetypePattern ( const RLinetypePattern ltPattern)
virtual
void RExporter::setLineweight ( RLineweight::Lineweight  weight)
virtual
void RExporter::setPen ( const QPen &  pen)
virtual

Sets the current pen (currentPen).

void RExporter::setPixelSizeHint ( double  v)
inline
void RExporter::setProjectionRenderingHint ( RS::ProjectionRenderingHint  p)

Sets a rendering hint for the current projection used for exports.

This is a rendering hint for the exporting entity to decide how its geometry should be rendered. For example a wall with a window exports itself differently when viewed from top than when viewed from the front or side. Note that the rendering difference is not only in the projection in a mathematical sense, but also in what edges are exported, how they are visualized and what types of shapes are exported (lines and arcs or triangles).

This rendering hint may also be used to determine what grid is appropriate to display for exporters that export to a graphics scene.

The mathematical projection is defined separately by setProjection().

void RExporter::setScreenBasedLinetypes ( bool  on)
void RExporter::setStyle ( Qt::PenStyle  penStyle)
virtual
void RExporter::setVisualExporter ( bool  on)
inline
virtual void RExporter::startEntity ( bool  )
inlinevirtual

Reimplemented in RGraphicsSceneQt.

void RExporter::startExport ( )
virtual

Called to start a new, complete export.

Implementors can for example clear any stored exported entities or caches. The default implementation does nothing.

void RExporter::toggleDraftMode ( )
inline
void RExporter::toggleScreenBasedLinetypes ( )
inline
void RExporter::unexportEntity ( REntity::Id  entityId)
virtual

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.

Reimplemented in RGraphicsScene, and RGraphicsSceneQt.


Member Data Documentation

QStack<RBlockReferenceEntity*> RExporter::blockRefStack
protected
RDocument* RExporter::blockSource
protected
QBrush RExporter::currentBrush
protected
RLayer* RExporter::currentLayer
protected
RLinetypePattern RExporter::currentLinetypePattern
protected
QPen RExporter::currentPen
protected
RDocument* RExporter::document
protected
bool RExporter::draftMode
protected
QStack<REntity*> RExporter::entityStack
protected
QString RExporter::errorMessage
protected
RDocument* RExporter::layerSource
protected
double RExporter::pixelSizeHint
protected
RS::ProjectionRenderingHint RExporter::projectionRenderingHint
private
bool RExporter::screenBasedLinetypes
protected
bool RExporter::visualExporter
protected

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