#include <Circle.h>
Inheritance diagram for Circle:
Public Methods | |
Circle () | |
Create a cirle with radius 0 at the origin. | |
Circle (const Position &, color, float radius) | |
Create a circle with given center, color and radius. | |
virtual void | add_feature (std::string, float) |
Allow radius to be specified. | |
bool | is_hit (const Position &) |
return true if position is inside the circle. | |
int | mutate (const Position &) |
Use the new position to set the radius. | |
void | render (SimpleWindow *) |
Draws the Circle. | |
Private Attributes | |
float | radius |
Static Private Attributes | |
Circle::Factory | factory |
A factory for creating circle objects. |
Only used directly in the CircleTool class, although it can be used indirectly, as a DrawElement, anywhere DrawElement is used.
|
Create a cirle with radius 0 at the origin.
00004 : DrawElement(), radius(0.0) {} |
|
Create a circle with given center, color and radius.
00006 : DrawElement(pos,c), radius(r) {} |
|
Allow radius to be specified.
Reimplemented from Object.
00009 { 00010 if (key == "radius") { 00011 radius = value; 00012 } else { 00013 Object::add_feature(key,value); 00014 } 00015 } |
|
return true if position is inside the circle.
Implements DrawElement.
00018 { 00019 Position delta = pos-get_center(); 00020 return abs(delta) <= radius; 00021 } |
|
Use the new position to set the radius.
Reimplemented from DrawElement.
00024 { 00025 radius = abs(pos-get_center()); 00026 inform_location(); 00027 return 1; 00028 } |
|
Draws the Circle. Uses SimpleWindow's RenderEllipse. Implements DrawElement.
00034 { 00035 Position delta = Position(radius,radius); 00036 w->RenderEllipse(get_center()-delta,get_center()+delta,get_color(), 00037 is_selected()); 00038 } |
|
A factory for creating circle objects.
|
|
|