QCAD
Open Source 2D CAD
RDocument Class Reference

A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc. More...

#include <RDocument.h>

Inheritance diagram for RDocument:
RRequireHeap RNonCopyable

Public Member Functions

bool addBlockToSpatialIndex (RBlock::Id blockId, RObject::Id ignoreBlockId)
 Add block references that point to blockId, unless they also point to ignoreBlockId. More...
 
void addToSpatialIndex (QSharedPointer< REntity > entity)
 
bool blockContainsReferences (RBlock::Id blockId, RBlock::Id referencedBlockId)
 
void clear ()
 Resets this document to its initial, empty state. More...
 
void clearSelection (QSet< REntity::Id > *affectedEntities=NULL)
 
void copyVariablesFrom (const RDocument &other)
 
int countSelectedEntities () const
 
bool deselectEntities (const QSet< REntity::Id > &entityId, QSet< REntity::Id > *affectedEntities=NULL)
 Deselects all entities with the given IDs. More...
 
void deselectEntity (REntity::Id entityId, QSet< REntity::Id > *affectedEntities=NULL)
 Deselects the entity with the given ID. More...
 
void dump ()
 
QString formatAngle (double value)
 
QString formatLinear (double value)
 
RS::AngleFormat getAngleFormat ()
 
int getAnglePrecision ()
 
RBlock::Id getBlockId (const QString &blockName) const
 
QString getBlockName (RBlock::Id blockId) const
 
QSet< QString > getBlockNames () const
 
RBox getBoundingBox (bool ignoreHiddenLayers=true, bool ignoreEmpty=false) const
 
RBlock::Id getCurrentBlockId () const
 
RColor getCurrentColor () const
 
RLayer::Id getCurrentLayerId ()
 
RLinetype::Id getCurrentLinetypeId () const
 
RLinetypePattern getCurrentLinetypePattern () const
 
RLineweight::Lineweight getCurrentLineweight () const
 
RView::Id getCurrentViewId () const
 
QList< QSharedPointer< RObject > > getDefaultLinetypes ()
 
QString getDimensionFont () const
 
QString getFileName () const
 
QString getFileVersion () const
 
QVariant getKnownVariable (RS::KnownVariable key, const QVariant &defaultValue=RDEFAULT_QVARIANT) const
 
RLayer::Id getLayerId (const QString &layerName) const
 
QString getLayerName (RLayer::Id layerId) const
 
QSet< QString > getLayerNames () const
 
RS::LinearFormat getLinearFormat ()
 
int getLinearPrecision ()
 
RLinetype::Id getLinetypeByBlockId () const
 
RLinetype::Id getLinetypeByLayerId () const
 
QString getLinetypeDescription (RLinetype::Id linetypeId) const
 
RLinetype::Id getLinetypeId (const QString &linetypeName) const
 
QString getLinetypeLabel (RLinetype::Id linetypeId) const
 
QString getLinetypeName (RLinetype::Id linetypeId) const
 
QSet< QString > getLinetypeNames () const
 
QList< RLinetypePatterngetLinetypePatterns () const
 
double getLinetypeScale () const
 
RLineweight::Lineweight getMaxLineweight () const
 
RBlock::Id getModelSpaceBlockId () const
 
RBox getSelectionBox () const
 
RSpatialIndexgetSpatialIndex ()
 
RStoragegetStorage ()
 
const RStoragegetStorage () const
 
QString getTempBlockName () const
 
int getTransactionGroup () const
 
RTransactionStackgetTransactionStack ()
 
RS::Unit getUnit () const
 
QVariant getVariable (const QString &key, const QVariant &defaultValue=RDEFAULT_QVARIANT, bool useSettings=false) const
 
QStringList getVariables () const
 
QSet< QString > getViewNames () const
 
bool hasBlock (const QString &blockName) const
 
bool hasChildEntities (REntity::Id parentId) const
 
bool hasLayer (const QString &layerName) const
 
