Rogue Wave Views
Manager Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions | Friends
IlvIndexedSet Class Reference

Storage class. More...

#include <ilviews/manager/indexgr.h>

Inheritance diagram for IlvIndexedSet:
IlvManagerLayer

Public Member Functions

 IlvIndexedSet (IlUShort maxInList=30, IlUShort maxInNode=30)
 Constructor. More...
 
void addObject (const IlvGraphic *obj)
 Adds a graphic object to the set, subdividing it if necessary. More...
 
IlvGraphic *const * allContains (IlUInt &count, const IlvPoint &p, const IlvPoint &tp, const IlvTransformer *t=0) const
 Returns all graphic objects containing a given point. More...
 
IlvGraphic *const * allInside (IlUInt &count, const IlvRect &rect, const IlvRect &trect, const IlvTransformer *t=0) const
 Returns all graphic objects located in a rectangle. More...
 
IlvGraphic *const * allIntersects (IlUInt &count, const IlvRect &rect, const IlvRect &trect, const IlvTransformer *t=0) const
 Returns all graphic objects intersecting a rectangle. More...
 
void allowSubdivision (IlBoolean b)
 Enable/disable automatic subdivision. More...
 
void apply (IlvApplyObject f, IlAny arg)
 Applies a user function to all objects of the set. More...
 
void apply (const IlSymbol *tag, IlvApplyObject f, IlAny arg)
 Apply a user function to tagged objects. More...
 
void applyDraw (IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const
 Draws all objects. More...
 
void applyInside (const IlvRect &rect, const IlvRect &trect, IlvApplyObject f, IlAny arg, const IlvTransformer *t=0)
 Apply a user function to objects located in a rectangle. More...
 
void applyInside (const IlvRect &rect, IlvApplyObject f, IlAny arg)
 Apply a user function to objects located in a rectangle. More...
 
void applyIntersects (const IlvRect &rect, const IlvRect &trect, IlvApplyObject f, IlAny arg, const IlvTransformer *t=0)
 Apply a user function to objects intersecting a rectangle. More...
 
void applyIntersects (const IlvRect &rect, IlvApplyObject f, IlAny arg)
 Apply a user function to objects intersecting a rectangle. More...
 
void applyToObject (IlvGraphic *obj, IlvApplyObject f, IlAny arg)
 Applies a user function to a graphic object. More...
 
IlvGraphicfirstIntersects (const IlvRegion &tr, const IlvTransformer *t=0) const
 Returns the first object intersecting a region. More...
 
IlUInt getCardinal () const
 Returns the number of objects in the set. More...
 
IlvGraphic *const * getObjects (IlUInt &count) const
 Returns the objects in the set. More...
 
IlBoolean isDivided () const
 Indicates whether the set is divided. More...
 
IlvGraphiclastContains (const IlvPoint &p, const IlvPoint &tp, const IlvTransformer *t=0) const
 Returns the object containing a given point. More...
 
void map (IlvApplyObject f, IlAny arg) const
 Applies a user function to all objects of the set. More...
 
void map (const IlSymbol *tag, IlvApplyObject f, IlAny arg) const
 Apply a user function to tagged objects. More...
 
void mapInside (const IlvRect &rect, const IlvRect &trect, IlvApplyObject f, IlAny arg, const IlvTransformer *t=0) const
 Apply a user function to objects located in a rectangle. More...
 
void mapInside (const IlvRect &rect, IlvApplyObject f, IlAny arg) const
 Apply a user function to objects located in a rectangle. More...
 
void mapIntersects (const IlvRect &rect, const IlvRect &trect, IlvApplyObject f, IlAny arg, const IlvTransformer *t=0) const
 Apply a user function to objects intersecting a rectangle. More...
 
void mapIntersects (const IlvRect &rect, IlvApplyObject f, IlAny arg) const
 Apply a user function to objects intersecting a rectangle. More...
 
IlBoolean removeObject (const IlvGraphic *obj)
 Removes a graphic object from the set. More...
 
void setMaxInNode (IlUShort m)
 Sets the subdividing threshold, or enable/disable automatic subdivision. More...
 
IlBoolean subDivide () const
 Indicates whether the set will subdivide itself or keep an ordered list. More...
 

Friends

class IlvManager
 

Detailed Description

Storage class.

Library: ilvmgr

An IlvIndexedSet object organizes large sets of IlvGraphic objects. It is much more efficient than the IlvGraphicSet class when many objects are to be grouped together, but it is also more complex to manipulate. This class is not a subclass of IlvGraphic. In order to represent an object of this kind graphically, create a subclass of a predefined IlvGraphic class that stores an object of the IlvIndexedSet type. The member function draw of your subclass must call the member function applyDraw of the IlvIndexedSet object.

See also
IlvApplyObject, IlvGraphic.

Constructor & Destructor Documentation

IlvIndexedSet::IlvIndexedSet ( IlUShort  maxInList = 30,
IlUShort  maxInNode = 30 
)

Constructor.

Initializes a new instance of the IlvIndexedSet class. It is initially empty. The objects are stored in a list, as long as there are fewer objects in this set than the maxInList parameter of the constructor. When you reach the limit of the maxInList parameter, the next object you insert in this set will divide the indexed set. In a divided set, objects are no longer stored in a linear list. They are stored in a much more efficient way in terms of access performance. To maintain this divided set consistently, you must not modify the geometry (size or position) of any object in an IlvIndexedSet without encapsulating these modifications in a call to the member function applyToObject.

Parameters
maxInListMaximum number of objects stored in a linear list in the set.
maxInNodeIf this value is 65535 (0xffff), the set will never be divided, allowing one to keep the objects in the order in which they were inserted. Otherwise, this parameter is used as a criteria to implement recursive subdivision of the subdivisions.

Member Function Documentation

void IlvIndexedSet::addObject ( const IlvGraphic obj)

Adds a graphic object to the set, subdividing it if necessary.

Parameters
objThe graphic object.
IlvGraphic* const* IlvIndexedSet::allContains ( IlUInt count,
const IlvPoint p,
const IlvPoint tp,
const IlvTransformer t = 0 
) const

Returns all graphic objects containing a given point.

Returns
An array of pointers to all the objects containing a given point. If a transformer is specified, the transformed point is used instead. This array must not be modified or deleted.
Parameters
countUsed to return the number of elements in the returned array.
pThe point.
tpThe transformed point.
tThe transformer.
IlvGraphic* const* IlvIndexedSet::allInside ( IlUInt count,
const IlvRect rect,
const IlvRect trect,
const IlvTransformer t = 0 
) const

Returns all graphic objects located in a rectangle.

Returns
An array of pointers to all objects whose bounding box is included in the given rectangle. If a transformer is specified, the transformed rectangle is used instead. The returned array must not be modified or deleted.
Parameters
countUsed to return the number of elements in the returned array.
rectThe rectangle.
trectThe transformed rectangle.
tThe transformer.
IlvGraphic* const* IlvIndexedSet::allIntersects ( IlUInt count,
const IlvRect rect,
const IlvRect trect,
const IlvTransformer t = 0 
) const

Returns all graphic objects intersecting a rectangle.

Returns
An array of pointers to all objects with a bounding box intersecting a given rectangle. If a transformer is specified, the transformed rectangle is used instead. The returned array must not be modified or deleted.
Parameters
countUsed to return the number of elements in the returned array.
rectThe rectangle.
trectThe transformed rectangle.
tThe transformer.
void IlvIndexedSet::allowSubdivision ( IlBoolean  b)

Enable/disable automatic subdivision.

Parameters
bIf this flag is IlTrue, then the set will never be subdivided, allowing objects to keep the order in which they were inserted. Otherwise, object will be spread in a quadtree allowing optimal refreshes.
void IlvIndexedSet::apply ( IlvApplyObject  f,
IlAny  arg 
)

Applies a user function to all objects of the set.

Encapsulates a call to f(obj, arg) for every object of the set.

Parameters
fThe user function to apply.
argThe user argument.
void IlvIndexedSet::apply ( const IlSymbol tag,
IlvApplyObject  f,
IlAny  arg 
)

Apply a user function to tagged objects.

Encapsulates a call to f(obj, arg) for all objects holding a specific tag. See IlvGraphic::hasTag.

Parameters
tagThe tag.
fThe user function to apply.
argThe user argument.
void IlvIndexedSet::applyDraw ( IlvPort dst,
const IlvTransformer t = 0,
const IlvRegion clip = 0 
) const

Draws all objects.

Draws every object of this set onto the destination port. The drawing is performed using a transformer and a clipping region.

Parameters
dstThe destination port.
tThe transformer.
clipThe clipping region.
void IlvIndexedSet::applyInside ( const IlvRect rect,
const IlvRect trect,
IlvApplyObject  f,
IlAny  arg,
const IlvTransformer t = 0 
)

Apply a user function to objects located in a rectangle.

Encapsulates a call to f(obj, arg) for each object whose bounding box is located inside a rectangle. If a transformer is specified, the transformed rectangle is used instead.

Parameters
rectThe rectangle.
trectThe transformed rectangle.
fThe user function to apply.
argThe user argument.
tThe transformer.
void IlvIndexedSet::applyInside ( const IlvRect rect,
IlvApplyObject  f,
IlAny  arg 
)

Apply a user function to objects located in a rectangle.

Encapsulates a call to f(obj, arg) for each object whose bounding box is located inside a rectangle.

Parameters
rectThe rectangle.
fThe user function to apply.
argThe user argument.
void IlvIndexedSet::applyIntersects ( const IlvRect rect,
const IlvRect trect,
IlvApplyObject  f,
IlAny  arg,
const IlvTransformer t = 0 
)

Apply a user function to objects intersecting a rectangle.

Encapsulates a call to f(obj, arg) for each object whose bounding box intersects a rectangle. If a transformer is specified, the transformed rectangle is used instead.

Parameters
rectThe rectangle.
trectThe transformed rectangle.
fThe user function to apply.
argThe user argument.
tThe transformer.
void IlvIndexedSet::applyIntersects ( const IlvRect rect,
IlvApplyObject  f,
IlAny  arg 
)

Apply a user function to objects intersecting a rectangle.

Encapsulates a call to f(obj, arg) for every object whose bounding box intersects a rectangle.

Parameters
rectThe rectangle.
fThe user function to apply.
argThe user argument.
void IlvIndexedSet::applyToObject ( IlvGraphic obj,
IlvApplyObject  f,
IlAny  arg 
)

Applies a user function to a graphic object.

Encapsulates a call to f(obj, arg), in order to keep the indexed set coherent.

Parameters
objThe graphic object.
fThe user function to apply.
argThe user argument.
IlvGraphic* IlvIndexedSet::firstIntersects ( const IlvRegion tr,
const IlvTransformer t = 0 
) const

Returns the first object intersecting a region.

Returns
A pointer to the first object whose bounding box intersects a region. If a transformer is specified, the method tests the intersection between the region and the transformed bounding box.
Parameters
trThe region.
tThe transformer.
IlUInt IlvIndexedSet::getCardinal ( ) const

Returns the number of objects in the set.

Returns
The number of objects stored in this set.
IlvGraphic* const* IlvIndexedSet::getObjects ( IlUInt count) const

Returns the objects in the set.

Returns
An array of pointers to all the objects stored in the set. This array must not be modified or deleted.
Parameters
countNumber of objects in the array.
IlBoolean IlvIndexedSet::isDivided ( ) const

Indicates whether the set is divided.

Returns
IlTrue if the set is divided; that is, objects are no longer stored in a list but in a more complex structure.
IlvGraphic* IlvIndexedSet::lastContains ( const IlvPoint p,
const IlvPoint tp,
const IlvTransformer t = 0 
) const

Returns the object containing a given point.

Parameters
pThe point.
tpThe transformed point.
tThe transformer.
Returns
The object stored in the set and containing the point p. If a transformer is specified, the transformed point is used. It returns 0 if there is no object at this location.
void IlvIndexedSet::map ( IlvApplyObject  f,
IlAny  arg 
) const

Applies a user function to all objects of the set.

Encapsulates a call to f(obj, arg) for every object of the set. No object must be modified by f.

Parameters
fThe user function to apply.
argThe user argument.
void IlvIndexedSet::map ( const IlSymbol tag,
IlvApplyObject  f,
IlAny  arg 
) const

Apply a user function to tagged objects.

Encapsulates a call to f(obj, arg) for all objects holding a specific tag. See IlvGraphic::hasTag. No object must be modified by f.

Parameters
tagThe tag.
fThe user function to apply.
argThe user argument.
void IlvIndexedSet::mapInside ( const IlvRect rect,
const IlvRect trect,
IlvApplyObject  f,
IlAny  arg,
const IlvTransformer t = 0 
) const

Apply a user function to objects located in a rectangle.

Encapsulates a call to f(obj, arg) for each object whose bounding box is located inside a rectangle. If a transformer is specified, the transformed rectangle is used instead. No object must be modified by f.

Parameters
rectThe rectangle.
trectThe transformed rectangle.
fThe user function to apply.
argThe user argument.
tThe transformer.
void IlvIndexedSet::mapInside ( const IlvRect rect,
IlvApplyObject  f,
IlAny  arg 
) const

Apply a user function to objects located in a rectangle.

Encapsulates a call to f(obj, arg) for each object whose bounding box is located inside a rectangle. No object must be modified by f.

Parameters
rectThe rectangle.
fThe user function to apply.
argThe user argument.
void IlvIndexedSet::mapIntersects ( const IlvRect rect,
const IlvRect trect,
IlvApplyObject  f,
IlAny  arg,
const IlvTransformer t = 0 
) const

Apply a user function to objects intersecting a rectangle.

Encapsulates a call to f(obj, arg) for each object whose bounding box intersects a rectangle. If a transformer is specified, the transformed rectangle is used instead. No object must be modified by f.

Parameters
rectThe rectangle.
trectThe transformed rectangle.
fThe user function to apply.
argThe user argument.
tThe transformer.
void IlvIndexedSet::mapIntersects ( const IlvRect rect,
IlvApplyObject  f,
IlAny  arg 
) const

Apply a user function to objects intersecting a rectangle.

Encapsulates a call to f(obj, arg) for every object whose bounding box intersects a rectangle. No object must be modified by f.

Parameters
rectThe rectangle.
fThe user function to apply.
argThe user argument.
IlBoolean IlvIndexedSet::removeObject ( const IlvGraphic obj)

Removes a graphic object from the set.

Returns
IlTrue if the object was stored in the set or IlFalse if it was not.
Parameters
objThe graphic object.
void IlvIndexedSet::setMaxInNode ( IlUShort  m)

Sets the subdividing threshold, or enable/disable automatic subdivision.

Parameters
mSets the maximum number of objects that are to be stored in a node of the corresponding quadtree. If this threshold is 65535 (0xffff), then the set will never be subdivided, allowing objects to keep the order in which they were inserted.
IlBoolean IlvIndexedSet::subDivide ( ) const

Indicates whether the set will subdivide itself or keep an ordered list.

Returns
IlTrue if adding objects beyond the maxInList threshold will subdivide the set or if all objects are to remain stored in an ordered list.

© Copyright 2016, 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.