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:
54 
67 
74 
76 
77 public:
78  REllipseEntity(RDocument* document, const REllipseData& data);
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  double getDirection1() const {
190  return data.getDirection1();
191  }
192 
193  double getDirection2() const {
194  return data.getDirection2();
195  }
196 
197  virtual bool reverse() {
198  return data.reverse();
199  }
200 
201  RS::Side getSideOfPoint(const RVector& point) const {
202  return data.getSideOfPoint(point);
203  }
204 
205  double getParamTo(const RVector& pos) {
206  return data.getParamTo(pos);
207  }
208 
209  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
210  return data.getTrimEnd(trimPoint, clickPoint);
211  }
212 
213  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid) {
214  return data.trimStartPoint(trimPoint, clickPoint);
215  }
216 
217  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid) {
218  return data.trimEndPoint(trimPoint, clickPoint);
219  }
220 
221  double getLength() const {
222  return data.getLength();
223  }
224 
225  double getSweep() const {
226  return data.getSweep();
227  }
228 
229  RVector getPointAt(double angle) const {
230  return data.getPointAt(angle);
231  }
232 
233  QList<RSpline> approximateWithSplines() const {
234  return data.approximateWithSplines();
235  }
236 
237 protected:
238  virtual void print(QDebug dbg) const;
239 
240 protected:
242 };
243 
245 Q_DECLARE_METATYPE(QSharedPointer<REllipseEntity>)
246 Q_DECLARE_METATYPE(QSharedPointer<REllipseEntity>*)
247 
248 #endif
Ending
Entity ending.
Definition: RS.h:149
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:55
static RPropertyTypeId PropertyCenterZ
Definition: REllipseEntity.h:57
virtual const REllipseData & getData() const
Definition: REllipseEntity.h:109
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid)
Definition: REllipseEntity.h:217
double getDirection2() const
Definition: REllipseEntity.h:193
bool isFullEllipse() const
Definition: REllipseEntity.h:185
Ellipse entity.
Definition: REllipseEntity.h:39
double getAngle() const
Definition: REllipseEntity.h:133
void setStartParam(double param)
Definition: REllipseEntity.h:149
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
static RPropertyTypeId PropertyStartAngle
Definition: REllipseEntity.h:64
static RPropertyTypeId PropertyBlock
Definition: REllipseEntity.h:46
bool isReversed() const
Definition: REllipseEntity.h:169
static RPropertyTypeId PropertyDisplayedColor
Definition: REllipseEntity.h:52
RVector getMajorPoint() const
Definition: REllipseEntity.h:117
static RPropertyTypeId PropertyEndPointX
Definition: REllipseEntity.h:71
RVector getStartPoint() const
Definition: REllipseEntity.h:177
static RPropertyTypeId PropertyLineweight
Definition: REllipseEntity.h:50
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:58
static RPropertyTypeId PropertyEndPointY
Definition: REllipseEntity.h:72
void setRatio(double ratio)
Definition: REllipseEntity.h:137
Ellipse.
Definition: RS.h:99
Side
Side used for side of a point relativ to an entity (right hand or left hand side) ...
Definition: RS.h:139
virtual bool reverse()
Definition: REllipseEntity.h:197
double getParamTo(const RVector &pos)
Definition: REllipseEntity.h:205
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2016 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:63
static RPropertyTypeId PropertyMajorPointY
Definition: REllipseEntity.h:59
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:68
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
static RPropertyTypeId PropertyStartParam
Definition: REllipseEntity.h:62
static RPropertyTypeId PropertyDrawOrder
Definition: REllipseEntity.h:53
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyStartPointZ
Definition: REllipseEntity.h:70
Low-level mathematical representation of an ellipse or ellipse arc.
Definition: REllipse.h:43
static RPropertyTypeId PropertyEndPointZ
Definition: REllipseEntity.h:73
double getMinorRadius() const
Definition: REllipseEntity.h:125
double getDirection1() const
Definition: REllipseEntity.h:189
static RPropertyTypeId PropertyProtected
Definition: REllipseEntity.h:44
REllipseData data
Definition: REllipseEntity.h:241
static RPropertyTypeId PropertyLinetypeScale
Definition: REllipseEntity.h:49
QList< RSpline > approximateWithSplines() const
Definition: REllipseEntity.h:233
static RPropertyTypeId PropertyCircumference
Definition: REllipseEntity.h:75
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:228
double getLength() const
Definition: REllipseEntity.h:221
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
static RPropertyTypeId PropertyCenterY
Definition: REllipseEntity.h:56
Abstract base class for exporters.
Definition: RExporter.h:71
double getMajorRadius() const
Definition: REllipseEntity.h:121
Copyright (c) 2011-2016 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:229
double getSweep() const
Definition: REllipseEntity.h:225
static RPropertyTypeId PropertyMajorPointZ
Definition: REllipseEntity.h:60
RS::Side getSideOfPoint(const RVector &point) const
Definition: REllipseEntity.h:201
virtual RS::EntityType getType() const
Definition: REllipseEntity.h:91
static RPropertyTypeId PropertyEndAngle
Definition: REllipseEntity.h:65
static RPropertyTypeId PropertyLinetype
Definition: REllipseEntity.h:48
RVector getEndPoint() const
Definition: REllipseEntity.h:181
static const RVector invalid
invalid vector
Definition: RVector.h:307
static RPropertyTypeId PropertyStartPointY
Definition: REllipseEntity.h:69
void setEndParam(double param)
Definition: REllipseEntity.h:161
static RPropertyTypeId PropertyRatio
Definition: REllipseEntity.h:61
double getEndAngle() const
Definition: REllipseEntity.h:153
double getEndParam() const
Definition: REllipseEntity.h:157
virtual REllipseEntity * clone() const
Definition: REllipseEntity.h:87
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: REllipseEntity.h:209
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:66
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:428
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid)
Definition: REllipseEntity.h:213