]> Shamusworld >> Repos - architektonas/blob - src/base/dimangular.h
Bugfixes related to removing Snapper class.
[architektonas] / src / base / dimangular.h
1 #ifndef __DIMANGULAR_H__
2 #define __DIMANGULAR_H__
3
4 #include "dimension.h"
5
6 /**
7  * Holds the data that defines a angular dimension entity.
8  */
9 class DimAngularData
10 {
11         public:
12                 /**
13                  * Default constructor. Leaves the data object uninitialized.
14                  */
15                 DimAngularData() {}
16
17                 /**
18                  * Constructor with initialisation.
19                  *
20                  * @param definitionPoint Definition point of the angular dimension.
21                  * @param leader Leader length.
22                  */
23                 DimAngularData(const Vector& definitionPoint1, const Vector& definitionPoint2,
24                         const Vector& definitionPoint3, const Vector& definitionPoint4)
25                 {
26                         this->definitionPoint1 = definitionPoint1;
27                         this->definitionPoint2 = definitionPoint2;
28                         this->definitionPoint3 = definitionPoint3;
29                         this->definitionPoint4 = definitionPoint4;
30                 }
31
32                 friend std::ostream & operator<<(std::ostream& os, const DimAngularData & dd)
33                 {
34                         os << "(" << dd.definitionPoint1 << "/" << dd.definitionPoint2 << "/"
35                                 << dd.definitionPoint3 << "/" << dd.definitionPoint3 << ")";
36                         return os;
37                 }
38
39         public:
40                 /** Definition point 1. */
41                 Vector definitionPoint1;
42                 /** Definition point 2. */
43                 Vector definitionPoint2;
44                 /** Definition point 3. */
45                 Vector definitionPoint3;
46                 /** Definition point 4. */
47                 Vector definitionPoint4;
48 };
49
50 /**
51  * Class for angular dimension entities.
52  *
53  * @author Andrew Mustun
54  */
55 class DimAngular: public Dimension
56 {
57         public:
58                 DimAngular(EntityContainer * parent, const DimensionData & d, const DimAngularData & ed);
59                 virtual ~DimAngular();
60
61                 virtual Entity * clone();
62                 virtual RS2::EntityType rtti() const;
63                 DimAngularData getEData() const;
64                 virtual QString getMeasuredLabel();
65                 double getAngle();
66                 Vector getCenter();
67                 bool getAngles(double & ang1, double & ang2, bool & reversed, Vector & p1, Vector & p2);
68
69                 virtual void update(bool autoText = false);
70
71                 Vector getDefinitionPoint1();
72                 Vector getDefinitionPoint2();
73                 Vector getDefinitionPoint3();
74                 Vector getDefinitionPoint4();
75
76                 virtual void move(Vector offset);
77                 virtual void rotate(Vector center, double angle);
78                 virtual void scale(Vector center, Vector factor);
79                 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
80
81                 friend std::ostream & operator<<(std::ostream & os, const DimAngular & d);
82
83         protected:
84                 /** Extended data. */
85                 DimAngularData edata;
86 };
87
88 #endif