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