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 
54  return *this;
55  }
56 
57  RVector getCenter() const {
58  return RArc::getCenter();
59  }
60  double getRadius() const {
61  return RArc::getRadius();
62  }
63  double getBulge() const {
64  return RArc::getBulge();
65  }
66  double getStartAngle() const {
67  return RArc::getStartAngle();
68  }
69  double getEndAngle() const {
70  return RArc::getEndAngle();
71  }
72  bool isReversed() const {
73  return RArc::isReversed();
74  }
75  double getDirection1() const {
76  return RArc::getDirection1();
77  }
78  double getDirection2() const {
79  return RArc::getDirection2();
80  }
81  bool reverse() {
82  return RArc::reverse();
83  }
84 
85  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
86  return RArc::getTrimEnd(trimPoint, clickPoint);
87  }
88  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
89  return RArc::trimStartPoint(trimPoint, clickPoint, extend);
90  }
91  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
92  return RArc::trimEndPoint(trimPoint, clickPoint, extend);
93  }
94 
95  double getLength() const {
96  return RArc::getLength();
97  }
98  double getAngleLength(bool allowForZeroLength = false) const {
99  return RArc::getAngleLength(allowForZeroLength);
100  }
101 
102  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
103 
104  virtual bool moveReferencePoint(const RVector& referencePoint, const RVector& targetPoint);
105 
106  RPolyline approximateWithLines(double segmentLength) {
107  return RArc::approximateWithLines(segmentLength);
108  }
109 
110  virtual RShape* castToShape() {
111  return this;
112  }
113 
114  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false) const {
115  Q_UNUSED(queryBox)
116  Q_UNUSED(ignoreComplex)
117 
118  return QList<QSharedPointer<RShape> >() <<
119  QSharedPointer<RShape>(new RArc(*this));
120  }
121 };
122 
126 Q_DECLARE_METATYPE(QSharedPointer<RArcData>)
127 
128 #endif
Represents a box e.g.
Definition: RBox.h:43
Ending
Entity ending.
Definition: RS.h:150
Base class for all entity data classes.
Definition: REntityData.h:65
double getRadius() const
Definition: RArc.cpp:464
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
double getRadius() const
Definition: RArcData.h:60
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RArc.cpp:760
double getAngleLength(bool allowForZeroLength=false) const
Definition: RArcData.h:98
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
Low-level mathematical representation of an arc.
Definition: RArc.h:41
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:489
RPolyline approximateWithLines(double segmentLength)
Definition: RArcData.h:106
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArcData.h:88
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RArcData.h:85
RVector getCenter() const
Definition: RArc.cpp:456
double getBulge() const
Definition: RArc.cpp:323
virtual bool reverse()
Definition: RArc.cpp:706
Arc entity.
Definition: RArcEntity.h:39
RArc getArc()
Definition: RArcData.h:53
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:129
double getStartAngle() const
Definition: RArcData.h:66
double getLength() const
Definition: RArcData.h:95
bool isReversed() const
Definition: RArcData.h:72
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false) const
Definition: RArcData.h:114
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:516
RPolyline approximateWithLines(double segmentLength)
Definition: RArc.cpp:804
double getDirection2() const
Definition: RArcData.h:78
double getAngleLength(bool allowForZeroLength=false) const
Definition: RArc.cpp:403
virtual RShape * castToShape()
Definition: RArcData.h:110
virtual double getDirection1() const
Definition: RArc.cpp:258
Definition: RS.h:130
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArc.cpp:779
double getDirection1() const
Definition: RArcData.h:75
virtual double getDirection2() const
Definition: RArc.cpp:267
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RArcData.h:40
RArc()
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RArc.cpp:30
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArcData.h:91
double getLength() const
Definition: RArc.cpp:332
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:50
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const
Definition: REntity.h:417
double getBulge() const
Definition: RArcData.h:63
virtual bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArc.cpp:786
Interface for geometrical shape classes.
Definition: RShape.h:52
bool reverse()
Definition: RArcData.h:81
static const RVector invalid
invalid vector
Definition: RVector.h:307
double getEndAngle() const
Definition: RArcData.h:69
double getEndAngle() const
Definition: RArc.cpp:480
double getStartAngle() const
Definition: RArc.cpp:472
RVector getCenter() const
Definition: RArcData.h:57
RArcData data
Definition: RArcEntity.h:201
RDocument * document
Definition: RObject.h:267