]> Shamusworld >> Repos - architektonas/blob - src/dimension.h
ba30b8f7e98980eb82274d8983c6b41190e90160
[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(Connection, Connection, DimensionType dt = DTLinear, Object * p = 0);
19                 ~Dimension();
20
21                 virtual void Draw(Painter *);
22                 virtual Vector Center(void);
23                 virtual bool Collided(Vector);
24                 virtual void PointerMoved(Vector);
25                 virtual void PointerReleased(void);
26                 virtual bool HitTest(Point);
27                 virtual void Enumerate(FILE *);
28                 virtual Object * Copy(void);
29                 virtual Vector GetPointAtParameter(double parameter);
30                 virtual void MovePointAtParameter(double parameter, Vector);
31 //              virtual void Connect(Object *, double);
32 //              virtual void Disconnect(Object *, double);
33 //              virtual void DisconnectAll(Object *);
34                 virtual QRectF Extents(void);
35                 void FlipSides(void);
36
37         protected:
38                 void SaveHitState(void);
39                 bool HitStateChanged(void);
40
41         protected:
42                 Vector endpoint;                                        // Starting point is Object::position
43                 Vector oldPoint;                                        // Used for dragging
44                 Point oldEndpoint;
45
46         private:
47                 bool dragging;
48                 bool draggingHandle1;
49                 bool draggingHandle2;
50                 bool objectWasDragged;
51                 double length;
52                 DimensionType dimensionType;
53                 bool hitPoint1;
54                 bool hitPoint2;
55                 bool hitLine;
56                 bool hitFlipSwitch;
57                 bool oldHitPoint1, oldHitPoint2, oldHitLine, oldHitFlipSwitch;
58         public:
59                 double size;                                            // Size of arrows/text in base units
60
61         private:
62                 // We use these in lieu of the built-in connected[] array; no reason to
63                 // do it this way especially
64 //              Connection point1;
65 //              Connection point2;
66 };
67
68 #endif  // __DIMENSION_H__