QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RPoint.h
Go to the documentation of this file.
1 
20 #ifndef RPOINT_H
21 #define RPOINT_H
22 
23 #include "../core_global.h"
24 
25 #include "RShape.h"
26 #include "RVector.h"
27 #include "RBox.h"
28 
38 class QCADCORE_EXPORT RPoint: public RShape {
39 public:
40  RPoint();
41  RPoint(double x, double y);
42  RPoint(const RVector& position);
43  virtual ~RPoint();
44 
45  virtual RPoint* clone() const {
46  return new RPoint(*this);
47  }
48 
49  virtual void to2D();
50 
51  RVector getPosition() const {
52  return position;
53  }
54 
55  void setPosition(const RVector& p) {
56  position = p;
57  }
58 
59  virtual RBox getBoundingBox() const;
60  virtual double getLength() const;
61 
62  virtual QList<RVector> getEndPoints() const;
63  virtual QList<RVector> getMiddlePoints() const;
64  virtual QList<RVector> getCenterPoints() const;
65  virtual QList<RVector> getPointsWithDistanceToEnd(
66  double distance, RS::From from = RS::FromAny) const;
67 
68  virtual double getAngleAt(double distance, RS::From from = RS::FromStart) const;
69 
70  virtual RVector getVectorTo(const RVector& point,
71  bool limited = true, double strictRange = RMAXDOUBLE) const;
72 
73  virtual bool move(const RVector& offset);
74  virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
75  virtual bool scale(const RVector& scaleFactors, const RVector& center = RDEFAULT_RVECTOR);
76  virtual bool mirror(const RLine& axis);
77  virtual bool flipHorizontal();
78  virtual bool flipVertical();
79 
80  virtual QSharedPointer<RShape> getTransformed(const QTransform& transform) const;
81 
82 protected:
83  virtual void print(QDebug dbg) const;
84 
85 public:
91 };
92 
95 Q_DECLARE_METATYPE(QSharedPointer<RPoint>)
96 Q_DECLARE_METATYPE(QSharedPointer<RPoint>*)
97 
98 #endif