QCAD
Open Source 2D CAD
|
Base class for all entity data classes. More...
#include <REntityData.h>
Public Member Functions | |
virtual const RShape * | castToConstShape () const |
virtual RShape * | castToShape () |
virtual bool | clickReferencePoint (const RVector &referencePoint) |
Called when user clicks a reference point. More... | |
virtual bool | cloneOnChange () const |
Reimplement to force clone on change in transactions. More... | |
void | copyAttributesFrom (const REntityData &entityData, bool copyBlockId=true) |
virtual bool | flipHorizontal () |
virtual bool | flipVertical () |
virtual QList< RVector > | getArcReferencePoints (const RBox &queryBox=RDEFAULT_RBOX) const |
RBlock::Id | getBlockId () const |
QString | getBlockName () const |
virtual RBox | getBoundingBox (bool ignoreEmpty=false) const |
virtual QList< RBox > | getBoundingBoxes (bool ignoreEmpty=false) const |
virtual QList< RVector > | getCenterPoints (const RBox &queryBox=RDEFAULT_RBOX) const |
virtual RVector | getClosestPointOnEntity (const RVector &point, double range=RNANDOUBLE, bool limited=true) const |
virtual QSharedPointer< RShape > | getClosestShape (const RVector &pos, double range=RNANDOUBLE, bool ignoreComplex=false) const |
virtual RColor | getColor () const |
virtual RColor | getColor (bool resolve, const QStack< REntity * > &blockRefStack) const |
virtual RColor | getColor (const RColor &unresolvedColor, const QStack< REntity * > &blockRefStack) const |
virtual RColor | getDisplayColor () |
virtual double | getDistanceTo (const RVector &point, bool limited=true, double range=0.0, bool draft=false, double strictRange=RMAXDOUBLE) const |
RDocument * | getDocument () |
const RDocument * | getDocument () const |
virtual int | getDrawOrder () const |
virtual QList< RVector > | getEndPoints (const RBox &queryBox=RDEFAULT_RBOX) const |
virtual RPolyline | getHull (double offset) const |
virtual QList< RRefPoint > | getInternalReferencePoints (RS::ProjectionRenderingHint hint=RS::RenderTop) const |
Can be overwritten to return internal, resolved reference points. More... | |
virtual QList< RVector > | getIntersectionPoints (const REntityData &other, bool limited=true, bool same=false, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true) const |
virtual QList< RVector > | getIntersectionPoints (const RShape &shape, bool limited=true, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true) const |
RLayer::Id | getLayerId () const |
QString | getLayerName () const |
virtual RLinetype::Id | getLinetypeId () const |
virtual RLinetype::Id | getLinetypeId (bool resolve, const QStack< REntity * > &blockRefStack) const |
virtual RLinetypePattern | getLinetypePattern () const |
virtual double | getLinetypeScale () const |
virtual RLineweight::Lineweight | getLineweight () const |
virtual RLineweight::Lineweight | getLineweight (bool resolve, const QStack< REntity * > &blockRefStack) const |
double | getLineweightInUnits (const QStack< REntity * > &blockRefStack) const |
virtual QList< RVector > | getMiddlePoints (const RBox &queryBox=RDEFAULT_RBOX) const |
RObject::Id | getParentId () const |
virtual RVector | getPointOnEntity () const |
virtual QList< RVector > | getPointsWithDistanceToEnd (double distance, int from=RS::FromAny, const RBox &queryBox=RDEFAULT_RBOX) const |
virtual QList< RRefPoint > | getReferencePoints (RS::ProjectionRenderingHint hint=RS::RenderTop) const =0 |
virtual QList< QSharedPointer< RShape > > | getShapes (const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const |
virtual RS::EntityType | getType () const |
virtual RVector | getVectorTo (const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const |
virtual bool | intersectsWith (const RShape &shape) const |
virtual bool | isInside (const RBox &box) const |
virtual bool | isOnEntity (const RVector &point, bool limited=true, double tolerance=RDEFAULT_TOLERANCE_1E_MIN4) const |
virtual bool | isPointType () const |
virtual bool | isSane () const |
virtual bool | isSelected () const |
virtual bool | isSelectedWorkingSet () const |
virtual bool | isUpdatesEnabled () const |
virtual bool | isValid () 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. More... | |
virtual bool | moveReferencePoint (const RVector &referencePoint, const RVector &targetPoint, Qt::KeyboardModifiers modifiers=Qt::NoModifier)=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. More... | |
REntityData (RDocument *document=NULL) | |
Copyright (c) 2011-2018 by Andrew Mustun. More... | |
virtual bool | rotate (double rotation, const RVector ¢er=RDEFAULT_RVECTOR) |
virtual bool | scale (const RVector &scaleFactors, const RVector ¢er=RDEFAULT_RVECTOR) |
virtual bool | scale (double scaleFactor, const RVector ¢er=RDEFAULT_RVECTOR) |
virtual void | scaleVisualProperties (double scaleFactor) |
void | setAutoUpdatesBlocked (bool on) |
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. More... | |
virtual void | setLayerId (RLayer::Id layerId) |
void | setLayerName (const QString &layerName) |
virtual void | setLinetypeId (RLinetype::Id linetypeId) |
Sets the linetype of this entity to the given linetype ID. More... | |
virtual void | setLinetypePattern (const RLinetypePattern &p) |
virtual void | setLinetypeScale (double linetypeScale) |
void | setLineweight (RLineweight::Lineweight lineweight) |
virtual void | setParentId (RObject::Id parentId) |
virtual void | setSelected (bool on) |
Selects or deselects this entity. More... | |
virtual void | setSelectedWorkingSet (bool on) |
Selects or deselects this entity for addition to the current working set. More... | |
void | setUpdatesEnabled (bool on) |
Enables / disables cache updates. More... | |
virtual void | setZ (double z) |
virtual bool | stretch (const RPolyline &area, const RVector &offset) |
Stretches the end points of this entity that are inside area by offset. More... | |
virtual void | to2D () |
virtual void | update () const |
Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty). More... | |
virtual | ~REntityData () |
Static Public Member Functions | |
static int | getDefaultDrawOrder () |
Protected Attributes | |
bool | autoUpdatesBlocked |
Block auto updates is true during imports, undo and redo. More... | |
RBlock::Id | blockId |
RColor | color |
RDocument * | document |
int | drawOrder |
RLayer::Id | layerId |
RLinetype::Id | linetypeId |
double | linetypeScale |
RLineweight::Lineweight | lineweight |
RObject::Id | parentId |
bool | selectionStatus |
bool | selectionStatusWorkingSet |
bool | updatesEnabled |
Friends | |
class | REntity |
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).
\TODO derive from RObjectData with flags for selection status etc.
REntityData::REntityData | ( | RDocument * | document = NULL | ) |
Copyright (c) 2011-2018 by Andrew Mustun.
All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in RSplineData, REllipseData, RArcData, RLineData, RHatchData, RXLineData, RRayData, RSolidData, RImageData, RViewportData, RCircleData, RPointData, RPolylineData, RLeaderData, and RToleranceData.
|
inlinevirtual |
Called when user clicks a reference point.
Reimplemented in RDimensionData.
|
inlinevirtual |
Reimplement to force clone on change in transactions.
Reimplemented in RHatchData.
void REntityData::copyAttributesFrom | ( | const REntityData & | entityData, |
bool | copyBlockId = true |
||
) |
|
virtual |
Reimplemented in RTextBasedData, and RToleranceData.
|
virtual |
Reimplemented in RTextBasedData, and RToleranceData.
|
virtual |
|
inline |
QString REntityData::getBlockName | ( | ) | const |
|
virtual |
Reimplemented in RTextBasedData, RHatchData, RImageData, RBlockReferenceData, RDimensionData, RSplineData, RDimRotatedData, RDimAlignedData, RViewportData, RLineData, and RDimOrdinateData.
|
inlinevirtual |
Reimplemented in RBlockReferenceData, and RPolylineData.
|
virtual |
Reimplemented in RTextBasedData.
|
virtual |
point
on this entity. Used for snap to points on entity. Reimplemented in RTextBasedData.
|
virtual |
Reimplemented in RTextBasedData.
|
inlinevirtual |
Reimplemented in RHatchData, and RAttributeData.
|
virtual |
resolve | Resolve color if ByLayer or ByBlock. |
Reimplemented in RHatchData, and RAttributeData.
|
virtual |
Reimplemented in RHatchData.
|
inlinestatic |
|
inlinevirtual |
|
virtual |
limited | Limit lines, arcs at end points, otherwise the orthogonal distance to the unlimited line / circle is returned. |
range | This is returned for solid filled entities (solid filled or dense hatches, text entities) if the point is on the entity and the distance would be zero. |
draft | Calculate based on draft mode representation of the entity. |
strictRange | If limited, this is the maximum range from either end point of the entity. Zero to only return distances that are strictly orthogonal to the entity. |
Reimplemented in RDimensionData, RViewportData, RTextBasedData, RHatchData, RBlockReferenceData, RImageData, and RPolylineData.
|
inline |
|
inline |
|
inlinevirtual |
|
virtual |
Reimplemented in RTextBasedData.
|
virtual |
Reimplemented in RLineData.
|
inlinevirtual |
Can be overwritten to return internal, resolved reference points.
This is used for example for block references in combination with snap to reference points. Default implementation returns same as getReferencePoints().
Reimplemented in RViewportData, and RBlockReferenceData.
|
virtual |
same
is true, the two datas originate from the same entity. Reimplemented in RPolylineData.
|
virtual |
|
inline |
QString REntityData::getLayerName | ( | ) | const |
|
inlinevirtual |
|
virtual |
Reimplemented in RAttributeData.
|
virtual |
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
resolve | True: resolve ByLayer / ByBlock and always return a lineweight in 1/100 mm. |
layer | Layer to use for resolving if known, NULL otherwise. |
blockRef | Block reference to use for resolving if known, NULL otherwise. |
Reimplemented in RAttributeData.
double REntityData::getLineweightInUnits | ( | const QStack< REntity * > & | blockRefStack | ) | const |
|
virtual |
Reimplemented in RTextBasedData.
|
inline |
|
virtual |
Reimplemented in RToleranceData, RTextBasedData, RHatchData, RBlockReferenceData, RImageData, and RDimensionData.
|
virtual |
distance
to either endpoint. Used for snap to points with distance on entity. Reimplemented in RTextBasedData.
|
pure virtual |
Implemented in RTextBasedData, RDimensionData, RViewportData, REllipseData, RArcData, RDimArcLengthData, RDimAngular2LData, RToleranceData, RLineData, RLeaderData, RXLineData, RDimOrdinateData, RRayData, RDimAngular3PData, RHatchData, RSolidData, RBlockReferenceData, RImageData, RDimDiametricData, RDimRadialData, RCircleData, RDimRotatedData, RPointData, RDimAngularData, RPolylineData, RSplineData, and RDimAlignedData.
|
inlinevirtual |
queryBox | Limit returned shapes to query box |
ignoreComplex | Ignore complex shapes and explode those into simple shapes |
segment | Split up splines into spline segments |
Reimplemented in RTextBasedData, RPolylineData, RSplineData, RViewportData, REllipseData, RArcData, RToleranceData, RLeaderData, RLineData, RDimOrdinateData, RHatchData, RXLineData, RRayData, RSolidData, RImageData, RDimRotatedData, RDimDiametricData, RDimRadialData, RBlockReferenceData, RCircleData, RDimAngularData, RPointData, and RDimAlignedData.
|
inlinevirtual |
Reimplemented in RTextBasedData, RTextData, RImageData, RViewportData, RBlockReferenceData, REllipseData, RDimensionData, RHatchData, RPolylineData, RArcData, RAttributeData, RCircleData, RDimAngular2LData, RSolidData, RDimAngular3PData, RDimArcLengthData, RLineData, RPointData, RXLineData, RAttributeDefinitionData, RSplineData, RDimRotatedData, RDimAlignedData, RDimAngularData, RDimLinearData, RDimOrdinateData, RRayData, RDimDiametricData, RDimRadialData, RLeaderData, RFaceData, RToleranceData, and RTraceData.
|
virtual |
point | the 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.
|
virtual |
Reimplemented in RDimensionData, RTextBasedData, RHatchData, and RImageData.
|
inlinevirtual |
|
virtual |
|
inlinevirtual |
Reimplemented in RBlockReferenceData, and RPointData.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
|
virtual |
Moves this entity by the given offset.
Reimplemented in RTextBasedData, RDimensionData, RDimArcLengthData, RDimAngular2LData, RToleranceData, RDimOrdinateData, RDimAngular3PData, RDimLinearData, RHatchData, RBlockReferenceData, RImageData, RDimDiametricData, and RDimRadialData.
|
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.
Implemented in RTextBasedData, RDimensionData, RViewportData, REllipseData, RArcData, RDimArcLengthData, RDimAngular2LData, RToleranceData, RLineData, RLeaderData, RXLineData, RDimOrdinateData, RRayData, RDimAngular3PData, RDimLinearData, RHatchData, RSolidData, RBlockReferenceData, RImageData, RDimDiametricData, RDimRadialData, RCircleData, RDimRotatedData, RPointData, RDimAngularData, RPolylineData, RSplineData, and RDimAlignedData.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Reimplemented in RDimensionData, RToleranceData, RBlockReferenceData, and RLeaderData.
void REntityData::setAutoUpdatesBlocked | ( | bool | on | ) |
|
inlinevirtual |
|
inline |
|
inline |
|
inlinevirtual |
Sets the draw order of this entity.
|
inlinevirtual |
void REntityData::setLayerName | ( | const QString & | layerName | ) |
|
inlinevirtual |
Sets the linetype of this entity to the given linetype ID.
|
virtual |
|
inlinevirtual |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Selects or deselects this entity.
Reimplemented in RTextBasedData.
|
inlinevirtual |
Selects or deselects this entity for addition to the current working set.
|
inline |
Enables / disables cache updates.
|
virtual |
Stretches the end points of this entity that are inside area by offset.
Reimplemented in RLeaderData, RDimOrdinateData, RDimLinearData, and RHatchData.
|
virtual |
Reimplemented in RBlockReferenceData, and RViewportData.
|
inlinevirtual |
Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty).
Reimplemented in RTextBasedData, RDimensionData, RSplineData, RHatchData, RBlockReferenceData, RLeaderData, and RToleranceData.
|
friend |
|
protected |
Block auto updates is true during imports, undo and redo.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |