rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Manager Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvIndexedSet Class Reference

Storage class. More...

#include <ilviews/manager/indexgr.h>

Inheritance diagram for IlvIndexedSet:
IlvManagerLayer

List of all members.

Public Member Functions

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

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:
maxInList Maximum number of objects stored in a linear list in the set.
maxInNode If 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:
obj The 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:
count Used to return the number of elements in the returned array.
p The point.
tp The transformed point.
t The 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:
count Used to return the number of elements in the returned array.
rect The rectangle.
trect The transformed rectangle.
t The 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:
count Used to return the number of elements in the returned array.
rect The rectangle.
trect The transformed rectangle.
t The transformer.
void IlvIndexedSet::allowSubdivision ( IlBoolean  b  ) 

Enable/disable automatic subdivision.

Parameters:
b If 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 ( 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:
tag The tag.
f The user function to apply.
arg The user argument.
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:
f The user function to apply.
arg The user argument.
void IlvIndexedSet::applyDraw ( IlvPort dst,
const IlvTransformer t = 0,
const IlvRegion region = 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:
dst The destination port.
t The transformer.
clip The clipping region.
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:
rect The rectangle.
f The user function to apply.
arg The user argument.
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:
rect The rectangle.
trect The transformed rectangle.
f The user function to apply.
arg The user argument.
t The 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:
rect The rectangle.
f The user function to apply.
arg The 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:
rect The rectangle.
trect The transformed rectangle.
f The user function to apply.
arg The user argument.
t The transformer.
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:
obj The graphic object.
f The user function to apply.
arg The 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:
tr The region.
t The 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:
count Number 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:
p The point.
tp The transformed point.
t The 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 ( 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:
tag The tag.
f The user function to apply.
arg The user argument.
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:
f The user function to apply.
arg The user argument.
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:
rect The rectangle.
f The user function to apply.
arg The 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:
rect The rectangle.
trect The transformed rectangle.
f The user function to apply.
arg The user argument.
t The 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:
rect The rectangle.
f The user function to apply.
arg The 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:
rect The rectangle.
trect The transformed rectangle.
f The user function to apply.
arg The user argument.
t The transformer.
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:
obj The graphic object.
void IlvIndexedSet::setMaxInNode ( IlUShort  m  ) 

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

Parameters:
m Sets 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.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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