]> Shamusworld >> Repos - architektonas/blob - src/arc.h
Fixed Arc to give continuous feedback like Line and Circle do.
[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
22         private:
23                 bool AngleInArcSpan(double angle);
24
25         protected:
26                 void SaveHitState(void);
27                 bool HitStateChanged(void);
28
29         protected:
30                 double radius;                                          // Center is Object::position
31                 double startAngle;                                      // Starting angle in radians
32                 double angleSpan;                                       // # of degrees the arc spans in radians
33
34         private:
35 //              bool hitHandle1;        // Moving
36 //              bool hitHandle2;        // Rotation
37 //              bool hitHandle3;        // Setting span of the arc
38 //              bool hitHandle4;        // Resizing
39                 bool draggingCenter;
40                 bool draggingEdge;
41                 bool draggingRotate;
42                 bool draggingSpan;
43                 bool objectWasDragged;
44                 Vector oldPoint;                                        // Used for dragging
45                 double oldAngle;                                        // Used for user feedback
46                 double oldRadius;                                       // Used for user feedback
47                 bool hitCenter, hitArc, hitRotate, hitSpan;
48                 bool oldHitCenter, oldHitArc, oldHitRotate, oldHitSpan;
49 };
50
51 #endif  // __ARC_H__