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  double getAngleAt(double distance, RS::From from) const {
170  return data.getAngleAt(distance, from);
171  }
172 
173  bool isReversed() const {
174  return data.isReversed();
175  }
176 
177  void setReversed(bool reversed) {
178  data.setReversed(reversed);
179  }
180 
182  return data.getStartPoint();
183  }
184 
186  return data.getEndPoint();
187  }
188 
189  bool isFullEllipse() const {
190  return data.isFullEllipse();
191  }
192 
193  double getDirection1() const {
194  return data.getDirection1();
195  }
196 
197  double getDirection2() const {
198  return data.getDirection2();
199  }
200 
201  virtual bool reverse() {
202  return data.reverse();
203  }
204 
205  RS::Side getSideOfPoint(const RVector& point) const {
206  return data.getSideOfPoint(point);
207  }
208 
209  double getParamTo(const RVector& pos) {
210  return data.getParamTo(pos);
211  }
212 
213  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
214  return data.getTrimEnd(trimPoint, clickPoint);
215  }
216 
217  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
218  return data.trimStartPoint(trimPoint, clickPoint, extend);
219  }
220 
221  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
222  return data.trimEndPoint(trimPoint, clickPoint, extend);
223  }
224 
225  double getLength() const {
226  return data.getLength();
227  }
228 
229  double getSweep() const {
230  return data.getSweep();
231  }
232 
233  RVector getPointAt(double angle) const {
234  return data.getPointAt(angle);
235  }
236 
237  QList<RSpline> approximateWithSplines() const {
238  return data.approximateWithSplines();
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:150
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
double getDirection2() const
Definition: REllipseEntity.h:197
bool isFullEllipse() const
Definition: REllipseEntity.h:189
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:173
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: REllipseEntity.h:217
static RPropertyTypeId PropertyDisplayedColor
Definition: REllipseEntity.h:52
double getAngleAt(double distance, RS::From from) const
Definition: REllipseEntity.h:169
RVector getMajorPoint() const
Definition: REllipseEntity.h:117
static RPropertyTypeId PropertyEndPointX
Definition: REllipseEntity.h:71
RVector getStartPoint() const
Definition: REllipseEntity.h:181
static RPropertyTypeId PropertyLineweight
Definition: REllipseEntity.h:50
Transaction implementation.
Definition: RTransaction.h:74
double getStartAngle() const
Definition: REllipseEntity.h:141
static RPropertyTypeId PropertyType
Definition: REllipseEntity.h:45
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: REllipseEntity.h:221
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:140
virtual bool reverse()
Definition: REllipseEntity.h:201
double getParamTo(const RVector &pos)
Definition: REllipseEntity.h:209
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:193
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:237
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:225
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:177
From
End used to specify from which end of a shape to measure a distance.
Definition: RS.h:198
static RPropertyTypeId PropertyLayer
Definition: REllipseEntity.h:47
RVector getPointAt(double angle) const
Definition: REllipseEntity.h:233
double getSweep() const
Definition: REllipseEntity.h:229
static RPropertyTypeId PropertyMajorPointZ
Definition: REllipseEntity.h:60
RS::Side getSideOfPoint(const RVector &point) const
Definition: REllipseEntity.h:205
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:185
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:213
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