]> Shamusworld >> Repos - architektonas/blob - src/base/rs_point.h
Final round of dialogs/forms needing to be converted from Qt3 to 4
[architektonas] / src / base / rs_point.h
1 #ifndef RS_POINT_H
2 #define RS_POINT_H
3
4 #include "rs_atomicentity.h"
5
6 /**
7  * Holds the data that defines a point.
8  */
9 class RS_PointData
10 {
11         public:
12                 RS_PointData(const Vector & pos)
13                 {
14                         this->pos = pos;
15                 }
16
17                 friend std::ostream & operator<<(std::ostream & os, const RS_PointData & pd)
18                 {
19                         os << "(" << pd.pos << ")";
20                         return os;
21                 }
22
23                 Vector pos;
24 };
25
26 /**
27  * Class for a point entity.
28  *
29  * @author Andrew Mustun
30  */
31 class RS_Point: public RS_AtomicEntity
32 {
33         public:
34                 RS_Point(RS_EntityContainer * parent, const RS_PointData & d);
35
36                 virtual RS_Entity * clone();
37                 virtual RS2::EntityType rtti() const;
38                 virtual Vector getStartpoint() const;
39                 virtual Vector getEndpoint() const;
40                 virtual void moveStartpoint(const Vector & pos);
41                 RS_PointData getData() const;
42                 virtual VectorSolutions getRefPoints();
43                 Vector getPos();
44                 void setPos(const Vector & pos);
45
46                 virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
47                 virtual Vector getNearestPointOnEntity(const Vector & coord,
48                                 bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
49                 virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
50                 virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
51                 virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
52                 virtual double getDistanceToPoint(const Vector& coord, RS_Entity ** entity = NULL,
53                         RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
54
55                 virtual void move(Vector offset);
56                 virtual void rotate(Vector center, double angle);
57                 virtual void scale(Vector center, Vector factor);
58                 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
59
60 //              virtual void draw(RS_Painter * painter, RS_GraphicView * view, double patternOffset = 0.0);
61                 virtual void draw(PaintInterface * painter, RS_GraphicView * view, double patternOffset = 0.0);
62
63                 friend std::ostream & operator<<(std::ostream & os, const RS_Point & p);
64
65                 /** Recalculates the borders of this entity. */
66                 virtual void calculateBorders();
67
68         protected:
69                 RS_PointData data;
70                 //Vector point;
71 };
72
73 #endif