]> Shamusworld >> Repos - architektonas/blob - src/base/point.h
Bugfixes related to removing Snapper class.
[architektonas] / src / base / point.h
1 #ifndef __POINT_H__
2 #define __POINT_H__
3
4 #include "atomicentity.h"
5
6 /**
7  * Holds the data that defines a point.
8  */
9 class PointData
10 {
11         public:
12                 PointData(const Vector & pos)
13                 {
14                         this->pos = pos;
15                 }
16
17                 friend std::ostream & operator<<(std::ostream & os, const 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 Point: public AtomicEntity
32 {
33         public:
34                 Point(EntityContainer * parent, const PointData & d);
35
36                 virtual 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                 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, 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, 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                 virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
60
61                 friend std::ostream & operator<<(std::ostream & os, const Point & p);
62
63                 /** Recalculates the borders of this entity. */
64                 virtual void calculateBorders();
65
66         protected:
67                 PointData data;
68                 //Vector point;
69 };
70
71 #endif