QCAD
Open Source 2D CAD
|
Abstract base class for all objects. More...
#include <RObject.h>
Public Types | |
typedef int | Handle |
typedef int | Id |
enum | ObjectFlag { NoFlags = 0x000, Undone = 0x001, Protect = 0x002, Selected = 0x004, Invisible = 0x008, WorkingSet = 0x010 } |
enum | XYZ { X, Y, Z } |
Public Member Functions | |
virtual RObject * | clone () const =0 |
void | copyCustomPropertiesFrom (RObject *other, const QString &title=RDEFAULT_QSTRING, bool overwrite=false, const QStringList &ignoreList=RDEFAULT_QSTRINGLIST, const QString &mapKeyFrom=RDEFAULT_QSTRING, const QString &mapKeyTo=RDEFAULT_QSTRING) |
Copies all custom properties from the given object. More... | |
void | dump () const |
virtual int | getComplexity () const |
virtual bool | getCustomBoolProperty (const QString &title, const QString &key, bool defaultValue) const |
virtual double | getCustomDoubleProperty (const QString &title, const QString &key, double defaultValue) const |
virtual int | getCustomIntProperty (const QString &title, const QString &key, int defaultValue) const |
QMap< QString, QVariantMap > | getCustomProperties () const |
virtual QVariant | getCustomProperty (const QString &title, const QString &key, const QVariant &defaultValue=RDEFAULT_QVARIANT) const |
QStringList | getCustomPropertyKeys (const QString &title) const |
QStringList | getCustomPropertyTitles () const |
virtual QSet< RPropertyTypeId > | getCustomPropertyTypeIds () const |
RDocument * | getDocument () |
const RDocument * | getDocument () const |
bool | getFlag (int flag) const |
RObject::Handle | getHandle () const |
RObject::Id | getId () const |
virtual QPair< QVariant, RPropertyAttributes > | getProperty (RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false) |
virtual QSet< RPropertyTypeId > | getPropertyTypeIds (RPropertyAttributes::Option option=RPropertyAttributes::NoOptions) const |
virtual RS::EntityType | getType () const =0 |
bool | hasCustomProperties () const |
bool | hasCustomProperty (const QString &title, const QRegExp &key) const |
bool | hasCustomProperty (const QString &title, const QString &key) const |
virtual bool | hasPropertyType (RPropertyTypeId propertyTypeId) |
bool | isInvisible () const |
bool | isProtected () const |
virtual bool | isSelected () const |
bool | isUndone () const |
virtual bool | isWorkingSet () const |
virtual bool | mustAlwaysClone () const |
virtual void | removeCustomProperty (const QString &title, const QString &key) |
Removes the custom property with the given name. More... | |
RObject (const RObject &other) | |
RObject (RDocument *document=NULL) | |
virtual void | setAutoUpdatesBlocked (bool on) |
virtual void | setCustomProperties (const RQMapQStringQString &properties) |
virtual void | setCustomProperty (const QString &title, const QString &key, const QVariant &value) |
Sets a custom property with the given name. More... | |
void | setDocument (RDocument *document) |
void | setFlag (int flag, bool on=true) |
void | setInvisible (bool on) |
virtual bool | setProperty (RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL) |
Sets the given property to the given value. More... | |
void | setProtected (bool on) |
virtual void | setSelected (bool on) |
virtual void | setWorkingSet (bool on) |
virtual bool | validate () |
virtual | ~RObject () |
Static Public Member Functions | |
static RPropertyAttributes | getCustomPropertyAttributes (const QString &title, const QString &key) |
static void | init () |
static void | setCustomPropertyAttributes (const QString &title, const QString &key, const RPropertyAttributes &att) |
Set attributes (read-only, invisible, ...) for the given custom property. More... | |
template<class T > | |
static bool | setMember (T &variable, const QVariant &value, bool condition=true) |
Static Public Attributes | |
static const Handle | INVALID_HANDLE = -1 |
static const Id | INVALID_ID = -1 |
Copyright (c) 2011-2018 by Andrew Mustun. More... | |
static RPropertyTypeId | PropertyCustom |
static RPropertyTypeId | PropertyHandle |
static RPropertyTypeId | PropertyInvisible |
static RPropertyTypeId | PropertyProtected |
static RPropertyTypeId | PropertySelected |
static RPropertyTypeId | PropertyType |
static RPropertyTypeId | PropertyWorkingSet |
Protected Member Functions | |
virtual void | print (QDebug dbg) const |
Stream operator for QDebug. More... | |
void | setHandle (RObject::Handle h) |
void | setId (RObject::Id id) |
bool | setMemberFlag (int flag, const QVariant &value, bool condition=true) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | setUndone (bool on) |
Static Protected Member Functions | |
static bool | setMember (bool &variable, const QVariant &value, bool condition=true) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
static bool | setMember (double &variable, const QVariant &value, bool condition=true) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
static bool | setMember (int &variable, const QVariant &value, bool condition=true) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
static bool | setMember (QList< double > &variable, const QVariant &value, bool condition) |
static bool | setMember (QString &variable, const QVariant &value, bool condition=true) |
Sets the given property. More... | |
static bool | setMemberVector (QList< RVector > &variable, const QVariant &value, RObject::XYZ xyz) |
static bool | setMemberX (QList< RVector > &variable, const QVariant &value, bool condition=true) |
static bool | setMemberY (QList< RVector > &variable, const QVariant &value, bool condition=true) |
static bool | setMemberZ (QList< RVector > &variable, const QVariant &value, bool condition=true) |
Private Attributes | |
QMap< QString, QVariantMap > | customProperties |
AppID -> key -> value e.g. More... | |
RDocument * | document |
Flags | flags |
Object flags (undone, protected, ...) More... | |
Handle | handle |
Handle of this object (from DXF / DWG). More... | |
Id | objectId |
Unique ID of this object. More... | |
Static Private Attributes | |
static QMap< QString, QMap< QString, RPropertyAttributes > > | customPropertyAttributes |
Attributes of custom properties (read-only, invisible, ...). More... | |
Friends | |
QDebug | operator<< (QDebug dbg, const RObject &o) |
class | RStorage |
Abstract base class for all objects.
Objects have an unique ID. Object types may register property types. Objects manage their own set of properties. Example objects are entities, layers, user coordinate systems.
typedef int RObject::Handle |
typedef int RObject::Id |
enum RObject::ObjectFlag |
enum RObject::XYZ |
RObject::RObject | ( | RDocument * | document = NULL | ) |
RObject::RObject | ( | const RObject & | other | ) |
|
virtual |
|
pure virtual |
Implemented in REntity, RLayout, RDimAngular2LEntity, RDimArcLengthEntity, RDimAngular3PEntity, RLayer, RDimRotatedEntity, RDimOrdinateEntity, RPolylineEntity, RDimAlignedEntity, RDimDiametricEntity, RDimRadialEntity, RSplineEntity, RAttributeEntity, REllipseEntity, RTextEntity, RAttributeDefinitionEntity, RImageEntity, RArcEntity, RFaceEntity, RSolidEntity, RTraceEntity, RUcs, RHatchEntity, RBlockReferenceEntity, RViewportEntity, RRayEntity, RXLineEntity, RToleranceEntity, RLineEntity, RCircleEntity, RLeaderEntity, RLinetype, RBlock, RPointEntity, RView, RLayerState, and RDocumentVariables.
void RObject::copyCustomPropertiesFrom | ( | RObject * | other, |
const QString & | title = RDEFAULT_QSTRING , |
||
bool | overwrite = false , |
||
const QStringList & | ignoreList = RDEFAULT_QSTRINGLIST , |
||
const QString & | mapKeyFrom = RDEFAULT_QSTRING , |
||
const QString & | mapKeyTo = RDEFAULT_QSTRING |
||
) |
Copies all custom properties from the given object.
Existing properties can be overwritten.
|
inline |
|
inlinevirtual |
Reimplemented in REntity, RPolylineEntity, RSplineEntity, and RHatchEntity.
|
virtual |
|
virtual |
|
virtual |
QMap< QString, QVariantMap > RObject::getCustomProperties | ( | ) | const |
|
virtual |
|
static |
QStringList RObject::getCustomPropertyKeys | ( | const QString & | title | ) | const |
QStringList RObject::getCustomPropertyTitles | ( | ) | const |
|
virtual |
Reimplemented in RDocumentVariables.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
virtual |
Reimplemented in REntity, RLayout, RLayer, RBlock, RLinetype, RDimAngular2LEntity, RDimArcLengthEntity, RView, RAttributeEntity, RDimAngular3PEntity, RDimRotatedEntity, RPolylineEntity, RDimOrdinateEntity, RAttributeDefinitionEntity, RHatchEntity, RDimAlignedEntity, RDimDiametricEntity, RDimRadialEntity, RDimensionEntity, RSplineEntity, RDimLinearEntity, REllipseEntity, RTextBasedEntity, RArcEntity, RImageEntity, RBlockReferenceEntity, RFaceEntity, RSolidEntity, RTraceEntity, RViewportEntity, RRayEntity, RXLineEntity, RUcs, RToleranceEntity, RLineEntity, RCircleEntity, RLeaderEntity, RPointEntity, RLayerState, and RDocumentVariables.
|
virtual |
Reimplemented in RBlockReferenceEntity.
|
pure virtual |
Implemented in RLayout, REntity, RLayer, RUcs, RLinetype, RBlock, RView, RLayerState, and RDocumentVariables.
bool RObject::hasCustomProperties | ( | ) | const |
bool RObject::hasCustomProperty | ( | const QString & | title, |
const QRegExp & | key | ||
) | const |
bool RObject::hasCustomProperty | ( | const QString & | title, |
const QString & | key | ||
) | const |
|
inlinevirtual |
|
static |
|
inline |
|
inline |
|
inlinevirtual |
Reimplemented in REntity.
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in RLayerState.
|
protectedvirtual |
Stream operator for QDebug.
Reimplemented in REntity, RPolylineEntity, RLayout, RSplineEntity, RTextBasedEntity, REllipseEntity, RDimensionEntity, RHatchEntity, RLeaderEntity, RBlockReferenceEntity, RViewportEntity, RArcEntity, RRayEntity, RXLineEntity, RImageEntity, RLineEntity, RDimOrdinateEntity, RFaceEntity, RSolidEntity, RDimAngular2LEntity, RBlock, RDimRotatedEntity, RToleranceEntity, RTraceEntity, RDocumentVariables, RDimAlignedEntity, RDimArcLengthEntity, RDimDiametricEntity, RDimAngular3PEntity, RAttributeEntity, RDimAngularEntity, RLinetype, RAttributeDefinitionEntity, RDimRadialEntity, RDimLinearEntity, RCircleEntity, RTextEntity, and RPointEntity.
|
virtual |
Removes the custom property with the given name.
|
inlinevirtual |
Reimplemented in REntity.
|
virtual |
|
virtual |
Sets a custom property with the given name.
Reimplemented in RBlock.
|
static |
Set attributes (read-only, invisible, ...) for the given custom property.
void RObject::setDocument | ( | RDocument * | document | ) |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
staticprotected |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
staticprotected |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
staticprotected |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
staticprotected |
value | A list for int / double pairs: QList<QPair<int, double> > |
|
staticprotected |
Sets the given property.
variable | a reference to the (member) variable we want to set |
value | the new value |
condition | the variable is only set to the new value if condition is true |
true | if condition is true and the value was successfully converted to the same type as the variable. |
|
inlinestatic |
|
protected |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
staticprotected |
value | A QList of QPairs of int and double where the int is the index and the double the value. |
|
staticprotected |
value | A list of int / double pairs: QList<QPair<int, double> > representing indexes in the list and values. |
|
staticprotected |
value | A list of int / double pairs: QList<QPair<int, double> > representing indexes in the list and values. |
|
staticprotected |
value | A list of int / double pairs: QList<QPair<int, double> > representing indexes in the list and values. |
|
virtual |
Sets the given property to the given value.
If this property owner does not know a property with that ID, it is up to the property owner what happens. The property might be added into a list of dynamic properties or dropped.
Reimplemented in REntity, RLayout, RLayer, RBlock, RLinetype, RView, RDimAngular2LEntity, RDimArcLengthEntity, RAttributeEntity, RDimAngular3PEntity, RDimRotatedEntity, RPolylineEntity, RDimOrdinateEntity, RAttributeDefinitionEntity, RDimAlignedEntity, RDimDiametricEntity, RDimRadialEntity, RHatchEntity, RDimensionEntity, RSplineEntity, RDimLinearEntity, REllipseEntity, RTextBasedEntity, RArcEntity, RUcs, RImageEntity, RBlockReferenceEntity, RFaceEntity, RSolidEntity, RTraceEntity, RViewportEntity, RRayEntity, RXLineEntity, RToleranceEntity, RLineEntity, RCircleEntity, RLeaderEntity, RPointEntity, RDocumentVariables, and RLayerState.
|
inline |
|
inlinevirtual |
Reimplemented in REntity.
|
protected |
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in RPolylineEntity.
|
friend |
|
friend |
|
private |
AppID -> key -> value e.g.
'QCAD' -> 'wall thickness' -> 12.0; or 'SomeApplication' -> '00001_1000' -> 'SomeString' where '00001' is the position in the list of values and 1000 is the original DXF code from the file.
|
staticprivate |
Attributes of custom properties (read-only, invisible, ...).
|
private |
|
private |
Object flags (undone, protected, ...)
|
private |
Handle of this object (from DXF / DWG).
|
static |
|
static |
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.
|
private |
Unique ID of this object.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |