degate 0.1.1
Public Member Functions | Private Member Functions | Private Attributes
degate::Circle Class Reference

#include <Circle.h>

Inheritance diagram for degate::Circle:
Inheritance graph
[legend]

List of all members.

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

Detailed Description

Definition at line 30 of file Circle.h.


Constructor & Destructor Documentation

Circle::Circle ( )

Definition at line 30 of file Circle.cc.

References calculate_bounding_box(), diameter, x, and y.

Here is the call graph for this function:

Circle::Circle ( int  x,
int  y,
unsigned int  diameter 
)

Definition at line 35 of file Circle.cc.

References calculate_bounding_box(), diameter, x, and y.

                                                  {
  this->x = x;
  this->y = y;
  this->diameter = diameter;
  calculate_bounding_box();
}

Here is the call graph for this function:

virtual degate::Circle::~Circle ( ) [inline, virtual]

Definition at line 45 of file Circle.h.

{}

Member Function Documentation

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);

}

Here is the caller graph for this function:

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;
}

Here is the caller graph for this function:

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;
}

Here is the caller graph for this function:

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;
}

Here is the caller graph for this function:

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);
}

Here is the call graph for this function:

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.

Definition at line 43 of file Circle.cc.

References diameter, x, and y.

                                                          {
  int delta_x = this->x - x;
  int delta_y = this->y - y;
  return sqrt((double)(delta_x * delta_x + delta_y * delta_y)) <= diameter + max_distance;
}
bool Circle::operator!= ( const Circle other) const [virtual]

Definition at line 62 of file Circle.cc.

                                                 {
    return !(*this == other);
}
bool Circle::operator== ( const Circle other) const [virtual]

Definition at line 58 of file Circle.cc.

References diameter, x, and y.

                                                 {
    return (x == other.x && y == other.y && diameter == other.diameter);
}
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.

Here is the call graph for this function:

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();
}

Here is the call graph for this function:

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();
}

Here is the call graph for this function:

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();
}

Here is the call graph for this function:

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();
}

Here is the call graph for this function:


Member Data Documentation

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]
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().


The documentation for this class was generated from the following files: