#include <Rectangle.h>
Public Member Functions | |
Rectangle () | |
Construct an empty rectangle. | |
Rectangle (const Point &top_left, const Point &bottom_right) | |
Construct a rectangle from two vertex. | |
Rectangle (int x1, int y1, int x2, int y2) | |
Construct a rectangle from coordinates. | |
Point & | getTopLeft () |
Return the top left vertex. | |
void | setTopLeft (const Point &value) |
Set the new top left vertex. | |
Point & | getBottomRight () |
Return the bottom right vertex. | |
void | setBottomRight (const Point &value) |
Set the new bottom right vertex. | |
int | getWidth () const |
Return the width of the rectangle. | |
int | getHeight () const |
Return the height of the rectangle. | |
void | move (const Point &position) |
Move the rectangle at gived position. | |
void | setCoord (int x1, int y1, int x2, int y2) |
Set new rectangle vertex from coordinates. | |
void | setSize (const Size &size) |
Set rectangle width and height. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Rectangle &obj) |
Overload std::ostream::operator<< for use in the model. | |
std::istream & | operator>> (std::istream &os, const Rectangle &obj) |
Overload std::istream::operator>> for use in the model. |
Construct a rectangle from two vertex.
top_left | the top left vertex | |
bottom_right | the bottom right vertex |
GUI::Rectangle::Rectangle | ( | int | x1, | |
int | y1, | |||
int | x2, | |||
int | y2 | |||
) |
Construct a rectangle from coordinates.
x1 | x coordinate of the top left vertex | |
y1 | y coordinate of the top left vertex | |
x2 | x coordinate of the bottom right vertex | |
y2 | y coordinate of the bottom right vertex |
Point & GUI::Rectangle::getBottomRight | ( | ) |
Return the bottom right vertex.
int GUI::Rectangle::getHeight | ( | ) | const |
Return the height of the rectangle.
Point & GUI::Rectangle::getTopLeft | ( | ) |
Return the top left vertex.
int GUI::Rectangle::getWidth | ( | ) | const |
Return the width of the rectangle.
void GUI::Rectangle::move | ( | const Point & | position | ) |
Move the rectangle at gived position.
position | the new position |
void GUI::Rectangle::setBottomRight | ( | const Point & | value | ) |
Set the new bottom right vertex.
value | the bottom right vertex |
void GUI::Rectangle::setCoord | ( | int | x1, | |
int | y1, | |||
int | x2, | |||
int | y2 | |||
) |
Set new rectangle vertex from coordinates.
x1 | x coordinate of the top left vertex | |
y1 | y coordinate of the top left vertex | |
x2 | x coordinate of the bottom right vertex | |
y2 | y coordinate of the bottom right vertex |
void GUI::Rectangle::setSize | ( | const Size & | size | ) |
Set rectangle width and height.
size | the new rectangle size |
void GUI::Rectangle::setTopLeft | ( | const Point & | value | ) |
Set the new top left vertex.
value | the top left vertex |