bool hasLinetype (const QString &linetypeName) const
 
bool hasSelection () const
 
bool hasVariable (const QString &key) const
 
bool hasView (const QString &viewName) const
 
void init ()
 
void initLinetypes (RTransaction *transaction=NULL)
 
bool isBlockFrozen (RBlock::Id blockId) const
 
bool isByBlock (RLinetype::Id linetypeId) const
 
bool isByLayer (RLinetype::Id linetypeId) const
 
bool isEntityEditable (REntity::Id entityId) const
 
bool isEntityLayerFrozen (REntity::Id entityId) const
 
bool isLayerFrozen (RLayer::Id layerId) const
 
bool isLayerLocked (RLayer::Id layerId) const
 
bool isMetric () const
 
bool isModified () const
 
bool isRedoAvailable () const
 
bool isSelected (REntity::Id entityId)
 
bool isUndoAvailable () const
 
QSet< REntity::IdqueryAllBlockReferences () const
 
QSet< RBlock::IdqueryAllBlocks () const
 
QSet< REntity::IdqueryAllEntities (bool undone=false, bool allBlocks=false, RS::EntityType type=RS::EntityAll) const
 Queries all entities of this document. More...
 
QSet< RLayer::IdqueryAllLayers () const
 Queries all layers of this document. More...
 
QSet< RLinetype::IdqueryAllLinetypes () const
 
QSet< RObject::IdqueryAllObjects () const
 Queries all objects of this document. More...
 
QSet< RUcs::IdqueryAllUcs () const
 Queries all UCSs of this document. More...
 
QSet< RView::IdqueryAllViews () const
 
QSharedPointer< RBlockqueryBlock (RBlock::Id blockId) const
 
QSharedPointer< RBlockqueryBlock (const QString &blockName) const
 
QSharedPointer< RBlockqueryBlockDirect (RBlock::Id blockId) const
 
QSet< REntity::IdqueryBlockEntities (RBlock::Id blockId) const
 
QSet< REntity::IdqueryBlockReferences (RBlock::Id blockId) const
 
QSet< REntity::IdqueryChildEntities (REntity::Id parentId, RS::EntityType type=RS::EntityAll) const
 
REntity::Id queryClosestXY (const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE, bool includeLockedLayers=true)
 Queries the one entity that is closest to the given position and within the given range (2d). More...
 
REntity::Id queryClosestXY (QSet< REntity::Id > &candidates, const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE)
 Queries the entity that is closest to the given position wcsPosition. More...
 
QSet< REntity::IdqueryContainedEntities (const RBox &box)
 Queries all entities which are completely inside the given box. More...
 
QSet< REntity::IdqueryContainedEntitiesXY (const RBox &box)
 
QSharedPointer< RBlockqueryCurrentBlock ()
 
QSharedPointer< RLayerqueryCurrentLayer ()
 
QSharedPointer< RViewqueryCurrentView ()
 
QSharedPointer< RDocumentVariablesqueryDocumentVariables () const
 
QSharedPointer< RDocumentVariablesqueryDocumentVariablesDirect () const
 
QSharedPointer< REntityqueryEntity (REntity::Id entityId) const
 Queries the entity with the given ID. More...
 
QSharedPointer< REntityqueryEntityDirect (REntity::Id entityId) const
 Queries the entity with the given ID. More...
 
QSet< REntity::IdqueryInfiniteEntities ()
 
QSet< REntity::IdqueryIntersectedEntitiesXY (const RBox &box, bool checkBoundingBoxOnly=false, bool includeLockedLayers=true, RBlock::Id blockId=RBlock::INVALID_ID, const QList< RS::EntityType > &filter=RDEFAULT_QLIST_RS_ENTITYTYPE)
 
QMap< REntity::Id, QSet< int > > queryIntersectedShapesXY (const RBox &box, bool checkBoundingBoxOnly=false, bool includeLockedLayers=true, RBlock::Id blockId=RBlock::INVALID_ID, const QList< RS::EntityType > &filter=RDEFAULT_QLIST_RS_ENTITYTYPE)
 
