Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Storage class. More...
#include <ilviews/manager/indexgr.h>
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 *region=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... | |
IlvGraphic * | firstIntersects (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... | |
IlvGraphic * | lastContains (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 |
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.
IlvApplyObject
, IlvGraphic
. 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
.
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. |
void IlvIndexedSet::addObject | ( | const IlvGraphic * | obj | ) |
Adds a graphic object to the set, subdividing it if necessary.
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.
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.
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.
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.
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 | ( | 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.
f | The user function to apply. |
arg | The 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
.
tag | The tag. |
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.
dst | The destination port. |
t | The transformer. |
clip | The 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.
rect | The rectangle. |
trect | The transformed rectangle. |
f | The user function to apply. |
arg | The user argument. |
t | The 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.
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.
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.
rect | The rectangle. |
f | The user function to apply. |
arg | The 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.
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.
tr | The region. |
t | The transformer. |
IlUInt IlvIndexedSet::getCardinal | ( | ) | const |
Returns the number of objects in the set.
IlvGraphic* const* IlvIndexedSet::getObjects | ( | IlUInt & | count | ) | const |
Returns the objects in the set.
count | Number of objects in the array. |
IlBoolean IlvIndexedSet::isDivided | ( | ) | const |
Indicates whether the set is divided.
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.
p | The point. |
tp | The transformed point. |
t | The transformer. |
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.
f | The user function to apply. |
arg | The 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.
tag | The tag. |
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.
rect | The rectangle. |
trect | The transformed rectangle. |
f | The user function to apply. |
arg | The user argument. |
t | The 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.
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.
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.
rect | The rectangle. |
f | The user function to apply. |
arg | The user argument. |
IlBoolean IlvIndexedSet::removeObject | ( | const IlvGraphic * | obj | ) |
Removes a graphic object from the set.
IlTrue
if the object was stored in the set or IlFalse
if it was not. obj | The graphic object. |
void IlvIndexedSet::setMaxInNode | ( | IlUShort | m | ) |
Sets the subdividing threshold, or enable/disable automatic subdivision.
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.
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 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.