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

Base class for all entity data classes. More...

#include <REntityData.h>

Inheritance diagram for REntityData:
RArcData RBlockReferenceData RCircleData RDimensionData REllipseData RHatchData RImageData RLeaderData RLineData RPointData RPolylineData RSolidData RSplineData RTextData

List of all members.

Public Member Functions

virtual const RShapecastToConstShape () const
virtual RShapecastToShape ()
virtual bool flipHorizontal ()
virtual bool flipVertical ()
RLayer::Id getBlockId () const
QString getBlockName () const
virtual RBox getBoundingBox () const
virtual QList< RBoxgetBoundingBoxes () const
virtual QList< RVectorgetCenterPoints (const RBox &queryBox=RDEFAULT_RBOX) const
virtual RVector getClosestPointOnEntity (const RVector &point, double range=RNANDOUBLE, bool limited=true) const
virtual QSharedPointer< RShapegetClosestShape (const RVector &pos, double range=RNANDOUBLE) const
RColor getColor () const
RColor getColor (bool resolve, const QStack< RBlockReferenceEntity * > &blockRefStack) const
virtual double getDistanceTo (const RVector &point, bool limited=true, double range=0.0, bool draft=false) const
RDocumentgetDocument ()
const RDocumentgetDocument () const
virtual int getDrawOrder () const
virtual QList< RVectorgetEndPoints (const RBox &queryBox=RDEFAULT_RBOX) const
virtual QList< RVectorgetIntersectionPoints (const REntityData &other, bool limited=true, bool same=false, const RBox &queryBox=RDEFAULT_RBOX) const
virtual QList< RVectorgetIntersectionPoints (const RShape &shape, bool limited=true, const RBox &queryBox=RDEFAULT_RBOX) const
RLayer::Id getLayerId () const
QString getLayerName ()
RLinetype::Id getLinetypeId () const
RLinetype::Id getLinetypeId (bool resolve, const QStack< RBlockReferenceEntity * > &blockRefStack) const
RLineweight::Lineweight getLineweight () const
RLineweight::Lineweight getLineweight (bool resolve, const QStack< RBlockReferenceEntity * > &blockRefStack) const
double getLineweightInUnits (const QStack< RBlockReferenceEntity * > &blockRefStack) const
virtual QList< RVectorgetMiddlePoints (const RBox &queryBox=RDEFAULT_RBOX) const
virtual RVector getPointOnEntity () const
virtual QList< RVectorgetPointsWithDistanceToEnd (double distance, RS::From from=RS::FromAny, const RBox &queryBox=RDEFAULT_RBOX) const
virtual QList< RVectorgetReferencePoints (RS::ProjectionRenderingHint hint=RS::RenderTop) const =0
virtual QList< QSharedPointer
< RShape > > 
getShapes (const RBox &queryBox=RDEFAULT_RBOX) const
virtual RVector getVectorTo (const RVector &point, bool limited=true) const
virtual bool intersectsWith (const RShape &shape) const
virtual bool isInside (const RBox &box) const
virtual bool isOnEntity (const RVector &point, bool limited=true) const
virtual bool isSelected () const
virtual bool mirror (const RLine &axis)
virtual bool mirror (const RVector &axis1, const RVector &axis2)
virtual bool move (const RVector &offset)
 Moves this entity by the given offset.
virtual bool moveReferencePoint (const RVector &referencePoint, const RVector &targetPoint)=0
 Moves the given reference point to the given target point or does nothing if this entity has no reference point as the given location.
 REntityData (RDocument *document=NULL)
virtual bool rotate (double rotation, const RVector &center=RDEFAULT_RVECTOR)
virtual bool scale (const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
virtual bool scale (double scaleFactor, const RVector &center=RDEFAULT_RVECTOR)
virtual void setBlockId (RBlock::Id blockId)
void setColor (const RColor &color)
void setDocument (RDocument *document)
virtual void setDrawOrder (int drawOrder)
 Sets the draw order of this entity.
virtual void setLayerId (RLayer::Id layerId)
virtual void setLinetype (RLinetype linetype)
virtual void setLinetypeId (RLinetype::Id linetypeId)
void setLineweight (RLineweight::Lineweight lineweight)
virtual void setSelected (bool on)
 Selects or deselects this entity.
virtual bool stretch (const RPolyline &area, const RVector &offset)
 Stretches the end points of this entity that are inside area by offset.
virtual void update () const
 Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty).
virtual ~REntityData ()

Protected Attributes

RBlock::Id blockId
RColor color
RDocumentdocument
int drawOrder
RLayer::Id layerId
RLinetype::Id linetypeId
RLineweight::Lineweight lineweight
bool selectionStatus

Friends

class REntity

Detailed Description

Base class for all entity data classes.

Such classes are used to separate functionality from data. Data objects may for example be used to perform certain calculations. A custom entity might use the same data class as a standard entity to provide similar behavior (e.g. a wall might behave similar like a line entity).

Scriptable:
This class is wrapped for script environments.
Shared Pointer Support:
Script wrappers of this class support wrapping in QSharedPointer.