QSharedPointer< RLayerqueryLayer (RLayer::Id layerId) const
 Queries the layer with the given ID. More...
 
QSharedPointer< RLayerqueryLayer (const QString &layerName) const
 Queries the layer with the given name. More...
 
QSharedPointer< RLayerqueryLayerDirect (RLayer::Id layerId) const
 Queries the layer with the given ID direct (no cloning). More...
 
QSet< REntity::IdqueryLayerEntities (RLayer::Id layerId, bool allBlocks=false) const
 
QSharedPointer< RLinetypequeryLinetype (RLinetype::Id linetypeId) const
 
QSharedPointer< RLinetypequeryLinetype (const QString &linetypeName) const
 
QSharedPointer< RObjectqueryObject (RObject::Id objectId) const
 Queries the object with the given ID. More...
 
QSharedPointer< RObjectqueryObjectByHandle (RObject::Handle objectHandle) const
 
QSharedPointer< RObjectqueryObjectDirect (RObject::Id objectId) const
 Queries the object with the given ID. More...
 
QSet< REntity::IdquerySelectedEntities ()
 Queries all selected entities. More...
 
QSharedPointer< RUcsqueryUcs (RUcs::Id ucsId) const
 Queries the UCS with the given ID. More...
 
QSharedPointer< RUcsqueryUcs (const QString &ucsName) const
 Queries the UCS with the given name. More...
 
QSharedPointer< RViewqueryView (RView::Id viewId) const
 
QSharedPointer< RViewqueryView (const QString &viewName) const
 
 RDocument (RStorage &storage, RSpatialIndex &spatialIndex)
 Creates a new document with the given storage as back-end. More...
 
