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:
52 
65 
66 public:
68  RObject::Id objectId = RObject::INVALID_ID);
70  virtual ~RBlockReferenceEntity();
71 
72  static void init();
73 
74  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
76  }
77 
78  virtual RBlockReferenceEntity* clone() const {
79  return new RBlockReferenceEntity(*this);
80  }
81 
82  virtual RS::EntityType getType() const {
83  return RS::EntityBlockRef;
84  }
85 
86  virtual QSet<RPropertyTypeId> getPropertyTypeIds() const;
87 
88  virtual bool setProperty(RPropertyTypeId propertyTypeId,
89  const QVariant& value, RTransaction* transaction=NULL);
90  virtual QPair<QVariant, RPropertyAttributes> getProperty(
91  RPropertyTypeId& propertyTypeId,
92  bool humanReadable = false, bool noAttributes = false);
93 
94 // virtual void setSelected(bool on);
95 
96  virtual void exportEntity(RExporter& e, bool preview = false, bool forceSelected=false) const;
97 
99  return data;
100  }
101 
102  virtual const RBlockReferenceData& getData() const {
103  return data;
104  }
105 
107  return data.getPosition();
108  }
109 
110  void setPosition(const RVector& pos) {
111  data.setPosition(pos);
112  }
113 
115  return data.getScaleFactors();
116  }
117 
118  void setScaleFactors(const RVector sf) {
119  data.setScaleFactors(sf);
120  }
121 
122  double getRotation() const {
123  return data.getRotation();
124  }
125 
126  void setRotation(double r) {
127  data.setRotation(r);
128  }
129 
130  int getColumnCount() const {
131  return data.getColumnCount();
132  }
133  void setColumnCount(int c) {
134  data.setColumnCount(c);
135  }
136 
137  int getRowCount() const {
138  return data.getRowCount();
139  }
140  void setRowCount(int c) {
141  data.setRowCount(c);
142  }
143 
144  double getColumnSpacing() const {
145  return data.getColumnSpacing();
146  }
147  void setColumnSpacing(double s) {
148  data.setColumnSpacing(s);
149  }
150 
151  double getRowSpacing() const {
152  return data.getRowSpacing();
153  }
154  void setRowSpacing(double s) {
155  data.setRowSpacing(s);
156  }
157 
159  data.setReferencedBlockId(blockId);
160  }
161 
163  return data.getReferencedBlockId();
164  }
165 
166  QString getReferencedBlockName() const {
167  return data.getReferencedBlockName();
168  }
169 
170  //virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
171 
172  virtual void update() const {
173  data.update();
174  }
175 
176  void update(REntity::Id entityId) const {
177  data.update(entityId);
178  }
179 
180  QSharedPointer<REntity> queryEntity(REntity::Id entityId) const {
181  return data.queryEntity(entityId);
182  }
183 
184  bool applyTransformationTo(REntity& entity) const {
185  return data.applyTransformationTo(entity);
186  }
187 
188  RVector mapToBlock(const RVector& v) const {
189  return data.mapToBlock(v);
190  }
191 
195  virtual void print(QDebug dbg) const;
196 
197 protected:
199  mutable int recursionDepth;
200 };
201 
205 
206 #endif
static RPropertyTypeId PropertyColor
Definition: RBlockReferenceEntity.h:50
void setColumnSpacing(double s)
Definition: RBlockReferenceEntity.h:147
static RPropertyTypeId PropertyType
Definition: RBlockReferenceEntity.h:44
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RBlockReferenceEntity.h:41
void setScaleFactors(const RVector sf)
Definition: RBlockReferenceEntity.h:118
virtual RBlockReferenceEntity * clone() const
Definition: RBlockReferenceEntity.h:78
void update(REntity::Id entityId) const
Definition: RBlockReferenceEntity.h:176
static RPropertyTypeId PropertyColumnSpacing
Definition: RBlockReferenceEntity.h:63
static RPropertyTypeId PropertyPositionY
Definition: RBlockReferenceEntity.h:55
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
static RPropertyTypeId PropertyRowSpacing
Definition: RBlockReferenceEntity.h:64
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RBlockReferenceEntity.h:74
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:75
double getRotation() const
Definition: RBlockReferenceEntity.h:122
static RPropertyTypeId PropertyLinetypeScale
Definition: RBlockReferenceEntity.h:48
static RPropertyTypeId PropertyDrawOrder
Definition: RBlockReferenceEntity.h:51
virtual RBlockReferenceData & getData()
Definition: RBlockReferenceEntity.h:98
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyTypeId.h:57
#define QCADCORE_EXPORT
Definition: core_global.h:10
void setRowCount(int c)
Definition: RBlockReferenceEntity.h:140
int Id
Definition: RObject.h:53
RBlockReferenceData data
Definition: RBlockReferenceEntity.h:198
static RPropertyTypeId PropertyRowCount
Definition: RBlockReferenceEntity.h:62
Transaction implementation.
Definition: RTransaction.h:70
static RPropertyTypeId PropertyBlock
Definition: RBlockReferenceEntity.h:45
static RPropertyTypeId PropertyLinetype
Definition: RBlockReferenceEntity.h:47
double getColumnSpacing() const
Definition: RBlockReferenceEntity.h:144
static const Id INVALID_ID
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RObject.h:54
RBlock::Id getReferencedBlockId() const
Definition: RBlockReferenceEntity.h:162
static RPropertyTypeId PropertyHandle
Definition: RBlockReferenceEntity.h:42
virtual RS::EntityType getType() const
Definition: RBlockReferenceEntity.h:82
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
RVector getScaleFactors() const
Definition: RBlockReferenceEntity.h:114
int recursionDepth
Definition: RBlockReferenceEntity.h:199
Base class for all entity classes.
Definition: REntity.h:64
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
static RPropertyTypeId PropertyReferencedBlock
Definition: RBlockReferenceEntity.h:53
static RPropertyTypeId PropertyScaleZ
Definition: RBlockReferenceEntity.h:59
Q_DECLARE_METATYPE(RMath *)
void setColumnCount(int c)
Definition: RBlockReferenceEntity.h:133
static RPropertyTypeId PropertyScaleX
Definition: RBlockReferenceEntity.h:57
static RPropertyTypeId PropertyProtected
Definition: RBlockReferenceEntity.h:43
static RPropertyTypeId PropertyPositionX
Definition: RBlockReferenceEntity.h:54
static RPropertyTypeId PropertyScaleY
Definition: RBlockReferenceEntity.h:58
static RPropertyTypeId PropertyLineweight
Definition: RBlockReferenceEntity.h:49
static RPropertyTypeId PropertyRotation
Definition: RBlockReferenceEntity.h:60
Defines the geometry and appearance of a block reference entity.
Definition: RBlockReferenceData.h:39
RVector mapToBlock(const RVector &v) const
Definition: RBlockReferenceEntity.h:188
void setRotation(double r)
Definition: RBlockReferenceEntity.h:126
virtual void update() const
Definition: RBlockReferenceEntity.h:172
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:193
QString getReferencedBlockName() const
Definition: RBlockReferenceEntity.h:166
Block reference.
Definition: RS.h:80
static RPropertyTypeId PropertyColumnCount
Definition: RBlockReferenceEntity.h:61
static void init()
Definition: REntity.cpp:71
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:277
Abstract base class for exporters.
Definition: RExporter.h:63
int getRowCount() const
Definition: RBlockReferenceEntity.h:137
double getRowSpacing() const
Definition: RBlockReferenceEntity.h:151
Block reference entity.
Definition: RBlockReferenceEntity.h:38
QSharedPointer< REntity > queryEntity(REntity::Id entityId) const
Definition: RBlockReferenceEntity.h:180
void setPosition(const RVector &pos)
Definition: RBlockReferenceEntity.h:110
virtual QSet< RPropertyTypeId > getPropertyTypeIds() const
Definition: RObject.cpp:356
static RPropertyTypeId PropertyPositionZ
Definition: RBlockReferenceEntity.h:56
int getColumnCount() const
Definition: RBlockReferenceEntity.h:130
virtual const RBlockReferenceData & getData() const
Definition: RBlockReferenceEntity.h:102
void setRowSpacing(double s)
Definition: RBlockReferenceEntity.h:154
void setReferencedBlockId(RBlock::Id blockId)
Definition: RBlockReferenceEntity.h:158
bool applyTransformationTo(REntity &entity) const
Definition: RBlockReferenceEntity.h:184
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
RVector getPosition() const
Definition: RBlockReferenceEntity.h:106
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:385
static RPropertyTypeId PropertyLayer
Definition: RBlockReferenceEntity.h:46