// (C) 2011 Underground Software
// See the README and GPLv3 files for licensing and warranty information
//
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
//
// WHO WHEN WHAT
// --- ---------- ------------------------------------------------------------
{
}
+
Circle::~Circle()
{
}
+
/*virtual*/ void Circle::Draw(Painter * painter)
{
if (state == OSSelected || hitCircle || hitCenter)
else
painter->SetPen(QPen(Qt::black, 1.0, Qt::SolidLine));
- // Draw handles (if needed)
+ // Hatch/Fill...
+// QBrush brush(Qt::DiagCrossPattern);
+// brush.setColor(QColor(255, 255, 0));
+// painter->SetBrush(brush);
+ painter->SetBrush(QBrush(Qt::NoBrush));
+
+ // Draw the object...
+ painter->DrawEllipse(position, radius, radius);
+
+ // & draw handles (if needed)
if (state == OSSelected || hitCenter)
painter->DrawHandle(position);
if (state == OSSelected && draggingEdge && objectWasDragged)
painter->DrawHandle(dragPoint);
-
- // & finally, draw the object!
- painter->DrawEllipse(position, radius, radius);
}
+
/*virtual*/ Vector Circle::Center(void)
{
return position;
}
+
/*virtual*/ bool Circle::Collided(Vector point)
{
// We can assume this, since this is a mouse down event here.
return false;
}
+
/*virtual*/ void Circle::PointerMoved(Vector point)
{
// Hit test tells us what we hit (if anything) through boolean variables. It
dragPoint = point;
}
+
/*virtual*/ void Circle::PointerReleased(void)
{
// Mouse went up, so our dragging is done (if any *was* done, that is)
state = oldState;
}
+
bool Circle::HitTest(Point point)
{
SaveState();
return StateChanged();
}
+
void Circle::SaveState(void)
{
oldHitCenter = hitCenter;
oldHitCircle = hitCircle;
}
+
bool Circle::StateChanged(void)
{
if ((hitCenter != oldHitCenter) || (hitCircle != oldHitCircle))
return false;
}
+
+
+/*virtual*/ void Circle::Enumerate(FILE * file)
+{
+ fprintf(file, "CIRCLE (%lf,%lf) %lf\n", position.x, position.y, radius);
+}
+