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