]> Shamusworld >> Repos - architektonas/blob - src/dimension.h
fbc2896a21735573983e69d477ae98d06f716e4d
[architektonas] / src / dimension.h
1 #ifndef __DIMENSION_H__
2 #define __DIMENSION_H__
3
4 #include "object.h"
5
6 class Line;
7
8 enum DimensionType { DTLinear, DTLinearVert, DTLinearHorz, DTRadial, DTDiametric, DTCircumferential, DTAngular, DTLeader };
9
10 class Dimension: public Object
11 {
12         friend class Line;
13         friend class Geometry;
14
15         public:
16                 Dimension(Vector, Vector, DimensionType dt = DTLinear, Object * p = 0);
17                 ~Dimension();
18
19                 virtual void Draw(Painter *);
20                 virtual Vector Center(void);
21                 virtual bool Collided(Vector);
22                 virtual bool PointerMoved(Vector);
23                 virtual void PointerReleased(void);
24                 virtual bool HitTest(Point);
25                 virtual void Enumerate(FILE *);
26                 virtual Object * Copy(void);
27                 virtual Vector GetPointAtParameter(double parameter);
28                 virtual void MovePointAtParameter(double parameter, Vector);
29                 virtual QRectF Extents(void);
30                 void FlipSides(void);
31
32         protected:
33                 void SaveHitState(void);
34                 bool HitStateChanged(void);
35
36         protected:
37                 Vector endpoint;                                        // Starting point is Object::position
38                 Vector oldPoint;                                        // Used for dragging
39                 Point oldEndpoint;
40                 Point linePt1, linePt2;                         // Used for testing dimension line hits
41
42         private:
43                 bool dragging;
44                 bool draggingHandle1;
45                 bool draggingHandle2;
46                 bool objectWasDragged;
47                 double length;
48                 DimensionType dimensionType;
49                 bool hitPoint1;
50                 bool hitPoint2;
51                 bool hitLine;
52                 bool hitFlipSwitch;
53                 bool hitChangeSwitch1;
54                 bool hitChangeSwitch2;
55                 bool oldHitPoint1, oldHitPoint2, oldHitLine, oldHitFlipSwitch, oldHitChangeSwitch1, oldHitChangeSwitch2;
56         public:
57                 double size;                                            // Size of arrows/text in base units
58 };
59
60 #endif  // __DIMENSION_H__