|
degate 0.1.1
|
#include <Circle.h>

Public Member Functions | |
| Circle () | |
| Circle (int x, int y, unsigned int diameter) | |
| virtual | ~Circle () |
| virtual bool | in_shape (int x, int y, int max_distance=0) const |
| Check in the Point with coordinates x and y is within the area of the shape. | |
| virtual bool | in_bounding_box (BoundingBox const &bbox) const |
| Check if this shape is in the bounding box. | |
| virtual BoundingBox const & | get_bounding_box () const |
| Get the bounding box. | |
| virtual bool | operator== (const Circle &other) const |
| virtual bool | operator!= (const Circle &other) const |
| virtual int | get_x () const |
| virtual int | get_y () const |
| virtual unsigned int | get_diameter () const |
| virtual void | set_x (int x) |
| virtual void | set_y (int y) |
| virtual void | set_diameter (unsigned int diameter) |
| virtual void | shift_x (int delta_x) |
| Shift the shape vertically. | |
| virtual void | shift_y (int delta_y) |
| Shift the shape horizontally. | |
Private Member Functions | |
| void | calculate_bounding_box () |
Private Attributes | |
| int | x |
| int | y |
| unsigned int | diameter |
| BoundingBox | bounding_box |
| Circle::Circle | ( | ) |
Definition at line 30 of file Circle.cc.
References calculate_bounding_box(), diameter, x, and y.
{
x = y = diameter = 0;
calculate_bounding_box();
}

| Circle::Circle | ( | int | x, |
| int | y, | ||
| unsigned int | diameter | ||
| ) |
| void Circle::calculate_bounding_box | ( | ) | [private] |
Definition at line 105 of file Circle.cc.
References bounding_box, diameter, x, and y.
Referenced by Circle(), set_diameter(), set_x(), set_y(), shift_x(), and shift_y().
{
unsigned int radius = diameter / 2;
bounding_box = BoundingBox(x - radius, x + radius,
y - radius, y + radius);
}

| BoundingBox const & Circle::get_bounding_box | ( | ) | const [virtual] |
Get the bounding box.
Implements degate::AbstractShape.
Reimplemented in degate::EMarker, degate::GatePort, and degate::Via.
Definition at line 53 of file Circle.cc.
References bounding_box.
{
return bounding_box;
}
| unsigned int Circle::get_diameter | ( | ) | const [virtual] |
Definition at line 75 of file Circle.cc.
References diameter.
Referenced by degate::GatePort::print(), degate::Via::push_object_to_server(), and degate::EMarker::push_object_to_server().
{
return diameter;
}

| int Circle::get_x | ( | ) | const [virtual] |
Definition at line 66 of file Circle.cc.
References x.
Referenced by degate::Via::print(), degate::GatePort::print(), degate::EMarker::print(), degate::Via::push_object_to_server(), and degate::EMarker::push_object_to_server().
{
return x;
}

| int Circle::get_y | ( | ) | const [virtual] |
Definition at line 70 of file Circle.cc.
References y.
Referenced by degate::Via::print(), degate::GatePort::print(), degate::EMarker::print(), degate::Via::push_object_to_server(), and degate::EMarker::push_object_to_server().
{
return y;
}

| bool Circle::in_bounding_box | ( | BoundingBox const & | bbox | ) | const [virtual] |
Check if this shape is in the bounding box.
Note: it is somhow unclear if this 'in' means complete within or if an intersection is sufficient.
Implements degate::AbstractShape.
Reimplemented in degate::EMarker, degate::GatePort, and degate::Via.
Definition at line 49 of file Circle.cc.
References bounding_box, and degate::BoundingBox::in_bounding_box().
{
return bounding_box.in_bounding_box(bbox);
}

| bool Circle::in_shape | ( | int | x, |
| int | y, | ||
| int | max_distance = 0 |
||
| ) | const [virtual] |
Check in the Point with coordinates x and y is within the area of the shape.
Implements degate::AbstractShape.
Reimplemented in degate::EMarker, degate::GatePort, and degate::Via.
| bool Circle::operator!= | ( | const Circle & | other | ) | const [virtual] |
| bool Circle::operator== | ( | const Circle & | other | ) | const [virtual] |
| void Circle::set_diameter | ( | unsigned int | diameter | ) | [virtual] |
Reimplemented in degate::EMarker, degate::GatePort, and degate::Via.
Definition at line 89 of file Circle.cc.
References calculate_bounding_box(), and diameter.
{
this->diameter = diameter;
calculate_bounding_box();
}

| void Circle::set_x | ( | int | x | ) | [virtual] |
Reimplemented in degate::EMarker, degate::GatePort, and degate::Via.
Definition at line 79 of file Circle.cc.
References calculate_bounding_box(), and x.
{
this->x = x;
calculate_bounding_box();
}

| void Circle::set_y | ( | int | y | ) | [virtual] |
Reimplemented in degate::EMarker, degate::GatePort, and degate::Via.
Definition at line 84 of file Circle.cc.
References calculate_bounding_box(), and y.
{
this->y = y;
calculate_bounding_box();
}

| void Circle::shift_x | ( | int | delta_x | ) | [virtual] |
Shift the shape vertically.
Note: If you store this shape in a QuadTree, you have to manage the changes in your QuadTree by yourself.
Implements degate::AbstractShape.
Reimplemented in degate::EMarker, degate::GatePort, and degate::Via.
Definition at line 99 of file Circle.cc.
References calculate_bounding_box(), and x.
{
x += delta_x;
calculate_bounding_box();
}

| void Circle::shift_y | ( | int | delta_y | ) | [virtual] |
Shift the shape horizontally.
Note: If you store this shape in a QuadTree, you have to manage the changes in your QuadTree by yourself.
Implements degate::AbstractShape.
Reimplemented in degate::EMarker, degate::GatePort, and degate::Via.
Definition at line 94 of file Circle.cc.
References calculate_bounding_box(), and y.
{
y += delta_y;
calculate_bounding_box();
}

BoundingBox degate::Circle::bounding_box [private] |
Definition at line 36 of file Circle.h.
Referenced by calculate_bounding_box(), get_bounding_box(), and in_bounding_box().
unsigned int degate::Circle::diameter [private] |
Definition at line 34 of file Circle.h.
Referenced by calculate_bounding_box(), Circle(), get_diameter(), in_shape(), operator==(), and set_diameter().
int degate::Circle::x [private] |
Definition at line 33 of file Circle.h.
Referenced by calculate_bounding_box(), Circle(), get_x(), in_shape(), operator==(), set_x(), and shift_x().
int degate::Circle::y [private] |
Definition at line 33 of file Circle.h.
Referenced by calculate_bounding_box(), Circle(), get_y(), in_shape(), operator==(), set_y(), and shift_y().
1.7.4