]> Shamusworld >> Repos - architektonas/blob - src/dimension.h
Added Architektonas drawing file loading/saving infrastructure.
[architektonas] / src / dimension.h
1 #ifndef __DIMENSION_H__
2 #define __DIMENSION_H__
3
4 #include "object.h"
5
6 enum DimensionType { DTLinear, DTRadial, DTDiametric, DTCircumferential, DTLeader };
7
8 class Dimension: public Object
9 {
10         public:
11                 Dimension(Vector, Vector, DimensionType dt = DTLinear, Object * p = 0);
12                 Dimension(Vector *, Vector *, DimensionType dt = DTLinear, Object * p = 0);
13                 ~Dimension();
14
15                 virtual void Draw(Painter *);
16                 virtual Vector Center(void);
17                 virtual bool Collided(Vector);
18                 virtual void PointerMoved(Vector);
19                 virtual void PointerReleased(void);
20                 void SetPoint1(Vector *);
21                 void SetPoint2(Vector *);
22                 Vector GetPoint1(void);
23                 Vector GetPoint2(void);
24                 void FlipSides(void);
25
26         protected:
27                 Vector endpoint;                                        // Starting point is Object::position
28                 Vector oldPoint;                                        // Used for dragging
29
30         private:
31                 bool dragging;
32                 bool draggingHandle1;
33                 bool draggingHandle2;
34                 bool objectWasDragged;
35                 double length;
36                 DimensionType type;
37
38                 Vector * point1;                                        // These couple to external points; if there
39                 Vector * point2;                                        // are none then fall back to endpoint/position
40 };
41
42 #endif  // __DIMENSION_H__