rwlogo
Rogue Wave Views 5.5.1

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvRegion Class Reference

Geometric class. More...

#include <ilviews/base/region.h>

List of all members.

Public Member Functions

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

Detailed Description

Geometric class.

Library: display

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::IlvRegion (  ) 

Constructor.

This constructor initializes a new empty region.

IlvRegion::IlvRegion ( const IlvRect &  rect  ) 

Constructor.

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

Parameters:
rect The initial rectangle stored in this region.
IlvRegion::IlvRegion ( const IlvRegion &   ) 

Constructor.

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


Member Function Documentation

void IlvRegion::add ( const IlvRegion &  region  ) 

Adds a region to this region.

Parameters:
region The region to add.
void IlvRegion::add ( const IlvRect &  rect  ) 

Adds a rectangle to this region.

Parameters:
rect The rectangle to add.
void IlvRegion::apply ( const IlvTransformer *  t  ) 

Transforms this region.

The resulting object has all its rectangles transformed.

Parameters:
t The transformer to be applied.
const IlvRect& IlvRegion::boundingBox (  )  const

Gets the region bounding box.

Returns:
The bounding rectangle of all the rectangles that this region object contains.
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.

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:
rect1 The initial rectangle.
rect2 The rectangle to subtract.
IlBoolean IlvRegion::contains ( const IlvRect &  rect  )  const

Tests is a rectangle is covered by this region.

Parameters:
rect The 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.
IlBoolean IlvRegion::contains ( const IlvPoint &  point  )  const

Tests if a point is located in this region.

Parameters:
point The 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.
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.
void IlvRegion::empty (  ) 

Removes all the rectangle from this region.

The resulting object is an empty region.

IlUShort IlvRegion::getCardinal (  )  const

Gets the number of stored rectangles.

Returns:
The number of rectangles that this region handles.
const IlvRect& IlvRegion::getRect ( IlUShort  idx  )  const

Gets one rectangle of this region.

Parameters:
idx The 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.
void IlvRegion::grow ( IlvPos  dw,
IlvPos  dh 
)

Enlarges a region.

All rectangles are enlarged, resulting in an enlarged region.

Parameters:
dw The horizontal growing value.
dh The vertical growing value.
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:
region The region from which the intersection is computed.
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:
rect The rectangle from which the intersection is computed.
IlBoolean IlvRegion::intersects ( const IlvRegion &  region  )  const

Tests whether another region intersects this region.

Parameters:
region The 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.
IlBoolean IlvRegion::intersects ( const IlvRect &  rect  )  const

Tests if a rectangle intersects this region.

Parameters:
rect The 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.
void IlvRegion::inverse ( const IlvTransformer *  t  ) 

Inverse transforms a region.

The resulting object has all its rectangles inversely transformed.

Parameters:
t The transformer which inverse to be applied.
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.
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.
const IlvRegion& IlvRegion::operator= ( const IlvRegion &   ) 

Assigns a region.

Parameters:
region The region that must be assigned.
Returns:
The current object after the assignment is done.
void IlvRegion::subtract ( const IlvRect &  rect  ) 

Subtracts a rectangle from this region.

Parameters:
rect The rectangle to subtract.
void IlvRegion::translate ( IlvPos  x,
IlvPos  y 
)

Translates a region.

All rectangles are translated, resulting in a translated region.

Parameters:
x The horizontal translation value.
y The vertical translation value.

© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.