CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Public Attributes | List of all members
CartoTypeCore::Rect Class Reference

#include <cartotype_base.h>

Public Member Functions

 Rect ()
 
 Rect (int32_t aMinX, int32_t aMinY, int32_t aMaxX, int32_t aMaxY)
 
 Rect (const RectFP &aRectFP) noexcept
 
 Rect (InputStream &aInput)
 
void Write (OutputStream &aOutput) const
 
bool operator== (const Rect &aRect) const
 
bool operator!= (const Rect &aRect) const
 
int32_t MinX () const
 
int32_t MinY () const
 
int32_t MaxX () const
 
int32_t MaxY () const
 
bool IsEmpty () const
 
bool IsMaximal () const
 
int32_t Width () const
 
int32_t Height () const
 
Point MaxMin () const
 
Point MinMax () const
 
Point Center () const
 
bool Contains (const Point &aPoint) const
 
bool Contains (const Rect &aRect) const
 
bool IsOnEdge (const Point &aPoint) const noexcept
 
bool Intersects (const Rect &aRect) const noexcept
 
bool Intersects (const Point &aStart, const Point &aEnd, Point *aIntersectionStart=nullptr, Point *aIntersectionEnd=nullptr) const noexcept
 
void Intersection (const Rect &aRect) noexcept
 
void Combine (const Rect &aRect) noexcept
 
void Combine (const Point &aPoint) noexcept
 
Rect Expanded (int32_t aExpansion) const noexcept
 

Public Attributes

Point Min
 
Point Max
 

Detailed Description

A rectangle in two-dimensional space, aligned with the coordinate system and defined by opposite corners with minimum and maximum coordinates.

Constructor & Destructor Documentation

◆ Rect() [1/4]

CartoTypeCore::Rect::Rect ( )
inline

Creates an empty rectangle with both corners at the point (0,0).

◆ Rect() [2/4]

CartoTypeCore::Rect::Rect ( int32_t  aMinX,
int32_t  aMinY,
int32_t  aMaxX,
int32_t  aMaxY 
)
inline

Creates a rectangle with the specified edges.

◆ Rect() [3/4]

CartoTypeCore::Rect::Rect ( const RectFP aRectFP)
explicitnoexcept

Construct an integer rectangle from a floating-point rectangle, clamping to the 32-bit range and rounding.

◆ Rect() [4/4]

CartoTypeCore::Rect::Rect ( InputStream aInput)
inlineexplicit

Creates a Rect by deserializing it from an input stream.

Member Function Documentation

◆ Center()

Point CartoTypeCore::Rect::Center ( ) const
inline

Returns the center.

◆ Combine() [1/2]

void CartoTypeCore::Rect::Combine ( const Point aPoint)
noexcept

Updates a rectangle so that it contains the specified point.

◆ Combine() [2/2]

void CartoTypeCore::Rect::Combine ( const Rect aRect)
noexcept

Sets a rectangle to the smallest new rectangle that contains itself and aRect.

◆ Contains() [1/2]

bool CartoTypeCore::Rect::Contains ( const Point aPoint) const
inline

Returns true if the rectangle contains the point, where containment is defined using half-open intervals: the rectangle includes points on its minimum X and Y edges but not its maximum X and Y edges.

◆ Contains() [2/2]

bool CartoTypeCore::Rect::Contains ( const Rect aRect) const
inline

Returns true if the rectangle contains another rectangle.

◆ Expanded()

Rect CartoTypeCore::Rect::Expanded ( int32_t  aExpansion) const
inlinenoexcept

Returns a new rectangle expanded in all directions by aExpansion.

◆ Height()

int32_t CartoTypeCore::Rect::Height ( ) const
inline

Returns the height.

◆ Intersection()

void CartoTypeCore::Rect::Intersection ( const Rect aRect)
noexcept

Sets a rectangle to its intersection with aRect.

◆ Intersects() [1/2]

bool CartoTypeCore::Rect::Intersects ( const Point aStart,
const Point aEnd,
Point aIntersectionStart = nullptr,
Point aIntersectionEnd = nullptr 
) const
noexcept

Returns true if the rectangle intersects the line from aStart to aEnd. If there is an intersection, and if aIntersectionStart and aIntersectionEnd are non-null, returns the intersecting line.

◆ Intersects() [2/2]

bool CartoTypeCore::Rect::Intersects ( const Rect aRect) const
noexcept

Returns true if the rectangle and aRect have an intersection. If both rectangles are non-empty, returns true only if the intersection is non-empy.

◆ IsEmpty()

bool CartoTypeCore::Rect::IsEmpty ( ) const
inline

Returns true if the rectangle is empty, defined as having a width or height less than or equal to zero.

◆ IsMaximal()

bool CartoTypeCore::Rect::IsMaximal ( ) const
inline

Returns true if the rectangle is maximal, defined as having minimum coords of INT32_MIN and maximum coords of INT32_MAX.

◆ IsOnEdge()

bool CartoTypeCore::Rect::IsOnEdge ( const Point aPoint) const
noexcept

Returns true if aPoint is exactly on an edge of a rectangle.

◆ MaxMin()

Point CartoTypeCore::Rect::MaxMin ( ) const
inline

Returns the point (Max.X,Min.Y).

◆ MaxX()

int32_t CartoTypeCore::Rect::MaxX ( ) const
inline

Returns the maximum X coordinate..

◆ MaxY()

int32_t CartoTypeCore::Rect::MaxY ( ) const
inline

Returns the maximum Y coordinate..

◆ MinMax()

Point CartoTypeCore::Rect::MinMax ( ) const
inline

Returns the point (Min.X,Max.Y).

◆ MinX()

int32_t CartoTypeCore::Rect::MinX ( ) const
inline

Returns the minimum X coordinate.

◆ MinY()

int32_t CartoTypeCore::Rect::MinY ( ) const
inline

Returns the minimum Y coordinate.

◆ operator!=()

bool CartoTypeCore::Rect::operator!= ( const Rect aRect) const
inline

The inequality operator.

◆ operator==()

bool CartoTypeCore::Rect::operator== ( const Rect aRect) const
inline

The equality operator.

◆ Width()

int32_t CartoTypeCore::Rect::Width ( ) const
inline

Returns the width.

◆ Write()

void CartoTypeCore::Rect::Write ( OutputStream aOutput) const
inline

Serializes a Rect to an output stream.

Member Data Documentation

◆ Max

Point CartoTypeCore::Rect::Max

The corner with maximum X and Y coordinates.

◆ Min

Point CartoTypeCore::Rect::Min

The corner with minimum X and Y coordinates.


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