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 RVector getVectorTo(const RVector& point,
66  bool limited = true) const;
67 
68  virtual RVector getStartPoint() const;
69  void setStartPoint(const RVector& vector);
70  virtual RVector getEndPoint() const;
71  void setEndPoint(const RVector& vector);
72 
73  RVector getMiddlePoint() const;
74 
75  double getLength() const;
76  double getAngle() const;
77 
78  void setLength(double l);
79  void setAngle(double a);
80 
81  virtual double getDirection1() const;
82  virtual double getDirection2() const;
83 
84  RS::Side getSideOfPoint(const RVector& point) const;
85 
86  void clipToXY(const RBox& box);
87 
88  virtual bool move(const RVector& offset);
89  virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
90  virtual bool scale(const RVector& scaleFactors, const RVector& center = RDEFAULT_RVECTOR);
91  virtual bool mirror(const RLine& axis);
92  virtual bool flipHorizontal();
93  virtual bool flipVertical();
94  virtual bool reverse();
95  virtual bool stretch(const RPolyline& area, const RVector& offset);
96 
97  virtual QSharedPointer<RShape> getTransformed(const QTransform& transform) const;
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  virtual double getDistanceFromStart(const RVector& p) const;
103 
104 protected:
105  virtual void print(QDebug dbg) const;
106 
107 public:
118 };
119 
123 Q_DECLARE_METATYPE(QSharedPointer<RLine>)
124 Q_DECLARE_METATYPE(QSharedPointer<RLine>*)
125 
126 #endif