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