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