]> Shamusworld >> Repos - architektonas/blob - src/arc.h
Added rotation tool.
[architektonas] / src / arc.h
1 #ifndef __ARC_H__
2 #define __ARC_H__
3
4 #include "object.h"
5
6 class Arc: public Object
7 {
8         public:
9                 Arc(Vector, double, double, double, Object * p = 0);
10                 ~Arc();
11
12                 virtual void Draw(Painter *);
13                 virtual Vector Center(void);
14                 virtual bool Collided(Vector);
15                 virtual void PointerMoved(Vector);
16                 virtual void PointerReleased(void);
17                 virtual bool HitTest(Point);
18                 virtual void Enumerate(FILE *);
19                 virtual Object * Copy(void);
20                 virtual QRectF Extents(void);
21                 virtual void Rotate(Point, double);
22                 virtual void Mirror(Point, Point);
23                 virtual void Save(void);
24                 virtual void Restore(void);
25
26         private:
27                 bool AngleInArcSpan(double angle);
28
29         protected:
30                 void SaveHitState(void);
31                 bool HitStateChanged(void);
32
33         protected:
34                 double radius;                                          // Center is Object::position
35                 double startAngle;                                      // Starting angle in radians
36                 double angleSpan;                                       // # of degrees the arc spans in radians
37                 double oldRadius2;
38                 double oldStartAngle;
39                 double oldAngleSpan;
40
41         private:
42 //              bool hitHandle1;        // Moving
43 //              bool hitHandle2;        // Rotation
44 //              bool hitHandle3;        // Setting span of the arc
45 //              bool hitHandle4;        // Resizing
46                 bool draggingCenter;
47                 bool draggingEdge;
48                 bool draggingRotate;
49                 bool draggingSpan;
50                 bool objectWasDragged;
51                 Vector oldPoint;                                        // Used for dragging
52                 double oldAngle;                                        // Used for user feedback
53                 double oldRadius;                                       // Used for user feedback
54                 bool hitCenter, hitArc, hitRotate, hitSpan;
55                 bool oldHitCenter, oldHitArc, oldHitRotate, oldHitSpan;
56 };
57
58 #endif  // __ARC_H__