]> Shamusworld >> Repos - architektonas/blob - src/line.h
5d84b39bf9128ab1bf69f27bea9ec5ed2660b5af
[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 void Translate(Vector);
26                 virtual void Rotate(Vector, double);
27                 virtual void Scale(Vector, double);
28                 virtual void Mirror(Point, Point);
29                 virtual void Save(void);
30                 virtual void Restore(void);
31                 void SetDimensionOnLine(Dimension * d = 0);
32                 Object * FindAttachedDimension(void);
33
34         protected:
35                 void SaveHitState(void);
36                 bool HitStateChanged(void);
37
38         protected:
39                 Vector endpoint;                                        // Starting point is Object::position
40                 Vector oldPoint;                                        // Used for dragging
41                 Point oldEndpoint;
42
43         private:
44                 bool draggingLine;
45                 bool draggingHandle1;
46                 bool draggingHandle2;
47                 bool objectWasDragged;
48                 double length;
49                 Vector angle;
50                 bool hitPoint1, hitPoint2, hitLine;
51                 bool oldHitPoint1, oldHitPoint2, oldHitLine;
52 };
53
54 #endif  // __LINE_H__