]> Shamusworld >> Repos - architektonas/blob - src/base/dimaligned.h
Fixed problem with MDI activation.
[architektonas] / src / base / dimaligned.h
1 #ifndef __DIMALIGNED_H__
2 #define __DIMALIGNED_H__
3
4 #include "dimension.h"
5
6 /**
7  * Holds the data that defines an aligned dimension entity.
8  */
9 class DimAlignedData
10 {
11         public:
12                 /**
13                  * Default constructor. Leaves the data object uninitialized.
14                  */
15                 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                 DimAlignedData(const Vector & extensionPoint1, const Vector & extensionPoint2)
26                 {
27                         this->extensionPoint1 = extensionPoint1;
28                         this->extensionPoint2 = extensionPoint2;
29                 }
30
31                 friend class DimAligned;
32                 friend class ActionDimAligned;
33
34                 friend std::ostream & operator<<(std::ostream & os, const 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 DimAligned: public Dimension
53 {
54         public:
55                 DimAligned(EntityContainer * parent, const DimensionData & d, const DimAlignedData & ed);
56                 virtual ~DimAligned();
57
58                 virtual Entity * clone();
59                 virtual RS2::EntityType rtti() const;
60                 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 DimAligned & d);
77
78         protected:
79                 /** Extended data. */
80                 DimAlignedData edata;
81 };
82
83 #endif