Constructor & Destructor Documentation

REntityData::REntityData ( RDocument document = NULL)
virtual REntityData::~REntityData ( )
inlinevirtual

Member Function Documentation

virtual const RShape* REntityData::castToConstShape ( ) const
inlinevirtual
   \par Non-Scriptable:

This function is not available in script environments.

virtual RShape* REntityData::castToShape ( )
inlinevirtual
bool REntityData::flipHorizontal ( )
virtual

Reimplemented in RTextData.

bool REntityData::flipVertical ( )
virtual

Reimplemented in RTextData.

RLayer::Id REntityData::getBlockId ( ) const
inline
QString REntityData::getBlockName ( ) const
RBox REntityData::getBoundingBox ( ) const
virtual
Returns:
The bounding box that contains this entity.

Reimplemented in RTextData, RImageData, RDimensionData, RHatchData, and RBlockReferenceData.

virtual QList<RBox> REntityData::getBoundingBoxes ( ) const
inlinevirtual
Returns:
Vector of bounding boxes that contain this entity. This is used for complex entities such as block references to further optimize algorithms that depend on bounding boxes (e.g. spatial index algorithms). The default implementation returns the bounding box that contains the whole entity.

Reimplemented in RPolylineData, and RBlockReferenceData.

QList< RVector > REntityData::getCenterPoints ( const RBox queryBox = RDEFAULT_RBOX) const
virtual
Returns:
Vector of center points of this entity. Used for snap to center points.
RVector REntityData::getClosestPointOnEntity ( const RVector point,
double  range = RNANDOUBLE,
bool  limited = true 
) const
virtual
Returns:
Closest point to point on this entity. Used for snap to points on entity.

Reimplemented in RTextData.

QSharedPointer< RShape > REntityData::getClosestShape ( const RVector pos,
double  range = RNANDOUBLE 
) const
virtual
Returns:
The one shape that is part of this entity which is the closest to the given position.
RColor REntityData::getColor ( ) const
inline
RColor REntityData::getColor ( bool  resolve,
const QStack< RBlockReferenceEntity * > &  blockRefStack 
) const
Returns:
Color of this entity.
Parameters:
resolveResolve color if ByLayer or ByBlock.
double REntityData::getDistanceTo ( const RVector point,
bool  limited = true,
double  range = 0.0,
bool  draft = false 
) const
virtual
Returns:
The shortest distance from this entity to the given point.

Reimplemented in RDimensionData, RTextData, RBlockReferenceData, RImageData, and RHatchData.

RDocument* REntityData::getDocument ( )
inline
const RDocument* REntityData::getDocument ( ) const
inline
virtual int REntityData::getDrawOrder ( ) const
inlinevirtual
Returns:
The draw order of this entity. Entities are usually drawn in ascending order of this number.
QList< RVector > REntityData::getEndPoints ( const RBox queryBox = RDEFAULT_RBOX) const
virtual
Returns:
Vector of end points of this entity. Used for snap to end points.
QList< RVector > REntityData::getIntersectionPoints ( const REntityData other,
bool  limited = true,
bool  same = false,
const RBox queryBox = RDEFAULT_RBOX 
) const
virtual
Returns:
Points on entity which are intersection points with the given other entity. If same is true, the two datas originate from the same entity.

Reimplemented in RPolylineData.

QList< RVector > REntityData::getIntersectionPoints ( const RShape shape,
bool  limited = true,
const RBox queryBox = RDEFAULT_RBOX 
) const
virtual
Returns:
Points on entity which are intersection points with the given shape.
RLayer::Id REntityData::getLayerId ( ) const
inline
QString REntityData::getLayerName ( )
RLinetype::Id REntityData::getLinetypeId ( ) const
inline
RLinetype::Id REntityData::getLinetypeId ( bool  resolve,
const QStack< RBlockReferenceEntity * > &  blockRefStack 
) const
RLineweight::Lineweight REntityData::getLineweight ( ) const
inline
RLineweight::Lineweight REntityData::getLineweight ( bool  resolve,
const QStack< RBlockReferenceEntity * > &  blockRefStack 
) const
Parameters:
resolveTrue: resolve ByLayer / ByBlock and always return a lineweight in 1/100 mm.
layerLayer to use for resolving if known, NULL otherwise.
blockRefBlock reference to use for resolving if known, NULL otherwise.
double REntityData::getLineweightInUnits ( const QStack< RBlockReferenceEntity * > &  blockRefStack) const
QList< RVector > REntityData::getMiddlePoints ( const RBox queryBox = RDEFAULT_RBOX) const
virtual
Returns:
Vector of middle points of this entity. Used for snap to middle points.
RVector REntityData::getPointOnEntity ( ) const
virtual
Returns:
A point that is on the entity. Used to check if an entity is inside a polygon.

Reimplemented in RTextData, RImageData, and RHatchData.

