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:
55 
68 
75 
77 
78 public:
79  REllipseEntity(RDocument* document, const REllipseData& data);
80  virtual ~REllipseEntity();
81 
82  static void init();
83 
84  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
86  }
87 
88  virtual REllipseEntity* clone() const {
89  return new REllipseEntity(*this);
90  }
91 
92  void setShape(const REllipse& e);
93 
94  virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
95  RTransaction* transaction=NULL);
96  virtual QPair<QVariant, RPropertyAttributes> getProperty(
97  RPropertyTypeId& propertyTypeId,
98  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
99 
100  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
101 
102  virtual QSharedPointer<REntity> scaleNonUniform(const RVector& scaleFactors, const RVector& center);
103 
104  virtual REllipseData& getData() {
105  return data;
106  }
107 
108  virtual const REllipseData& getData() const {
109  return data;
110  }
111 
112  RVector getCenter() const {
113  return data.getCenter();
114  }
115 
117  return data.getMajorPoint();
118  }
119 
120  double getMajorRadius() const {
121  return data.getMajorRadius();
122  }
123 
124  double getMinorRadius() const {
125  return data.getMinorRadius();
126  }
127 
128  double getRatio() const {
129  return data.getRatio();
130  }
131 
132  double getAngle() const {
133  return data.getAngle();
134  }
135 
136  void setRatio(double ratio) {
137  data.setRatio(ratio);
138  }
139 
140  double getStartAngle() const {
141  return data.getStartAngle();
142  }
143 
144  double getStartParam() const {
145  return data.getStartParam();
146  }
147 
148  void setStartParam(double param) {
149  data.setStartParam(param);
150  }
151 
152  double getEndAngle() const {
153  return data.getEndAngle();
154  }
155 
156  double getEndParam() const {
157  return data.getEndParam();
158  }
159 
160  void setEndParam(double param) {
161  data.setEndParam(param);
162  }
163 
164  double getAngleLength() const {
165  return data.getAngleLength();
166  }
167 
168  double getAngleAt(double distance, RS::From from) const {
169  return data.getAngleAt(distance, from);
170  }
171 
172  bool isReversed() const {
173  return data.isReversed();
174  }
175 
176  void setReversed(bool reversed) {
177  data.setReversed(reversed);
178  }
179 
181  return data.getStartPoint();
182  }
183 
185  return data.getEndPoint();
186  }
187 
188  bool isFullEllipse() const {
189  return data.isFullEllipse();
190  }
191 
192  double getDirection1() const {
193  return data.getDirection1();
194  }
195 
196  double getDirection2() const {
197  return data.getDirection2();
198  }
199 
200  virtual bool reverse() {
201  return data.reverse();
202  }
203 
204  RS::Side getSideOfPoint(const RVector& point) const {
205  return data.getSideOfPoint(point);
206  }
207 
208  double getParamTo(const RVector& pos) {
209  return data.getParamTo(pos);
210  }
211 
212  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
213  return data.getTrimEnd(trimPoint, clickPoint);
214  }
215 
216  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
217  return data.trimStartPoint(trimPoint, clickPoint, extend);
218  }
219 
220  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
221  return data.trimEndPoint(trimPoint, clickPoint, extend);
222  }
223 
224  double getLength() const {
225  return data.getLength();
226  }
227 
228  double getSweep() const {
229  return data.getSweep();
230  }
231 
232  RVector getPointAt(double angle) const {
233  return data.getPointAt(angle);
234  }
235 
236  QList<RSpline> approximateWithSplines() const {
237  return data.approximateWithSplines();
238  }
239 
240  RPolyline approximateWithArcs(int segments) const {
241  return data.approximateWithArcs(segments);
242  }
243 
244 protected:
245  virtual void print(QDebug dbg) const;
246 
247 protected:
249 };
250 
252 Q_DECLARE_METATYPE(QSharedPointer<REllipseEntity>)
253 Q_DECLARE_METATYPE(QSharedPointer<REllipseEntity>*)
254 
255 #endif
REllipseEntity::PropertyEndPointX
static RPropertyTypeId PropertyEndPointX
Definition: REllipseEntity.h:72
REntity.h
REllipseEntity::getAngleLength
double getAngleLength() const
Definition: REllipseEntity.h:164
REllipseEntity::getLength
double getLength() const
Definition: REllipseEntity.h:224
REllipseEntity::getEndParam
double getEndParam() const
Definition: REllipseEntity.h:156
REllipseEntity::PropertyStartPointY
static RPropertyTypeId PropertyStartPointY
Definition: REllipseEntity.h:70
REllipseEntity::getStartPoint
RVector getStartPoint() const
Definition: REllipseEntity.h:180
REllipseEntity
Ellipse entity.
Definition: REllipseEntity.h:39
REllipseEntity::PropertyEndAngle
static RPropertyTypeId PropertyEndAngle
Definition: REllipseEntity.h:66
REllipseEntity::PropertyMajorPointX
static RPropertyTypeId PropertyMajorPointX
Definition: REllipseEntity.h:59
RLineweight.h
REllipseEntity::PropertyEndParam
static RPropertyTypeId PropertyEndParam
Definition: REllipseEntity.h:64
REllipseEntity::PropertyEndPointY
static RPropertyTypeId PropertyEndPointY
Definition: REllipseEntity.h:73
REllipseEntity::clone
virtual REllipseEntity * clone() const
Definition: REllipseEntity.h:88
REllipseEntity::getAngleAt
double getAngleAt(double distance, RS::From from) const
Definition: REllipseEntity.h:168
REllipseEntity::trimEndPoint
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: REllipseEntity.h:220
RS::Side
Side
Side used for side of a point relative to an entity (right hand or left hand side)
Definition: RS.h:205
RVector
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RS::Ending
Ending
Entity ending.
Definition: RS.h:215
REllipseEntity::PropertyCenterZ
static RPropertyTypeId PropertyCenterZ
Definition: REllipseEntity.h:58
REllipseEntity::PropertyStartParam
static RPropertyTypeId PropertyStartParam
Definition: REllipseEntity.h:63
REllipseEntity::PropertyEndPointZ
static RPropertyTypeId PropertyEndPointZ
Definition: REllipseEntity.h:74
REllipseEntity::PropertyProtected
static RPropertyTypeId PropertyProtected
Definition: REllipseEntity.h:44
QCADENTITY_EXPORT
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
REllipseEntity::data
REllipseData data
Definition: REllipseEntity.h:248
REllipseEntity::setRatio
void setRatio(double ratio)
Definition: REllipseEntity.h:136
REntity::exportEntity
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
REllipseEntity::getEndAngle
double getEndAngle() const
Definition: REllipseEntity.h:152
REllipseEntity::PropertyStartPointZ
static RPropertyTypeId PropertyStartPointZ
Definition: REllipseEntity.h:71
REllipseEntity::isReversed
bool isReversed() const
Definition: REllipseEntity.h:172
REllipseEntity::getCenter
RVector getCenter() const
Definition: REllipseEntity.h:112
REllipseEntity::getSideOfPoint
RS::Side getSideOfPoint(const RVector &point) const
Definition: REllipseEntity.h:204
REllipseData.h
REntity
Base class for all entity classes.
Definition: REntity.h:65
REllipseEntity::PropertyStartPointX
static RPropertyTypeId PropertyStartPointX
Definition: REllipseEntity.h:69
REllipseEntity::getStartAngle
double getStartAngle() const
Definition: REllipseEntity.h:140
REllipseEntity::trimStartPoint
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: REllipseEntity.h:216
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
REllipseEntity::PropertyWorkingSet
static RPropertyTypeId PropertyWorkingSet
Definition: REllipseEntity.h:45
REllipseEntity::setReversed
void setReversed(bool reversed)
Definition: REllipseEntity.h:176
REllipseEntity::getMajorRadius
double getMajorRadius() const
Definition: REllipseEntity.h:120
REllipseEntity::getRatio
double getRatio() const
Definition: REllipseEntity.h:128
REllipseEntity::PropertyLinetype
static RPropertyTypeId PropertyLinetype
Definition: REllipseEntity.h:49
REllipseEntity::PropertyLineweight
static RPropertyTypeId PropertyLineweight
Definition: REllipseEntity.h:51
REntity::init
static void init()
Definition: REntity.cpp:88
REntity::print
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:455
RPropertyTypeId
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyTypeId.h:59
REllipseEntity::PropertyStartAngle
static RPropertyTypeId PropertyStartAngle
Definition: REllipseEntity.h:65
REllipseEntity::PropertyLinetypeScale
static RPropertyTypeId PropertyLinetypeScale
Definition: REllipseEntity.h:50
REllipseEntity::approximateWithSplines
QList< RSpline > approximateWithSplines() const
Definition: REllipseEntity.h:236
REllipseEntity::getTrimEnd
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: REllipseEntity.h:212
REllipseEntity::PropertyCenterY
static RPropertyTypeId PropertyCenterY
Definition: REllipseEntity.h:57
REllipseEntity::PropertyType
static RPropertyTypeId PropertyType
Definition: REllipseEntity.h:46
REllipseEntity::isFullEllipse
bool isFullEllipse() const
Definition: REllipseEntity.h:188
REllipseEntity::getPointAt
RVector getPointAt(double angle) const
Definition: REllipseEntity.h:232
RExporter
Abstract base class for exporters.
Definition: RExporter.h:72
REntity::setProperty
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:323
REllipseEntity::getData
virtual const REllipseData & getData() const
Definition: REllipseEntity.h:108
RDocument
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:72
REllipseEntity::PropertyMajorPointY
static RPropertyTypeId PropertyMajorPointY
Definition: REllipseEntity.h:60
REllipseEntity::PropertyRatio
static RPropertyTypeId PropertyRatio
Definition: REllipseEntity.h:62
REllipseEntity::PropertyDrawOrder
static RPropertyTypeId PropertyDrawOrder
Definition: REllipseEntity.h:54
REllipseEntity::PropertyCircumference
static RPropertyTypeId PropertyCircumference
Definition: REllipseEntity.h:76
REllipseEntity::reverse
virtual bool reverse()
Definition: REllipseEntity.h:200
REntity::scaleNonUniform
virtual QSharedPointer< REntity > scaleNonUniform(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
Definition: REntity.cpp:442
REllipseEntity::getParamTo
double getParamTo(const RVector &pos)
Definition: REllipseEntity.h:208
REllipseEntity::PropertyCustom
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: REllipseEntity.h:42
REllipseEntity::PropertyColor
static RPropertyTypeId PropertyColor
Definition: REllipseEntity.h:52
REllipseEntity::getStaticPropertyTypeIds
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: REllipseEntity.h:84
REllipseEntity::getEndPoint
RVector getEndPoint() const
Definition: REllipseEntity.h:184
REllipseEntity::getMinorRadius
double getMinorRadius() const
Definition: REllipseEntity.h:124
REllipseEntity::getMajorPoint
RVector getMajorPoint() const
Definition: REllipseEntity.h:116
REllipse
Low-level mathematical representation of an ellipse or ellipse arc.
Definition: REllipse.h:42
REllipseEntity::approximateWithArcs
RPolyline approximateWithArcs(int segments) const
Definition: REllipseEntity.h:240
REntity::getProperty
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: REntity.cpp:230
REllipseData
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: REllipseData.h:40
REllipseEntity::PropertyCenterX
static RPropertyTypeId PropertyCenterX
Definition: REllipseEntity.h:56
REllipseEntity::PropertyLayer
static RPropertyTypeId PropertyLayer
Definition: REllipseEntity.h:48
RTransaction
Transaction implementation.
Definition: RTransaction.h:74
REllipseEntity::getDirection1
double getDirection1() const
Definition: REllipseEntity.h:192
RPropertyTypeId::getPropertyTypeIds
static QSet< RPropertyTypeId > getPropertyTypeIds(const std::type_info &classInfo, RPropertyAttributes::Option=RPropertyAttributes::NoOptions)
Gets all property type IDs that where registered for the given class.
Definition: RPropertyTypeId.cpp:273
REllipseEntity::setEndParam
void setEndParam(double param)
Definition: REllipseEntity.h:160
REllipseEntity::PropertyDisplayedColor
static RPropertyTypeId PropertyDisplayedColor
Definition: REllipseEntity.h:53
REllipseEntity::PropertyHandle
static RPropertyTypeId PropertyHandle
Definition: REllipseEntity.h:43
RVector::invalid
static const RVector invalid
invalid vector
Definition: RVector.h:322
entity_global.h
RS::From
From
End used to specify from which end of a shape to measure a distance.
Definition: RS.h:263
REllipseEntity::getData
virtual REllipseData & getData()
Definition: REllipseEntity.h:104
REllipseEntity::PropertyReversed
static RPropertyTypeId PropertyReversed
Definition: REllipseEntity.h:67
REllipseEntity::getSweep
double getSweep() const
Definition: REllipseEntity.h:228
REllipseEntity::getStartParam
double getStartParam() const
Definition: REllipseEntity.h:144
RPolyline
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
REllipseEntity::setStartParam
void setStartParam(double param)
Definition: REllipseEntity.h:148
REllipseEntity::PropertyMajorPointZ
static RPropertyTypeId PropertyMajorPointZ
Definition: REllipseEntity.h:61
REllipseEntity::PropertyBlock
static RPropertyTypeId PropertyBlock
Definition: REllipseEntity.h:47
REllipseEntity::getDirection2
double getDirection2() const
Definition: REllipseEntity.h:196
REllipseEntity::getAngle
double getAngle() const
Definition: REllipseEntity.h:132