QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RLine.h
Go to the documentation of this file.
1 
20 #ifndef RLINE_H
21 #define RLINE_H
22 
23 #include "../core_global.h"
24 
25 #include "RDirected.h"
26 #include "RS.h"
27 #include "RShape.h"
28 #include "RVector.h"
29 
30 class RBox;
31 class RPolyline;
32 
42 class QCADCORE_EXPORT RLine: public RShape, public RDirected {
43 public:
44  RLine();
45  RLine(const RVector& startPoint, const RVector& endPoint);
46  RLine(const RVector& startPoint, double angle, double distance);
47  virtual ~RLine();
48 
49  virtual RLine* clone() const {
50  return new RLine(*this);
51  }
52 
53  virtual void to2D();
54 
55  bool isValid() const;
56 
57  virtual RBox getBoundingBox() const;
58 
59  virtual QList<RVector> getEndPoints() const;
60  virtual QList<RVector> getMiddlePoints() const;
61  virtual QList<RVector> getCenterPoints() const;
62  virtual QList<RVector> getPointsWithDistanceToEnd(
63  double distance, RS::From from = RS::FromAny) const;
64 
65  virtual double getAngleAt(double distance, RS::From from = RS::FromStart) const;
66 
67  virtual RVector getVectorTo(const RVector& point,
68  bool limited = true, double strictRange = RMAXDOUBLE) const;
69 
70  virtual RVector getStartPoint() const;
71  void setStartPoint(const RVector& vector);
72  virtual RVector getEndPoint() const;
73  void setEndPoint(const RVector& vector);
74 
75  RVector getMiddlePoint() const;
76 
77  double getLength() const;
78  double getAngle() const;
79 
80  void setLength(double l);
81  void setAngle(double a);
82 
83  virtual double getDirection1() const;
84  virtual double getDirection2() const;
85 
86  RS::Side getSideOfPoint(const RVector& point) const;
87 
88  void clipToXY(const RBox& box);
89 
90  virtual bool move(const RVector& offset);
91  virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
92  virtual bool scale(const RVector& scaleFactors, const RVector& center = RDEFAULT_RVECTOR);
93  virtual bool mirror(const RLine& axis);
94  virtual bool flipHorizontal();
95  virtual bool flipVertical();
96  virtual bool reverse();
97  virtual bool stretch(const RPolyline& area, const RVector& offset);
98 
99  virtual QSharedPointer<RShape> getTransformed(const QTransform& transform) const;
100 
101  virtual RS::Ending getTrimEnd(const RVector& coord, const RVector& trimPoint);
102  virtual void trimStartPoint(const RVector& p);
103  virtual void trimEndPoint(const RVector& p);
104  virtual double getDistanceFromStart(const RVector& p) const;
105 
106 protected:
107  virtual void print(QDebug dbg) const;
108 
109 public:
120 };
121 
125 Q_DECLARE_METATYPE(QSharedPointer<RLine>)
126 Q_DECLARE_METATYPE(QSharedPointer<RLine>*)
127 
128 #endif