QList< RVector > REntityData::getPointsWithDistanceToEnd ( double  distance,
RS::From  from = RS::FromAny,
const RBox queryBox = RDEFAULT_RBOX 
) const
virtual
Returns:
Points on entity with given distance to either endpoint. Used for snap to points with distance on entity.
virtual QList<RVector> REntityData::getReferencePoints ( RS::ProjectionRenderingHint  hint = RS::RenderTop) const
pure virtual
Returns:
Vector of reference points of this entity. Reference points can usually be moved around by the user to change the geometry of the entity.

Implemented in RTextData, RDimensionData, RArcData, REllipseData, RDimAngularData, RDimOrdinateData, RLineData, RSolidData, RLeaderData, RImageData, RDimDiametricData, RDimRadialData, RCircleData, RHatchData, RDimRotatedData, RPointData, RBlockReferenceData, RPolylineData, RSplineData, and RDimAlignedData.

virtual QList<QSharedPointer<RShape> > REntityData::getShapes ( const RBox queryBox = RDEFAULT_RBOX) const
inlinevirtual
RVector REntityData::getVectorTo ( const RVector point,
bool  limited = true 
) const
virtual
Returns:
The distance vector from this entity to the given point.
Parameters:
pointthe point to which the distance was measured
limited,:If true, an invalid vector is returned if the closest point on the entity is outside of the entity (e.g. in the extension line of a line or outside the start / end angle of an arc).

Reimplemented in RBlockReferenceData.

bool REntityData::intersectsWith ( const RShape shape) const
virtual
Returns:
True if this entity intersects with the given shape, false otherwise.
Todo:
better to pass another entity data object?

Reimplemented in RDimensionData, RTextData, RImageData, and RHatchData.

virtual bool REntityData::isInside ( const RBox box) const
inlinevirtual
Returns:
True if this entity is completely inside the given box, false otherwise. Only geometry is accounted for, not the line width.
bool REntityData::isOnEntity ( const RVector point,
bool  limited = true 
) const
virtual
Returns:
True if the given point is on this entity.
virtual bool REntityData::isSelected ( ) const
inlinevirtual
Returns:
True if the entity is currently selected. This can for example influence the color in which the entity is exported.
bool REntityData::mirror ( const RVector axis1,
const RVector axis2 
)
virtual
bool REntityData::move ( const RVector offset)
virtual

Moves this entity by the given offset.

Returns:
Points on entity which are intersection points in the given document.
True if this entity intersects with the given box or is completely inside it, false otherwise.

Reimplemented in RTextData, RDimensionData, RDimAngularData, RDimOrdinateData, RDimLinearData, RImageData, RBlockReferenceData, RDimDiametricData, RDimRadialData, and RHatchData.

virtual bool REntityData::moveReferencePoint ( const RVector referencePoint,
const RVector targetPoint 
)
pure virtual

Moves the given reference point to the given target point or does nothing if this entity has no reference point as the given location.

Returns:
True if a reference point has been moved successfully, false otherwise.

Implemented in RTextData, RDimensionData, RArcData, REllipseData, RDimAngularData, RDimOrdinateData, RLineData, RSolidData, RDimLinearData, RLeaderData, RImageData, RBlockReferenceData, RDimDiametricData, RDimRadialData, RCircleData, RHatchData, RPointData, RPolylineData, RSplineData, and RDimAlignedData.

bool REntityData::rotate ( double  rotation,
const RVector center = RDEFAULT_RVECTOR 
)
virtual
bool REntityData::scale ( const RVector scaleFactors,
const RVector center = RDEFAULT_RVECTOR 
)
virtual
bool REntityData::scale ( double  scaleFactor,
const RVector center = RDEFAULT_RVECTOR 
)
virtual
virtual void REntityData::setBlockId ( RBlock::Id  blockId)
inlinevirtual
void REntityData::setColor ( const RColor color)
inline
void REntityData::setDocument ( RDocument document)
inline
virtual void REntityData::setDrawOrder ( int  drawOrder)
inlinevirtual

Sets the draw order of this entity.

virtual void REntityData::setLayerId ( RLayer::Id  layerId)
inlinevirtual
void REntityData::setLinetype ( RLinetype  linetype)
virtual
virtual void REntityData::setLinetypeId ( RLinetype::Id  linetypeId)
inlinevirtual
void REntityData::setLineweight ( RLineweight::Lineweight  lineweight)
inline
virtual void REntityData::setSelected ( bool  on)
inlinevirtual

Selects or deselects this entity.

bool REntityData::stretch ( const RPolyline area,
const RVector offset 
)
virtual

Stretches the end points of this entity that are inside area by offset.

Reimplemented in RDimOrdinateData, RDimLinearData, and RHatchData.

virtual void REntityData::update ( ) const
inlinevirtual

Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty).

Reimplemented in RTextData, RDimensionData, RHatchData, and RBlockReferenceData.


Friends And Related Function Documentation

friend class REntity
friend

Member Data Documentation

RBlock::Id REntityData::blockId
protected
RColor REntityData::color
protected
RDocument* REntityData::document
protected
int REntityData::drawOrder
protected
RLayer::Id REntityData::layerId
protected
RLinetype::Id REntityData::linetypeId
protected
RLineweight::Lineweight REntityData::lineweight
protected
bool REntityData::selectionStatus
protected

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