Rectangle that holds the top left and bottom right corner in int values. More...
#include "Rect.h"
Public Member Functions | |
Rect () | |
Rect (const Point2D &_topLeft, const Point2D &_bottomRight) | |
Rect (const Point2D &_topLeft, const Size2D &_size) | |
Rect (const Rect &_other) | |
virtual void | addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const override |
Add the object contents to the provided JSON object. | |
virtual void | setFromJsonObject (const ot::ConstJsonObject &_object) override |
Will set the object contents from the provided JSON object. | |
bool | operator= (const Rect &_other) |
bool | operator== (const Rect &_other) const |
bool | operator!= (const Rect &_other) const |
void | setTop (int _top) |
int | getTop (void) const |
void | setLeft (int _left) |
int | getLeft (void) const |
void | setTopLeft (const Point2D &_topLeft) |
const Point2D & | getTopLeft (void) const |
void | setBottom (int _bottom) |
int | getBottom (void) const |
void | setRight (int _right) |
int | getRight (void) const |
void | setBottomRight (const Point2D &_bottomRight) |
const Point2D & | getBottomRight (void) const |
void | setWidth (int _width) |
int | getWidth (void) const |
void | setHeight (int _height) |
int | getHeight (void) const |
void | setSize (const Size2D &_size) |
Size2D | getSize (void) const |
Rect | unionWith (const Rect &_other) const |
Calculates and returns the union of this Rect and the provided Rect. | |
Rect | intersectsWith (const Rect &_other) const |
Calclates and returns the intersection of this Rect and the provided Rect. | |
bool | isAllZero (void) const |
Returns true if top left is (0, 0) and bottom right is (0, 0). | |
bool | isValid (void) const |
Returns true if the top left and bottom right points are set correctly. If the left value is bigger than the right value or the bottom value bigger than the top value false is returned. | |
void | moveTo (int _ax, int _ay) |
void | moveTo (const Point2D &_topLeft) |
Moves the rect to the specified location. The top left and bottom right will be moved. | |
void | moveBy (int _dx, int _dy) |
void | moveBy (const Point2D &_distance) |
Moves the rect by the provided distance. The top left and bottom right will be moved. | |
RectF | toRectF (void) const |
RectD | toRectD (void) const |
Public Member Functions inherited from ot::Serializable | |
Serializable () | |
virtual | ~Serializable () |
Rectangle that holds the top left and bottom right corner in int values.
Rectangle that holds the top left and bottom right corner in float values.
ot::Rect::Rect | ( | ) |
ot::Rect::Rect | ( | const Rect & | _other | ) |
|
overridevirtual |
Add the object contents to the provided JSON object.
_object | Json object reference |
_allocator | Allocator |
Implements ot::Serializable.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns true if top left is (0, 0) and bottom right is (0, 0).
|
inline |
Returns true if the top left and bottom right points are set correctly. If the left value is bigger than the right value or the bottom value bigger than the top value false is returned.
void ot::Rect::moveBy | ( | const Point2D & | _distance | ) |
Moves the rect by the provided distance. The top left and bottom right will be moved.
|
inline |
void ot::Rect::moveTo | ( | const Point2D & | _topLeft | ) |
Moves the rect to the specified location. The top left and bottom right will be moved.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
overridevirtual |
Will set the object contents from the provided JSON object.
_object | The JSON object containing the information |
Will | throw an exception if the provided object is not valid (members missing or invalid types) |
Implements ot::Serializable.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
ot::RectD ot::Rect::toRectD | ( | void | ) | const |
ot::RectF ot::Rect::toRectF | ( | void | ) | const |