]> Shamusworld >> Repos - architektonas/blob - src/dimension.h
Fixed duplicate Connection issue.
[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
15         public:
16                 Dimension(Vector, Vector, DimensionType dt = DTLinear, Object * p = 0);
17                 Dimension(Connection, Connection, 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 void Connect(Object *, double);
31                 virtual void Disconnect(Object *, double);
32                 virtual void DisconnectAll(Object *);
33                 virtual QRectF Extents(void);
34                 void FlipSides(void);
35
36         protected:
37                 void SaveHitState(void);
38                 bool HitStateChanged(void);
39
40         protected:
41                 Vector endpoint;                                        // Starting point is Object::position
42                 Vector oldPoint;                                        // Used for dragging
43                 Point oldEndpoint;
44
45         private:
46                 bool dragging;
47                 bool draggingHandle1;
48                 bool draggingHandle2;
49                 bool objectWasDragged;
50                 double length;
51                 DimensionType dimensionType;
52                 bool hitPoint1;
53                 bool hitPoint2;
54                 bool oldHitPoint1, oldHitPoint2;
55         public:
56                 double size;                                            // Size of arrows/text in base units
57
58         private:
59                 // We use these in lieu of the built-in connected[] array; no reason to
60                 // do it this way especially
61                 Connection point1;
62                 Connection point2;
63 };
64
65 #endif  // __DIMENSION_H__