QCAD
Open Source 2D CAD
RArcData.h
Go to the documentation of this file.
1 
20 #ifndef RARCDATA_H
21 #define RARCDATA_H
22 
23 #include "entity_global.h"
24 
25 #include "RBox.h"
26 #include "RDocument.h"
27 #include "REntity.h"
28 #include "RPoint.h"
29 #include "RVector.h"
30 #include "RArc.h"
31 
40 class QCADENTITY_EXPORT RArcData: public REntityData, protected RArc {
41 
42  friend class RArcEntity;
43 
44 protected:
46 
47 public:
48  RArcData();
49  RArcData(const RArc& arc);
50  RArcData(const RVector& center, double radius, double startAngle,
51  double endAngle, bool reversed = false);
52 
53  virtual RS::EntityType getType() const {
54  return RS::EntityArc;
55  }
57  return *this;
58  }
59 
60  RVector getCenter() const {
61  return RArc::getCenter();
62  }
63  double getRadius() const {
64  return RArc::getRadius();
65  }
66  double getBulge() const {
67  return RArc::getBulge();
68  }
69  double getStartAngle() const {
70  return RArc::getStartAngle();
71  }
72  double getEndAngle() const {
73  return RArc::getEndAngle();
74  }
75  bool isReversed() const {
76  return RArc::isReversed();
77  }
78  double getDirection1() const {
79  return RArc::getDirection1();
80  }
81  double getDirection2() const {
82  return RArc::getDirection2();
83  }
84  bool reverse() {
85  return RArc::reverse();
86  }
87 
88  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
89  return RArc::getTrimEnd(trimPoint, clickPoint);
90  }
91  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
92  return RArc::trimStartPoint(trimPoint, clickPoint, extend);
93  }
94  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
95  return RArc::trimEndPoint(trimPoint, clickPoint, extend);
96  }
97 
98  double getLength() const {
99  return RArc::getLength();
100  }
101  double getAngleLength(bool allowForZeroLength = false) const {
102  return RArc::getAngleLength(allowForZeroLength);
103  }
104 
105  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
106 
107  virtual bool moveReferencePoint(const RVector& referencePoint, const RVector& targetPoint);
108 
109  RPolyline approximateWithLines(double segmentLength) {
110  return RArc::approximateWithLines(segmentLength);
111  }
112 
113  virtual RShape* castToShape() {
114  return this;
115  }
116 
117  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false, bool segment = false) const {
118  Q_UNUSED(queryBox)
119  Q_UNUSED(ignoreComplex)
120  Q_UNUSED(segment)
121 
122  return QList<QSharedPointer<RShape> >() <<
123  QSharedPointer<RShape>(new RArc(*this));
124  }
125 };
126 
130 Q_DECLARE_METATYPE(QSharedPointer<RArcData>)
131 
132 #endif
virtual RS::EntityType getType() const
Definition: RArcData.h:53
Represents a box e.g.
Definition: RBox.h:43
Ending
Entity ending.
Definition: RS.h:152
Base class for all entity data classes.
Definition: REntityData.h:65
double getRadius() const
Definition: RArc.cpp:475
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
double getRadius() const
Definition: RArcData.h:63
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RArc.cpp:771
double getAngleLength(bool allowForZeroLength=false) const
Definition: RArcData.h:101
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
Low-level mathematical representation of an arc.
Definition: RArc.h:40
virtual bool moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint)
Moves the given reference point to the given target point or does nothing if this entity has no refer...
Definition: REntity.h:498
RPolyline approximateWithLines(double segmentLength)
Definition: RArcData.h:109
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArcData.h:91
Arc.
Definition: RS.h:99
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RArcData.h:88
RVector getCenter() const
Definition: RArc.cpp:467
double getBulge() const
Definition: RArc.cpp:335
virtual bool reverse()
Definition: RArc.cpp:717
Arc entity.
Definition: RArcEntity.h:39
RArc getArc()
Definition: RArcData.h:56
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:131
double getStartAngle() const
Definition: RArcData.h:69
double getLength() const
Definition: RArcData.h:98
bool isReversed() const
Definition: RArcData.h:75
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
Q_DECLARE_METATYPE(RMath *)
bool isReversed() const
Definition: RArc.cpp:527
double getDirection2() const
Definition: RArcData.h:81
double getAngleLength(bool allowForZeroLength=false) const
Definition: RArc.cpp:415
virtual RShape * castToShape()
Definition: RArcData.h:113
virtual double getDirection1() const
Definition: RArc.cpp:270
Definition: RS.h:132
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArc.cpp:790
double getDirection1() const
Definition: RArcData.h:78
virtual double getDirection2() const
Definition: RArc.cpp:279
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RArcData.h:40
RArc()
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RArc.cpp:30
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArcData.h:94
double getLength() const
Definition: RArc.cpp:344
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const
Definition: REntity.h:426
double getBulge() const
Definition: RArcData.h:66
virtual bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArc.cpp:797
Interface for geometrical shape classes.
Definition: RShape.h:52
bool reverse()
Definition: RArcData.h:84
static const RVector invalid
invalid vector
Definition: RVector.h:317
RPolyline approximateWithLines(double segmentLength) const
Definition: RArc.cpp:815
double getEndAngle() const
Definition: RArcData.h:72
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const
Definition: RArcData.h:117
double getEndAngle() const
Definition: RArc.cpp:491
double getStartAngle() const
Definition: RArc.cpp:483
RVector getCenter() const
Definition: RArcData.h:60
RArcData data
Definition: RArcEntity.h:197
RDocument * document
Definition: RObject.h:271