Each graphic representation of an object is an instance of the
class
IlpGraphic. It has a set of decorations
that are instances of the class
IlvGraphic. (Note that the
IlpGraphic
class itself is a subclass of
IlvGraphic
.) The graphic representations (
IlpGraphic
) are layered according to a given order, and so are the
decorations. The mechanism that defines the stacking order for
decorations and graphic representations is called
layer policy, and is implemented by the
abstract class
IltLayerPolicy. This mechanism defines how
two graphic representations overlap and ensures that their
decorations do not intertwine. See the stacking order defined at
the beginning of
Layers.
Each
IlpNetworkView has a layer policy that
defines in which order the objects will be displayed in the
grapher. This layer policy is created during initialization, but
you can also modify it through the
IltCompositeGrapher
class:
The layer policy is responsible for allocating specific layers in
the Rogue Wave® JViews grapher. The grapher is used to define the
stacking order of the decorations.
JViews TGO provides a
specific class for handling layers called
IltcLayer. This interface is the extension
of
IlvManagerLayer for
IlpGraphic objects. Even though
JViews TGO uses
IltcLayer instances, it is also possible to
use
IlvManagerLayer instances directly to place
graphic objects like map backgrounds or annotations.
Important
The created layers must be referenced using
IlvManagerLayer instead of the layer
numbers, since
JViews
TGO may cause layers to be added or removed, which invalidates
the previous layer numbers.
To create your own layer policy, you will have to implement the
IltLayerPolicy interface that defines the
following methods:
The layers returned by the methods above can be created in layer
policy initialization. The class
IltCompositeGrapher provides methods
through its superclass for dynamically allocating the layers in
the grapher to execute this operation.
addLayerOnTop/addLayerBelow
(IltcLayer layer)
. These methods create a new
IltcLayer
above or below the given
IltcLayer
.
addLayerOnTop/addLayerBelow
(IlvManagerLayer layer)
. These methods create a new
IltcLayer
above or below the given
IlvManagerLayer
.
addIlvManagerLayerOnTop/addIlvManagerLayerBelow
(IltcLayer layer)
. These methods create a new
IlvManagerLayer above or below the given
IltcLayer
.
addLayerOnTop
. This method creates a new
IltcLayer on top of all the other layers
of this grapher.
addLayerAtBottom
. This method creates a new
IltcLayer beneath all the other layers
of this grapher.
The following code extract shows you how
to create layers.
How to create layers
public MyLayerPolicy (IltCompositeGrapher grapher) {
_groupLayer = grapher.addLayerOnTop ();
_linkLayer = grapher.addLayerOnTop();
_mainLayer = grapher.addLayerOnTop();
_alarmBalloonLayer = grapher.addLayerOnTop();
_infoWindowLayer = grapher.addLayerOnTop();
_systemWindowLayer = grapher.addLayerOnTop();
}
public IltcLayer getElementLayer (IlpGraphic graphic,
IltGraphicElementName element) {
if (element == IltGraphicElementName.AlarmBalloon)
return _alarmBalloonLayer;
else if (element == IltGraphicElementName.InfoWindow)
return _infoWindowLayer;
else if (element == IltGraphicElementName.SystemWindow)
return _systemWindowLayer;
return null;
}
Note
When you use the layer policy and your own layers in an
IlpNetworkView
,
JViews TGO
expects all the layers for
IlpGraphic
instances and decorations to be adjacent. For example, if you
intend to load an IVL file that has predefined layers for the
vectorial elements, these layers must be previously allocated
in the
IlvGrapher
instance before you create the
IlpNetworkView
. (See
IlvManager in the Rogue Wave JViews
Java™ API Reference
Documentation for information on how to create layers.)