Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvRegion Class Reference

Geometric class. More...

#include <ilviews/base/region.h>

Public Member Functions

 IlvRegion ()
 Constructor. More...
 
 IlvRegion (const IlvRect &rect)
 Constructor. More...
 
 IlvRegion (const IlvRegion &)
 Constructor. More...
 
void add (const IlvRect &rect)
 Adds a rectangle to this region. More...
 
void add (const IlvRegion &region)
 Adds a region to this region. More...
 
void apply (const IlvTransformer *t)
 Transforms this region. More...
 
const IlvRectboundingBox () const
 Gets the region bounding box. More...
 
void compact ()
 Compacts the rectangles of this region. More...
 
void computeDifference (const IlvRect &rect1, const IlvRect &rect2)
 Computes a new region as the difference of the two specified rectangles. More...
 
IlBoolean contains (const IlvPoint &point) const
 Tests if a point is located in this region. More...
 
IlBoolean contains (const IlvRect &rect) const
 Tests is a rectangle is covered by this region. More...
 
IlvRegioncopy () const
 Copies a region. More...
 
void empty ()
 Removes all the rectangle from this region. More...
 
IlUShort getCardinal () const
 Gets the number of stored rectangles. More...
 
const IlvRectgetRect (IlUShort idx) const
 Gets one rectangle of this region. More...
 
void grow (IlvPos dw, IlvPos dh)
 Enlarges a region. More...
 
void intersection (const IlvRect &rect)
 Computes the intersection with a rectangle. More...
 
void intersection (const IlvRegion &region)
 Computes the intersection with another region. More...
 
IlBoolean intersects (const IlvRect &rect) const
 Tests if a rectangle intersects this region. More...
 
IlBoolean intersects (const IlvRegion &region) const
 Tests whether another region intersects this region. More...
 
void inverse (const IlvTransformer *t)
 Inverse transforms a region. More...
 
IlBoolean isEmpty () const
 Tests if the region is empty. More...
 
IlBoolean isFull () const
 Tests if the region is full. More...
 
IlvRegionoperator= (const IlvRegion &region)
 Assigns a region. More...
 
void subtract (const IlvRect &rect)
 Subtracts a rectangle from this region. More...
 
void translate (IlvPos x, IlvPos y)
 Translates a region. More...
 

Detailed Description

Geometric class.

Library: xviews or winviews or mviews (mutually exclusive)

