Skip to content

RBlockReferenceData

Class in Core Module
Header: #include <src/core/RBlockReferenceData.h>
Inherits: REntityData

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.

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) const
Can 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) const
Block 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 &center=RDEFAULT_RVECTOR)
virtual bool scale(const RVector &scaleFactors, const RVector &center=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() const
Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty).
virtual void update(RObject::Id entityId) const
static RS::EntityType getRtti()
RBlockReferenceData(RDocument *document, const RBlockReferenceData &data)
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
class RBlockReferenceEntity
class RViewportEntity

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::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 RBlockReferenceData::applyColumnRowOffsetTo(REntity &entity, int col, int row, bool rotated=false) const

const

bool RBlockReferenceData::applyTransformationTo(QSharedPointer< REntity > &entity) const

const

Non-Scriptable: This function is not available in script environments.

bool RBlockReferenceData::applyTransformationTo(REntity &entity) const

const

virtual RBox RBlockReferenceData::getBoundingBox(bool ignoreEmpty=false) const

virtual const

Returns: The bounding box that contains this entity.

Reimplemented from getBoundingBox.

virtual QList< RBox > RBlockReferenceData::getBoundingBoxes(bool ignoreEmpty=false) const

virtual 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.

int RBlockReferenceData::getColumnCount() const

inline const

RVector RBlockReferenceData::getColumnRowOffset(int col, int row, bool rotated=false) const

const

double RBlockReferenceData::getColumnSpacing() const

inline const

virtual double RBlockReferenceData::getDistanceTo(const RVector &point, bool limited=true, double range=0.0, bool draft=false, double strictRange=RMAXDOUBLE) const

virtual 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.

double RBlockReferenceData::getDistanceToContents(const RVector &point, bool limited, double range, bool draft, double strictRange, bool useBoundingBox) const

const

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.

double RBlockReferenceData::getDistanceToContents(const RVector &point, bool limited, double range, bool draft, double strictRange, bool useBoundingBox, bool ignoreHatches) const

const

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.

virtual QList< RRefPoint > RBlockReferenceData::getInternalReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop, QList< RObject::Id > *subEntityIds=NULL) const

virtual 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.

virtual RVector RBlockReferenceData::getPointOnEntity() const

virtual const

Returns: A point that is on the entity. Used to check if an entity is inside a polygon.

Reimplemented from getPointOnEntity.

RVector RBlockReferenceData::getPosition() const

inline const

RBox RBlockReferenceData::getQueryBoxInBlockCoordinates(const RBox &box) const

const

RObject::Id RBlockReferenceData::getReferencedBlockId() const

inline const

QString RBlockReferenceData::getReferencedBlockName() const

const

virtual QList< RRefPoint > RBlockReferenceData::getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const

virtual 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.

double RBlockReferenceData::getRotation() const

inline const

int RBlockReferenceData::getRowCount() const

inline const

double RBlockReferenceData::getRowSpacing() const

inline const

RVector RBlockReferenceData::getScaleFactors() const

inline const

virtual QList< QSharedPointer< RShape > > RBlockReferenceData::getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false, QList< RObject::Id > *entityIds=NULL) const

virtual const

Block shapes, transformed.

Reimplemented from getShapes.

RTransform RBlockReferenceData::getTransform() const

const

QSharedPointer< REntity > RBlockReferenceData::getTransformed(QSharedPointer< REntity > &entity) const

inline const

virtual RS::EntityType RBlockReferenceData::getType() const

virtual inline const

Reimplemented from getType.

virtual RVector RBlockReferenceData::getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const

virtual const

Returns: The distance vector from this entity to the given point.

Parameters:

  • 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 from getVectorTo.

void RBlockReferenceData::groundReferencedBlockId() const

const

bool RBlockReferenceData::hasBlockOwnership() const

const

bool RBlockReferenceData::isPixelUnit() const

const

virtual bool RBlockReferenceData::isPointType() const

virtual const

Returns: True if entity is of point nature (point, pixel based block).

Reimplemented from isPointType.

bool RBlockReferenceData::isXRef() const

const

bool RBlockReferenceData::loadXRef() const

const

RVector RBlockReferenceData::mapToBlock(const RVector &v) const

const

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.

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.

QSharedPointer< REntity > RBlockReferenceData::queryEntity(RObject::Id entityId, bool transform=false, bool ignoreAttDef=true) const

const

Returns: The entity with the given ID.

Parameters:

  • transform: Transform according to the transformation of this block reference.

virtual bool RBlockReferenceData::rotate(double rotation, const RVector &center=RDEFAULT_RVECTOR)

virtual

Reimplemented from rotate.

virtual bool RBlockReferenceData::scale(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)

virtual

Reimplemented from scale.

virtual void RBlockReferenceData::scaleVisualProperties(double scaleFactor)

virtual

Reimplemented from scaleVisualProperties.

void RBlockReferenceData::setColumnCount(int c)

inline

void RBlockReferenceData::setColumnSpacing(double s)

inline

void RBlockReferenceData::setPosition(const RVector &p)

void RBlockReferenceData::setReferencedBlockId(RObject::Id blockId)

void RBlockReferenceData::setReferencedBlockName(const QString &blockName)

void RBlockReferenceData::setRotation(double r)

void RBlockReferenceData::setRowCount(int c)

inline

void RBlockReferenceData::setRowSpacing(double s)

inline

void RBlockReferenceData::setScaleFactors(const RVector &sf)

virtual void RBlockReferenceData::to2D()

virtual

Reimplemented from to2D.

virtual void RBlockReferenceData::update() const

virtual const

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

Reimplemented from update.

virtual void RBlockReferenceData::update(RObject::Id entityId) const

virtual const

static RS::EntityType RBlockReferenceData::getRtti()

static inline

RBlockReferenceData::RBlockReferenceData(RDocument *document, const RBlockReferenceData &data)

protected

QList<RBox> RBlockReferenceData::boundingBoxes

private

QList<RBox> RBlockReferenceData::boundingBoxesIgnoreEmpty

private

QMap<RObject::Id, QSharedPointer<REntity> > RBlockReferenceData::cache

private

int RBlockReferenceData::columnCount

private

double RBlockReferenceData::columnSpacing

private

RVector RBlockReferenceData::position

private

RObject::Id RBlockReferenceData::referencedBlockId

private

double RBlockReferenceData::rotation

private

int RBlockReferenceData::rowCount

private

double RBlockReferenceData::rowSpacing

private

RVector RBlockReferenceData::scaleFactors

private

double RBlockReferenceData::visualPropertiesScale

private

friend class RBlockReferenceEntity

private

friend class RViewportEntity

private