QCAD
Open Source 2D CAD
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 #include "RLineweight.h"
28 
29 class RDocument;
30 class RExporter;
31 
40 
41 public:
54 
62 
69 
70 public:
71  RArcEntity(RDocument* document, const RArcData& data);
72  RArcEntity(const RArcEntity& other);
73  virtual ~RArcEntity();
74 
75  static void init();
76 
77  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
79  }
80 
81  virtual RArcEntity* clone() const {
82  return new RArcEntity(*this);
83  }
84 
85  void setShape(const RArc& a);
86 
87  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
88  RTransaction* transaction=NULL);
89  QPair<QVariant, RPropertyAttributes> getProperty(
90  RPropertyTypeId& propertyTypeId,
91  bool humanReadable = false, bool noAttributes = false);
92 
93  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
94 
95  virtual RArcData& getData() {
96  return data;
97  }
98 
99  virtual const RArcData& getData() const {
100  return data;
101  }
102 
103  RVector getCenter() const {
104  return data.getCenter();
105  }
106 
107  double getRadius() const {
108  return data.getRadius();
109  }
110 
111  void setRadius(double radius) {
112  data.setRadius(radius);
113  }
114 
115  double getBulge() const {
116  return data.getBulge();
117  }
118 
119  double getStartAngle() const {
120  return data.getStartAngle();
121  }
122 
123  void setStartAngle(double angle) {
124  data.setStartAngle(angle);
125  }
126 
127  double getEndAngle() const {
128  return data.getEndAngle();
129  }
130 
131  void setEndAngle(double angle) {
132  data.setEndAngle(angle);
133  }
134 
135  bool isReversed() const {
136  return data.isReversed();
137  }
138 
139  void setReversed(bool reversed) {
140  data.setReversed(reversed);
141  }
142 
143  double getDirection1() const {
144  return data.getDirection1();
145  }
146 
147  double getDirection2() const {
148  return data.getDirection2();
149  }
150 
152  return data.getStartPoint();
153  }
154 
156  return data.getEndPoint();
157  }
158 
160  return data.getMiddlePoint();
161  }
162 
163  bool reverse() {
164  return data.reverse();
165  }
166 
167  RS::Side getSideOfPoint(const RVector& point) const {
168  return data.getSideOfPoint(point);
169  }
170 
171  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
172  return data.getTrimEnd(trimPoint, clickPoint);
173  }
174 
175  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
176  return data.trimStartPoint(trimPoint, clickPoint, extend);
177  }
178  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
179  return data.trimEndPoint(trimPoint, clickPoint, extend);
180  }
181 
182  double getLength() const {
183  return data.getLength();
184  }
185  double getAngleLength(bool allowForZeroLength = false) const {
186  return data.getAngleLength(allowForZeroLength);
187  }
188 
189  double getAngleAt(double distance, RS::From from) const {
190  return data.getAngleAt(distance, from);
191  }
192 
193 protected:
194  virtual void print(QDebug dbg) const;
195 
196 protected:
198 };
199 
201 Q_DECLARE_METATYPE(QSharedPointer<RArcEntity>)
202 Q_DECLARE_METATYPE(QSharedPointer<RArcEntity>*)
203 
204 #endif
double getLength() const
Definition: RArcEntity.h:182
Ending
Entity ending.
Definition: RS.h:152
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RArcEntity.h:77
static RPropertyTypeId PropertyProtected
Definition: RArcEntity.h:44
static RPropertyTypeId PropertyLinetype
Definition: RArcEntity.h:48
static RPropertyTypeId PropertyHandle
Definition: RArcEntity.h:43
void setRadius(double radius)
Definition: RArcEntity.h:111
static RPropertyTypeId PropertyLineweight
Definition: RArcEntity.h:50
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
static RPropertyTypeId PropertyStartAngle
Definition: RArcEntity.h:59
RVector getMiddlePoint() const
Definition: RArcEntity.h:159
virtual const RArcData & getData() const
Definition: RArcEntity.h:99
static RPropertyTypeId PropertyArea
Definition: RArcEntity.h:67
void setReversed(bool reversed)
Definition: RArcEntity.h:139
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
Low-level mathematical representation of an arc.
Definition: RArc.h:40
double getBulge() const
Definition: RArcEntity.h:115
static RPropertyTypeId PropertyBlock
Definition: RArcEntity.h:46
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
RVector getStartPoint() const
Definition: RArcEntity.h:151
double getEndAngle() const
Definition: RArcEntity.h:127
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RArcEntity.h:42
Transaction implementation.
Definition: RTransaction.h:74
static RPropertyTypeId PropertyDrawOrder
Definition: RArcEntity.h:53
Arc entity.
Definition: RArcEntity.h:39
double getRadius() const
Definition: RArcEntity.h:107
RVector getEndPoint() const
Definition: RArcEntity.h:155
static RPropertyTypeId PropertyEndAngle
Definition: RArcEntity.h:60
Side
Side used for side of a point relativ to an entity (right hand or left hand side) ...
Definition: RS.h:142
static RPropertyTypeId PropertyTotalLength
Definition: RArcEntity.h:65
static RPropertyTypeId PropertyDiameter
Definition: RArcEntity.h:63
virtual RArcData & getData()
Definition: RArcEntity.h:95
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
static RPropertyTypeId PropertyLength
Definition: RArcEntity.h:64
Base class for all entity classes.
Definition: REntity.h:64
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
double getStartAngle() const
Definition: RArcEntity.h:119
Q_DECLARE_METATYPE(RMath *)
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArcEntity.h:175
RS::Side getSideOfPoint(const RVector &point) const
Definition: RArcEntity.h:167
bool reverse()
Definition: RArcEntity.h:163
bool isReversed() const
Definition: RArcEntity.h:135
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArcEntity.h:178
static RPropertyTypeId PropertyTotalArea
Definition: RArcEntity.h:68
static RPropertyTypeId PropertyCenterY
Definition: RArcEntity.h:56
double getDirection1() const
Definition: RArcEntity.h:143
static RPropertyTypeId PropertyType
Definition: RArcEntity.h:45
double getAngleAt(double distance, RS::From from) const
Definition: RArcEntity.h:189
static RPropertyTypeId PropertyLayer
Definition: RArcEntity.h:47
static RPropertyTypeId PropertyCenterZ
Definition: RArcEntity.h:57
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:228
static RPropertyTypeId PropertySweepAngle
Definition: RArcEntity.h:66
RVector getCenter() const
Definition: RArcEntity.h:103
double getAngleLength(bool allowForZeroLength=false) const
Definition: RArcEntity.h:185
static RPropertyTypeId PropertyDisplayedColor
Definition: RArcEntity.h:52
static void init()
Definition: REntity.cpp:82
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RArcData.h:40
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:321
Abstract base class for exporters.
Definition: RExporter.h:71
static RPropertyTypeId PropertyColor
Definition: RArcEntity.h:51
virtual RArcEntity * clone() const
Definition: RArcEntity.h:81
From
End used to specify from which end of a shape to measure a distance.
Definition: RS.h:200
void setStartAngle(double angle)
Definition: RArcEntity.h:123
void setEndAngle(double angle)
Definition: RArcEntity.h:131
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RArcEntity.h:171
static RPropertyTypeId PropertyRadius
Definition: RArcEntity.h:58
static const RVector invalid
invalid vector
Definition: RVector.h:317
static RPropertyTypeId PropertyReversed
Definition: RArcEntity.h:61
static RPropertyTypeId PropertyLinetypeScale
Definition: RArcEntity.h:49
double getDirection2() const
Definition: RArcEntity.h:147
static RPropertyTypeId PropertyCenterX
Definition: RArcEntity.h:55
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
RArcData data
Definition: RArcEntity.h:197
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:468