]> Shamusworld >> Repos - architektonas/blob - src/line.h
Added glue layer to Qt painting, to properly render cartesian coordinates.
[architektonas] / src / line.h
1 #ifndef __LINE_H__
2 #define __LINE_H__
3
4 #include "object.h"
5
6 class Dimension;
7
8 class Line: public Object
9 {
10         public:
11                 Line(Vector, Vector, Object * p = 0);
12                 ~Line();
13
14                 virtual void Draw(Painter *);
15                 virtual Vector Center(void);
16                 virtual bool Collided(Vector);
17                 virtual void PointerMoved(Vector);
18                 virtual void PointerReleased(void);
19 //              void SetDimensionOnPoint1(Dimension *);
20 //              void SetDimensionOnPoint2(Dimension *);
21                 void SetDimensionOnLine(Dimension * d = 0);
22
23         protected:
24                 bool HitTest(Point);
25                 void SaveState(void);
26                 bool StateChanged(void);
27
28         protected:
29                 Vector endpoint;                                        // Starting point is Object::position
30                 Vector oldPoint;                                        // Used for dragging
31
32         private:
33                 bool draggingLine;
34                 bool draggingHandle1;
35                 bool draggingHandle2;
36                 bool objectWasDragged;
37                 double length;
38                 Vector angle;
39                 bool hitPoint1, hitPoint2, hitLine;
40                 bool oldHitPoint1, oldHitPoint2, oldHitLine;
41 };
42
43 #endif  // __LINE_H__