1 #ifndef RS_CONSTRUCTIONLINE_H
2 #define RS_CONSTRUCTIONLINE_H
4 #include "rs_atomicentity.h"
8 * Holds the data that defines a construction line (a line
9 * which is not limited to both directions).
11 class RS_ConstructionLineData
15 * Default constructor. Leaves the data object uninitialized.
17 RS_ConstructionLineData() {}
19 RS_ConstructionLineData(const Vector& point1,
20 const Vector& point2) {
22 this->point1 = point1;
23 this->point2 = point2;
26 friend class RS_ConstructionLine;
28 friend std::ostream& operator << (std::ostream& os,
29 const RS_ConstructionLineData& ld) {
31 os << "(" << ld.point1 <<
44 * Class for a construction line entity.
46 * @author Andrew Mustun
48 class RS_ConstructionLine : public RS_AtomicEntity {
50 RS_ConstructionLine(RS_EntityContainer* parent,
51 const RS_ConstructionLineData& d);
53 virtual RS_Entity* clone();
55 virtual ~RS_ConstructionLine();
57 /** @return RS2::EntityConstructionLine */
58 virtual RS2::EntityType rtti() const {
59 return RS2::EntityConstructionLine;
64 * @return Start point of the entity.
66 virtual Vector getStartpoint() const {
71 * @return End point of the entity.
73 virtual Vector getEndpoint() const {
77 /** @return Copy of data that defines the line. */
78 RS_ConstructionLineData getData() const {
82 /** @return First definition point. */
83 Vector getPoint1() const {
86 /** @return Second definition point. */
87 Vector getPoint2() const {
91 virtual Vector getNearestEndpoint(const Vector& coord,
93 virtual Vector getNearestPointOnEntity(const Vector& coord,
94 bool onEntity = true, double* dist = NULL, RS_Entity** entity=NULL);
95 virtual Vector getNearestCenter(const Vector& coord,
97 virtual Vector getNearestMiddle(const Vector& coord,
99 virtual Vector getNearestDist(double distance,
101 double* dist = NULL);
102 virtual double getDistanceToPoint(const Vector& coord,
103 RS_Entity** entity=NULL,
104 RS2::ResolveLevel level=RS2::ResolveNone,
105 double solidDist = RS_MAXDOUBLE);
107 virtual void move(Vector offset);
108 virtual void rotate(Vector center, double angle);
109 virtual void scale(Vector center, Vector factor);
110 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
112 // virtual void draw(RS_Painter* /*painter*/, RS_GraphicView* /*view*/,
113 virtual void draw(PaintInterface * /*painter*/, RS_GraphicView* /*view*/,
114 double /*patternOffset*/) {}
116 friend std::ostream& operator << (std::ostream& os,
117 const RS_ConstructionLine& l);
119 virtual void calculateBorders();
122 RS_ConstructionLineData data;