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  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
77  RTransaction* transaction=NULL);
78  QPair<QVariant, RPropertyAttributes> getProperty(
79  RPropertyTypeId& propertyTypeId,
80  bool humanReadable = false, bool noAttributes = false);
81 
82  virtual RLeaderData& getData() {
83  return data;
84  }
85 
86  void setData(RLeaderData& d) {
87  data = d;
88  }
89 
90  virtual const RLeaderData& getData() const {
91  return data;
92  }
93 
94  void setArrowHead(bool on) {
95  data.setArrowHead(on);
96  }
97 
98  bool hasArrowHead() const {
99  return data.hasArrowHead();
100  }
101 
102  void clear() {
103  data.clear();
104  }
105 
106  void normalize() {
107  data.normalize();
108  }
109 
110  int countVertices() const {
111  return data.countVertices();
112  }
113 
114  void appendVertex(const RVector& vertex, double bulge=0.0) {
115  Q_UNUSED(bulge);
116  data.appendVertex(vertex);
117  }
118 
119  void prependVertex(const RVector& vertex, double bulge=0.0) {
120  Q_UNUSED(bulge);
121  data.prependVertex(vertex);
122  }
123 
124  void insertVertex(int index, const RVector& vertex) {
125  data.insertVertex(index, vertex);
126  }
127 
128  RVector getVertexAt(int i) const {
129  return data.getVertexAt(i);
130  }
131 
132  void setVertexAt(int i, const RVector& v) {
133  data.setVertexAt(i, v);
134  }
135 
137  data.removeLastVertex();
138  }
139 
140  void removeVertex(int index) {
141  data.removeVertex(index);
142  }
143 
144  int countSegments() const {
145  return data.countSegments();
146  }
147 
148  QSharedPointer<RShape> getSegmentAt(int i) const {
149  return data.getSegmentAt(i);
150  }
151 
152  double getBulgeAt(int i) const {
153  return data.getBulgeAt(i);
154  }
155 
156  void setBulgeAt(int i, double b) {
157  data.setBulgeAt(i, b);
158  }
159 
160  double getDirection1() const {
161  return data.getDirection1();
162  }
163 
164  double getDirection2() const {
165  return data.getDirection2();
166  }
167 
169  return data.getEndPoint();
170  }
171 
173  return data.getStartPoint();
174  }
175 
176  void setClosed(bool on) {
177  data.setClosed(on);
178  }
179 
180  bool isClosed() const {
181  return data.isClosed();
182  }
183 
184  QList<QSharedPointer<RShape> > getExploded() const {
185  return data.getExploded();
186  }
187 
188  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
189 
190 protected:
191  virtual void print(QDebug dbg) const;
192 
193 protected:
195 };
196 
198 Q_DECLARE_METATYPE(QSharedPointer<RLeaderEntity>)
199 Q_DECLARE_METATYPE(QSharedPointer<RLeaderEntity>*)
200 
201 #endif
RVector getVertexAt(int i) const
Definition: RLeaderEntity.h:128
static RPropertyTypeId PropertyDrawOrder
Definition: RLeaderEntity.h:53
QSharedPointer< RShape > getSegmentAt(int i) const
Definition: RLeaderEntity.h:148
RLeaderData data
Definition: RLeaderEntity.h:194
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
int countSegments() const
Definition: RLeaderEntity.h:144
void clear()
Definition: RLeaderEntity.h:102
static RPropertyTypeId PropertyProtected
Definition: RLeaderEntity.h:44
static RPropertyTypeId PropertyBlock
Definition: RLeaderEntity.h:46
void normalize()
Definition: RLeaderEntity.h:106
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
void insertVertex(int index, const RVector &vertex)
Definition: RLeaderEntity.h:124
static RPropertyTypeId PropertyDimLeaderBlock
Definition: RLeaderEntity.h:56
QList< QSharedPointer< RShape > > getExploded() const
Definition: RLeaderEntity.h:184
double getDirection2() const
Definition: RLeaderEntity.h:164
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
void prependVertex(const RVector &vertex, double bulge=0.0)
Definition: RLeaderEntity.h:119
Leader entity class.
Definition: RLeaderEntity.h:38
void appendVertex(const RVector &vertex, double bulge=0.0)
Definition: RLeaderEntity.h:114
void setData(RLeaderData &d)
Definition: RLeaderEntity.h:86
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:94
double getDirection1() const
Definition: RLeaderEntity.h:160
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:176
static RPropertyTypeId PropertyArrowHead
Definition: RLeaderEntity.h:55
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-2017 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:168
void setBulgeAt(int i, double b)
Definition: RLeaderEntity.h:156
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:180
void setVertexAt(int i, const RVector &v)
Definition: RLeaderEntity.h:132
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:90
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:82
bool hasArrowHead() const
Definition: RLeaderEntity.h:98
RVector getStartPoint() const
Definition: RLeaderEntity.h:172
void removeLastVertex()
Definition: RLeaderEntity.h:136
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RLeaderEntity.h:42
int countVertices() const
Definition: RLeaderEntity.h:110
double getBulgeAt(int i) const
Definition: RLeaderEntity.h:152
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:468
void removeVertex(int index)
Definition: RLeaderEntity.h:140