CartoType API
Public Types | Public Member Functions | Public Attributes
CartoType::TRect Class Reference

#include <cartotype_base.h>

List of all members.

Public Types

enum  {
  ELeftRegion = 1, ERightRegion = 2, ETopRegion = 4, EBottomRegion = 8,
  ETopLeftRegion = ETopRegion | ELeftRegion, ETopRightRegion = ETopRegion | ERightRegion, EBottomLeftRegion = EBottomRegion | ELeftRegion, EBottomRightRegion = EBottomRegion | ERightRegion
}

Public Member Functions

 TRect ()
 TRect (int32 aLeft, int32 aTop, int32 aRight, int32 aBottom)
bool operator== (const TRect &aRect) const
bool operator!= (const TRect &aRect) const
int32 Left () const
int32 Top () const
int32 Right () const
int32 Bottom () const
bool IsEmpty () const
bool IsMaximal () const
int32 Width () const
int32 Height () const
TPoint TopRight () const
TPoint BottomLeft () const
bool Contains (const TPoint &aPoint) const
bool Contains (const TRect &aRect) const
CT_IMPORT bool Intersects (const TRect &aRect) const
CT_IMPORT bool Intersects (const TPoint &aStart, const TPoint &aEnd, TPoint *aIntersectionStart=NULL, TPoint *aIntersectionEnd=NULL) const
CT_IMPORT void Intersection (const TRect &aRect)
CT_IMPORT void Combine (const TRect &aRect)
CT_IMPORT void Combine (const TPoint &aPoint)
int32 Region (const TPoint &aPoint) const

Public Attributes

TPoint iTopLeft
TPoint iBottomRight

Detailed Description

A rectangle in two-dimensional space, aligned with the coordinate system and defined by its top-left and bottom-right corners.


Member Enumeration Documentation

anonymous enum

Constants for bits combined to make a return value for Region.


Constructor & Destructor Documentation

CartoType::TRect::TRect ( ) [inline]

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

CartoType::TRect::TRect ( int32  aLeft,
int32  aTop,
int32  aRight,
int32  aBottom 
) [inline]

Create a rectangle with the specified edges.


Member Function Documentation

int32 CartoType::TRect::Bottom ( ) const [inline]

Return the bottom edge.

TPoint CartoType::TRect::BottomLeft ( ) const [inline]

Return the bottom left corner.

CT_EXPORT void TRect::Combine ( const TRect aRect)

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

CT_EXPORT void TRect::Combine ( const TPoint aPoint)

Update a rectangle such that it contains the specified point.

bool CartoType::TRect::Contains ( const TPoint aPoint) const [inline]

Return true if the rectangle contains the point, where containment is defined using half-open intervals: the rectangle includes points on its top and left edges but not its right and bottom edges.

bool CartoType::TRect::Contains ( const TRect aRect) const [inline]

Return true if the rectangle contains another rectangle.

int32 CartoType::TRect::Height ( ) const [inline]

Return the height.

CT_EXPORT void TRect::Intersection ( const TRect aRect)

Set a rectangle to its intersection with aRect.

CT_EXPORT bool TRect::Intersects ( const TRect aRect) const

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

CT_EXPORT bool TRect::Intersects ( const TPoint aStart,
const TPoint aEnd,
TPoint aIntersectionStart = NULL,
TPoint aIntersectionEnd = NULL 
) const

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

This is the Liang-Barsky algorithm (http://en.wikipedia.org/wiki/Liang-Barsky).

bool CartoType::TRect::IsEmpty ( ) const [inline]

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

bool CartoType::TRect::IsMaximal ( ) const [inline]

Return true if the rectangle is maximal, defined as having left and top of INT32_MIN and bottom and right of INT32_MAX.

int32 CartoType::TRect::Left ( ) const [inline]

Return the left edge.

bool CartoType::TRect::operator!= ( const TRect aRect) const [inline]

The inequality operator.

bool CartoType::TRect::operator== ( const TRect aRect) const [inline]

The equality operator.

int32 CartoType::TRect::Region ( const TPoint aPoint) const [inline]

Return the region of a point relative to a rectangle. A rectangle defines nine possible regions. Region 0 is inside the rectangle, and is only returned if the point is inside and doesn't touch the boundary, which is useful when clipping paths to a rectangle.

int32 CartoType::TRect::Right ( ) const [inline]

Return the right edge.

int32 CartoType::TRect::Top ( ) const [inline]

Return the top edge.

TPoint CartoType::TRect::TopRight ( ) const [inline]

Return the top right corner.

int32 CartoType::TRect::Width ( ) const [inline]

Return the width.


Member Data Documentation

The bottom left corner.

The top right corner.


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