]> Shamusworld >> Repos - architektonas/blob - src/line.h
0ad264cd1f2debc38a08dabe68cf654bd59a78ab
[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         friend class Geometry;
11
12         public:
13                 Line(Vector, Vector, Object * p = 0);
14                 ~Line();
15
16                 virtual void Draw(Painter *);
17                 virtual Vector Center(void);
18                 virtual bool Collided(Vector);
19                 virtual void PointerMoved(Vector);
20                 virtual void PointerReleased(void);
21                 virtual bool HitTest(Point);
22                 virtual Vector * GetPointAt(Vector);
23                 virtual void Enumerate(FILE *);
24                 virtual Object * Copy(void);
25                 virtual Vector GetPointAtParameter(double parameter);
26                 virtual void MovePointAtParameter(double parameter, Vector);
27                 virtual QRectF Extents(void);
28                 virtual void Translate(Vector);
29                 virtual void Rotate(Point, double);
30                 virtual void Scale(Vector, double);
31                 virtual void Mirror(Point, Point);
32                 virtual void Save(void);
33                 virtual void Restore(void);
34                 void SetDimensionOnLine(Dimension * d = 0);
35                 Object * FindAttachedDimension(void);
36
37         protected:
38                 void SaveHitState(void);
39                 bool HitStateChanged(void);
40
41         protected:
42                 Vector endpoint;                                        // Starting point is Object::position
43                 Vector oldPoint;                                        // Used for dragging
44                 Point oldEndpoint;
45
46         private:
47                 bool draggingLine;
48                 bool draggingHandle1;
49                 bool draggingHandle2;
50                 bool objectWasDragged;
51                 double length;
52                 Vector angle;
53                 bool hitPoint1, hitPoint2, hitLine;
54                 bool oldHitPoint1, oldHitPoint2, oldHitLine;
55 };
56
57 #endif  // __LINE_H__