The class IlvLabelLayout is an abstract class. It has
no constructors. You will instantiate a subclass as shown in the
following example:
IlvAnnealingLabelLayout layout = new IlvAnnealingLabelLayout();
In order to place labels, a manager needs to be attached to the
layout instance. The following method, defined on the class
IlvLabelLayout
, allows you to specify the manager you want to lay out:
void attach(IlvManager manager)
For example:
... IlvManager manager = new IlvManager(); /* Add obstacles and labels to the manager here */ layout.attach(manager);
The
attach
method does nothing if the specified manager is already attached.
If a different manager is attached, this method first detaches this
old manager, then attaches the new one. You can obtain the attached
manager using the method
getManager
. If the manager is attached in this way, a default labeling model
is created internally. The labeling model can be obtained by:
IlvLabelingModel labelingModel = layout.getLabelingModel();
Warning
It is not allowed to attach any such model
created internally to any other layout instance.
After layout, when you no longer need the
layout instance, you should call the method
void detach()
If the
detach
method is not called, some objects may not be garbage-collected.
This method also performs cleaning operations on the manager
(properties that may have been added by the layout algorithm on
objects of the manager.