QCAD
Open Source 2D CAD
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
Represents a box e.g.
Definition: RBox.h:43
virtual RVector getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const =0
virtual void to2D()=0
Flattens this shape to the X/Y plane.
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RVector getPosition() const
Definition: RPoint.h:51
virtual QList< RVector > getEndPoints() const =0
void setPosition(const RVector &p)
Definition: RPoint.h:55
virtual bool rotate(double rotation, const RVector &center=RDEFAULT_RVECTOR)=0
#define QCADCORE_EXPORT
Definition: core_global.h:10
virtual double getLength() const =0
virtual RBox getBoundingBox() const =0
Start or end.
Definition: RS.h:187
virtual bool move(const RVector &offset)=0
virtual bool flipHorizontal()
Definition: RShape.cpp:1600
virtual double getAngleAt(double distance, RS::From from=RS::FromStart) const
Definition: RShape.h:135
virtual QList< RVector > getPointsWithDistanceToEnd(double distance, RS::From from=RS::FromAny) const =0
Q_DECLARE_METATYPE(RMath *)
virtual QList< RVector > getMiddlePoints() const =0
#define RMAXDOUBLE
Definition: RMath.h:50
virtual RPoint * clone() const
Definition: RPoint.h:45
Definition: RS.h:185
virtual bool mirror(const RLine &axis)=0
Low-level mathematical representation of a line.
Definition: RLine.h:42
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPoint.h:38
virtual QSharedPointer< RShape > getTransformed(const QTransform &transform) const =0
From
End used to specify from which end of a shape to measure a distance.
Definition: RS.h:184
virtual bool flipVertical()
Definition: RShape.cpp:1604
virtual bool scale(double scaleFactor, const RVector &center=RVector())
Definition: RShape.cpp:1619
RVector position
Getter function for this property: getPosition.
Definition: RPoint.h:90
Interface for geometrical shape classes.
Definition: RShape.h:52
virtual QList< RVector > getCenterPoints() const =0
virtual void print(QDebug dbg) const
Definition: RShape.cpp:1623
#define RDEFAULT_RVECTOR
Definition: RVector.h:37