]> Shamusworld >> Repos - architektonas/blob - src/line.h
fb17f2e2f41d9601108150bb0c9fb9db0b081ac0
[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                 virtual bool HitTest(Point);
20                 virtual Vector * GetPointAt(Vector);
21                 virtual void Enumerate(FILE *);
22                 virtual Object * Copy(void);
23                 virtual Vector GetPointAtParameter(double parameter);
24                 virtual QRectF Extents(void);
25 //              virtual ObjectType Type(void);
26                 void SetDimensionOnLine(Dimension * d = 0);
27                 Object * FindAttachedDimension(void);
28
29         protected:
30                 void SaveState(void);
31                 bool StateChanged(void);
32
33         protected:
34                 Vector endpoint;                                        // Starting point is Object::position
35                 Vector oldPoint;                                        // Used for dragging
36
37         private:
38                 bool draggingLine;
39                 bool draggingHandle1;
40                 bool draggingHandle2;
41                 bool objectWasDragged;
42                 double length;
43                 Vector angle;
44                 bool hitPoint1, hitPoint2, hitLine;
45                 bool oldHitPoint1, oldHitPoint2, oldHitLine;
46 };
47
48 #endif  // __LINE_H__