|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.IlvIndexedSet
public class IlvIndexedSet
IlvIndexedSet is a class dedicated to managing a large number of
graphic objects in a list or a quadtree.
| Constructor Summary | |
|---|---|
IlvIndexedSet()
Creates a new indexed set. |
|
IlvIndexedSet(int maxInNode,
int maxInList)
Creates a new indexed set. |
|
| Method Summary | |
|---|---|
void |
addObject(IlvGraphic obj)
Adds an object. |
void |
afterUpdate(IlvGraphic obj,
IlvRect bbox)
Updates the location of the object in the quadtree. |
void |
beforeUpdate(IlvGraphic obj,
IlvRect bbox)
Prepares the update of the IlvIndexedSet. |
void |
collectObjects(IlvPoint p,
IlvPoint tp,
IlvTransformer t,
IlvGraphicVector result)
Collects all visible objects at a specified location. |
IlvRect |
computeBBox(IlvTransformer t)
Returns the bounding rectangle of the set when drawn with the specified transformer. |
void |
deleteAll()
Removes all the objects. |
int |
getCardinal()
Returns the number of objects. |
IlvGraphicEnumeration |
getElements()
Returns an enumeration of all the objects. |
int |
getIndex(IlvGraphic obj)
Returns the index of the specified object in the IlvIndexedSet. |
IlvGraphicEnumeration |
getManagers()
Returns an enumeration of all the instances of IlvManager
that have been added in this IlvIndexedSet. |
int |
getManagersCount()
Returns the number of IlvManager objects that have been
added in this IlvIndexedSet. |
IlvGraphic |
getObject(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Looks for an object at a specified location. |
IlvGraphic |
getObject(int index)
Returns the object at the input index. |
long |
getSubsequentRemoveThreshold()
Returns the threshold for optimized remove operations. |
boolean |
isQuadtreeEnabled()
Returns true if the quadtree is enabled. |
void |
map(IlvApplyObject f,
Object arg)
Applies a function to all the objects in the set. |
void |
mapInside(IlvRect rect,
IlvRect trect,
IlvApplyObject f,
Object arg,
IlvTransformer t)
Applies a function to all objects located in a specified rectangle. |
void |
mapInside(IlvRect rect,
IlvRect trect,
IlvApplyObject f,
Object arg,
IlvTransformer t,
boolean traverse)
Applies a function to all objects located in a specified rectangle. |
void |
mapIntersects(IlvRect rect,
IlvRect trect,
IlvApplyObject f,
Object arg,
IlvTransformer t)
Applies a function to all objects with a bounding box that intersects a specified rectangle. |
void |
mapIntersects(IlvRect rect,
IlvRect trect,
IlvApplyObject f,
Object arg,
IlvTransformer t,
boolean traverse)
Applies a function to all objects with a bounding box that intersects a specified rectangle. |
void |
removeObject(IlvGraphic obj)
Removes an object. |
void |
setIndex(IlvGraphic obj,
int index)
Changes the index of the specified object in the IlvIndexedSet. |
void |
setQuadtreeEnabled(boolean enable)
Enables or disables the quadtree. |
void |
setSubsequentRemoveThreshold(long threshold)
Sets the threshold when to use optimized remove operations. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IlvIndexedSet()
public IlvIndexedSet(int maxInNode,
int maxInList)
maxInNode - The maximum number of objects for a node of the quadtree.maxInList - The maximum number of objects before using the quadtree.| Method Detail |
|---|
public void setQuadtreeEnabled(boolean enable)
Compared to a list, the quadtree is a spatial data structure that speeds
up the search of graphic objects at a given location
(for instance getObject, mapInside,
mapIntersects) but requires a (usually negligible) slowdown
of operations that modify the location of any objects (see
afterUpdate).
enable - If true, the quadtree gets enabled; otherwise
it gets disabled.isQuadtreeEnabled(),
getObject(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvTransformer),
mapInside(ilog.views.IlvRect, ilog.views.IlvRect, ilog.views.IlvApplyObject, java.lang.Object, ilog.views.IlvTransformer),
mapIntersects(ilog.views.IlvRect, ilog.views.IlvRect, ilog.views.IlvApplyObject, java.lang.Object, ilog.views.IlvTransformer),
afterUpdate(ilog.views.IlvGraphic, ilog.views.IlvRect),
IlvQuadtreepublic boolean isQuadtreeEnabled()
true if the quadtree is enabled.
setQuadtreeEnabled(boolean),
IlvQuadtreepublic void setSubsequentRemoveThreshold(long threshold)
You can set the threshold to Long.MAX_VALUE to
disable the optimized mechanism, so that errors of the remove operation
are detected immediately. This is in general better if you want to
debug operations related to IlvIndexedSet.
The default value is 3.
removeObject(ilog.views.IlvGraphic),
getSubsequentRemoveThreshold()public long getSubsequentRemoveThreshold()
setSubsequentRemoveThreshold(long)public void addObject(IlvGraphic obj)
obj - The graphic object to be added.public void removeObject(IlvGraphic obj)
obj - The graphic object to be removed.public int getCardinal()
public void deleteAll()
public IlvGraphic getObject(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
p - The point at which the search will be started.tp - The point p transformed.t - The transformer through which the set is drawn.
p if there is one.
Otherwise it returns null.setQuadtreeEnabled(boolean)
public void collectObjects(IlvPoint p,
IlvPoint tp,
IlvTransformer t,
IlvGraphicVector result)
p - The point at which the search will be started.tp - The point p transformed.t - The transformer through which the set is drawn.result - The resulting objects.setQuadtreeEnabled(boolean)
public void beforeUpdate(IlvGraphic obj,
IlvRect bbox)
IlvIndexedSet. This method is
called before a change of the bounding box of a graphic object.
You should not call this method directly.
obj - The graphic object.bbox - The old bounding box of the graphic object in manager
coordinates.
It can be null, in which case it will be computed.afterUpdate(ilog.views.IlvGraphic, ilog.views.IlvRect)
public void afterUpdate(IlvGraphic obj,
IlvRect bbox)
You should not call this method directly.
obj - The graphic object.bbox - The new bounding box of the graphic object in manager
coordinates.
It can be null, in which case it will be computed.beforeUpdate(ilog.views.IlvGraphic, ilog.views.IlvRect),
setQuadtreeEnabled(boolean)public IlvGraphicEnumeration getElements()
Note that it is not allowed to remove or add graphic objects while browsing the enumeration returned by this method.
public void setIndex(IlvGraphic obj,
int index)
IlvIndexedSet.
If the specified graphic object is not in this IlvIndexedSet,
the method does nothing and does not issue any exception.
Note that changing the index of an object in the IlvIndexedSet
will change the drawing order of the object only if the quadtree is
turned off.
setQuadtreeEnabled(boolean),
getIndex(ilog.views.IlvGraphic)public int getIndex(IlvGraphic obj)
IlvIndexedSet.
If the specified graphic object is not in this IlvIndexedSet,
the method returns -1.
Note that the index of an object in the IlvIndexedSet
defines the drawing order of the object only if the quadtree is
turned off.
setQuadtreeEnabled(boolean),
setIndex(ilog.views.IlvGraphic, int)public IlvGraphic getObject(int index)
IlvIndexedSet.
Note that the index of an object in the IlvIndexedSet
defines the drawing order of the object only if the quadtree is
turned off.
setQuadtreeEnabled(boolean),
getCardinal(),
setIndex(ilog.views.IlvGraphic, int)public IlvGraphicEnumeration getManagers()
IlvManager
that have been added in this IlvIndexedSet.
public int getManagersCount()
IlvManager objects that have been
added in this IlvIndexedSet.
public void map(IlvApplyObject f,
Object arg)
f - The function to be applied.arg - The argument of the function.
public void mapInside(IlvRect rect,
IlvRect trect,
IlvApplyObject f,
Object arg,
IlvTransformer t)
f to all graphic
objects inside the rectangle rect.
rect - The rectangle.trect - The transformed rectangle.f - The method to be applied.arg - The argument passed to the method.t - The transformer used to display the set.setQuadtreeEnabled(boolean)
public void mapInside(IlvRect rect,
IlvRect trect,
IlvApplyObject f,
Object arg,
IlvTransformer t,
boolean traverse)
f to all graphic
objects inside the rectangle rect.
This method will traverse recursively
the IlvManager objects added in this set to apply the function
to all objects that are inside the specified rectangle if the
parameter traverse is set to true.
rect - The rectangle.trect - The transformed rectangle.f - The method to be applied.arg - The argument passed to the method.t - The transformer used to display the set.traverse - When true, the method will traverse
recursively the IlvManager objects added in this set to apply
the function to all objects that are inside the specified rectangle.setQuadtreeEnabled(boolean)
public void mapIntersects(IlvRect rect,
IlvRect trect,
IlvApplyObject f,
Object arg,
IlvTransformer t)
rect - The rectangle.trect - The transformed rectangle.f - The method to be applied.arg - The argument passed to the method.t - The transformer used to display the set.setQuadtreeEnabled(boolean)
public void mapIntersects(IlvRect rect,
IlvRect trect,
IlvApplyObject f,
Object arg,
IlvTransformer t,
boolean traverse)
IlvManager objects added in this set to apply the function
to all objects that intersect the rectangle if the parameter
traverse is set to true.
rect - The rectangle.trect - The transformed rectangle.f - The method to be applied.arg - The argument passed to the method.t - The transformer used to display the set.traverse - If true, then the method will traverse
recursively the IlvManager objects added in this set to apply
the function to all objects that intersect the rectangle.setQuadtreeEnabled(boolean)public IlvRect computeBBox(IlvTransformer t)
t - The transformer.
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||