rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

List of all members | Public Member Functions
IlvPointArray Class Reference

Geometric class. More...

#include <ilviews/base/ptarray.h>

Public Member Functions

 IlvPointArray ()
 Constructor. More...
 
 IlvPointArray (IlUInt count, const IlvPoint *points, IlBoolean copy=IlTrue)
 Constructor. More...
 
 IlvPointArray (const IlvPointArray &source)
 Copy constructor. More...
 
 ~IlvPointArray ()
 Destructor. More...
 
void addPoints (IlUInt count, const IlvPoint *points, IlUInt where)
 Appends a point array. More...
 
void applyTransform (const IlvTransformer *t)
 Applies a transformer to the object. More...
 
IlInt area (const IlvTransformer *t=0) const
 Computes the area of the point array. More...
 
const IlvRectbbox () const
 Retrieves the bounding box of the points. More...
 
void boundingBox (IlvRect &box, const IlvTransformer *t=0) const
 Retrieves the transformed bounding box of the points. More...
 
void movePoint (const IlvPoint &pos, IlUInt which)
 Moves a point. More...
 
IlUInt nbHorizontalIntersect (const IlvPoint &p) const
 Counts horizontal crossings. More...
 
IlUInt npoints () const
 Retrieves the size of the array. More...
 
IlBoolean outlineContains (const IlvPoint &p) const
 Hit test. More...
 
const IlvPointpoints () const
 Retrieves the IlvPoint array. More...
 
const IlvPointpoints (IlUInt index) const
 Retrieves a pointer in the IlvPoint array. More...
 
IlBoolean removePoints (IlUInt start, IlUInt count)
 Removes a block of points. More...
 
void setPoints (IlUInt count, const IlvPoint *points, IlBoolean copy=IlTrue)
 Sets the point array. More...
 

Detailed Description

Geometric class.

Library: display

IlvPointArray is a class that encapsulates an array of IlvPoints so that you can more easily manipulate these arrays.

Constructor & Destructor Documentation

IlvPointArray::IlvPointArray ( )

Constructor.

Initializes a new, empty instance of IlvPointArray.

IlvPointArray::IlvPointArray ( IlUInt  count,
const IlvPoint points,
IlBoolean  copy = IlTrue 
)

Constructor.

Parameters
countThe number of initial points of this array.
pointsThe array of at least count points that defines the shape of this new instance.
copyIf set to IlTrue, this constructor makes a copy of points and the user is responsible of freeing points if necessary. If copy is IlFalse, the IlvPointArray stores directly the parameter points and the user must not modify it anymore.
IlvPointArray::IlvPointArray ( const IlvPointArray source)

Copy constructor.

Initializes a new IlvPointArray as a copy of source.

Parameters
sourceThe instance that is copied.
IlvPointArray::~IlvPointArray ( )

Destructor.

The destructor deletes the internal point array. The IlvPointArray must always be considered as the owner of the array of the IlvPoint it stores. This array is deleted when the object is destroyed.

Member Function Documentation

void IlvPointArray::addPoints ( IlUInt  count,
const IlvPoint points,
IlUInt  where 
)

Appends a point array.

Parameters
countThe number of points to be appended.
pointsThe array of at least count IlvPoints that are appended. This array is copied, so the user is responsible for deleting points if necessary.
whereThe insertion index. where becomes the index of the first point of points in the new array.
void IlvPointArray::applyTransform ( const IlvTransformer t)

Applies a transformer to the object.

The transformer t is applied to each point in the array.

Parameters
tThe transformer to be applied.
IlInt IlvPointArray::area ( const IlvTransformer t = 0) const

Computes the area of the point array.

Parameters
tThe transformer that must be applied before the area is computed.
Returns
The area of the polygon formed by the sequence of IlvPoints of the object. This area is positive if the polygon turns clockwise.
const IlvRect& IlvPointArray::bbox ( ) const

Retrieves the bounding box of the points.

Returns
The bounding box of all IlvPoints in the array.
void IlvPointArray::boundingBox ( IlvRect box,
const IlvTransformer t = 0 
) const

Retrieves the transformed bounding box of the points.

Parameters
boxThe output transformed bounding box. It is the IlvRect obtained by applying the transformer t to the bounding box of the IlvPointArray. box strictly includes the bounding box of the point array if the transformer t is applied to each point.
tThe transformed to be applied. If this parameter is not provided, or set to 0, the points are not transformed when the bounding box is computed.
void IlvPointArray::movePoint ( const IlvPoint pos,
IlUInt  which 
)

Moves a point.

Parameters
posThe new location of the point.
whichThe index of the point to move.
IlUInt IlvPointArray::nbHorizontalIntersect ( const IlvPoint p) const

Counts horizontal crossings.

Parameters
pThe source point of the horizontal ray.
Returns
The number of times an infinite horizontal ray intersects the polyline formed by the sequence of IlvPoints of the object. The ray starts at p and goes towards positive x.
IlUInt IlvPointArray::npoints ( ) const

Retrieves the size of the array.

Returns
The number of IlvPoints in the internal array.
IlBoolean IlvPointArray::outlineContains ( const IlvPoint p) const

Hit test.

Parameters
pThe point whose location is tested.
Returns
IlTrue if p lies on a segment of the polyline formed by the sequence of IlvPoints of the object.
const IlvPoint* IlvPointArray::points ( ) const

Retrieves the IlvPoint array.

Returns
The internal array of IlvPoints. This array must not be modified nor freed.
const IlvPoint* IlvPointArray::points ( IlUInt  index) const

Retrieves a pointer in the IlvPoint array.

Returns
The address of the IlvPoint at index index. Equivalent to &(points()[index]).
IlBoolean IlvPointArray::removePoints ( IlUInt  start,
IlUInt  count 
)

Removes a block of points.

Parameters
startThe index of the first point to be removed.
countThe number of consecutive points to be removed.
Returns
IlTrue if the operation is successful, and IlFalse if the operation cannot be performed (not enough points in the array).
void IlvPointArray::setPoints ( IlUInt  count,
const IlvPoint points,
IlBoolean  copy = IlTrue 
)

Sets the point array.

Parameters
countThe number of points that are set.
pointsThe source array of points. It must store at least count IlvPoints.
copyIndicates, if set to IlTrue, that the array is copied before it is stored in this object. If copy is IlFalse, the IlvPointArray stores directly the parameter points and the user must no longer modify it.

© 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.