QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RArc.h
Go to the documentation of this file.
1 #ifndef RARC_H
2 #define RARC_H
3 
4 #include "RDirected.h"
5 #include "RShape.h"
6 #include "RVector.h"
7 
8 class RBox;
9 class RPolyline;
10 
20 class RArc: public RShape, public RDirected {
21 public:
22  RArc();
23  RArc(const RVector& center, double radius, double startAngle,
24  double endAngle, bool reversed = false);
25  virtual ~RArc();
26 
27  virtual RArc* clone() const {
28  return new RArc(*this);
29  }
30 
31  virtual void to2D();
32 
33  bool isValid() const;
34  bool isFullCircle() const;
35 
36  static RArc createFrom3Points(const RVector& startPoint,
37  const RVector& point,
38  const RVector& endPoint);
39  static RArc createFrom2PBulge(const RVector& startPoint,
40  const RVector& endPoint,
41  double bulge);
42  static RArc createTangential(const RVector& startPoint,
43  const RVector& pos,
44  double direction,
45  double radius);
46 
47  virtual RBox getBoundingBox() const;
48 
49  virtual QList<RVector> getEndPoints() const;
50  virtual QList<RVector> getMiddlePoints() const;
51  virtual QList<RVector> getCenterPoints() const;
52  virtual QList<RVector> getPointsWithDistanceToEnd(
53  double distance, RS::From from = RS::FromAny) const;
54 
55  virtual RVector getVectorTo(const RVector& point,
56  bool limited = true) const;
57 
58  RVector getCenter() const;
59  void setCenter(const RVector& vector);
60  double getRadius() const;
61  void setRadius(double radius);
62  double getStartAngle() const;
63  void setStartAngle(double startAngle);
64  double getEndAngle() const;
65  void setEndAngle(double endAngle);
66  bool isReversed() const;
67  void setReversed(bool reversed);
68  double getAngleLength(bool allowForZeroLength = false) const;
69 
70  double getDiameter() const;
71  void setDiameter(double d);
72  void setLength(double l);
73  double getArea() const;
74  void setArea(double a);
75 
76  double getDirection1() const;
77  double getDirection2() const;
78 
79  RS::Side getSideOfPoint(const RVector& point) const;
80 
81  double getSweep() const;
82  double getLength() const;
83 
84  virtual RVector getStartPoint() const;
85  virtual RVector getEndPoint() const;
86  RVector getMiddlePoint() const;
87 
88  void moveStartPoint(const RVector& pos);
89  void moveEndPoint(const RVector& pos);
90  double getBulge() const;
91 
92  virtual bool move(const RVector& offset);
93  virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
94  virtual bool scale(const RVector& scaleFactors, const RVector& center = RDEFAULT_RVECTOR);
95  virtual bool mirror(const RLine& axis);
96  virtual bool reverse();
97  virtual bool stretch(const RPolyline& area, const RVector& offset);
98 
99  virtual RS::Ending getTrimEnd(const RVector& coord, const RVector& trimPoint);
100  virtual void trimStartPoint(const RVector& p);
101  virtual void trimEndPoint(const RVector& p);
102 
103  RPolyline approximateWithLines(double segmentLength);
104 
105 protected:
106  virtual void print(QDebug dbg) const;
107 
108 public:
118  double radius;
123  double startAngle;
128  double endAngle;
133  bool reversed;
134 };
135 
136 Q_DECLARE_METATYPE(const RArc*)
139 Q_DECLARE_METATYPE(QSharedPointer<RArc>)
140 Q_DECLARE_METATYPE(QSharedPointer<RArc>*)
141 
142 #endif