QCAD
Open Source 2D CAD
RBlockReferenceEntity.h
Go to the documentation of this file.
1 
20 #ifndef RBLOCKREFERENCEENTITY_H
21 #define RBLOCKREFERENCEENTITY_H
22 
23 #include "core_global.h"
24 
25 #include "REntity.h"
26 #include "RBlockReferenceData.h"
27 
28 class RDocument;
29 class RExporter;
30 
39 
40 public:
54 
67 
68 public:
69  RBlockReferenceEntity(RDocument* document, const RBlockReferenceData& data);
71  virtual ~RBlockReferenceEntity();
72 
73  static void init();
74 
75  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
77  }
78 
79  virtual RBlockReferenceEntity* clone() const {
80  return new RBlockReferenceEntity(*this);
81  }
82 
83  virtual QSet<RPropertyTypeId> getPropertyTypeIds(RPropertyAttributes::Option option = RPropertyAttributes::NoOptions) const;
84 
85  virtual bool setProperty(RPropertyTypeId propertyTypeId,
86  const QVariant& value, RTransaction* transaction=NULL);
87  virtual QPair<QVariant, RPropertyAttributes> getProperty(
88  RPropertyTypeId& propertyTypeId,
89  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
90 
91 // virtual void setSelected(bool on);
92 
93  virtual void exportEntity(RExporter& e, bool preview = false, bool forceSelected=false) const;
94 
96  return data;
97  }
98 
99  virtual const RBlockReferenceData& getData() const {
100  return data;
101  }
102 
104  return data.getPosition();
105  }
106 
107  void setPosition(const RVector& pos) {
108  data.setPosition(pos);
109  }
110 
112  return data.getScaleFactors();
113  }
114 
115  void setScaleFactors(const RVector sf) {
116  data.setScaleFactors(sf);
117  }
118 
119  double getRotation() const {
120  return data.getRotation();
121  }
122 
123  void setRotation(double r) {
124  data.setRotation(r);
125  }
126 
127  int getColumnCount() const {
128  return data.getColumnCount();
129  }
130  void setColumnCount(int c) {
131  data.setColumnCount(c);
132  }
133 
134  int getRowCount() const {
135  return data.getRowCount();
136  }
137  void setRowCount(int c) {
138  data.setRowCount(c);
139  }
140 
141  double getColumnSpacing() const {
142  return data.getColumnSpacing();
143  }
144  void setColumnSpacing(double s) {
145  data.setColumnSpacing(s);
146  }
147 
148  double getRowSpacing() const {
149  return data.getRowSpacing();
150  }
151  void setRowSpacing(double s) {
152  data.setRowSpacing(s);
153  }
154 
156  data.setReferencedBlockId(blockId);
157  }
158 
159  void setReferencedBlockName(const QString& blockName) {
160  data.setReferencedBlockName(blockName);
161  }
162 
164  return data.getReferencedBlockId();
165  }
166 
167  QString getReferencedBlockName() const {
168  return data.getReferencedBlockName();
169  }
170 
171  //virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
172 
173  virtual void update() const {
174  data.update();
175  }
176 
177  void update(REntity::Id entityId) const {
178  data.update(entityId);
179  }
180 
181  QSharedPointer<REntity> queryEntity(REntity::Id entityId, bool transform = false, bool ignoreAttDef = true) const {
182  return data.queryEntity(entityId, transform, ignoreAttDef);
183  }
184 
185  bool applyTransformationTo(REntity& entity) const {
186  return data.applyTransformationTo(entity);
187  }
188 
192  bool applyTransformationTo(QSharedPointer<REntity>& entity) const {
193  return data.applyTransformationTo(entity);
194  }
195 
196  RVector mapToBlock(const RVector& v) const {
197  return data.mapToBlock(v);
198  }
199 
203  virtual void print(QDebug dbg) const;
204 
205 protected:
207  mutable int recursionDepth;
208 };
209 
211 Q_DECLARE_METATYPE(QSharedPointer<RBlockReferenceEntity>)
212 Q_DECLARE_METATYPE(QSharedPointer<RBlockReferenceEntity>*)
213 
214 #endif
RBlockReferenceEntity::PropertyRowSpacing
static RPropertyTypeId PropertyRowSpacing
Definition: RBlockReferenceEntity.h:66
REntity.h
RBlockReferenceEntity::getStaticPropertyTypeIds
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RBlockReferenceEntity.h:75
RBlockReferenceEntity::setRowSpacing
void setRowSpacing(double s)
Definition: RBlockReferenceEntity.h:151
RBlockReferenceEntity::setReferencedBlockId
void setReferencedBlockId(RBlock::Id blockId)
Definition: RBlockReferenceEntity.h:155
RBlockReferenceEntity::getData
virtual RBlockReferenceData & getData()
Definition: RBlockReferenceEntity.h:95
RBlockReferenceEntity::clone
virtual RBlockReferenceEntity * clone() const
Definition: RBlockReferenceEntity.h:79
RBlockReferenceEntity::PropertyColor
static RPropertyTypeId PropertyColor
Definition: RBlockReferenceEntity.h:51
RBlockReferenceEntity::setColumnSpacing
void setColumnSpacing(double s)
Definition: RBlockReferenceEntity.h:144
RBlockReferenceEntity::PropertyType
static RPropertyTypeId PropertyType
Definition: RBlockReferenceEntity.h:45
RBlockReferenceEntity::setScaleFactors
void setScaleFactors(const RVector sf)
Definition: RBlockReferenceEntity.h:115
RBlockReferenceEntity::setRowCount
void setRowCount(int c)
Definition: RBlockReferenceEntity.h:137
RBlockReferenceEntity::setReferencedBlockName
void setReferencedBlockName(const QString &blockName)
Definition: RBlockReferenceEntity.h:159
RBlockReferenceEntity::PropertyColumnSpacing
static RPropertyTypeId PropertyColumnSpacing
Definition: RBlockReferenceEntity.h:65
RBlockReferenceEntity::data
RBlockReferenceData data
Definition: RBlockReferenceEntity.h:206
RBlockReferenceEntity::PropertyRowCount
static RPropertyTypeId PropertyRowCount
Definition: RBlockReferenceEntity.h:64
RBlockReferenceEntity::update
virtual void update() const
Definition: RBlockReferenceEntity.h:173
RBlockReferenceEntity::getColumnSpacing
double getColumnSpacing() const
Definition: RBlockReferenceEntity.h:141
RBlockReferenceEntity::PropertyLinetype
static RPropertyTypeId PropertyLinetype
Definition: RBlockReferenceEntity.h:48
RBlockReferenceEntity::getScaleFactors
RVector getScaleFactors() const
Definition: RBlockReferenceEntity.h:111
RVector
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RBlockReferenceEntity::PropertyLinetypeScale
static RPropertyTypeId PropertyLinetypeScale
Definition: RBlockReferenceEntity.h:49
RBlockReferenceEntity::PropertyScaleY
static RPropertyTypeId PropertyScaleY
Definition: RBlockReferenceEntity.h:60
RBlockReferenceEntity::PropertyCustom
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RBlockReferenceEntity.h:41
RBlockReferenceEntity::getPosition
RVector getPosition() const
Definition: RBlockReferenceEntity.h:103
REntity::exportEntity
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
RBlockReferenceEntity::getData
virtual const RBlockReferenceData & getData() const
Definition: RBlockReferenceEntity.h:99
RPropertyAttributes::Option
Option
Definition: RPropertyAttributes.h:48
RBlockReferenceEntity::PropertyBlock
static RPropertyTypeId PropertyBlock
Definition: RBlockReferenceEntity.h:46
RBlockReferenceEntity::getRotation
double getRotation() const
Definition: RBlockReferenceEntity.h:119
RBlockReferenceEntity::PropertyScaleZ
static RPropertyTypeId PropertyScaleZ
Definition: RBlockReferenceEntity.h:61
RBlockReferenceEntity::mapToBlock
RVector mapToBlock(const RVector &v) const
Definition: RBlockReferenceEntity.h:196
RBlockReferenceEntity::PropertyReferencedBlock
static RPropertyTypeId PropertyReferencedBlock
Definition: RBlockReferenceEntity.h:55
RBlockReferenceEntity::setColumnCount
void setColumnCount(int c)
Definition: RBlockReferenceEntity.h:130
REntity
Base class for all entity classes.
Definition: REntity.h:65
RBlockReferenceEntity::PropertyDrawOrder
static RPropertyTypeId PropertyDrawOrder
Definition: RBlockReferenceEntity.h:53
RBlockReferenceEntity::PropertyProtected
static RPropertyTypeId PropertyProtected
Definition: RBlockReferenceEntity.h:43
RBlockReferenceEntity::PropertyWorkingSet
static RPropertyTypeId PropertyWorkingSet
Definition: RBlockReferenceEntity.h:44
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
RBlockReferenceEntity::queryEntity
QSharedPointer< REntity > queryEntity(REntity::Id entityId, bool transform=false, bool ignoreAttDef=true) const
Definition: RBlockReferenceEntity.h:181
RBlockReferenceEntity::PropertyLineweight
static RPropertyTypeId PropertyLineweight
Definition: RBlockReferenceEntity.h:50
RBlockReferenceEntity::PropertyRotation
static RPropertyTypeId PropertyRotation
Definition: RBlockReferenceEntity.h:62
RBlockReferenceEntity::applyTransformationTo
bool applyTransformationTo(QSharedPointer< REntity > &entity) const
Definition: RBlockReferenceEntity.h:192
RBlockReferenceEntity::PropertyHandle
static RPropertyTypeId PropertyHandle
Definition: RBlockReferenceEntity.h:42
RBlockReferenceEntity::update
void update(REntity::Id entityId) const
Definition: RBlockReferenceEntity.h:177
RBlockReferenceEntity::getReferencedBlockId
RBlock::Id getReferencedBlockId() const
Definition: RBlockReferenceEntity.h:163
RBlockReferenceData
Defines the geometry and appearance of a block reference entity.
Definition: RBlockReferenceData.h:41
REntity::init
static void init()
Definition: REntity.cpp:88
REntity::print
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:455
RPropertyTypeId
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyTypeId.h:59
RBlockReferenceEntity::getRowCount
int getRowCount() const
Definition: RBlockReferenceEntity.h:134
RObject::Id
int Id
Definition: RObject.h:66
RBlockReferenceEntity::applyTransformationTo
bool applyTransformationTo(REntity &entity) const
Definition: RBlockReferenceEntity.h:185
core_global.h
RObject::getPropertyTypeIds
virtual QSet< RPropertyTypeId > getPropertyTypeIds(RPropertyAttributes::Option option=RPropertyAttributes::NoOptions) const
Definition: RObject.cpp:424
RBlockReferenceEntity::recursionDepth
int recursionDepth
Definition: RBlockReferenceEntity.h:207
RExporter
Abstract base class for exporters.
Definition: RExporter.h:72
REntity::setProperty
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:323
RDocument
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:72
RBlockReferenceEntity::PropertyPositionX
static RPropertyTypeId PropertyPositionX
Definition: RBlockReferenceEntity.h:56
RBlockReferenceEntity::setRotation
void setRotation(double r)
Definition: RBlockReferenceEntity.h:123
RBlockReferenceData.h
RBlockReferenceEntity::PropertyPositionY
static RPropertyTypeId PropertyPositionY
Definition: RBlockReferenceEntity.h:57
RBlockReferenceEntity::getRowSpacing
double getRowSpacing() const
Definition: RBlockReferenceEntity.h:148
RBlockReferenceEntity::setPosition
void setPosition(const RVector &pos)
Definition: RBlockReferenceEntity.h:107
RPropertyAttributes::NoOptions
@ NoOptions
Definition: RPropertyAttributes.h:49
RBlockReferenceEntity::PropertyPositionZ
static RPropertyTypeId PropertyPositionZ
Definition: RBlockReferenceEntity.h:58
RBlockReferenceEntity::PropertyColumnCount
static RPropertyTypeId PropertyColumnCount
Definition: RBlockReferenceEntity.h:63
RBlockReferenceEntity::getColumnCount
int getColumnCount() const
Definition: RBlockReferenceEntity.h:127
REntity::getProperty
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: REntity.cpp:230
RTransaction
Transaction implementation.
Definition: RTransaction.h:74
RPropertyTypeId::getPropertyTypeIds
static QSet< RPropertyTypeId > getPropertyTypeIds(const std::type_info &classInfo, RPropertyAttributes::Option=RPropertyAttributes::NoOptions)
Gets all property type IDs that where registered for the given class.
Definition: RPropertyTypeId.cpp:273
RBlockReferenceEntity::PropertyScaleX
static RPropertyTypeId PropertyScaleX
Definition: RBlockReferenceEntity.h:59
RBlockReferenceEntity::PropertyLayer
static RPropertyTypeId PropertyLayer
Definition: RBlockReferenceEntity.h:47
RBlockReferenceEntity::PropertyDisplayedColor
static RPropertyTypeId PropertyDisplayedColor
Definition: RBlockReferenceEntity.h:52
RBlockReferenceEntity
Block reference entity.
Definition: RBlockReferenceEntity.h:38
QCADCORE_EXPORT
#define QCADCORE_EXPORT
Definition: core_global.h:10
RBlockReferenceEntity::getReferencedBlockName
QString getReferencedBlockName() const
Definition: RBlockReferenceEntity.h:167