QCAD
Open Source 2D CAD
RAttributeEntity.h
Go to the documentation of this file.
1 
20 #ifndef RATTRIBUTEENTITY_H
21 #define RATTRIBUTEENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "RTextBasedEntity.h"
27 #include "RAttributeData.h"
28 
29 class RDocument;
30 class RExporter;
31 
40 
41  Q_DECLARE_TR_FUNCTIONS(RAttributeEntity)
42 
43 public:
56 
73 
74 public:
75  RAttributeEntity(RDocument* document, const RAttributeData& data);
76  virtual ~RAttributeEntity();
77 
78  static void init();
79 
80  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
82  }
83 
84  virtual RAttributeEntity* clone() const {
85  return new RAttributeEntity(*this);
86  }
87 
88  virtual RAttributeData& getData() {
89  return data;
90  }
91 
92  virtual const RAttributeData& getData() const {
93  return data;
94  }
95 
97  data = d;
98  }
99 
100 
101  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
102  RTransaction* transaction=NULL);
103  QPair<QVariant, RPropertyAttributes> getProperty(
104  RPropertyTypeId& propertyTypeId,
105  bool humanReadable = false, bool noAttributes = false);
106 
107  virtual bool isVisible() const;
108 
109  void exportEntity(RExporter& e, bool preview, bool forceSelected=false) const;
110 
111  QString getTag() const {
112  return data.getTag();
113  }
114 
115  void setTag(const QString& t) {
116  data.setTag(t);
117  }
118 
119  bool isInvisible() const {
120  return data.isInvisible();
121  }
122 
123  void setInvisible(bool i) {
124  data.setInvisible(i);
125  }
126 
127 protected:
128  virtual void print(QDebug dbg) const;
129 
130 protected:
132 };
133 
135 Q_DECLARE_METATYPE(QSharedPointer<RAttributeEntity>)
136 Q_DECLARE_METATYPE(QSharedPointer<RAttributeEntity>*)
137 
138 #endif
bool isInvisible() const
Definition: RAttributeEntity.h:119
static RPropertyTypeId PropertyPositionY
Definition: RAttributeEntity.h:66
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const
Exports the entity to the given exporter.
Definition: RTextBasedEntity.cpp:157
static RPropertyTypeId PropertyLayer
Definition: RAttributeEntity.h:49
static RPropertyTypeId PropertyHAlign
Definition: RAttributeEntity.h:61
static void init()
Definition: RTextBasedEntity.cpp:58
void setData(RAttributeData &d)
Definition: RAttributeEntity.h:96
static RPropertyTypeId PropertyDrawOrder
Definition: RAttributeEntity.h:55
void setTag(const QString &t)
Definition: RAttributeEntity.h:115
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: RTextBasedEntity.cpp:172
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
static RPropertyTypeId PropertyLinetype
Definition: RAttributeEntity.h:50
virtual const RAttributeData & getData() const
Definition: RAttributeEntity.h:92
Transaction implementation.
Definition: RTransaction.h:74
static RPropertyTypeId PropertyAngle
Definition: RAttributeEntity.h:57
static RPropertyTypeId PropertyPositionX
Definition: RAttributeEntity.h:65
virtual bool isVisible() const
Definition: REntity.cpp:372
static RPropertyTypeId PropertyLinetypeScale
Definition: RAttributeEntity.h:51
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RAttributeEntity.h:44
static RPropertyTypeId PropertyType
Definition: RAttributeEntity.h:47
static RPropertyTypeId PropertyPositionZ
Definition: RAttributeEntity.h:67
Text entity.
Definition: RTextBasedEntity.h:38
static RPropertyTypeId PropertyDisplayedColor
Definition: RAttributeEntity.h:54
static QSet< RPropertyTypeId > getPropertyTypeIds(const std::type_info &classInfo)
Gets all property type IDs that where registered for the given class.
Definition: RPropertyTypeId.cpp:229
bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: RTextBasedEntity.cpp:88
static RPropertyTypeId PropertyHandle
Definition: RAttributeEntity.h:45
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyHeight
Definition: RAttributeEntity.h:62
static RPropertyTypeId PropertyPlainText
Definition: RAttributeEntity.h:70
static RPropertyTypeId PropertyFontName
Definition: RAttributeEntity.h:60
virtual RAttributeData & getData()
Definition: RAttributeEntity.h:88
RAttributeData data
Definition: RAttributeEntity.h:131
static RPropertyTypeId PropertyColor
Definition: RAttributeEntity.h:53
static RPropertyTypeId PropertyBlock
Definition: RAttributeEntity.h:48
static RPropertyTypeId PropertyLineSpacingFactor
Definition: RAttributeEntity.h:64
QString getTag() const
Definition: RAttributeEntity.h:111
static RPropertyTypeId PropertyProtected
Definition: RAttributeEntity.h:46
Stores and manages all data that defines the geometry and appearance of a block attribute entity...
Definition: RAttributeData.h:42
Abstract base class for exporters.
Definition: RExporter.h:71
QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: RTextBasedEntity.cpp:118
static RPropertyTypeId PropertyItalic
Definition: RAttributeEntity.h:63
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RAttributeEntity.h:80
static RPropertyTypeId PropertyVAlign
Definition: RAttributeEntity.h:71
static RPropertyTypeId PropertyLineweight
Definition: RAttributeEntity.h:52
static RPropertyTypeId PropertyBold
Definition: RAttributeEntity.h:59
static RPropertyTypeId PropertyXScale
Definition: RAttributeEntity.h:58
virtual RAttributeEntity * clone() const
Definition: RAttributeEntity.h:84
static RPropertyTypeId PropertyTag
Definition: RAttributeEntity.h:68
static RPropertyTypeId PropertyInvisible
Definition: RAttributeEntity.h:72
Attribute entity.
Definition: RAttributeEntity.h:39
void setInvisible(bool i)
Definition: RAttributeEntity.h:123
static RPropertyTypeId PropertyText
Definition: RAttributeEntity.h:69