]> Shamusworld >> Repos - architektonas/blob - src/dimension.h
7ffca2faabf8e72b4473c809c1f8981391cf8c07
[architektonas] / src / dimension.h
1 #ifndef __DIMENSION_H__
2 #define __DIMENSION_H__
3
4 #include "connection.h"
5 #include "object.h"
6
7 enum DimensionType { DTLinear, DTLinearVert, DTLinearHorz, DTRadial, DTDiametric, DTCircumferential, DTAngular, DTLeader };
8
9 class Dimension: public Object
10 {
11         public:
12                 Dimension(Vector, Vector, DimensionType dt = DTLinear, Object * p = 0);
13                 Dimension(Connection, Connection, DimensionType dt = DTLinear, Object * p = 0);
14                 ~Dimension();
15
16                 virtual void Draw(Painter *);
17                 virtual Vector Center(void);
18                 virtual bool Collided(Vector);
19                 virtual void PointerMoved(Vector);
20                 virtual void PointerReleased(void);
21                 virtual bool HitTest(Point);
22                 virtual void Enumerate(FILE *);
23                 virtual Object * Copy(void);
24                 virtual Vector GetPointAtParameter(double parameter);
25                 virtual void Connect(Object *, double);
26                 virtual void Disconnect(Object *, double);
27                 virtual void DisconnectAll(Object *);
28                 virtual QRectF Extents(void);
29                 void FlipSides(void);
30
31         protected:
32                 Vector endpoint;                                        // Starting point is Object::position
33                 Vector oldPoint;                                        // Used for dragging
34
35         private:
36                 bool dragging;
37                 bool draggingHandle1;
38                 bool draggingHandle2;
39                 bool objectWasDragged;
40                 double length;
41                 DimensionType dimensionType;
42                 bool hitPoint1;
43                 bool hitPoint2;
44         public:
45                 double size;                                            // Size of arrows/text in base units
46
47         private:
48                 // We use these in lieu of the built-in connected[] array; no reason to
49                 // do it this way especially
50                 Connection point1;
51                 Connection point2;
52 };
53
54 #endif  // __DIMENSION_H__