]> Shamusworld >> Repos - architektonas/blob - src/base/dimangular.h
Fixed thumbnail rendering in LibraryWidget and DXF detection.
[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 RS_DimAngularData
10 {
11         public:
12                 /**
13                  * Default constructor. Leaves the data object uninitialized.
14                  */
15                 RS_DimAngularData() {}
16
17                 /**
18                  * Constructor with initialisation.
19                  *
20                  * @param definitionPoint Definition point of the angular dimension.
21                  * @param leader Leader length.
22                  */
23                 RS_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 RS_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 RS_DimAngular: public RS_Dimension
56 {
57         public:
58                 RS_DimAngular(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimAngularData & ed);
59                 virtual ~RS_DimAngular();
60
61                 virtual RS_Entity * clone();
62                 virtual RS2::EntityType rtti() const;
63                 RS_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 RS_DimAngular & d);
82
83         protected:
84                 /** Extended data. */
85                 RS_DimAngularData edata;
86 };
87
88 #endif