Maps SDK for C++ 1.0.0
Loading...
Searching...
No Matches
gem::RectType< T > Struct Template Reference

Rectangle representation based on pixels. More...

Public Member Functions

 RectType (T left=0, T top=0, T right=0, T bottom=0)
 Constructor initializing a rectangle based on left, top, right, bottom sides, which are set to 0 if no values are passed in.
 RectType (XyType< T > pos, SizeType< T > size)
 Constructor initializing a rectangle based on a TXy (upper left x,y) position and a TSize size (width, height).
bool operator== (const RectType &item) const
 Returns true if all 4 values of the passed in rectangle, left, top, width, height are equal to this rectangle.
bool operator!= (const RectType &item) const
 Returns false if operator== returns true, and true if operator== returns false.
right () const
 Return the rightmost x coordinate (right side) of the rectangle.
bottom () const
 Return the lowest y coordinate (bottom side) of the rectangle.
RectTypeinflate (T dx, T dy)
 Expand viewport by adding 2*dx to its width and 2*dy to its height, while leaving its center unmoved.
SizeType< T > dimensions () const
 Get dimensions representation based on pixels.
XyType< T > center () const
 Returns rectangle center point.
bool isEmpty () const
 Returns true if all 4 sides of the rectangle are set to zero.
bool pointInRectangle (const XyType< T > &pt) const
 Check if XY position is inside rectangle.

Public Attributes

x
 Horizontal offset of viewport from left edge of screen.
y
 Vertical offset of viewport from top edge of screen.
width
 Viewport width, in pixels.from left edge of screen.
height
 Viewport height, in pixels.from top edge of screen.

Detailed Description

template<typename T>
struct gem::RectType< T >

Rectangle representation based on pixels.

Constructor & Destructor Documentation

◆ RectType() [1/2]

template<typename T>
gem::RectType< T >::RectType ( T left = 0,
T top = 0,
T right = 0,
T bottom = 0 )
inline

Constructor initializing a rectangle based on left, top, right, bottom sides, which are set to 0 if no values are passed in.

Parameters
leftHorizontal offset of viewport from left edge of screen.
topVertical offset of viewport from top edge of screen.
rightViewport width, in pixels, from left edge of screen.
bottomViewport height, in pixels, from top edge of screen.

◆ RectType() [2/2]

template<typename T>
gem::RectType< T >::RectType ( XyType< T > pos,
SizeType< T > size )
inline

Constructor initializing a rectangle based on a TXy (upper left x,y) position and a TSize size (width, height).

Parameters
posHorizontal zero-based screen position, in pixels, increasing from left to right.
sizeVertical zero-based screen position, in pixels, increasing from top to bottom.

Member Function Documentation

◆ bottom()

template<typename T>
T gem::RectType< T >::bottom ( ) const
inline

Return the lowest y coordinate (bottom side) of the rectangle.

Returns
Lowest y coordinate (bottom side) of the rectangle.

◆ center()

template<typename T>
XyType< T > gem::RectType< T >::center ( ) const
inline

Returns rectangle center point.

Returns
XyType object with x and y coordinates of the rectangle center.

◆ dimensions()

template<typename T>
SizeType< T > gem::RectType< T >::dimensions ( ) const
inline

Get dimensions representation based on pixels.

Returns
SizeType object with width and height of the rectangle.

◆ inflate()

template<typename T>
RectType & gem::RectType< T >::inflate ( T dx,
T dy )
inline

Expand viewport by adding 2*dx to its width and 2*dy to its height, while leaving its center unmoved.

Parameters
dxHorizontal offset to add to the left and right sides of the rectangle.
dyVertical offset to add to the top and bottom sides of the rectangle.
Returns
This rectangle with its width and height expanded by 2*dx and 2*dy, respectively.

◆ isEmpty()

template<typename T>
bool gem::RectType< T >::isEmpty ( ) const
inline

Returns true if all 4 sides of the rectangle are set to zero.

Returns
True if all 4 sides of the rectangle are set to zero, false otherwise.

◆ operator!=()

template<typename T>
bool gem::RectType< T >::operator!= ( const RectType< T > & item) const
inline

Returns false if operator== returns true, and true if operator== returns false.

Parameters
itemRectangle to compare to.
Returns
False if operator== returns true, and true if operator== returns false.

◆ operator==()

template<typename T>
bool gem::RectType< T >::operator== ( const RectType< T > & item) const
inline

Returns true if all 4 values of the passed in rectangle, left, top, width, height are equal to this rectangle.

Parameters
itemRectangle to compare to.
Returns
True if all 4 values of the passed in rectangle, left, top, width, height are equal to this rectangle, false otherwise.

◆ pointInRectangle()

template<typename T>
bool gem::RectType< T >::pointInRectangle ( const XyType< T > & pt) const
inline

Check if XY position is inside rectangle.

Parameters
ptXY position to check.
Returns
True if XY position is inside rectangle, false otherwise.

◆ right()

template<typename T>
T gem::RectType< T >::right ( ) const
inline

Return the rightmost x coordinate (right side) of the rectangle.

Returns
Rightmost x coordinate (right side) of the rectangle.