]> Shamusworld >> Repos - architektonas/blob - src/base/rs_dimaligned.h
Initial import
[architektonas] / src / base / rs_dimaligned.h
1 #ifndef RS_DIMALIGNED_H
2 #define RS_DIMALIGNED_H
3
4 #include "rs_dimension.h"
5
6 /**
7  * Holds the data that defines an aligned dimension entity.
8  */
9 class RS_DimAlignedData
10 {
11         public:
12                 /**
13                  * Default constructor. Leaves the data object uninitialized.
14                  */
15                 RS_DimAlignedData() {}
16
17                 /**
18                  * Constructor with initialisation.
19                  *
20                  * @para extensionPoint1 Definition point. Startpoint of the
21                  *         first extension line.
22                  * @para extensionPoint2 Definition point. Startpoint of the
23                  *         second extension line.
24                  */
25                 RS_DimAlignedData(const Vector & extensionPoint1, const Vector & extensionPoint2)
26                 {
27                         this->extensionPoint1 = extensionPoint1;
28                         this->extensionPoint2 = extensionPoint2;
29                 }
30
31                 friend class RS_DimAligned;
32                 friend class RS_ActionDimAligned;
33
34                 friend std::ostream & operator<<(std::ostream & os, const RS_DimAlignedData & dd)
35                 {
36                         os << "(" << dd.extensionPoint1 << "/" << dd.extensionPoint1 << ")";
37                         return os;
38                 }
39
40         private:
41                 /** Definition point. Startpoint of the first extension line. */
42                 Vector extensionPoint1;
43                 /** Definition point. Startpoint of the second extension line. */
44                 Vector extensionPoint2;
45 };
46
47 /**
48  * Class for aligned dimension entities.
49  *
50  * @author Andrew Mustun
51  */
52 class RS_DimAligned: public RS_Dimension
53 {
54         public:
55                 RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimAlignedData & ed);
56                 virtual ~RS_DimAligned();
57
58                 virtual RS_Entity * clone();
59                 virtual RS2::EntityType rtti() const;
60                 RS_DimAlignedData getEData() const;
61                 virtual VectorSolutions getRefPoints();
62                 virtual QString getMeasuredLabel();
63                 virtual void update(bool autoText = false);
64
65                 Vector getExtensionPoint1();
66                 Vector getExtensionPoint2();
67                 virtual bool hasEndpointsWithinWindow(Vector v1, Vector v2);
68
69                 virtual void move(Vector offset);
70                 virtual void rotate(Vector center, double angle);
71                 virtual void scale(Vector center, Vector factor);
72                 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
73                 virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
74                 virtual void moveRef(const Vector & ref, const Vector & offset);
75
76                 friend std::ostream & operator<<(std::ostream & os, const RS_DimAligned & d);
77
78         protected:
79                 /** Extended data. */
80                 RS_DimAlignedData edata;
81 };
82
83 #endif