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 RShape::Type getShapeType() const {
46  return Point;
47  }
48 
49  virtual RPoint* clone() const {
50  return new RPoint(*this);
51  }
52 
53  virtual void to2D();
54 
55  virtual QList<RVector> getVectorProperties() const;
56 
57  RVector getPosition() const {
58  return position;
59  }
60 
61  void setPosition(const RVector& p) {
62  position = p;
63  }
64 
65  virtual RBox getBoundingBox() const;
66  virtual double getLength() const;
67 
68  virtual QList<RVector> getEndPoints() const;
69  virtual QList<RVector> getMiddlePoints() const;
70  virtual QList<RVector> getCenterPoints() const;
71  virtual QList<RVector> getPointsWithDistanceToEnd(
72  double distance, int from = RS::FromAny) const;
73 
74  virtual double getAngleAt(double distance, RS::From from = RS::FromStart) const;
75 
76  virtual RVector getVectorTo(const RVector& point,
77  bool limited = true, double strictRange = RMAXDOUBLE) const;
78 
79  virtual bool move(const RVector& offset);
80  virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
81  virtual bool scale(const RVector& scaleFactors, const RVector& center = RDEFAULT_RVECTOR);
82  virtual bool mirror(const RLine& axis);
83  virtual bool flipHorizontal();
84  virtual bool flipVertical();
85 
86  virtual QSharedPointer<RShape> getTransformed(const QTransform& transform) const;
87 
88 protected:
89  virtual void print(QDebug dbg) const;
90 
91 public:
97 };
98 
101 Q_DECLARE_METATYPE(QSharedPointer<RPoint>)
102 Q_DECLARE_METATYPE(QSharedPointer<RPoint>*)
103 
104 #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:57
virtual QList< RVector > getEndPoints() const =0
virtual QList< RVector > getVectorProperties() const
Definition: RShape.h:141
void setPosition(const RVector &p)
Definition: RPoint.h:61
Definition: RShape.h:56
virtual bool rotate(double rotation, const RVector &center=RDEFAULT_RVECTOR)=0
#define QCADCORE_EXPORT
Definition: core_global.h:10
virtual QList< RVector > getPointsWithDistanceToEnd(double distance, int from=RS::FromAny) const =0
virtual double getLength() const =0
virtual RBox getBoundingBox() const =0
Start or end.
Definition: RS.h:203
virtual bool move(const RVector &offset)=0
virtual bool flipHorizontal()
Definition: RShape.cpp:1696
virtual double getAngleAt(double distance, RS::From from=RS::FromStart) const
Definition: RShape.h:208
Q_DECLARE_METATYPE(RMath *)
virtual QList< RVector > getMiddlePoints() const =0
Type
Definition: RShape.h:54
#define RMAXDOUBLE
Definition: RMath.h:63
virtual RPoint * clone() const
Definition: RPoint.h:49
Definition: RS.h:201
virtual bool mirror(const RLine &axis)=0
Low-level mathematical representation of a line.
Definition: RLine.h:41
Copyright (c) 2011-2017 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:200
virtual bool flipVertical()
Definition: RShape.cpp:1700
virtual bool scale(double scaleFactor, const RVector &center=RVector())
Definition: RShape.cpp:1715
RVector position
Getter function for this property: getPosition.
Definition: RPoint.h:96
Interface for geometrical shape classes.
Definition: RShape.h:52
virtual QList< RVector > getCenterPoints() const =0
virtual void print(QDebug dbg) const
Definition: RShape.cpp:1719
virtual RShape::Type getShapeType() const
Definition: RPoint.h:45
#define RDEFAULT_RVECTOR
Definition: RVector.h:37