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