QCAD
Open Source 2D CAD
REllipseEntity.h
Go to the documentation of this file.
1 
20 #ifndef RELLIPSEENTITY_H
21 #define RELLIPSEENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "REntity.h"
26 #include "REllipseData.h"
27 #include "RLineweight.h"
28 
29 class RDocument;
30 class RExporter;
31 
40 
41 public:
53 
66 
73 
75 
76 public:
77  REllipseEntity(RDocument* document, const REllipseData& data,
78  RObject::Id objectId = RObject::INVALID_ID);
79  virtual ~REllipseEntity();
80 
81  static void init();
82 
83  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
85  }
86 
87  virtual REllipseEntity* clone() const {
88  return new REllipseEntity(*this);
89  }
90 
91  virtual RS::EntityType getType() const {
92  return RS::EntityEllipse;
93  }
94 
95  void setShape(const REllipse& e);
96 
97  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
98  RTransaction* transaction=NULL);
99  QPair<QVariant, RPropertyAttributes> getProperty(
100  RPropertyTypeId& propertyTypeId,
101  bool humanReadable = false, bool noAttributes = false);
102 
103  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
104 
105  virtual REllipseData& getData() {
106  return data;
107  }
108 
109  virtual const REllipseData& getData() const {
110  return data;
111  }
112 
113  RVector getCenter() const {
114  return data.getCenter();
115  }
116 
118  return data.getMajorPoint();
119  }
120 
121  double getMajorRadius() const {
122  return data.getMajorRadius();
123  }
124 
125  double getMinorRadius() const {
126  return data.getMinorRadius();
127  }
128 
129  double getRatio() const {
130  return data.getRatio();
131  }
132 
133  double getAngle() const {
134  return data.getAngle();
135  }
136 
137  void setRatio(double ratio) {
138  data.setRatio(ratio);
139  }
140 
141  double getStartAngle() const {
142  return data.getStartAngle();
143  }
144 
145  double getStartParam() const {
146  return data.getStartParam();
147  }
148 
149  void setStartParam(double param) {
150  data.setStartParam(param);
151  }
152 
153  double getEndAngle() const {
154  return data.getEndAngle();
155  }
156 
157  double getEndParam() const {
158  return data.getEndParam();
159  }
160 
161  void setEndParam(double param) {
162  data.setEndParam(param);
163  }
164 
165  double getAngleLength() const {
166  return data.getAngleLength();
167  }
168 
169  bool isReversed() const {
170  return data.isReversed();
171  }
172 
173  void setReversed(bool reversed) {
174  data.setReversed(reversed);
175  }
176 
178  return data.getStartPoint();
179  }
180 
182  return data.getEndPoint();
183  }
184 
185  bool isFullEllipse() const {
186  return data.isFullEllipse();
187  }
188 
189  virtual bool reverse() {
190  return data.reverse();
191  }
192 
193  double getParamTo(const RVector& pos) {
194  return data.getParamTo(pos);
195  }
196 
198  const RVector& trimPoint) {
199  return data.getTrimEnd(coord, trimPoint);
200  }
201 
202  void trimStartPoint(const RVector& p) {
203  return data.trimStartPoint(p);
204  }
205 
206  void trimEndPoint(const RVector& p) {
207  return data.trimEndPoint(p);
208  }
209 
210  double getLength() const {
211  return data.getLength();
212  }
213 
214  double getSweep() const {
215  return data.getSweep();
216  }
217 
218  RVector getPointAt(double angle) const {
219  return data.getPointAt(angle);
220  }
221 
222 protected:
223  virtual void print(QDebug dbg) const;
224 
225 protected:
227 };
228 
230 Q_DECLARE_METATYPE(QSharedPointer<REllipseEntity>)
231 Q_DECLARE_METATYPE(QSharedPointer<REllipseEntity>*)
232 
233 #endif
Ending
Entity ending.
Definition: RS.h:136
RVector getCenter() const
Definition: REllipseEntity.h:113
double getStartParam() const
Definition: REllipseEntity.h:145
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
static RPropertyTypeId PropertyColor
Definition: REllipseEntity.h:51
static RPropertyTypeId PropertyCenterX
Definition: REllipseEntity.h:54
static RPropertyTypeId PropertyCenterZ
Definition: REllipseEntity.h:56
virtual const REllipseData & getData() const
Definition: REllipseEntity.h:109
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:75
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
bool isFullEllipse() const
Definition: REllipseEntity.h:185
Ellipse entity.
Definition: REllipseEntity.h:39
double getAngle() const
Definition: REllipseEntity.h:133
RS::Ending getTrimEnd(const RVector &coord, const RVector &trimPoint)
Definition: REllipseEntity.h:197
void setStartParam(double param)
Definition: REllipseEntity.h:149
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyTypeId.h:57
static RPropertyTypeId PropertyStartAngle
Definition: REllipseEntity.h:63
void trimEndPoint(const RVector &p)
Definition: REllipseEntity.h:206
static RPropertyTypeId PropertyBlock
Definition: REllipseEntity.h:46
bool isReversed() const
Definition: REllipseEntity.h:169
RVector getMajorPoint() const
Definition: REllipseEntity.h:117
int Id
Definition: RObject.h:53
static RPropertyTypeId PropertyEndPointX
Definition: REllipseEntity.h:70
RVector getStartPoint() const
Definition: REllipseEntity.h:177
static RPropertyTypeId PropertyLineweight
Definition: REllipseEntity.h:50
void trimStartPoint(const RVector &p)
Definition: REllipseEntity.h:202
Transaction implementation.
Definition: RTransaction.h:70
double getStartAngle() const
Definition: REllipseEntity.h:141
static RPropertyTypeId PropertyType
Definition: REllipseEntity.h:45
static RPropertyTypeId PropertyMajorPointX
Definition: REllipseEntity.h:57
static const Id INVALID_ID
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RObject.h:54
static RPropertyTypeId PropertyEndPointY
Definition: REllipseEntity.h:71
void setRatio(double ratio)
Definition: REllipseEntity.h:137
Ellipse.
Definition: RS.h:89
virtual bool reverse()
Definition: REllipseEntity.h:189
double getParamTo(const RVector &pos)
Definition: REllipseEntity.h:193
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: REllipseEntity.h:42
double getAngleLength() const
Definition: REllipseEntity.h:165
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: REllipseEntity.h:83
static RPropertyTypeId PropertyEndParam
Definition: REllipseEntity.h:62
static RPropertyTypeId PropertyMajorPointY
Definition: REllipseEntity.h:58
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
Base class for all entity classes.
Definition: REntity.h:64
static RPropertyTypeId PropertyStartPointX
Definition: REllipseEntity.h:67
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
static RPropertyTypeId PropertyStartParam
Definition: REllipseEntity.h:61
static RPropertyTypeId PropertyDrawOrder
Definition: REllipseEntity.h:52
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyStartPointZ
Definition: REllipseEntity.h:69
Low-level mathematical representation of an ellipse or ellipse arc.
Definition: REllipse.h:41
static RPropertyTypeId PropertyEndPointZ
Definition: REllipseEntity.h:72
double getMinorRadius() const
Definition: REllipseEntity.h:125
static RPropertyTypeId PropertyProtected
Definition: REllipseEntity.h:44
REllipseData data
Definition: REllipseEntity.h:226
static RPropertyTypeId PropertyLinetypeScale
Definition: REllipseEntity.h:49
static RPropertyTypeId PropertyCircumference
Definition: REllipseEntity.h:74
static RPropertyTypeId PropertyHandle
Definition: REllipseEntity.h:43
virtual REllipseData & getData()
Definition: REllipseEntity.h:105
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:193
double getLength() const
Definition: REllipseEntity.h:210
static void init()
Definition: REntity.cpp:71
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:277
static RPropertyTypeId PropertyCenterY
Definition: REllipseEntity.h:55
Abstract base class for exporters.
Definition: RExporter.h:63
double getMajorRadius() const
Definition: REllipseEntity.h:121
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: REllipseData.h:40
void setReversed(bool reversed)
Definition: REllipseEntity.h:173
static RPropertyTypeId PropertyLayer
Definition: REllipseEntity.h:47
RVector getPointAt(double angle) const
Definition: REllipseEntity.h:218
double getSweep() const
Definition: REllipseEntity.h:214
static RPropertyTypeId PropertyMajorPointZ
Definition: REllipseEntity.h:59
virtual RS::EntityType getType() const
Definition: REllipseEntity.h:91
static RPropertyTypeId PropertyEndAngle
Definition: REllipseEntity.h:64
static RPropertyTypeId PropertyLinetype
Definition: REllipseEntity.h:48
RVector getEndPoint() const
Definition: REllipseEntity.h:181
static RPropertyTypeId PropertyStartPointY
Definition: REllipseEntity.h:68
void setEndParam(double param)
Definition: REllipseEntity.h:161
static RPropertyTypeId PropertyRatio
Definition: REllipseEntity.h:60
double getEndAngle() const
Definition: REllipseEntity.h:153
double getEndParam() const
Definition: REllipseEntity.h:157
virtual REllipseEntity * clone() const
Definition: REllipseEntity.h:87
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
double getRatio() const
Definition: REllipseEntity.h:129
static RPropertyTypeId PropertyReversed
Definition: REllipseEntity.h:65
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:385