QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RArcEntity.h
Go to the documentation of this file.
1
20#ifndef RARCENTITY_H
21#define RARCENTITY_H
22
23#include "entity_global.h"
24
25#include "REntity.h"
26#include "RArcData.h"
27
28class RDocument;
29class RExporter;
30
39
40public:
54
65
72
73public:
74 RArcEntity(RDocument* document, const RArcData& data);
75 RArcEntity(const RArcEntity& other);
76 virtual ~RArcEntity();
77
78 static void init();
79
81 return RS::EntityArc;
82 }
83
84 static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
86 }
87
88 virtual QSharedPointer<RObject> clone() const {
89 return QSharedPointer<RObject>(new RArcEntity(*this));
90 }
91
92 QSharedPointer<RArcEntity> cloneToArc() const {
93 return QSharedPointer<RArcEntity>(new RArcEntity(*this));
94 }
95
96 void setShape(const RArc& a);
97
98 virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
99 RTransaction* transaction=NULL);
100 virtual QPair<QVariant, RPropertyAttributes> getProperty(
101 RPropertyTypeId& propertyTypeId,
102 bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
103
104 virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
105
106 virtual QSharedPointer<REntity> scaleNonUniform(const RVector& scaleFactors, const RVector& center);
107 static QSharedPointer<REntity> scaleNonUniform(REntity& entity, const RVector& scaleFactors, const RVector& center);
108
109 virtual RArcData& getData() {
110 return data;
111 }
112
113 virtual const RArcData& getData() const {
114 return data;
115 }
116
118 return data.getCenter();
119 }
120
121 double getRadius() const {
122 return data.getRadius();
123 }
124
125 void setRadius(double radius) {
126 data.setRadius(radius);
127 }
128
129 double getBulge() const {
130 return data.getBulge();
131 }
132
133 double getStartAngle() const {
134 return data.getStartAngle();
135 }
136
137 void setStartAngle(double angle) {
138 data.setStartAngle(angle);
139 }
140
141 double getEndAngle() const {
142 return data.getEndAngle();
143 }
144
145 void setEndAngle(double angle) {
146 data.setEndAngle(angle);
147 }
148
149 bool isReversed() const {
150 return data.isReversed();
151 }
152
153 void setReversed(bool reversed) {
154 data.setReversed(reversed);
155 }
156
157 double getDirection1() const {
158 return data.getDirection1();
159 }
160
161 double getDirection2() const {
162 return data.getDirection2();
163 }
164
166 return data.getStartPoint();
167 }
168
170 return data.getEndPoint();
171 }
172
174 return data.getMiddlePoint();
175 }
176
177 bool reverse() {
178 return data.reverse();
179 }
180
181 RS::Side getSideOfPoint(const RVector& point) const {
182 return data.getSideOfPoint(point);
183 }
184
185 double getSweep() const {
186 return data.getSweep();
187 }
188
189 RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
190 return data.getTrimEnd(trimPoint, clickPoint);
191 }
192
193 bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
194 return data.trimStartPoint(trimPoint, clickPoint, extend);
195 }
196 bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
197 return data.trimEndPoint(trimPoint, clickPoint, extend);
198 }
199
200 double getLength() const {
201 return data.getLength();
202 }
203 double getAngleLength(bool allowForZeroLength = false) const {
204 return data.getAngleLength(allowForZeroLength);
205 }
206
207 double getAngleAt(double distance, RS::From from) const {
208 return data.getAngleAt(distance, from);
209 }
210
211protected:
212 virtual void print(QDebug dbg) const;
213
214protected:
216};
217
219Q_DECLARE_METATYPE(QSharedPointer<RArcEntity>)
220Q_DECLARE_METATYPE(QSharedPointer<RArcEntity>*)
221
222#endif
Q_DECLARE_METATYPE(RMath *)
Stores and manages all data that defines the geometry and appearance of an arc entity.
Definition RArcData.h:45
Arc entity.
Definition RArcEntity.h:38
QSharedPointer< RArcEntity > cloneToArc() const
Definition RArcEntity.h:92
static RPropertyTypeId PropertyLayer
Definition RArcEntity.h:47
double getDirection2() const
Definition RArcEntity.h:161
static RPropertyTypeId PropertyLinetypeScale
Definition RArcEntity.h:49
void setStartAngle(double angle)
Definition RArcEntity.h:137
static RS::EntityType getRtti()
Definition RArcEntity.h:80
static RPropertyTypeId PropertyReversed
Definition RArcEntity.h:64
static RPropertyTypeId PropertyTotalArea
Definition RArcEntity.h:71
static RPropertyTypeId PropertyRadius
Definition RArcEntity.h:61
static RPropertyTypeId PropertyLineweight
Definition RArcEntity.h:50
RVector getStartPoint() const
Definition RArcEntity.h:165
static RPropertyTypeId PropertyTotalLength
Definition RArcEntity.h:68
double getRadius() const
Definition RArcEntity.h:121
static RPropertyTypeId PropertyMiddlePointX
Definition RArcEntity.h:58
void setRadius(double radius)
Definition RArcEntity.h:125
bool isReversed() const
Definition RArcEntity.h:149
double getBulge() const
Definition RArcEntity.h:129
static RPropertyTypeId PropertyHandle
Definition RArcEntity.h:42
static RPropertyTypeId PropertyCenterX
Definition RArcEntity.h:55
double getDirection1() const
Definition RArcEntity.h:157
static RPropertyTypeId PropertySweepAngle
Definition RArcEntity.h:69
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RArcEntity.h:41
static RPropertyTypeId PropertyProtected
Definition RArcEntity.h:43
static RPropertyTypeId PropertyLinetype
Definition RArcEntity.h:48
static RPropertyTypeId PropertyType
Definition RArcEntity.h:45
static RPropertyTypeId PropertyStartAngle
Definition RArcEntity.h:62
virtual const RArcData & getData() const
Definition RArcEntity.h:113
double getEndAngle() const
Definition RArcEntity.h:141
static RPropertyTypeId PropertyCenterY
Definition RArcEntity.h:56
static RPropertyTypeId PropertyDisplayedColor
Definition RArcEntity.h:52
RVector getMiddlePoint() const
Definition RArcEntity.h:173
static RPropertyTypeId PropertyMiddlePointZ
Definition RArcEntity.h:60
double getAngleLength(bool allowForZeroLength=false) const
Definition RArcEntity.h:203
static RPropertyTypeId PropertyLength
Definition RArcEntity.h:67
static RPropertyTypeId PropertyWorkingSet
Definition RArcEntity.h:44
virtual RArcData & getData()
Definition RArcEntity.h:109
void setEndAngle(double angle)
Definition RArcEntity.h:145
static RPropertyTypeId PropertyDiameter
Definition RArcEntity.h:66
static RPropertyTypeId PropertyDrawOrder
Definition RArcEntity.h:53
double getAngleAt(double distance, RS::From from) const
Definition RArcEntity.h:207
static RPropertyTypeId PropertyArea
Definition RArcEntity.h:70
RVector getEndPoint() const
Definition RArcEntity.h:169
double getSweep() const
Definition RArcEntity.h:185
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition RArcEntity.h:189
bool reverse()
Definition RArcEntity.h:177
RArcData data
Definition RArcEntity.h:215
virtual QSharedPointer< RObject > clone() const
Definition RArcEntity.h:88
double getLength() const
Definition RArcEntity.h:200
static RPropertyTypeId PropertyCenterZ
Definition RArcEntity.h:57
static RPropertyTypeId PropertyColor
Definition RArcEntity.h:51
static RPropertyTypeId PropertyBlock
Definition RArcEntity.h:46
void setReversed(bool reversed)
Definition RArcEntity.h:153
RS::Side getSideOfPoint(const RVector &point) const
Definition RArcEntity.h:181
double getStartAngle() const
Definition RArcEntity.h:133
static RPropertyTypeId PropertyEndAngle
Definition RArcEntity.h:63
static RPropertyTypeId PropertyMiddlePointY
Definition RArcEntity.h:59
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition RArcEntity.h:84
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition RArcEntity.h:193
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition RArcEntity.h:196
RVector getCenter() const
Definition RArcEntity.h:117
Low-level mathematical representation of an arc.
Definition RArc.h:42
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
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
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
@ EntityArc
Arc.
Definition RS.h:253
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