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, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
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
RArcData::getShapes
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const
Definition: RArcData.h:117
RArcData::getTrimEnd
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RArcData.h:88
REntity.h
RArcData::getCenter
RVector getCenter() const
Definition: RArcData.h:60
RArcData::reverse
bool reverse()
Definition: RArcData.h:84
RArcData::isReversed
bool isReversed() const
Definition: RArcData.h:75
RBox.h
RArc::getDirection1
virtual double getDirection1() const
Definition: RArc.cpp:267
RArc::getCenter
RVector getCenter() const
Definition: RArc.cpp:464
RS::EntityArc
@ EntityArc
Arc.
Definition: RS.h:149
REntity::getReferencePoints
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const
Definition: REntity.h:444
RArc::RArc
RArc()
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RArc.cpp:30
RVector
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RS::Ending
Ending
Entity ending.
Definition: RS.h:214
RArc::getBulge
double getBulge() const
Definition: RArc.cpp:332
RS::EntityType
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:125
RArc::trimStartPoint
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArc.cpp:814
RArcEntity
Arc entity.
Definition: RArcEntity.h:39
RArc::getRadius
double getRadius() const
Definition: RArc.cpp:472
RObject::document
RDocument * document
Definition: RObject.h:327
RArc::getStartAngle
double getStartAngle() const
Definition: RArc.cpp:480
RArc
Low-level mathematical representation of an arc.
Definition: RArc.h:40
QCADENTITY_EXPORT
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
RArcData::getDirection1
double getDirection1() const
Definition: RArcData.h:78
RArc::trimEndPoint
virtual bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArc.cpp:821
RShape
Interface for geometrical shape classes.
Definition: RShape.h:72
RPoint.h
RArcData
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RArcData.h:40
RDocument.h
RArcData::getEndAngle
double getEndAngle() const
Definition: RArcData.h:72
REntity::moveReferencePoint
virtual bool moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
Moves the given reference point to the given target point or does nothing if this entity has no refer...
Definition: REntity.h:523
RArcData::getStartAngle
double getStartAngle() const
Definition: RArcData.h:69
RVector.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
RArcData::getArc
RArc getArc()
Definition: RArcData.h:56
RArc::getAngleLength
double getAngleLength(bool allowForZeroLength=false) const
Definition: RArc.cpp:412
RArc::getEndAngle
double getEndAngle() const
Definition: RArc.cpp:488
REntityData
Base class for all entity data classes.
Definition: REntityData.h:65
RArc::isReversed
bool isReversed() const
Definition: RArc.cpp:524
RArc::approximateWithLines
RPolyline approximateWithLines(double segmentLength, double angle=0.0) const
Definition: RArc.cpp:843
RArc::getDirection2
virtual double getDirection2() const
Definition: RArc.cpp:276
RArc::getTrimEnd
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RArc.cpp:795
RDocument
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:68
RArcData::trimEndPoint
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArcData.h:94
RArcData::getLength
double getLength() const
Definition: RArcData.h:98
RArc.h
RArc::reverse
virtual bool reverse()
Definition: RArc.cpp:741
RArcData::castToShape
virtual RShape * castToShape()
Definition: RArcData.h:113
RS::ProjectionRenderingHint
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:184
RDEFAULT_RBOX
#define RDEFAULT_RBOX
Definition: RBox.h:32
RArcEntity::data
RArcData data
Definition: RArcEntity.h:204
RS::RenderTop
@ RenderTop
Definition: RS.h:185
RBox
Represents a box e.g.
Definition: RBox.h:43
RVector::invalid
static const RVector invalid
invalid vector
Definition: RVector.h:322
entity_global.h
RArcData::getType
virtual RS::EntityType getType() const
Definition: RArcData.h:53
RArcData::getAngleLength
double getAngleLength(bool allowForZeroLength=false) const
Definition: RArcData.h:101
RArc::getLength
double getLength() const
Definition: RArc.cpp:341
RArcData::getRadius
double getRadius() const
Definition: RArcData.h:63
RArcData::getDirection2
double getDirection2() const
Definition: RArcData.h:81
RArcData::approximateWithLines
RPolyline approximateWithLines(double segmentLength)
Definition: RArcData.h:109
RArcData::getBulge
double getBulge() const
Definition: RArcData.h:66
RPolyline
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
RArcData::trimStartPoint
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RArcData.h:91