]> Shamusworld >> Repos - architektonas/blob - src/dimension.h
In the middle of refactoring objects for loading/saving.
[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                 virtual void Enumerate(FILE *);
21                 virtual Object * Copy(void);
22                 void SetPoint1(Vector *);
23                 void SetPoint2(Vector *);
24                 Vector GetPoint1(void);
25                 Vector GetPoint2(void);
26                 void FlipSides(void);
27
28         protected:
29                 Vector endpoint;                                        // Starting point is Object::position
30                 Vector oldPoint;                                        // Used for dragging
31
32         private:
33                 bool dragging;
34                 bool draggingHandle1;
35                 bool draggingHandle2;
36                 bool objectWasDragged;
37                 double length;
38                 DimensionType type;
39
40                 Vector * point1;                                        // These couple to external points; if there
41                 Vector * point2;                                        // are none then fall back to endpoint/position
42 };
43
44 #endif  // __DIMENSION_H__