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  void setShape(const REllipse& e);
92 
93  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
94  RTransaction* transaction=NULL);
95  QPair<QVariant, RPropertyAttributes> getProperty(
96  RPropertyTypeId& propertyTypeId,
97  bool humanReadable = false, bool noAttributes = false);
98 
99  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
100 
101  virtual REllipseData& getData() {
102  return data;
103  }
104 
105  virtual const REllipseData& getData() const {
106  return data;
107  }
108 
109  RVector getCenter() const {
110  return data.getCenter();
111  }
112 
114  return data.getMajorPoint();
115  }
116 
117  double getMajorRadius() const {
118  return data.getMajorRadius();
119  }
120 
121  double getMinorRadius() const {
122  return data.getMinorRadius();
123  }
124 
125  double getRatio() const {
126  return data.getRatio();
127  }
128 
129  double getAngle() const {
130  return data.getAngle();
131  }
132 
133  void setRatio(double ratio) {
134  data.setRatio(ratio);
135  }
136 
137  double getStartAngle() const {
138  return data.getStartAngle();
139  }
140 
141  double getStartParam() const {
142  return data.getStartParam();
143  }
144 
145  void setStartParam(double param) {
146  data.setStartParam(param);
147  }
148 
149  double getEndAngle() const {
150  return data.getEndAngle();
151  }
152 
153  double getEndParam() const {
154  return data.getEndParam();
155  }
156 
157  void setEndParam(double param) {
158  data.setEndParam(param);
159  }
160 
161  double getAngleLength() const {
162  return data.getAngleLength();
163  }
164 
165  double getAngleAt(double distance, RS::From from) const {
166  return data.getAngleAt(distance, from);
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, bool extend = false) {
214  return data.trimStartPoint(trimPoint, clickPoint, extend);
215  }
216 
217  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
218  return data.trimEndPoint(trimPoint, clickPoint, extend);
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  RPolyline approximateWithArcs(int segments) const {
238  return data.approximateWithArcs(segments);
239  }
240 
241 protected:
242  virtual void print(QDebug dbg) const;
243 
244 protected:
246 };
247 
249 Q_DECLARE_METATYPE(QSharedPointer<REllipseEntity>)
250 Q_DECLARE_METATYPE(QSharedPointer<REllipseEntity>*)
251 
252 #endif
Ending
Entity ending.
Definition: RS.h:152
RVector getCenter() const
Definition: REllipseEntity.h:109
double getStartParam() const
Definition: REllipseEntity.h:141
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:105
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
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:129
void setStartParam(double param)
Definition: REllipseEntity.h:145
Copyright (c) 2011-2017 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
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: REllipseEntity.h:213
static RPropertyTypeId PropertyDisplayedColor
Definition: REllipseEntity.h:52
double getAngleAt(double distance, RS::From from) const
Definition: REllipseEntity.h:165
RVector getMajorPoint() const
Definition: REllipseEntity.h:113
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:74
double getStartAngle() const
Definition: REllipseEntity.h:137
static RPropertyTypeId PropertyType
Definition: REllipseEntity.h:45
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: REllipseEntity.h:217
static RPropertyTypeId PropertyMajorPointX
Definition: REllipseEntity.h:58
static RPropertyTypeId PropertyEndPointY
Definition: REllipseEntity.h:72
void setRatio(double ratio)
Definition: REllipseEntity.h:133
Side
Side used for side of a point relativ to an entity (right hand or left hand side) ...
Definition: RS.h:142
virtual bool reverse()
Definition: REllipseEntity.h:197
double getParamTo(const RVector &pos)
Definition: REllipseEntity.h:205
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: REllipseEntity.h:42
double getAngleLength() const
Definition: REllipseEntity.h:161
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:42
static RPropertyTypeId PropertyEndPointZ
Definition: REllipseEntity.h:73
double getMinorRadius() const
Definition: REllipseEntity.h:121
double getDirection1() const
Definition: REllipseEntity.h:189
static RPropertyTypeId PropertyProtected
Definition: REllipseEntity.h:44
REllipseData data
Definition: REllipseEntity.h:245
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:101
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:117
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: REllipseData.h:40
void setReversed(bool reversed)
Definition: REllipseEntity.h:173
From
End used to specify from which end of a shape to measure a distance.
Definition: RS.h:200
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
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
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:317
static RPropertyTypeId PropertyStartPointY
Definition: REllipseEntity.h:69
void setEndParam(double param)
Definition: REllipseEntity.h:157
static RPropertyTypeId PropertyRatio
Definition: REllipseEntity.h:61
double getEndAngle() const
Definition: REllipseEntity.h:149
double getEndParam() const
Definition: REllipseEntity.h:153
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:125
static RPropertyTypeId PropertyReversed
Definition: REllipseEntity.h:66
RPolyline approximateWithArcs(int segments) const
Definition: REllipseEntity.h:237
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:468