QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RBlockReferenceData Class Reference

Defines the geometry and appearance of a block reference entity. More...

#include <RBlockReferenceData.h>

Inheritance diagram for RBlockReferenceData:
REntityData

Public Member Functions

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< RBoxgetBoundingBoxes (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
 
virtual QList< RRefPointgetInternalReferencePoints (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< RRefPointgetReferencePoints (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< REntitygetTransformed (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
 
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< REntityqueryEntity (RObject::Id entityId, bool transform=false, bool ignoreAttDef=true) const
 
 RBlockReferenceData ()
 Copyright (c) 2011-2018 by Andrew Mustun.
 
 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)
 
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
 
- Public Member Functions inherited from REntityData
virtual const RShapecastToConstShape () const
 
virtual RShapecastToShape ()
 
virtual bool clickReferencePoint (const RVector &referencePoint)
 Called when user clicks a reference point.
 
virtual bool cloneOnChange () const
 Reimplement to force clone on change in transactions.
 
void copyAttributesFrom (const REntityData &entityData, bool copyBlockId=true)
 
virtual bool flipHorizontal ()
 
virtual bool flipVertical ()
 
virtual QList< RVectorgetArcReferencePoints (const RBox &queryBox=RDEFAULT_RBOX) const
 
bool getAutoUpdatesBlocked () const
 
RObject::Id getBlockId () const
 
QString getBlockName () const
 
virtual QList< RVectorgetCenterPoints (const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
 
virtual RVector getClosestPointOnEntity (const RVector &point, double range=RNANDOUBLE, bool limited=true, RObject::Id *subEntityId=NULL) const
 
virtual QSharedPointer< RShapegetClosestShape (const RVector &pos, double range=RNANDOUBLE, bool ignoreComplex=false, RObject::Id *subEntityId=NULL) const
 
RObject::Id getClosestSubEntityId (const RVector &pos, double range, bool ignoreComplex) const
 Convenience function for scripts.
 
virtual RColor getColor () const
 
virtual RColor getColor (bool resolve, const QStack< QSharedPointer< REntity > > &blockRefStack) const
 
virtual RColor getColor (const RColor &unresolvedColor, const QStack< QSharedPointer< REntity > > &blockRefStack) const
 
virtual RColor getDisplayColor ()
 
RDocumentgetDocument ()
 
const RDocumentgetDocument () const
 
virtual int getDrawOrder () const
 
virtual QList< RVectorgetEndPoints (const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
 
virtual RPolyline getHull (double offset) const
 
virtual QList< RVectorgetIntersectionPoints (const REntityData &other, bool limited=true, bool same=false, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true, QList< QPair< RObject::Id, RObject::Id > > *entityIds=NULL) const
 
virtual QList< RVectorgetIntersectionPoints (const RShape &shape, bool limited=true, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true) const
 
RObject::Id getLayerId () const
 
QString getLayerName () const
 
virtual RObject::Id getLinetypeId () const
 
virtual RObject::Id getLinetypeId (bool resolve, const QStack< QSharedPointer< REntity > > &blockRefStack) const
 
virtual RLinetypePattern getLinetypePattern () const
 
virtual double getLinetypeScale () const
 
virtual RLineweight::Lineweight getLineweight () const
 
virtual RLineweight::Lineweight getLineweight (bool resolve, const QStack< QSharedPointer< REntity > > &blockRefStack) const
 
double getLineweightInUnits (const QStack< QSharedPointer< REntity > > &blockRefStack) const
 
virtual QList< RVectorgetMiddlePoints (const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
 
RObject::Id getParentId () const
 
virtual QList< RVectorgetPointsWithDistanceToEnd (double distance, int from=RS::FromAny, const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) 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 isSane () const
 
virtual bool isSelected () const
 
virtual bool isSelectedWorkingSet () const
 
virtual bool isUpdatesEnabled () const
 
virtual bool isValid () const
 
virtual bool mirror (const RVector &axis1, const RVector &axis2)
 
 REntityData (RDocument *document=NULL)
 Copyright (c) 2011-2018 by Andrew Mustun.
 
virtual bool scale (double scaleFactor, const RVector &center=RDEFAULT_RVECTOR)
 
void setAutoUpdatesBlocked (bool on)
 
virtual void setBlockId (RObject::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 (RObject::Id layerId)
 
void setLayerName (const QString &layerName)
 
virtual void setLinetypeId (RObject::Id linetypeId)
 Sets the linetype of this entity to the given linetype ID.
 
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.
 
virtual void setSelectedWorkingSet (bool on)
 Selects or deselects this entity for addition to the current working set.
 
void setUpdatesEnabled (bool on)
 Enables / disables cache updates.
 
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.
 
virtual ~REntityData ()
 

Static Public Member Functions

static RS::EntityType getRtti ()
 
- Static Public Member Functions inherited from REntityData
static int getDefaultDrawOrder ()
 

Protected Member Functions

 RBlockReferenceData (RDocument *document, const RBlockReferenceData &data)
 

Private Attributes

QList< RBoxboundingBoxes
 
QList< RBoxboundingBoxesIgnoreEmpty
 
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

class RBlockReferenceEntity
 
class RViewportEntity
 

Additional Inherited Members

- Protected Attributes inherited from REntityData
bool autoUpdatesBlocked
 Block auto updates is true during imports, undo and redo.
 
RObject::Id blockId
 
RColor color
 
RDocumentdocument
 
int drawOrder
 
RObject::Id layerId
 
RObject::Id linetypeId
 
double linetypeScale
 
RLineweight::Lineweight lineweight
 
RObject::Id parentId
 
bool selectionStatus
 
bool selectionStatusWorkingSet
 
bool updatesEnabled
 

Detailed Description

Defines the geometry and appearance of a block reference entity.

Scriptable:\nThis class is available in script environments.\n
Copyable:\nObjects are cleaned up automatically by the garbage collector of the script engine.\n

Constructor & Destructor Documentation

◆ RBlockReferenceData() [1/3]

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

◆ RBlockReferenceData() [2/3]

RBlockReferenceData::RBlockReferenceData ( )

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.

◆ RBlockReferenceData() [3/3]

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 )

Member Function Documentation

◆ applyColumnRowOffsetTo()

void RBlockReferenceData::applyColumnRowOffsetTo ( REntity & entity,
int col,
int row,
bool rotated = false ) const

◆ applyTransformationTo() [1/2]

bool RBlockReferenceData::applyTransformationTo ( QSharedPointer< REntity > & entity) const
Non-Scriptable:\nThis function is not available in script environments.\n

◆ applyTransformationTo() [2/2]

bool RBlockReferenceData::applyTransformationTo ( REntity & entity) const

◆ getBoundingBox()

RBox RBlockReferenceData::getBoundingBox ( bool ignoreEmpty = false) const
virtual
Returns
The bounding box that contains this entity.

Reimplemented from REntityData.

◆ getBoundingBoxes()

QList< RBox > RBlockReferenceData::getBoundingBoxes ( bool ignoreEmpty = false) const
virtual
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 REntityData.

◆ getColumnCount()

int RBlockReferenceData::getColumnCount ( ) const
inline

◆ getColumnRowOffset()

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

◆ getColumnSpacing()

double RBlockReferenceData::getColumnSpacing ( ) const
inline

◆ getDistanceTo()

double RBlockReferenceData::getDistanceTo ( const RVector & point,
bool limited = true,
double range = 0.0,
bool draft = false,
double strictRange = RMAXDOUBLE ) const
virtual
Returns
The shortest distance from this entity to the given point.
Parameters
limitedLimit lines, arcs at end points, otherwise the orthogonal distance to the unlimited line / circle is returned.
rangeThis 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.
draftCalculate based on draft mode representation of the entity.
strictRangeIf 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 REntityData.

◆ getInternalReferencePoints()

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

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

◆ getPointOnEntity()

RVector RBlockReferenceData::getPointOnEntity ( ) const
virtual
Returns
A point that is on the entity. Used to check if an entity is inside a polygon.

Reimplemented from REntityData.

◆ getPosition()

RVector RBlockReferenceData::getPosition ( ) const
inline

◆ getQueryBoxInBlockCoordinates()

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

◆ getReferencedBlockId()

RObject::Id RBlockReferenceData::getReferencedBlockId ( ) const
inline

◆ getReferencedBlockName()

QString RBlockReferenceData::getReferencedBlockName ( ) const

◆ getReferencePoints()

QList< RRefPoint > RBlockReferenceData::getReferencePoints ( RS::ProjectionRenderingHint hint = RS::RenderTop) const
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.

Implements REntityData.

◆ getRotation()

double RBlockReferenceData::getRotation ( ) const
inline

◆ getRowCount()

int RBlockReferenceData::getRowCount ( ) const
inline

◆ getRowSpacing()

double RBlockReferenceData::getRowSpacing ( ) const
inline

◆ getRtti()

static RS::EntityType RBlockReferenceData::getRtti ( )
inlinestatic

◆ getScaleFactors()

RVector RBlockReferenceData::getScaleFactors ( ) const
inline

◆ getShapes()

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

Block shapes, transformed.

Reimplemented from REntityData.

◆ getTransform()

RTransform RBlockReferenceData::getTransform ( ) const

◆ getTransformed()

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

◆ getType()

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

Reimplemented from REntityData.

◆ getVectorTo()

RVector RBlockReferenceData::getVectorTo ( const RVector & point,
bool limited = true,
double strictRange = RMAXDOUBLE ) const
virtual
Returns
The distance vector from this entity to the given point.
Parameters
pointthe point to which the distance was measured
limitedIf 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 REntityData.

◆ groundReferencedBlockId()

void RBlockReferenceData::groundReferencedBlockId ( ) const

◆ hasBlockOwnership()

bool RBlockReferenceData::hasBlockOwnership ( ) const

◆ isPixelUnit()

bool RBlockReferenceData::isPixelUnit ( ) const

◆ isPointType()

bool RBlockReferenceData::isPointType ( ) const
virtual
Returns
True if entity is of point nature (point, pixel based block).

Reimplemented from REntityData.

◆ mapToBlock()

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

◆ mirror()

bool RBlockReferenceData::mirror ( const RLine & axis)
virtual

Reimplemented from REntityData.

◆ move()

bool RBlockReferenceData::move ( const RVector & offset)
virtual

Moves this entity by the given offset.

Reimplemented from REntityData.

◆ moveReferencePoint()

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.

Implements REntityData.

◆ queryEntity()

QSharedPointer< REntity > RBlockReferenceData::queryEntity ( RObject::Id entityId,
bool transform = false,
bool ignoreAttDef = true ) const
Returns
The entity with the given ID.
Parameters
transformTransform according to the transformation of this block reference.

◆ rotate()

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

Reimplemented from REntityData.

◆ scale()

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

Reimplemented from REntityData.

◆ scaleVisualProperties()

void RBlockReferenceData::scaleVisualProperties ( double scaleFactor)
virtual

Reimplemented from REntityData.

◆ setColumnCount()

void RBlockReferenceData::setColumnCount ( int c)
inline

◆ setColumnSpacing()

void RBlockReferenceData::setColumnSpacing ( double s)
inline

◆ setPosition()

void RBlockReferenceData::setPosition ( const RVector & p)

◆ setReferencedBlockId()

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

◆ setReferencedBlockName()

void RBlockReferenceData::setReferencedBlockName ( const QString & blockName)

◆ setRotation()

void RBlockReferenceData::setRotation ( double r)

◆ setRowCount()

void RBlockReferenceData::setRowCount ( int c)
inline

◆ setRowSpacing()

void RBlockReferenceData::setRowSpacing ( double s)
inline

◆ setScaleFactors()

void RBlockReferenceData::setScaleFactors ( const RVector & sf)

◆ to2D()

void RBlockReferenceData::to2D ( )
virtual

Reimplemented from REntityData.

◆ update() [1/2]

void RBlockReferenceData::update ( ) const
virtual

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

Reimplemented from REntityData.

◆ update() [2/2]

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

Friends And Related Symbol Documentation

◆ RBlockReferenceEntity

friend class RBlockReferenceEntity
friend

◆ RViewportEntity

friend class RViewportEntity
friend

Member Data Documentation

◆ boundingBoxes

QList<RBox> RBlockReferenceData::boundingBoxes
mutableprivate

◆ boundingBoxesIgnoreEmpty

QList<RBox> RBlockReferenceData::boundingBoxesIgnoreEmpty
mutableprivate

◆ cache

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

◆ columnCount

int RBlockReferenceData::columnCount
private

◆ columnSpacing

double RBlockReferenceData::columnSpacing
private

◆ position

RVector RBlockReferenceData::position
private

◆ referencedBlockId

RObject::Id RBlockReferenceData::referencedBlockId
mutableprivate

◆ rotation

double RBlockReferenceData::rotation
private

◆ rowCount

int RBlockReferenceData::rowCount
private

◆ rowSpacing

double RBlockReferenceData::rowSpacing
private

◆ scaleFactors

RVector RBlockReferenceData::scaleFactors
private

◆ visualPropertiesScale

double RBlockReferenceData::visualPropertiesScale
private

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