OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::RectD Class Reference

Rectangle that holds the top left and bottom right corner in double values. More...

#include "Rect.h"

Inheritance diagram for ot::RectD:
ot::Serializable

Public Member Functions

 RectD ()
 
 RectD (const Point2DD &_topLeft, const Point2DD &_bottomRight)
 
 RectD (const Point2DD &_topLeft, const Size2DD &_size)
 
 RectD (const RectD &_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 RectD &_other)
 
bool operator== (const RectD &_other) const
 
bool operator!= (const RectD &_other) const
 
void setTop (double _top)
 
double getTop (void) const
 
void setLeft (double _left)
 
double getLeft (void) const
 
void setTopLeft (const Point2DD &_topLeft)
 
const Point2DDgetTopLeft (void) const
 
void setBottom (double _bottom)
 
double getBottom (void) const
 
void setRight (double _right)
 
double getRight (void) const
 
void setBottomRight (const Point2DD &_bottomRight)
 
const Point2DDgetBottomRight (void) const
 
void setWidth (double _width)
 
double getWidth (void) const
 
void setHeight (double _height)
 
double getHeight (void) const
 
void setSize (const Size2DD &_size)
 
Size2DD getSize (void) const
 
RectD unionWith (const RectD &_other) const
 Calculates and returns the union of this Rect and the provided Rect.
 
RectD intersectsWith (const RectD &_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 (double _ax, double _ay)
 
void moveTo (const Point2DD &_topLeft)
 Moves the rect to the specified location. The top left and bottom right will be moved.
 
void moveBy (double _dx, double _dy)
 
void moveBy (const Point2DD &_distance)
 Moves the rect by the provided distance. The top left and bottom right will be moved.
 
Rect toRect (void) const
 
RectF toRectF (void) const
 
- Public Member Functions inherited from ot::Serializable
 Serializable ()
 
virtual ~Serializable ()
 

Detailed Description

Rectangle that holds the top left and bottom right corner in double values.

Constructor & Destructor Documentation

◆ RectD() [1/4]

ot::RectD::RectD ( )

◆ RectD() [2/4]

ot::RectD::RectD ( const Point2DD & _topLeft,
const Point2DD & _bottomRight )

◆ RectD() [3/4]

ot::RectD::RectD ( const Point2DD & _topLeft,
const Size2DD & _size )

◆ RectD() [4/4]

ot::RectD::RectD ( const RectD & _other)

Member Function Documentation

◆ addToJsonObject()

void ot::RectD::addToJsonObject ( ot::JsonValue & _object,
ot::JsonAllocator & _allocator ) const
overridevirtual

Add the object contents to the provided JSON object.

Parameters
_objectJson object reference
_allocatorAllocator

Implements ot::Serializable.

◆ getBottom()

double ot::RectD::getBottom ( void ) const
inline

◆ getBottomRight()

const Point2DD & ot::RectD::getBottomRight ( void ) const
inline

◆ getHeight()

double ot::RectD::getHeight ( void ) const
inline

◆ getLeft()

double ot::RectD::getLeft ( void ) const
inline

◆ getRight()

double ot::RectD::getRight ( void ) const
inline

◆ getSize()

Size2DD ot::RectD::getSize ( void ) const
inline

◆ getTop()

double ot::RectD::getTop ( void ) const
inline

◆ getTopLeft()

const Point2DD & ot::RectD::getTopLeft ( void ) const
inline

◆ getWidth()

double ot::RectD::getWidth ( void ) const
inline

◆ intersectsWith()

ot::RectD ot::RectD::intersectsWith ( const RectD & _other) const

Calclates and returns the intersection of this Rect and the provided Rect.

◆ isAllZero()

bool ot::RectD::isAllZero ( void ) const
inline

Returns true if top left is (0, 0) and bottom right is (0, 0).

◆ isValid()

bool ot::RectD::isValid ( void ) const
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.

◆ moveBy() [1/2]

void ot::RectD::moveBy ( const Point2DD & _distance)

Moves the rect by the provided distance. The top left and bottom right will be moved.

◆ moveBy() [2/2]

void ot::RectD::moveBy ( double _dx,
double _dy )
inline

◆ moveTo() [1/2]

void ot::RectD::moveTo ( const Point2DD & _topLeft)

Moves the rect to the specified location. The top left and bottom right will be moved.

◆ moveTo() [2/2]

void ot::RectD::moveTo ( double _ax,
double _ay )
inline

◆ operator!=()

bool ot::RectD::operator!= ( const RectD & _other) const
inline

◆ operator=()

bool ot::RectD::operator= ( const RectD & _other)
inline

◆ operator==()

bool ot::RectD::operator== ( const RectD & _other) const
inline

◆ setBottom()

void ot::RectD::setBottom ( double _bottom)
inline

◆ setBottomRight()

void ot::RectD::setBottomRight ( const Point2DD & _bottomRight)
inline

◆ setFromJsonObject()

void ot::RectD::setFromJsonObject ( const ot::ConstJsonObject & _object)
overridevirtual

Will set the object contents from the provided JSON object.

Parameters
_objectThe JSON object containing the information
Exceptions
Willthrow an exception if the provided object is not valid (members missing or invalid types)

Implements ot::Serializable.

◆ setHeight()

void ot::RectD::setHeight ( double _height)
inline

◆ setLeft()

void ot::RectD::setLeft ( double _left)
inline

◆ setRight()

void ot::RectD::setRight ( double _right)
inline

◆ setSize()

void ot::RectD::setSize ( const Size2DD & _size)
inline

◆ setTop()

void ot::RectD::setTop ( double _top)
inline

◆ setTopLeft()

void ot::RectD::setTopLeft ( const Point2DD & _topLeft)
inline

◆ setWidth()

void ot::RectD::setWidth ( double _width)
inline

◆ toRect()

ot::Rect ot::RectD::toRect ( void ) const

◆ toRectF()

ot::RectF ot::RectD::toRectF ( void ) const

◆ unionWith()

ot::RectD ot::RectD::unionWith ( const RectD & _other) const

Calculates and returns the union of this Rect and the provided Rect.


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