Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Geometric class. More...
#include <ilviews/base/geometry.h>
Public Member Functions | |
IlvRect (IlvPos x=0, IlvPos y=0, IlvDim w=0, IlvDim h=0) | |
Constructor. | |
IlvRect & | add (const IlvPoint &point) |
Adds a point. | |
IlvRect & | add (const IlvRect &rect) |
Adds a rectangle. | |
IlvPos | bottom () const |
Retrieves the location of the bottom border. | |
IlvPoint | center () const |
Retrieves to location of the center. | |
IlvPos | centerx () const |
Retrieves the x coordinate of the center. | |
IlvPos | centery () const |
Retrieves the y coordinate of the center. | |
IlBoolean | contains (const IlvRect &rect) const |
Checks if a rectangle is located in this rectangle. | |
IlBoolean | contains (const IlvPoint &p) const |
Checks if a point is located in this rectangle. | |
void | expand (IlvPos dx, IlvPos dy) |
Expands the rectangle. | |
void | expand (IlvPos delta) |
Uniformly expands the rectangle. | |
IlvDim | getH () const |
Retrieves the height. | |
IlvDim | getW () const |
Retrieves the width. | |
IlvPos | getX () const |
Retrieves the x coordinate of the origin. | |
IlvPos | getY () const |
Retrieves the y coordinate of the origin. | |
void | grow (IlvPos dw, IlvPos dh) |
Resizes the rectangle. | |
IlBoolean | inside (const IlvRect &rect) const |
Checks if a rectangle is located in this rectangle. | |
IlvRect & | intersection (const IlvRect &) |
Computes an intersection. | |
IlBoolean | intersects (const IlvRect &rect) const |
Checks if a rectangle intersects with this rectangle. | |
IlvPos | left () const |
Retrieves the location of the left border. | |
IlvPoint | lowerLeft () const |
Retrieves to location of the lower-left corner. | |
IlvPoint | lowerRight () const |
Retrieves to location of the lower-right corner. | |
void | move (IlvPos x, IlvPos y) |
Moves the rectangle. | |
void | move (const IlvPoint &orig) |
Moves the rectangle. | |
void | moveResize (IlvPos x, IlvPos y, IlvDim w, IlvDim h) |
Moves and resizes the rectangles. | |
IlvRect & | operator= (const IlvRect &r) |
Assignment operator. | |
int | operator== (const IlvRect &r) const |
Equality operator. | |
void | resize (IlvDim w, IlvDim h) |
Resizes the rectangle. | |
IlvPos | right () const |
Retrieves the location of the right border. | |
void | scale (IlFloat sw, IlFloat sh) |
Resizes the rectangle. | |
void | set (IlvPos x, IlvPos y, IlvDim w, IlvDim h) |
Moves and resizes the rectangles. | |
void | setH (IlvDim newH) |
Sets the height. | |
void | setW (IlvDim newW) |
Sets the width. | |
void | setX (IlvPos newX) |
Sets the x coordinate of the origin. | |
void | setY (IlvPos newY) |
Sets the y coordinate of the origin. | |
void | size (IlvDim &w, IlvDim &h) const |
Retrieves the dimensions. | |
IlvPos | top () const |
Retrieves the location of the top border. | |
void | translate (IlvPos dx, IlvPos dy) |
Translates the rectangle. | |
void | translate (const IlvPoint &dp) |
Translates the rectangle. | |
const IlvPoint & | upperLeft () const |
Retrieves to location of the upper-left corner. | |
IlvPoint | upperRight () const |
Retrieves to location of the upper-right corner. |
Geometric class.
Library: display
The IlvRect
class handle rectangular geometric entities, which are always specified by four numbers: the x and y coordinates of the top-left corner (also called the origin of the rectangle, the width and the height.
IlvFloatRect
, IlvPoint
. Constructor.
This constructor initializes a new rectangle with defined location and sizes.
x | The x coordinate of the top-left corner of this rectangle. | |
y | The y coordinate of the top-left corner of this rectangle. | |
w | The width of this rectangle. | |
h | The height of this rectangle. rectangle. |
Adds a point.
Acts on the current rectangle (referred to here by the C++ keyword this)
. The following diagram illustrates how this first add
function operates:
- The IlvRect::add(const IlvPoint&)
member function -
The add
function:
this
so that it is just big enough to include the point at (p,q) referred to as point.
In the special case in which point
lies inside the rectangle this
, the rectangle is not modified. this
. As a result of the execution of the member function add
, the this
object is physically modified. In the above diagram, the modified this
object is still located at the point (x,y), but it is changed in size. This would not be the case if the provided point was located to the left or above the rectangle's top-left corner.
point | The point to be added. |
this
object. Adds a rectangle.
The following diagram illustrates the way in which this second add
function operates:
- The IlvRect::add(const IlvRect&)
member function -
The add
function:
this
with another given rectangle, referred to as other
. this
. As a result of the execution of the member function add
, the this
object is physically modified. Note that in the above diagram, the modified this
object is still located at the point (x,y), but it has changed its size. That would not be the case if the provided rectangle was located to the left or above the original rectangle top-left corner. this
object. rect | The rectangle to be added. |
this
object. IlvPos IlvRect::bottom | ( | ) | const |
Retrieves the location of the bottom border.
This member function is equivalent to getY()+getH()
.
IlvPoint IlvRect::center | ( | ) | const |
Retrieves to location of the center.
IlvPos IlvRect::centerx | ( | ) | const |
IlvPos IlvRect::centery | ( | ) | const |
Retrieves the y coordinate of the center.
Checks if a rectangle is located in this rectangle.
IlBoolean
value indicating whether or not the current rectangle contains the rectangle passed as the rect
parameter. Checks if a point is located in this rectangle.
IlBoolean
value indicating whether or not the current rectangle contains a certain point. Expands the rectangle.
This member function is equivalent to:
If dx is negative, and |dx| is bigger than the current width, the new width is set to 0
. If dy is negative, and |dy| is bigger than the current height, the new height is set to 0
.
dx | The horizontal growth to be applied to the rectangle. | |
dy | The vertical growth to be applied to the rectangle. |
void IlvRect::expand | ( | IlvPos | delta | ) |
Uniformly expands the rectangle.
This member function is equivalent to:
If delta is negative, and 2*|delta| is bigger than of one of the rectangle's current dimensions, this dimension (width or height) is set to 0.
delta | The growth to be applied to the rectangle, in all directions. |
IlvDim IlvRect::getH | ( | ) | const |
Retrieves the height.
IlvDim IlvRect::getW | ( | ) | const |
Retrieves the width.
IlvPos IlvRect::getX | ( | ) | const |
Retrieves the x coordinate of the origin.
IlvPos IlvRect::getY | ( | ) | const |
Retrieves the y coordinate of the origin.
Resizes the rectangle.
Changes the dimensions of this object by means of a variation of the current width and height. The new width is the sum of the old width and dw.
Sets the new width of the rectangle to 0
if -dw
is larger than the current width. The new height is the sum of the old height and dh.
Sets the new height of the rectangle to 0
if -dh
is larger than the current height.
Checks if a rectangle is located in this rectangle.
This is similar to contains(const IlvRect&)
.
IlBoolean
value indicating whether or not the current rectangle is inside or contained in the rect
rectangle. Computes an intersection.
Acts on the current rectangle (referred to here by the C++ keyword this)
. The diagram below illustrates how the intersection
function operates:
- The IlvRect::intersection
member function -
The intersection
function:
this
with another given rectangle, designated by the parameter other
. this
. As a result of the execution of the member function intersection
, the this
object is physically modified. In the above diagram, the modified this
object has changed both its position and its size. It is now located at the same point as the other
rectangle: that is at (x,y).
this
object. If the this
and other
rectangles do not intersect, then this
is given 0
width and height, indicating an invalid rectangle. In this case, both the x and the y coordinates of the rectangle this
are left unchanged.
Checks if a rectangle intersects with this rectangle.
IlBoolean
value indicating whether or not the current rectangle forms a non-empty intersection with another given rectangle. IlvPos IlvRect::left | ( | ) | const |
Retrieves the location of the left border.
This member function is equivalent to x()
.
IlvPoint IlvRect::lowerLeft | ( | ) | const |
Retrieves to location of the lower-left corner.
IlvPoint IlvRect::lowerRight | ( | ) | const |
Retrieves to location of the lower-right corner.
Moves the rectangle.
x | The new x coordinate of the top-left corner. | |
y | The new y coordinate of the top-left corner. |
void IlvRect::move | ( | const IlvPoint & | orig | ) |
Moves the rectangle.
point | The new origin of this rectangle. |
Moves and resizes the rectangles.
x | The new x coordinate of the top-left corner of this rectangle. | |
y | The new y coordinate of the top-left corner of this rectangle. | |
w | The new width of this rectangle. | |
h | The new height of this rectangle. |
Assignment operator.
r | The rectangle that is copied to the current object. |
int IlvRect::operator== | ( | const IlvRect & | r | ) | const |
Equality operator.
r | The rectangle to compare to. |
0
if r is different than the current object. Resizes the rectangle.
w | The new width of this rectangle. | |
h | The new height of this rectangle. |
IlvPos IlvRect::right | ( | ) | const |
Retrieves the location of the right border.
This member function is equivalent to getX()+getW()
.
Resizes the rectangle.
Changes the dimensions of this object by means of two scaling factors applied to both the width and the height of this rectangle. sw
and sh
must be positive values.
Moves and resizes the rectangles.
x | The new x coordinate of the top-left corner of this rectangle. | |
y | The new y coordinate of the top-left corner of this rectangle. | |
w | The new width of this rectangle. | |
h | The new height of this rectangle. |
void IlvRect::setH | ( | IlvDim | newH | ) |
Sets the height.
newH | The new height of this rectangle. |
void IlvRect::setW | ( | IlvDim | newW | ) |
Sets the width.
newW | The new width of this rectangle. |
void IlvRect::setX | ( | IlvPos | newX | ) |
Sets the x coordinate of the origin.
newX | The new x coordinate of the origin. |
void IlvRect::setY | ( | IlvPos | newY | ) |
Sets the y coordinate of the origin.
newY | The new y coordinate of the origin. |
Retrieves the dimensions.
w | Is assigned the width of this rectangle. | |
h | Is assigned the height of this rectangle. |
IlvPos IlvRect::top | ( | ) | const |
Retrieves the location of the top border.
This member function is equivalent to y()
.
Translates the rectangle.
x | The x translation applied to the rectangle. | |
y | The y translation applied to the rectangle. |
void IlvRect::translate | ( | const IlvPoint & | dp | ) |
Translates the rectangle.
delta | The translation applied to the rectangle. |
const IlvPoint& IlvRect::upperLeft | ( | ) | const |
Retrieves to location of the upper-left corner.
This member function is equivalent to orig()
.
IlvPoint IlvRect::upperRight | ( | ) | const |
Retrieves to location of the upper-right corner.
© 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.