virtual void rebuildSpatialIndex ()
 Rebuilds the entire spatial index from scratch (e.g. More...
 
QList< RTransactionredo ()
 Redoes a previously undone transaction. More...
 
void removeBlockFromSpatialIndex (RBlock::Id blockId)
 
virtual void removeFromSpatialIndex (QSharedPointer< REntity > entity)
 
void resetTransactionStack ()
 
void selectAllEntites (QSet< REntity::Id > *affectedEntities=NULL)
 Selects all not selected entities. More...
 
void selectEntities (const QSet< REntity::Id > &entityId, bool add=false, QSet< REntity::Id > *affectedEntities=NULL)
 Selects all entities with the given IDs. More...
 
void selectEntity (REntity::Id entityId, bool add=false, QSet< REntity::Id > *affectedEntities=NULL)
 Selects the entity with the given ID. More...
 
void setCurrentBlock (RBlock::Id blockId)
 
void setCurrentBlock (const QString &blockName)
 
void setCurrentColor (const RColor &color)
 
void setCurrentLayer (RLayer::Id layerId, RTransaction *transaction=NULL)
 
void setCurrentLayer (const QString &layerName, RTransaction *transaction=NULL)
 
void setCurrentLinetype (RLinetype::Id ltId)
 
void setCurrentLinetype (const QString &name)
 
void setCurrentLinetypePattern (const RLinetypePattern &p)
 
void setCurrentLineweight (RLineweight::Lineweight lw)
 
void setCurrentView (RView::Id viewId)
 
void setCurrentView (const QString &viewName)
 
void setDimensionFont (const QString &f, RTransaction *transaction=NULL)
 
void setFileName (const QString &fn)
 
void setFileVersion (const QString &fv)
 
void setKnownVariable (RS::KnownVariable key, const QVariant &value, RTransaction *transaction=NULL)
 
void setKnownVariable (RS::KnownVariable key, const RVector &value, RTransaction *transaction=NULL)
 
void setLinetypeScale (double v, RTransaction *transaction=NULL)
 
void setModified (bool m)
 
void setUnit (RS::Unit unit, RTransaction *transaction=NULL)
 
void setVariable (const QString &key, const QVariant &value, bool overwrite=true)
 
bool showLeadingZeroes ()
 
bool showLeadingZeroesAngle ()
 
bool showTrailingZeroes ()
 
bool showTrailingZeroesAngle ()
 
void startTransactionGroup ()
 
QList< RTransactionundo ()
 Undoes the last transaction. More...
 
void updateAllEntities ()
 
virtual ~RDocument ()
 
- Public Member Functions inherited from RRequireHeap
void doDelete ()
 

Static Public Member Functions

static RDocumentgetClipboard ()
 

Static Protected Attributes

static RDocumentclipboard = NULL
 Copyright (c) 2011-2015 by Andrew Mustun. More...
 

Private Attributes

QString fileName
 
QString fileVersion
 
RLinetype::Id linetypeByBlockId
 
RLinetype::Id linetypeByLayerId
 
RBlock::Id modelSpaceBlockId
 
RSpatialIndexspatialIndex
 
RStoragestorage
 
RTransactionStack transactionStack
 

Friends

QDebug operator<< (QDebug dbg, RDocument &d)
 Stream operator for QDebug. More...
 

Additional Inherited Members

- Protected Member Functions inherited from RRequireHeap
virtual ~RRequireHeap ()
 
- Private Member Functions inherited from RNonCopyable
 RNonCopyable ()
 
 ~RNonCopyable ()
 

Detailed Description

A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.

Every document maintains a spatial index for fast entity lookups. Documents also handle transactions through a RTransactionStack. A document is backed by an RStorage implementation to store the document for the duration of the document's lifetime.

Scriptable:
This class is available in script environments.

Constructor & Destructor Documentation

RDocument::RDocument ( RStorage storage,
RSpatialIndex spatialIndex 
)

Creates a new document with the given storage as back-end.

The document takes ownership of the storage and spatial index. A new document contains one layer ("0") and a number of default line types. The default unit is Millimeter.

RDocument::~RDocument ( )
virtual

Member Function Documentation

bool RDocument::addBlockToSpatialIndex ( RBlock::Id  blockId,
RObject::Id  ignoreBlockId 
)

Add block references that point to blockId, unless they also point to ignoreBlockId.

void RDocument::addToSpatialIndex ( QSharedPointer< REntity entity)
bool RDocument::blockContainsReferences ( RBlock::Id  blockId,
RBlock::Id  referencedBlockId 
)
void RDocument::clear ( )

Resets this document to its initial, empty state.

void RDocument::clearSelection ( QSet< REntity::Id > *  affectedEntities = NULL)
Todo:
refactoring to operation

Deselectes all selected entities.

void RDocument::copyVariablesFrom ( const RDocument other)
int RDocument::countSelectedEntities ( ) const
bool RDocument::deselectEntities ( const QSet< REntity::Id > &  entityIds,
QSet< REntity::Id > *  affectedEntities = NULL 
)

Deselects all entities with the given IDs.

Todo:
refactoring to operation
Parameters
affectedOptional pointer to an empty set of entity IDs. After the call, this set will contain all entity IDs of entities that were affected by the call.
void RDocument::deselectEntity ( REntity::Id  entityId,
QSet< REntity::Id > *  affectedEntities = NULL 
)

Deselects the entity with the given ID.

Parameters
affectedOptional pointer to an empty set of entity IDs. After the call, this set will contain all entity IDs of entities that were affected by the call.
void RDocument::dump ( )
QString RDocument::formatAngle ( double  value)
QString RDocument::formatLinear ( double  value)
RS::AngleFormat RDocument::getAngleFormat ( )
Returns
The angle format type for this document. This is determined by the variable "$DIMAUNIT".
int RDocument::getAnglePrecision ( )
Returns
The angular precision for this document. This is determined by the variable "$DIMADEC".
RBlock::Id RDocument::getBlockId ( const QString &  blockName) const
QString RDocument::getBlockName ( RBlock::Id  blockId) const
QSet< QString > RDocument::getBlockNames ( ) const
RBox RDocument::getBoundingBox ( bool  ignoreHiddenLayers = true,
bool  ignoreEmpty = false 
) const

Returns
The bounding box around all visible entities.
RDocument & RDocument::getClipboard ( )
static
RBlock::Id RDocument::getCurrentBlockId ( ) const
RColor RDocument::getCurrentColor ( ) const
RLayer::Id RDocument::getCurrentLayerId ( )
RLinetype::Id RDocument::getCurrentLinetypeId ( ) const
RLinetypePattern RDocument::getCurrentLinetypePattern ( ) const
RLineweight::Lineweight RDocument::getCurrentLineweight ( ) const
RView::Id RDocument::getCurrentViewId ( ) const
QList< QSharedPointer< RObject > > RDocument::getDefaultLinetypes ( )
QString RDocument::getDimensionFont ( ) const
QString RDocument::getFileName ( ) const
QString RDocument::getFileVersion ( ) const
QVariant RDocument::getKnownVariable ( RS::KnownVariable  key,
const QVariant &  defaultValue = RDEFAULT_QVARIANT 
) const
RLayer::Id RDocument::getLayerId ( const QString &  layerName) const
QString RDocument::getLayerName ( RLayer::Id  layerId) const
QSet< QString > RDocument::getLayerNames ( ) const
RS::LinearFormat RDocument::getLinearFormat ( )
Returns
The linear format type for this document. This is determined by the variable "$DIMLUNIT".
int RDocument::getLinearPrecision ( )
Returns
The linear precision for this document. This is determined by the variable "$DIMDEC".
RLinetype::Id RDocument::getLinetypeByBlockId ( ) const
inline
RLinetype::Id RDocument::getLinetypeByLayerId ( ) const
inline
QString RDocument::getLinetypeDescription ( RLinetype::Id  linetypeId) const
RLinetype::Id RDocument::getLinetypeId ( const QString &  linetypeName) const
QString RDocument::getLinetypeLabel ( RLinetype::Id  linetypeId) const
QString RDocument::getLinetypeName ( RLinetype::Id  linetypeId) const
QSet< QString > RDocument::getLinetypeNames ( ) const
QList< RLinetypePattern > RDocument::getLinetypePatterns ( ) const
double RDocument::getLinetypeScale ( ) const
RLineweight::Lineweight RDocument::getMaxLineweight ( ) const
RBlock::Id RDocument::getModelSpaceBlockId ( ) const
RBox RDocument::getSelectionBox ( ) const
RSpatialIndex & RDocument::getSpatialIndex ( )
Returns
Reference to the spatial index.
RStorage & RDocument::getStorage ( )
Returns
Reference to storage that backs the document.
const RStorage & RDocument::getStorage ( ) const
QString RDocument::getTempBlockName ( ) const
int RDocument::getTransactionGroup ( ) const
RTransactionStack & RDocument::getTransactionStack ( )
Returns
Reference to the transaction stack for undo/redo handling.
RS::Unit RDocument::getUnit ( ) const
QVariant RDocument::getVariable ( const QString &  key,
const QVariant &  defaultValue = RDEFAULT_QVARIANT,
bool  useSettings = false 
) const
QStringList RDocument::getVariables ( ) const
QSet< QString > RDocument::getViewNames ( ) const
bool RDocument::hasBlock ( const QString &  blockName) const
bool RDocument::hasChildEntities ( REntity::Id  parentId) const
bool RDocument::hasLayer ( const QString &  layerName) const
bool RDocument::hasLinetype ( const QString &  linetypeName) const
bool RDocument::hasSelection ( ) const
bool RDocument::hasVariable ( const QString &  key) const
bool RDocument::hasView ( const QString &  viewName) const
void RDocument::init ( )
void RDocument::initLinetypes ( RTransaction transaction = NULL)
bool RDocument::isBlockFrozen ( RBlock::Id  blockId) const
bool RDocument::isByBlock ( RLinetype::Id  linetypeId) const
bool RDocument::isByLayer ( RLinetype::Id  linetypeId) const
bool RDocument::isEntityEditable ( REntity::Id  entityId) const
bool RDocument::isEntityLayerFrozen ( REntity::Id  entityId) const
bool RDocument::isLayerFrozen ( RLayer::Id  layerId) const
bool RDocument::isLayerLocked ( RLayer::Id  layerId) const
bool RDocument::isMetric ( ) const
bool RDocument::isModified ( ) const
bool RDocument::isRedoAvailable ( ) const
bool RDocument::isSelected ( REntity::Id  entityId)
bool RDocument::isUndoAvailable ( ) const
QSet< REntity::Id > RDocument::queryAllBlockReferences ( ) const
QSet< RBlock::Id > RDocument::queryAllBlocks ( ) const
QSet< REntity::Id > RDocument::queryAllEntities ( bool  undone = false,
bool  allBlocks = false,
RS::EntityType  type = RS::EntityAll 
) const

Queries all entities of this document.

This operation can be slow, depending on the total number of entities and the storage type that is used for this document.

Returns
Set of entity IDs.
QSet< RLayer::Id > RDocument::queryAllLayers ( ) const

Queries all layers of this document.

Returns
Set of layer IDs.
QSet< RLinetype::Id > RDocument::queryAllLinetypes ( ) const
QSet< RObject::Id > RDocument::queryAllObjects ( ) const

Queries all objects of this document.

Returns
Set of object IDs.
QSet< RUcs::Id > RDocument::queryAllUcs ( ) const

Queries all UCSs of this document.

Returns
Set of UCS IDs.
QSet< RView::Id > RDocument::queryAllViews ( ) const
QSharedPointer< RBlock > RDocument::queryBlock ( RBlock::Id  blockId) const
QSharedPointer< RBlock > RDocument::queryBlock ( const QString &  blockName) const
QSharedPointer< RBlock > RDocument::queryBlockDirect ( RBlock::Id  blockId) const
QSet< REntity::Id > RDocument::queryBlockEntities ( RBlock::Id  blockId) const
QSet< REntity::Id > RDocument::queryBlockReferences ( RBlock::Id  blockId) const
QSet< REntity::Id > RDocument::queryChildEntities ( REntity::Id  parentId,
RS::EntityType  type = RS::EntityAll 
) const
REntity::Id RDocument::queryClosestXY ( const RVector wcsPosition,
double  range,
bool  draft,
double  strictRange = RMAXDOUBLE,
bool  includeLockedLayers = true 
)

Queries the one entity that is closest to the given position and within the given range (2d).

Parameters
wcsPositionThe position to which the entity has to be close (2d).
rangeThe range in which to search.
REntity::Id RDocument::queryClosestXY ( QSet< REntity::Id > &  candidates,
const RVector wcsPosition,
double  range,
bool  draft,
double  strictRange = RMAXDOUBLE 
)

Queries the entity that is closest to the given position wcsPosition.

Only entities in the given set of candidates are considered. candidates is usually the result of an approximate spatial index query.

Parameters
candidatesSets of candidates to consider.
wcsPosition
rangeMaximum distance between position and entity.
QSet< REntity::Id > RDocument::queryContainedEntities ( const RBox box)

Queries all entities which are completely inside the given box.

Parameters
boxQuery box.
resultSet of IDs of entities that are completely inside the given area.
QSet< REntity::Id > RDocument::queryContainedEntitiesXY ( const RBox box)
QSharedPointer< RBlock > RDocument::queryCurrentBlock ( )
QSharedPointer< RLayer > RDocument::queryCurrentLayer ( )
QSharedPointer< RView > RDocument::queryCurrentView ( )
QSharedPointer< RDocumentVariables > RDocument::queryDocumentVariables ( ) const
QSharedPointer< RDocumentVariables > RDocument::queryDocumentVariablesDirect ( ) const
QSharedPointer< REntity > RDocument::queryEntity ( REntity::Id  entityId) const

Queries the entity with the given ID.

Returns
Pointer to the entity or NULL.
QSharedPointer< REntity > RDocument::queryEntityDirect ( REntity::Id  entityId) const

Queries the entity with the given ID.

If the storage has the entity instantiated, the instance is returned (rather than a clone).

Returns
Pointer to the entity or NULL.
QSet< REntity::Id > RDocument::queryInfiniteEntities ( )
QSet< REntity::Id > RDocument::queryIntersectedEntitiesXY ( const RBox box,
bool  checkBoundingBoxOnly = false,
bool  includeLockedLayers = true,
RBlock::Id  blockId = RBlock::INVALID_ID,
const QList< RS::EntityType > &  filter = RDEFAULT_QLIST_RS_ENTITYTYPE 
)
QMap< REntity::Id, QSet< int > > RDocument::queryIntersectedShapesXY ( const RBox box,
bool  checkBoundingBoxOnly = false,
bool  includeLockedLayers = true,
RBlock::Id  blockId = RBlock::INVALID_ID,
const QList< RS::EntityType > &  filter = RDEFAULT_QLIST_RS_ENTITYTYPE 
)
QSharedPointer< RLayer > RDocument::queryLayer ( RLayer::Id  layerId) const

Queries the layer with the given ID.

Returns
Pointer to the layer or NULL.
QSharedPointer< RLayer > RDocument::queryLayer ( const QString &  layerName) const

Queries the layer with the given name.

Returns
Pointer to the layer or NULL.
QSharedPointer< RLayer > RDocument::queryLayerDirect ( RLayer::Id  layerId) const

Queries the layer with the given ID direct (no cloning).

Returns
Pointer to the layer or NULL.
QSet< REntity::Id > RDocument::queryLayerEntities ( RLayer::Id  layerId,
bool  allBlocks = false 
) const
QSharedPointer< RLinetype > RDocument::queryLinetype ( RLinetype::Id  linetypeId) const
QSharedPointer< RLinetype > RDocument::queryLinetype ( const QString &  linetypeName) const
QSharedPointer< RObject > RDocument::queryObject ( RObject::Id  objectId) const

Queries the object with the given ID.

Returns
Shared pointer to the object or a null pointer.
QSharedPointer< RObject > RDocument::queryObjectByHandle ( RObject::Handle  objectHandle) const
QSharedPointer< RObject > RDocument::queryObjectDirect ( RObject::Id  objectId) const

Queries the object with the given ID.

If the storage has the object instantiated, the instance is returned (rather than a clone).

Returns
Pointer to the object or NULL.
QSet< REntity::Id > RDocument::querySelectedEntities ( )

Queries all selected entities.

Returns
Set of IDs of all selected entities.
QSharedPointer< RUcs > RDocument::queryUcs ( RUcs::Id  ucsId) const

Queries the UCS with the given ID.

Returns
Pointer to the UCS or NULL.
QSharedPointer< RUcs > RDocument::queryUcs ( const QString &  ucsName) const

Queries the UCS with the given name.

Returns
Pointer to the UCS or NULL.
QSharedPointer< RView > RDocument::queryView ( RView::Id  viewId) const
QSharedPointer< RView > RDocument::queryView ( const QString &  viewName) const
void RDocument::rebuildSpatialIndex ( )
virtual

Rebuilds the entire spatial index from scratch (e.g.

when current block is changed).

QList< RTransaction > RDocument::redo ( )

Redoes a previously undone transaction.

Returns
Set of affected entity IDs. Higher level callers can use this set to update scenes, views, etc accordingly.
void RDocument::removeBlockFromSpatialIndex ( RBlock::Id  blockId)
void RDocument::removeFromSpatialIndex ( QSharedPointer< REntity entity)
virtual
void RDocument::resetTransactionStack ( )
void RDocument::selectAllEntites ( QSet< REntity::Id > *  affectedEntities = NULL)

Selects all not selected entities.

void RDocument::selectEntities ( const QSet< REntity::Id > &  entityIds,
bool  add = false,
QSet< REntity::Id > *  affectedEntities = NULL 
)

Selects all entities with the given IDs.

Todo:
refactoring to operation
Parameters
addTrue to add the entities to the current selection. False to replace the current selection with the new entities.
affectedOptional pointer to an empty set of entity IDs. After the call, this set will contain all entity IDs of entities that were affected by the call.
void RDocument::selectEntity ( REntity::Id  entityId,
bool  add = false,
QSet< REntity::Id > *  affectedEntities = NULL 
)

Selects the entity with the given ID.

Todo:
refactoring to operation
Parameters
addTrue to add the entity to the current selection. False to replace the current selection with the given entity.
affectedOptional pointer to an empty set of entity IDs. After the call, this set will contain all entity IDs of entities that were affected by the call.
void RDocument::setCurrentBlock ( RBlock::Id  blockId)
void RDocument::setCurrentBlock ( const QString &  blockName)
void RDocument::setCurrentColor ( const RColor color)
void RDocument::setCurrentLayer ( RLayer::Id  layerId,
RTransaction transaction = NULL 
)
void RDocument::setCurrentLayer ( const QString &  layerName,
RTransaction transaction = NULL 
)
void RDocument::setCurrentLinetype ( RLinetype::Id  ltId)
void RDocument::setCurrentLinetype ( const QString &  name)
void RDocument::setCurrentLinetypePattern ( const RLinetypePattern p)
void RDocument::setCurrentLineweight ( RLineweight::Lineweight  lw)
void RDocument::setCurrentView ( RView::Id  viewId)
void RDocument::setCurrentView ( const QString &  viewName)
void RDocument::setDimensionFont ( const QString &  f,
RTransaction transaction = NULL 
)
void RDocument::setFileName ( const QString &  fn)
void RDocument::setFileVersion ( const QString &  fv)
void RDocument::setKnownVariable ( RS::KnownVariable  key,
const QVariant &  value,
RTransaction transaction = NULL 
)
void RDocument::setKnownVariable ( RS::KnownVariable  key,
const RVector value,
RTransaction transaction = NULL 
)
void RDocument::setLinetypeScale ( double  v,
RTransaction transaction = NULL 
)
void RDocument::setModified ( bool  m)
void RDocument::setUnit ( RS::Unit  unit,
RTransaction transaction = NULL 
)
void RDocument::setVariable ( const QString &  key,
const QVariant &  value,
bool  overwrite = true 
)
bool RDocument::showLeadingZeroes ( )
bool RDocument::showLeadingZeroesAngle ( )
bool RDocument::showTrailingZeroes ( )
bool RDocument::showTrailingZeroesAngle ( )
void RDocument::startTransactionGroup ( )
QList< RTransaction > RDocument::undo ( )

Undoes the last transaction.

Returns
The transaction that was undone. Higher level callers can use this set to update scenes, views, etc accordingly.
void RDocument::updateAllEntities ( )

Friends And Related Function Documentation

QDebug operator<< ( QDebug  dbg,
RDocument d 
)
friend

Stream operator for QDebug.

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

Member Data Documentation

RDocument * RDocument::clipboard = NULL
staticprotected

Copyright (c) 2011-2015 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.

QString RDocument::fileName
private
QString RDocument::fileVersion
private
RLinetype::Id RDocument::linetypeByBlockId
private
RLinetype::Id RDocument::linetypeByLayerId
private
RBlock::Id RDocument::modelSpaceBlockId
private
RSpatialIndex& RDocument::spatialIndex
private
RStorage& RDocument::storage
private
RTransactionStack RDocument::transactionStack
private

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