QCAD
Open Source 2D CAD
RLeaderEntity.h
Go to the documentation of this file.
1 
20 #ifndef RLEADERENTITY_H
21 #define RLEADERENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "REntity.h"
26 #include "RLeaderData.h"
27 
28 class RDocument;
29 class RExporter;
30 
39  Q_DECLARE_TR_FUNCTIONS(RLeaderEntity)
40 
41 public:
54 
60 
61 public:
62  RLeaderEntity(RDocument* document, const RLeaderData& data);
63  RLeaderEntity(const RLeaderEntity& other);
64  virtual ~RLeaderEntity();
65 
66  static void init();
67 
68  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
70  }
71 
72  virtual RLeaderEntity* clone() const {
73  return new RLeaderEntity(*this);
74  }
75 
76  virtual RS::EntityType getType() const {
77  return RS::EntityLeader;
78  }
79 
80  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
81  RTransaction* transaction=NULL);
82  QPair<QVariant, RPropertyAttributes> getProperty(
83  RPropertyTypeId& propertyTypeId,
84  bool humanReadable = false, bool noAttributes = false);
85 
86  virtual RLeaderData& getData() {
87  return data;
88  }
89 
90  void setData(RLeaderData& d) {
91  data = d;
92  }
93 
94  virtual const RLeaderData& getData() const {
95  return data;
96  }
97 
98  void setArrowHead(bool on) {
99  data.setArrowHead(on);
100  }
101 
102  bool hasArrowHead() const {
103  return data.hasArrowHead();
104  }
105 
106  void clear() {
107  data.clear();
108  }
109 
110  void normalize() {
111  data.normalize();
112  }
113 
114  int countVertices() const {
115  return data.countVertices();
116  }
117 
118  void appendVertex(const RVector& vertex, double bulge=0.0) {
119  Q_UNUSED(bulge);
120  data.appendVertex(vertex);
121  }
122 
123  void prependVertex(const RVector& vertex, double bulge=0.0) {
124  Q_UNUSED(bulge);
125  data.prependVertex(vertex);
126  }
127 
128  void insertVertex(int index, const RVector& vertex) {
129  data.insertVertex(index, vertex);
130  }
131 
132  RVector getVertexAt(int i) const {
133  return data.getVertexAt(i);
134  }
135 
136  void setVertexAt(int i, const RVector& v) {
137  data.setVertexAt(i, v);
138  }
139 
141  data.removeLastVertex();
142  }
143 
144  void removeVertex(int index) {
145  data.removeVertex(index);
146  }
147 
148  int countSegments() const {
149  return data.countSegments();
150  }
151 
152  QSharedPointer<RShape> getSegmentAt(int i) const {
153  return data.getSegmentAt(i);
154  }
155 
156  double getBulgeAt(int i) const {
157  return data.getBulgeAt(i);
158  }
159 
160  void setBulgeAt(int i, double b) {
161  data.setBulgeAt(i, b);
162  }
163 
164  double getDirection1() const {
165  return data.getDirection1();
166  }
167 
168  double getDirection2() const {
169  return data.getDirection2();
170  }
171 
173  return data.getEndPoint();
174  }
175 
177  return data.getStartPoint();
178  }
179 
180  void setClosed(bool on) {
181  data.setClosed(on);
182  }
183 
184  bool isClosed() const {
185  return data.isClosed();
186  }
187 
188  QList<QSharedPointer<RShape> > getExploded() const {
189  return data.getExploded();
190  }
191 
192  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
193 
194 protected:
195  virtual void print(QDebug dbg) const;
196 
197 protected:
199 };
200 
202 Q_DECLARE_METATYPE(QSharedPointer<RLeaderEntity>)
203 Q_DECLARE_METATYPE(QSharedPointer<RLeaderEntity>*)
204 
205 #endif
RVector getVertexAt(int i) const
Definition: RLeaderEntity.h:132
static RPropertyTypeId PropertyDrawOrder
Definition: RLeaderEntity.h:53
QSharedPointer< RShape > getSegmentAt(int i) const
Definition: RLeaderEntity.h:152
RLeaderData data
Definition: RLeaderEntity.h:198
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
int countSegments() const
Definition: RLeaderEntity.h:148
void clear()
Definition: RLeaderEntity.h:106
static RPropertyTypeId PropertyProtected
Definition: RLeaderEntity.h:44
static RPropertyTypeId PropertyBlock
Definition: RLeaderEntity.h:46
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
void normalize()
Definition: RLeaderEntity.h:110
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
void insertVertex(int index, const RVector &vertex)
Definition: RLeaderEntity.h:128
static RPropertyTypeId PropertyDimLeaderBlock
Definition: RLeaderEntity.h:56
QList< QSharedPointer< RShape > > getExploded() const
Definition: RLeaderEntity.h:188
double getDirection2() const
Definition: RLeaderEntity.h:168
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
void prependVertex(const RVector &vertex, double bulge=0.0)
Definition: RLeaderEntity.h:123
Leader entity class.
Definition: RLeaderEntity.h:38
void appendVertex(const RVector &vertex, double bulge=0.0)
Definition: RLeaderEntity.h:118
void setData(RLeaderData &d)
Definition: RLeaderEntity.h:90
static RPropertyTypeId PropertyType
Definition: RLeaderEntity.h:45
Transaction implementation.
Definition: RTransaction.h:74
static RPropertyTypeId PropertyColor
Definition: RLeaderEntity.h:51
void setArrowHead(bool on)
Definition: RLeaderEntity.h:98
double getDirection1() const
Definition: RLeaderEntity.h:164
static RPropertyTypeId PropertyLinetypeScale
Definition: RLeaderEntity.h:49
static RPropertyTypeId PropertyVertexNZ
Definition: RLeaderEntity.h:59
static RPropertyTypeId PropertyVertexNY
Definition: RLeaderEntity.h:58
void setClosed(bool on)
Definition: RLeaderEntity.h:180
static RPropertyTypeId PropertyArrowHead
Definition: RLeaderEntity.h:55
virtual RS::EntityType getType() const
Definition: RLeaderEntity.h:76
static RPropertyTypeId PropertyVertexNX
Definition: RLeaderEntity.h:57
static RPropertyTypeId PropertyLayer
Definition: RLeaderEntity.h:47
static RPropertyTypeId PropertyLinetype
Definition: RLeaderEntity.h:48
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
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RLeaderData.h:37
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
Q_DECLARE_METATYPE(RMath *)
RVector getEndPoint() const
Definition: RLeaderEntity.h:172
void setBulgeAt(int i, double b)
Definition: RLeaderEntity.h:160
static RPropertyTypeId PropertyDisplayedColor
Definition: RLeaderEntity.h:52
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RLeaderEntity.h:68
static RPropertyTypeId PropertyLineweight
Definition: RLeaderEntity.h:50
virtual RLeaderEntity * clone() const
Definition: RLeaderEntity.h:72
bool isClosed() const
Definition: RLeaderEntity.h:184
void setVertexAt(int i, const RVector &v)
Definition: RLeaderEntity.h:136
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:228
static RPropertyTypeId PropertyHandle
Definition: RLeaderEntity.h:43
virtual const RLeaderData & getData() const
Definition: RLeaderEntity.h:94
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
virtual RLeaderData & getData()
Definition: RLeaderEntity.h:86
bool hasArrowHead() const
Definition: RLeaderEntity.h:102
RVector getStartPoint() const
Definition: RLeaderEntity.h:176
void removeLastVertex()
Definition: RLeaderEntity.h:140
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RLeaderEntity.h:42
int countVertices() const
Definition: RLeaderEntity.h:114
double getBulgeAt(int i) const
Definition: RLeaderEntity.h:156
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
Leader.
Definition: RS.h:116
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:428
void removeVertex(int index)
Definition: RLeaderEntity.h:144