public abstract class IlvLabelLayout
extends java.lang.Object
A Label Layout algorithm has the task to place labels at graphic
objects such that the labels are well readable. Labels should not
overlap each other or overlap the graphic objects of the
IlvManager
. JViews provides special support for this
task. Using the IlvManager
class, any graphic object can be
defined to behave like a label and can be automatically placed as a
decoration close to any graphic obstacle object.
The Label Layout algorithms are not restricted to be used only with
IlvManager
. They can be used with any data structure. This is
achieved an IlvLabelingModel
. This abstract class defines the
API that is necessary to allow the label layout algorithms to work. To
use your own data structures, all you need to do is to implement an
adapter (a bridge) that connects your graphic data with the generic
labeling model. For details, see the class IlvLabelingModel
.
The class IlvLabelLayout
is abstract and cannot be used
directly. You must use one of its subclasses provided in this package.
You can also create your own subclasses to implement other layout
algorithms. Note that, in order to be applied on any data structures,
the layout algorithms must be written using the API of IlvLabelingModel
instead of the API of IlvManager
.
The class contains layout parameters or options that can be useful for
different layout algorithms. The implementation of the #layout(boolean)
method is solely responsible for whether or not the
current settings of the parameters are taken into account.
If the documentation does not indicate a different coordinate space,
all dimensional parameters are expressed in the same coordinate space
as the position and dimension of the labels and obstacles. In
particular, when laying out an IlvManager
, the dimensional
parameters are expressed in manager coordinates, not in manager view
coordinates. However, optionally, the coordinate space of the view can
be used. For details, see #setCoordinatesMode(int)
.
To learn more about the layout algorithms and the corresponding
IlvLabelLayout
subclasses, read the sections of the
Reference Manual describing those classes and the JViews Graph Layout
User's Manual.
Note that the initialization of all instance variables of the
subclasses needs to be done in the overridden implementation of the
method #init()
. This is to prevent execution of methods of the
subclasses before the initialization of the instance variables of the
subclasses.
Note also that you must call the method #detach()
when you no
longer need the layout instance; otherwise, some objects may not be
garbage collected. This is necessary only if the layout instance is
directly created by your code. Calling #detach()
is not
necessary if the layout instance is created internally by the JViews
Graph Layout library.
CSS example:
This class cannot be instantiated because it is an abstract class.
IlvAnnealingLabelLayout
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.