1 // drawcircleaction.cpp: Action class for drawing circles
3 // Part of the Architektonas Project
4 // (C) 2012 Underground Software
5 // See the README and GPLv3 files for licensing and warranty information
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- ------------------------------------------------------------
11 // JLH 02/01/2012 Created this file
14 #include "drawcircleaction.h"
24 DrawCircleAction::DrawCircleAction(): state(0), circle(NULL)
28 DrawCircleAction::~DrawCircleAction()
33 /*virtual*/ void DrawCircleAction::Draw(Painter * painter)
35 // Need to fix pen colors, etc...
36 // I think stuff like crosshairs should be done in the DrawingView, tho
37 if (state == FIRST_POINT)
39 painter->DrawPoint(p1.x, p1.y);
43 double radius = Vector::Magnitude(p1, p2);
44 painter->DrawEllipse(p1, radius, radius);
48 /*virtual*/ void DrawCircleAction::MouseDown(Vector point)
50 if (state == FIRST_POINT)
56 /*virtual*/ void DrawCircleAction::MouseMoved(Vector point)
58 if (state == FIRST_POINT)
64 /*virtual*/ void DrawCircleAction::MouseReleased(void)
66 if (state == FIRST_POINT)
71 else if (state == NEXT_POINT)
73 // We create the new object here, and then pass it off to the
74 // DrawingView which stuffs it into the document.
75 circle = new Circle(p1, Vector::Magnitude(p1, p2));
76 // We don't need no stinkin' sentinels, when we have signals & slots!
77 emit ObjectReady(circle);