The IlvRegion class maintains a list of rectangles (instances of the class IlvRect to speed up internal tasks related to regions of interest, such as redrawing operations. A region is created by specifying a rectangle or a region. It can also be created empty.

See also
IlvRect.

Constructor & Destructor Documentation

◆ IlvRegion() [1/3]

IlvRegion::IlvRegion ( )

Constructor.

This constructor initializes a new empty region.

◆ IlvRegion() [2/3]

IlvRegion::IlvRegion ( const IlvRect rect)

Constructor.

This constructor initializes a new region that contains a single rectangle.

Parameters
rectThe initial rectangle stored in this region.

◆ IlvRegion() [3/3]

IlvRegion::IlvRegion ( const IlvRegion )

Constructor.

This constructor initializes a new region by creating a copy of region.

Member Function Documentation

◆ add() [1/2]

void IlvRegion::add ( const IlvRect rect)

Adds a rectangle to this region.

Parameters
rectThe rectangle to add.

◆ add() [2/2]

void IlvRegion::add ( const IlvRegion region)

Adds a region to this region.

Parameters
regionThe region to add.

◆ apply()

void IlvRegion::apply ( const IlvTransformer t)

Transforms this region.

The resulting object has all its rectangles transformed.

Parameters
tThe transformer to be applied.

◆ boundingBox()

const IlvRect& IlvRegion::boundingBox ( ) const

Gets the region bounding box.

Returns
The bounding rectangle of all the rectangles that this region object contains.

◆ compact()

void IlvRegion::compact ( )

Compacts the rectangles of this region.

Calling this method ensures that no rectangle of the region is intersecting with another rectangle of the region.

◆ computeDifference()

void IlvRegion::computeDifference ( const IlvRect rect1,
const IlvRect rect2 
)

Computes a new region as the difference of the two specified rectangles.

This method calls the empty method before filling the region with the difference of rect1 less rect2.

Parameters
rect1The initial rectangle.
rect2The rectangle to subtract.

◆ contains() [1/2]

IlBoolean IlvRegion::contains ( const IlvPoint point) const

Tests if a point is located in this region.

Parameters
pointThe point that is tested.
Returns
IlTrue if point is inside one of the rectangles stored in this region. If point is outside all of the region's rectangles, it returns IlFalse.

◆ contains() [2/2]

IlBoolean IlvRegion::contains ( const IlvRect rect) const

Tests is a rectangle is covered by this region.

Parameters
rectThe rectangle that is tested.
Returns
IlTrue if rect is entirely inside one of the rectangles stored in this region. If rect is not contained in any of this region's rectangles, it returns IlFalse.

◆ copy()

IlvRegion* IlvRegion::copy ( ) const

Copies a region.

This member function creates and returns a new object that is the exact copy of this.

Returns
A pointer to a copy of the current object.

◆ empty()

void IlvRegion::empty ( )

Removes all the rectangle from this region.

The resulting object is an empty region.

◆ getCardinal()

IlUShort IlvRegion::getCardinal ( ) const

Gets the number of stored rectangles.

Returns
The number of rectangles that this region handles.

◆ getRect()

const IlvRect& IlvRegion::getRect ( IlUShort  idx) const

Gets one rectangle of this region.

Parameters
idxThe index of the rectangle you want to retrieve.
Returns
The idx th rectangle stored in this region. The first rectangle of a region has an index of 0.

◆ grow()

void IlvRegion::grow ( IlvPos  dw,
IlvPos  dh 
)

Enlarges a region.

All rectangles are enlarged, resulting in an enlarged region.

Parameters
dwThe horizontal growing value.
dhThe vertical growing value.

◆ intersection() [1/2]

void IlvRegion::intersection ( const IlvRect rect)

Computes the intersection with a rectangle.

Sets the current region so it becomes the result of the intersection of the whole region with a rectangle.

Parameters
rectThe rectangle from which the intersection is computed.

◆ intersection() [2/2]

void IlvRegion::intersection ( const IlvRegion region)

Computes the intersection with another region.

Sets the current region so it becomes the result of the intersection of the whole region with another region.

Parameters
regionThe region from which the intersection is computed.

◆ intersects() [1/2]

IlBoolean IlvRegion::intersects ( const IlvRect rect) const

Tests if a rectangle intersects this region.

Parameters
rectThe rectangle that is tested.
Returns
IlTrue if rect intersects with any of the rectangles stored in this region. If rect does not intersect with any of these rectangles, it returns IlFalse.

◆ intersects() [2/2]

IlBoolean IlvRegion::intersects ( const IlvRegion region) const

Tests whether another region intersects this region.

Parameters
regionThe region that is tested.
Returns
IlTrue if region intersects with any of the rectangles stored in this region. If region does not intersect with any of these rectangles, it returns IlFalse.

◆ inverse()

void IlvRegion::inverse ( const IlvTransformer t)

Inverse transforms a region.

The resulting object has all its rectangles inversely transformed.

Parameters
tThe transformer which inverse to be applied.

◆ isEmpty()

IlBoolean IlvRegion::isEmpty ( ) const

Tests if the region is empty.

An empty region is a region that contains no point or rectangle at all.

Returns
IlTrue if this object does not store any rectangle or if all the rectangles it contains have null dimensions. Otherwise, it returns IlFalse.

◆ isFull()

IlBoolean IlvRegion::isFull ( ) const

Tests if the region is full.

A full region is a region that contains every possible point or rectangle.

Returns
IlTrue if this object corresponds to a full region. Otherwise, it returns IlFalse.

◆ operator=()

IlvRegion& IlvRegion::operator= ( const IlvRegion region)

Assigns a region.

Parameters
regionThe region that must be assigned.
Returns
The current object after the assignment is done.

◆ subtract()

void IlvRegion::subtract ( const IlvRect rect)

Subtracts a rectangle from this region.

Parameters
rectThe rectangle to subtract.

◆ translate()

void IlvRegion::translate ( IlvPos  x,
IlvPos  y 
)

Translates a region.

All rectangles are translated, resulting in a translated region.

Parameters
xThe horizontal translation value.
yThe vertical translation value.