]> Shamusworld >> Repos - architektonas/blob - src/dimension.h
Initial stab at horizontally aligned Dimensions.
[architektonas] / src / dimension.h
1 #ifndef __DIMENSION_H__
2 #define __DIMENSION_H__
3
4 #include "connection.h"
5 #include "object.h"
6
7 class Line;
8
9 enum DimensionType { DTLinear, DTLinearVert, DTLinearHorz, DTRadial, DTDiametric, DTCircumferential, DTAngular, DTLeader };
10
11 class Dimension: public Object
12 {
13         friend class Line;
14         friend class Geometry;
15
16         public:
17                 Dimension(Vector, Vector, DimensionType dt = DTLinear, Object * p = 0);
18                 ~Dimension();
19
20                 virtual void Draw(Painter *);
21                 virtual Vector Center(void);
22                 virtual bool Collided(Vector);
23                 virtual void PointerMoved(Vector);
24                 virtual void PointerReleased(void);
25                 virtual bool HitTest(Point);
26                 virtual void Enumerate(FILE *);
27                 virtual Object * Copy(void);
28                 virtual Vector GetPointAtParameter(double parameter);
29                 virtual void MovePointAtParameter(double parameter, Vector);
30                 virtual QRectF Extents(void);
31                 void FlipSides(void);
32
33         protected:
34                 void SaveHitState(void);
35                 bool HitStateChanged(void);
36
37         protected:
38                 Vector endpoint;                                        // Starting point is Object::position
39                 Vector oldPoint;                                        // Used for dragging
40                 Point oldEndpoint;
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 oldHitPoint1, oldHitPoint2, oldHitLine, oldHitFlipSwitch;
54         public:
55                 double size;                                            // Size of arrows/text in base units
56 };
57
58 #endif  // __DIMENSION_H__