RBlockReferenceData
Class in Core Module
Header: #include <src/core/RBlockReferenceData.h>
Inherits: REntityData
Description
Section titled “Description”Defines the geometry and appearance of a block reference entity.
Scriptable: This class is available in script environments.
Copyable: Objects are cleaned up automatically by the garbage collector of the script engine.
Public Functions
Section titled “Public Functions”RBlockReferenceData() |
|
RBlockReferenceData(RObject::Id referencedBlockId, const RVector &position, const RVector &scaleFactors, double angle, int columnCount=1, int rowCount=1, double columnSpacing=0, double rowSpacing=0, double visualPropertiesScale=1.0) |
|
| void | applyColumnRowOffsetTo(REntity &entity, int col, int row, bool rotated=false) const |
| bool | applyTransformationTo(QSharedPointer< REntity > &entity) const |
| bool | applyTransformationTo(REntity &entity) const |
| virtual RBox | getBoundingBox(bool ignoreEmpty=false) const |
| virtual QList< RBox > | getBoundingBoxes(bool ignoreEmpty=false) const |
| int | getColumnCount() const |
| RVector | getColumnRowOffset(int col, int row, bool rotated=false) const |
| double | getColumnSpacing() const |
| virtual double | getDistanceTo(const RVector &point, bool limited=true, double range=0.0, bool draft=false, double strictRange=RMAXDOUBLE) const |
| double | getDistanceToContents(const RVector &point, bool limited, double range, bool draft, double strictRange, bool useBoundingBox) const |
| double | getDistanceToContents(const RVector &point, bool limited, double range, bool draft, double strictRange, bool useBoundingBox, bool ignoreHatches) const |
| virtual QList< RRefPoint > | getInternalReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop, QList< RObject::Id > *subEntityIds=NULL) constCan be overwritten to return internal, resolved reference points. |
| virtual RVector | getPointOnEntity() const |
| RVector | getPosition() const |
| RBox | getQueryBoxInBlockCoordinates(const RBox &box) const |
| RObject::Id | getReferencedBlockId() const |
| QString | getReferencedBlockName() const |
| virtual QList< RRefPoint > | getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const |
| double | getRotation() const |
| int | getRowCount() const |
| double | getRowSpacing() const |
| RVector | getScaleFactors() const |
| virtual QList< QSharedPointer< RShape > > | getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false, QList< RObject::Id > *entityIds=NULL) constBlock shapes, transformed. |
| RTransform | getTransform() const |
| QSharedPointer< REntity > | getTransformed(QSharedPointer< REntity > &entity) const |
| virtual RS::EntityType | getType() const |
| virtual RVector | getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const |
| void | groundReferencedBlockId() const |
| bool | hasBlockOwnership() const |
| bool | isPixelUnit() const |
| virtual bool | isPointType() const |
| bool | isXRef() const |
| bool | loadXRef() const |
| RVector | mapToBlock(const RVector &v) const |
| virtual bool | mirror(const RLine &axis) |
| virtual bool | move(const RVector &offset)Moves this entity by the given offset. |
| virtual bool | moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint, Qt::KeyboardModifiers modifiers=Qt::NoModifier)Moves the given reference point to the given target point or does nothing if this entity has no reference point as the given location. |
| QSharedPointer< REntity > | queryEntity(RObject::Id entityId, bool transform=false, bool ignoreAttDef=true) const |
| virtual bool | rotate(double rotation, const RVector ¢er=RDEFAULT_RVECTOR) |
| virtual bool | scale(const RVector &scaleFactors, const RVector ¢er=RDEFAULT_RVECTOR) |
| virtual void | scaleVisualProperties(double scaleFactor) |
| void | setColumnCount(int c) |
| void | setColumnSpacing(double s) |
| void | setPosition(const RVector &p) |
| void | setReferencedBlockId(RObject::Id blockId) |
| void | setReferencedBlockName(const QString &blockName) |
| void | setRotation(double r) |
| void | setRowCount(int c) |
| void | setRowSpacing(double s) |
| void | setScaleFactors(const RVector &sf) |
| virtual void | to2D() |
| virtual void | update() constEntities can reimplement this function to invalidate any internal cache (mark the entity as dirty). |
| virtual void | update(RObject::Id entityId) const |
Static Public Functions
Section titled “Static Public Functions”| static RS::EntityType | getRtti() |
Protected Functions
Section titled “Protected Functions”RBlockReferenceData(RDocument *document, const RBlockReferenceData &data) |
Private Attributes
Section titled “Private Attributes”| QList< RBox > | boundingBoxes |
| QList< RBox > | boundingBoxesIgnoreEmpty |
| QMap< RObject::Id, QSharedPointer< REntity > > | cache |
| int | columnCount |
| double | columnSpacing |
| RVector | position |
| RObject::Id | referencedBlockId |
| double | rotation |
| int | rowCount |
| double | rowSpacing |
| RVector | scaleFactors |
| double | visualPropertiesScale |
Friends
Section titled “Friends”| class | RBlockReferenceEntity |
| class | RViewportEntity |
Member Documentation
Section titled “Member Documentation”RBlockReferenceData
Section titled “RBlockReferenceData”RBlockReferenceData::RBlockReferenceData()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.
RBlockReferenceData
Section titled “RBlockReferenceData”RBlockReferenceData::RBlockReferenceData(RObject::Id referencedBlockId, const RVector &position, const RVector &scaleFactors, double angle, int columnCount=1, int rowCount=1, double columnSpacing=0, double rowSpacing=0, double visualPropertiesScale=1.0)applyColumnRowOffsetTo
Section titled “applyColumnRowOffsetTo”void RBlockReferenceData::applyColumnRowOffsetTo(REntity &entity, int col, int row, bool rotated=false) constconst
applyTransformationTo
Section titled “applyTransformationTo”bool RBlockReferenceData::applyTransformationTo(QSharedPointer< REntity > &entity) constconst
Non-Scriptable: This function is not available in script environments.
applyTransformationTo
Section titled “applyTransformationTo”bool RBlockReferenceData::applyTransformationTo(REntity &entity) constconst
getBoundingBox
Section titled “getBoundingBox”virtual RBox RBlockReferenceData::getBoundingBox(bool ignoreEmpty=false) constvirtual const
Returns: The bounding box that contains this entity.
Reimplemented from getBoundingBox.
getBoundingBoxes
Section titled “getBoundingBoxes”virtual QList< RBox > RBlockReferenceData::getBoundingBoxes(bool ignoreEmpty=false) constvirtual const
Returns: List 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 from getBoundingBoxes.
getColumnCount
Section titled “getColumnCount”int RBlockReferenceData::getColumnCount() constinline const
getColumnRowOffset
Section titled “getColumnRowOffset”RVector RBlockReferenceData::getColumnRowOffset(int col, int row, bool rotated=false) constconst
getColumnSpacing
Section titled “getColumnSpacing”double RBlockReferenceData::getColumnSpacing() constinline const
getDistanceTo
Section titled “getDistanceTo”virtual double RBlockReferenceData::getDistanceTo(const RVector &point, bool limited=true, double range=0.0, bool draft=false, double strictRange=RMAXDOUBLE) constvirtual const
Returns: The shortest distance from this entity to the given point.
Parameters:
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 from getDistanceTo.
getDistanceToContents
Section titled “getDistanceToContents”double RBlockReferenceData::getDistanceToContents(const RVector &point, bool limited, double range, bool draft, double strictRange, bool useBoundingBox) constconst
Returns: Distance from the given point to the entities of the referenced block (same as getDistanceTo). If useBoundingBox is true and this block reference owns its block (custom entity), every point inside the bounding box of the block reference is treated as being within strictRange, i.e. the entity can be selected by clicking anywhere inside its bounding box. If useBoundingBox is false, only the distance to the actual (visible) entities of the block counts.
getDistanceToContents
Section titled “getDistanceToContents”double RBlockReferenceData::getDistanceToContents(const RVector &point, bool limited, double range, bool draft, double strictRange, bool useBoundingBox, bool ignoreHatches) constconst
Returns: Distance from the given point to the entities of the referenced block (same as getDistanceTo). If useBoundingBox is true and this block reference owns its block (custom entity), every point inside the bounding box of the block reference is treated as being within strictRange, i.e. the entity can be selected by clicking anywhere inside its bounding box. If useBoundingBox is false, only the distance to the actual (visible) entities of the block counts.
Parameters:
ignoreHatches: True to ignore the hatches in the block: a solid hatch counts as hit anywhere inside its boundary, which would make a filled container (e.g. a swimlane with a background) swallow every click inside it. With this flag only the other entities of the block (border, texts, …) count.
getInternalReferencePoints
Section titled “getInternalReferencePoints”virtual QList< RRefPoint > RBlockReferenceData::getInternalReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop, QList< RObject::Id > *subEntityIds=NULL) constvirtual const
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 from getInternalReferencePoints.
getPointOnEntity
Section titled “getPointOnEntity”virtual RVector RBlockReferenceData::getPointOnEntity() constvirtual const
Returns: A point that is on the entity. Used to check if an entity is inside a polygon.
Reimplemented from getPointOnEntity.
getPosition
Section titled “getPosition”RVector RBlockReferenceData::getPosition() constinline const
getQueryBoxInBlockCoordinates
Section titled “getQueryBoxInBlockCoordinates”RBox RBlockReferenceData::getQueryBoxInBlockCoordinates(const RBox &box) constconst
getReferencedBlockId
Section titled “getReferencedBlockId”RObject::Id RBlockReferenceData::getReferencedBlockId() constinline const
getReferencedBlockName
Section titled “getReferencedBlockName”QString RBlockReferenceData::getReferencedBlockName() constconst
getReferencePoints
Section titled “getReferencePoints”virtual QList< RRefPoint > RBlockReferenceData::getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) constvirtual const
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.
Reimplemented from getReferencePoints.
getRotation
Section titled “getRotation”double RBlockReferenceData::getRotation() constinline const
getRowCount
Section titled “getRowCount”int RBlockReferenceData::getRowCount() constinline const
getRowSpacing
Section titled “getRowSpacing”double RBlockReferenceData::getRowSpacing() constinline const
getScaleFactors
Section titled “getScaleFactors”RVector RBlockReferenceData::getScaleFactors() constinline const
getShapes
Section titled “getShapes”virtual QList< QSharedPointer< RShape > > RBlockReferenceData::getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false, QList< RObject::Id > *entityIds=NULL) constvirtual const
Block shapes, transformed.
Reimplemented from getShapes.
getTransform
Section titled “getTransform”RTransform RBlockReferenceData::getTransform() constconst
getTransformed
Section titled “getTransformed”QSharedPointer< REntity > RBlockReferenceData::getTransformed(QSharedPointer< REntity > &entity) constinline const
getType
Section titled “getType”virtual RS::EntityType RBlockReferenceData::getType() constvirtual inline const
Reimplemented from getType.
getVectorTo
Section titled “getVectorTo”virtual RVector RBlockReferenceData::getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) constvirtual const
Returns: The distance vector from this entity to the given point.
Parameters:
point: the point to which the distance was measuredlimited: 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 from getVectorTo.
groundReferencedBlockId
Section titled “groundReferencedBlockId”void RBlockReferenceData::groundReferencedBlockId() constconst
hasBlockOwnership
Section titled “hasBlockOwnership”bool RBlockReferenceData::hasBlockOwnership() constconst
isPixelUnit
Section titled “isPixelUnit”bool RBlockReferenceData::isPixelUnit() constconst
isPointType
Section titled “isPointType”virtual bool RBlockReferenceData::isPointType() constvirtual const
Returns: True if entity is of point nature (point, pixel based block).
Reimplemented from isPointType.
isXRef
Section titled “isXRef”bool RBlockReferenceData::isXRef() constconst
loadXRef
Section titled “loadXRef”bool RBlockReferenceData::loadXRef() constconst
mapToBlock
Section titled “mapToBlock”RVector RBlockReferenceData::mapToBlock(const RVector &v) constconst
mirror
Section titled “mirror”virtual bool RBlockReferenceData::mirror(const RLine &axis)virtual
Reimplemented from mirror.
virtual bool RBlockReferenceData::move(const RVector &offset)virtual
Moves this entity by the given offset.
Reimplemented from move.
moveReferencePoint
Section titled “moveReferencePoint”virtual bool RBlockReferenceData::moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint, Qt::KeyboardModifiers modifiers=Qt::NoModifier)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.
Reimplemented from moveReferencePoint.
queryEntity
Section titled “queryEntity”QSharedPointer< REntity > RBlockReferenceData::queryEntity(RObject::Id entityId, bool transform=false, bool ignoreAttDef=true) constconst
Returns: The entity with the given ID.
Parameters:
transform: Transform according to the transformation of this block reference.
rotate
Section titled “rotate”virtual bool RBlockReferenceData::rotate(double rotation, const RVector ¢er=RDEFAULT_RVECTOR)virtual
Reimplemented from rotate.
virtual bool RBlockReferenceData::scale(const RVector &scaleFactors, const RVector ¢er=RDEFAULT_RVECTOR)virtual
Reimplemented from scale.
scaleVisualProperties
Section titled “scaleVisualProperties”virtual void RBlockReferenceData::scaleVisualProperties(double scaleFactor)virtual
Reimplemented from scaleVisualProperties.
setColumnCount
Section titled “setColumnCount”void RBlockReferenceData::setColumnCount(int c)inline
setColumnSpacing
Section titled “setColumnSpacing”void RBlockReferenceData::setColumnSpacing(double s)inline
setPosition
Section titled “setPosition”void RBlockReferenceData::setPosition(const RVector &p)setReferencedBlockId
Section titled “setReferencedBlockId”void RBlockReferenceData::setReferencedBlockId(RObject::Id blockId)setReferencedBlockName
Section titled “setReferencedBlockName”void RBlockReferenceData::setReferencedBlockName(const QString &blockName)setRotation
Section titled “setRotation”void RBlockReferenceData::setRotation(double r)setRowCount
Section titled “setRowCount”void RBlockReferenceData::setRowCount(int c)inline
setRowSpacing
Section titled “setRowSpacing”void RBlockReferenceData::setRowSpacing(double s)inline
setScaleFactors
Section titled “setScaleFactors”void RBlockReferenceData::setScaleFactors(const RVector &sf)virtual void RBlockReferenceData::to2D()virtual
Reimplemented from to2D.
update
Section titled “update”virtual void RBlockReferenceData::update() constvirtual const
Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty).
Reimplemented from update.
update
Section titled “update”virtual void RBlockReferenceData::update(RObject::Id entityId) constvirtual const
getRtti
Section titled “getRtti”static RS::EntityType RBlockReferenceData::getRtti()static inline
RBlockReferenceData
Section titled “RBlockReferenceData”RBlockReferenceData::RBlockReferenceData(RDocument *document, const RBlockReferenceData &data)protected
boundingBoxes
Section titled “boundingBoxes”QList<RBox> RBlockReferenceData::boundingBoxesprivate
boundingBoxesIgnoreEmpty
Section titled “boundingBoxesIgnoreEmpty”QList<RBox> RBlockReferenceData::boundingBoxesIgnoreEmptyprivate
QMap<RObject::Id, QSharedPointer<REntity> > RBlockReferenceData::cacheprivate
columnCount
Section titled “columnCount”int RBlockReferenceData::columnCountprivate
columnSpacing
Section titled “columnSpacing”double RBlockReferenceData::columnSpacingprivate
position
Section titled “position”RVector RBlockReferenceData::positionprivate
referencedBlockId
Section titled “referencedBlockId”RObject::Id RBlockReferenceData::referencedBlockIdprivate
rotation
Section titled “rotation”double RBlockReferenceData::rotationprivate
rowCount
Section titled “rowCount”int RBlockReferenceData::rowCountprivate
rowSpacing
Section titled “rowSpacing”double RBlockReferenceData::rowSpacingprivate
scaleFactors
Section titled “scaleFactors”RVector RBlockReferenceData::scaleFactorsprivate
visualPropertiesScale
Section titled “visualPropertiesScale”double RBlockReferenceData::visualPropertiesScaleprivate
RBlockReferenceEntity
Section titled “RBlockReferenceEntity”friend class RBlockReferenceEntityprivate
RViewportEntity
Section titled “RViewportEntity”friend class RViewportEntityprivate