|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.graphlayout.labellayout.IlvLabelingModel
ilog.views.graphlayout.labellayout.IlvDefaultLabelingModel
public class IlvDefaultLabelingModel
An IlvDefaultLabelingModel provides a default labeling model
for an IlvManager and provides a bridge between the API of the
IlvManager and the API of the IlvLabelingModel.
IlvDefaultLabelingModel is a concrete subclass of
IlvLabelingModel that allows IlvGraphic objects
of an IlvManager to be labels or obstacles.
It handles objects of the following types as labels:
IlvLabel (and subclasses of this).IlvZoomableLabel (and subclasses of this).IlvText (and subclasses of this).IlvLabelingModel.
The default labeling model is optimized to handle polyline graphics and
polyline links efficiently. It can be used to place labels at links of type
IlvPolylineLinkImage. However, it currently does not handle splines
very precisely, because this would be very costly. It uses a rough
approximation for splines.
If labels of any other subclass of IlvGraphic should be
positioned, it is sufficient to override the method
isDefaultLabelClass(java.lang.Object).
If only a subset of IlvGraphic objects should be obstacles,
it is sufficient to override the method isDefaultObstacleClass(java.lang.Object).
As an alternative to subclassing, the user can call the methods
setLabel(java.lang.Object, boolean) and setObstacle(java.lang.Object, boolean) to redefine for individual
objects whether they are labels or obstacles.
If an application uses the class IlvManager, the manager can be
attached directly to the layout instance, without explicitly using a labeling
model (see the method IlvLabelLayout.attach(IlvManager).
In this case, an IlvDefaultLabelingModel will be internally
created. This default model can be retrieved using the method
IlvLabelLayout.getLabelingModel(), which will return an instance
of IlvDefaultLabelingModel.
Note that you must call the method dispose() after detaching the
label layouts when you no longer need the labeling model instance;
otherwise, some objects may not be garbage collected.
This is necessary only if the labeling model instance is directly
created by your code. Calling dispose() is not necessary if the
labeling model instance is created internally by the ILOG JViews Graph
Layout library, for instance when attaching directly an
IlvManager to a layout instance using
IlvLabelLayout.attach(IlvManager).
| Constructor Summary | |
|---|---|
IlvDefaultLabelingModel(IlvManager manager)
Creates a new labeling model for a given IlvManager. |
|
| Method Summary | |
|---|---|
void |
addLayer(IlvManagerLayer layer)
Adds a manager layer to the list of layers to be used during the label layout. |
void |
afterLayout(IlvLabelLayout layout,
IlvLabelLayoutReport layoutReport,
boolean redraw)
Notifies the labeling model that a layout session has finished. |
void |
beforeLayout(IlvLabelLayout layout,
boolean redraw)
Notifies the labeling model that a layout session has been started. |
IlvRect |
boundingBox(Object labelOrObstacle)
Returns the bounding rectangle of a label or obstacle. |
IlvLabelingModel |
createLabelingModel(Object subgraph)
Creates a new IlvDefaultLabelingModel for a subgraph. |
void |
dispose()
Disposes of this IlvDefaultLabelingModel and releases any
resources that it is using. |
int |
getCoordinatesMode()
Returns the current coordinates mode. |
double |
getLabelOverlap(Object label1,
IlvRect rect1,
double angle1,
Object label2,
IlvRect rect2,
double angle2,
float minDist)
Returns the overlap between two labels, if the labels would be at the given positions specified by the passed rectangles and the rotation angle. |
double |
getLabelOverlap(Object label1,
IlvRect bbox1,
Object label2,
IlvRect bbox2,
float minDist)
Returns the overlap between two labels, if the labels would be at the given positions specified by the passed bounding boxes. |
Enumeration |
getLabels()
Returns the enumeration of all labels. |
Enumeration |
getLayers()
Returns an enumeration of the manager layers to be taken into account during the label layout. |
int |
getLayersCount()
Returns the number of manager layers to be taken into account during the label layout. |
IlvManager |
getManager()
Returns the IlvManager that stores the labels and the obstacles. |
double |
getObstacleOverlap(Object label,
IlvRect labelRect,
double angle,
Object obstacle,
IlvRect obstacleBBox,
float minDist)
Returns the overlap between the label and the obstacle, if the label would be at the given position specified by the passed rectangle and the rotation angle. |
double |
getObstacleOverlap(Object label,
IlvRect labelBBox,
Object obstacle,
IlvRect obstacleBBox,
float minDist)
Returns the overlap between the label and the obstacle, if the label would be at the given position specified by the passed bounding box. |
Enumeration |
getObstacles()
Returns the enumeration of all obstacles. |
double |
getPolylineObstacleOverlap(Object label,
IlvRect labelRect,
double angle,
Object polylineObstacle,
IlvPoint[] pts,
float lineWidth,
float minDist)
Returns the overlap between the label and the polyline obstacle, if the label would be at the given position specified by the passed rectangle and the rotation angle. |
double |
getPolylineObstacleOverlap(Object label,
IlvRect labelBBox,
Object polylineObstacle,
IlvPoint[] pts,
float lineWidth,
float minDist)
Returns the overlap between the label and the polyline obstacle, if the label would be at the given position specified by the passed bounding box. |
IlvPoint[] |
getPolylinePoints(Object polylineObstacle)
Returns the points that define the shape of a polyline obstacle. |
float |
getPolylineWidth(Object polylineObstacle)
Returns the line width of a polyline obstacle. |
Object |
getProperty(Object labelOrObstacle,
String key)
Returns the value of a property. |
Object |
getProperty(String key)
Returns the value of a property of the labeling model. |
IlvTransformer |
getReferenceTransformer()
Returns the transformer to be taken into account. |
IlvManagerView |
getReferenceView()
Returns the specified reference view (if any) and null otherwise. |
double |
getRotation(Object label,
IlvRect rect)
Returns the rotation of the label if it were placed at the position given by the input rectangle rect. |
boolean |
isBoundingBoxDependent()
Returns true if two objects overlap only if their bounding
boxes overlap. |
protected boolean |
isDefaultLabelClass(Object obj)
Returns true if the class of the object is the default
labeling class. |
protected boolean |
isDefaultObstacleClass(Object obj)
Returns true if the class of the object is the default
obstacle class. |
boolean |
isFullLayerNotification()
Returns true if adding or removing a layer
sends a separate event for each object contained in the layer. |
boolean |
isLabel(Object obj)
Returns true if an object is a valid label and
false otherwise. |
boolean |
isLayerAdded(IlvManagerLayer layer)
Returns true if the manager layer is one of the layers
to be taken into account during the layout. |
boolean |
isLayoutNeeded(IlvLabelLayout layout)
Returns true if a given layout that has been already applied
to this manager is still valid. |
boolean |
isObstacle(Object obj)
Returns true if an object is a valid obstacle and
false otherwise. |
boolean |
isPolylineObstacle(Object obj)
Returns true if an object is a valid polyline obstacle
and false otherwise. |
boolean |
loadParametersFromNamedProperties(IlvLabelLayout layout)
Transfers the layout parameter settings from the named properties of the manager back to the layout instance. |
boolean |
loadParametersFromNamedProperties(IlvLabelLayout layout,
String propertyPrefix)
Transfers the layout parameter settings from the named properties of the manager back to the layout instance. |
IlvLabelLayout |
loadParametersFromNamedProperties(String propertyPrefix)
Transfers the layout parameter settings from the named properties of the manager back to a new layout instance. |
void |
moveLabel(Object label,
float x,
float y,
boolean redraw)
Changes the position of the specified label. |
boolean |
removeAllLayers()
Removes all manager layers from the list of layers to be used during the label layout. |
boolean |
removeLayer(IlvManagerLayer layer)
Removes a manager layer from the list of layers to be used during the label layout. |
void |
removeParametersFromNamedProperties()
Removes all named properties that were used to store the label layout parameter settings from the manager. |
void |
removeParametersFromNamedProperties(Class layoutClass)
Removes the named properties that were used to store the label layout parameter settings from the manager. |
void |
removeParametersFromNamedProperties(String propertyPrefix)
Removes the named properties that were used to store the label layout parameter settings from the manager. |
String |
saveParametersToNamedProperties(IlvLabelLayout layout,
boolean withDefaults)
Transfers the layout parameter settings to named properties of the manager. |
String |
saveParametersToNamedProperties(IlvLabelLayout layout,
String propertyPrefix,
boolean withDefaults)
Transfers the layout parameter settings to named properties of the manager. |
void |
setCoordinatesMode(int mode)
Sets the coordinates mode to be used outside the layout. |
void |
setFullLayerNotification(boolean flag)
Sets whether adding or removing a layer fires just one or many labeling model events. |
void |
setLabel(Object obj,
boolean isLabel)
Sets whether an object is a valid label. |
void |
setObstacle(Object obj,
boolean isObstacle)
Sets whether an object is a valid obstacle. |
void |
setProperty(Object labelOrObstacle,
String key,
Object value)
Sets the value of a property for a label or an obstacle. |
void |
setProperty(String key,
Object value)
Sets the value of a property for the labeling model. |
void |
setReferenceTransformer(IlvTransformer transformer)
Allows you to specify the reference transformer. |
void |
setReferenceView(IlvManagerView view)
Allows you to specify the reference manager view. |
void |
setRotation(Object label,
double angle)
Rotates the label around the center of its bounding box. |
String |
toString()
Returns a string representation of the object. |
| Methods inherited from class ilog.views.graphlayout.labellayout.IlvLabelingModel |
|---|
addLabelingModelListener, adjustmentEnd, fireLabelingModelEvent, fireLabelingModelEvent, geometryChanged, getInstanceId, getLabelsCount, getObstaclesCount, removeLabelingModelListener, structureChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IlvDefaultLabelingModel(IlvManager manager)
IlvManager.
manager - The manager.| Method Detail |
|---|
public void dispose()
IlvDefaultLabelingModel and releases any
resources that it is using. An IlvDefaultLabelingModel object
cannot be used after the dispose method has been called.
This method performs cleaning operations on the manager (for example, properties added to the manager are removed).
Note that the finalization process of the garbage collector also calls this method.
dispose in class IlvLabelingModelObject.finalize()public IlvLabelingModel createLabelingModel(Object subgraph)
IlvDefaultLabelingModel for a subgraph.
The method is used when performing a layout of nested graphs that contain
labels. It is called on the labeling model of a top-level graph that
contains the subgraph.
createLabelingModel in class IlvLabelingModelsubgraph - The subgraph object. It must be an instance of
IlvManager.
nullpublic Enumeration getLabels()
getLabels in class IlvLabelingModelIlvLabelingModel.getLabelsCount()protected boolean isDefaultLabelClass(Object obj)
true if the class of the object is the default
labeling class. This implementation returns true if the
object is an IlvLabel, an IlvZoomableLabel or
an IlvText.
You can override this method if you want to change the default behavior.
obj - The object to test.
true if the class of the object is the default
labeling class.public boolean isLabel(Object obj)
true if an object is a valid label and
false otherwise.
It returns true if the object
was specified as a label via setLabel(java.lang.Object, boolean), and false if
the object was explicitly specified not to be a label.
If nothing was specified via setLabel(java.lang.Object, boolean), this method also returns
true if the object is an IlvLabel, an
IlvZoomableLabel or an IlvText.
If layers were selected for layout (see addLayer(ilog.views.IlvManagerLayer)), then it
returns false if the object is in a layer that is
currently not selected for layout, independent of its type.
If you want to change the default behavior to consider different
classes as labels, you should not override this method but rather
override isDefaultLabelClass(java.lang.Object).
isLabel in class IlvLabelingModelobj - The object to test.
true if an object is a valid label.
public void setLabel(Object obj,
boolean isLabel)
IlvLabel,
IlvZoomableLabel, and IlvText are considered
to be labels. You can change this default behavior by specifying
explicitly with this method whether the input object is a label or not.
Note that an object cannot be a label and an obstacle at the same time.
obj - The object.isLabel - true if the object should be considered as
label.
public void moveLabel(Object label,
float x,
float y,
boolean redraw)
x and
y coordinates correspond to the top-left corner of
the rectangle that defines the label (see also the method
boundingBox(Object)). The coordinates are given with respect
to the current coordinates mode.
moveLabel in class IlvLabelingModellabel - The label.x - The new x-position of the label.y - The new y-position of the label.redraw - If true, the label is redrawn.setCoordinatesMode(int)
public double getLabelOverlap(Object label1,
IlvRect bbox1,
Object label2,
IlvRect bbox2,
float minDist)
The default implementation compares the bounding boxes of both labels.
getLabelOverlap in class IlvLabelingModellabel1 - The first label.bbox1 - The bounding box of the first label, translated to the
speculative position of the label.label2 - The second label.bbox2 - The bounding box of the second label, translated to the
speculative position of the label.minDist - The desired minimal distance between labels.
public Enumeration getObstacles()
getObstacles in class IlvLabelingModelIlvLabelingModel.getObstaclesCount()protected boolean isDefaultObstacleClass(Object obj)
true if the class of the object is the default
obstacle class. This implementation returns true if the
object is an IlvGraphic but neither an IlvLabel
nor an IlvZoomableLabel nor an IlvText.
You can override this method if you want to change the default behavior.
obj - The object to test.
true if the class of the object is the default
obstacle class.public boolean isObstacle(Object obj)
true if an object is a valid obstacle and
false otherwise.
It returns true if the object
was specified as obstacle via setObstacle(java.lang.Object, boolean), and false
if the object was explicitly specified to not be an obstacle.
If nothing was specified via setObstacle(java.lang.Object, boolean), this method also returns
true if the object is not an IlvLabel or an
IlvZoomableLabel or an IlvText.
If layers were selected for layout (see addLayer(ilog.views.IlvManagerLayer)), then it
returns false if the object is in a layer that is
currently not selected for layout, independent of its type.
If you want to change the default behavior to consider different
classes as obstacles, you should not override this method but rather
override isDefaultObstacleClass(java.lang.Object).
isObstacle in class IlvLabelingModelobj - The object to test.
true if an object is a valid obstacle.IlvLabelingModel.isPolylineObstacle(java.lang.Object)
public void setObstacle(Object obj,
boolean isObstacle)
IlvLabel,
IlvZoomableLabel, and IlvText are considered
to be labels, and all other objects are considered to be obstacles.
You can change this default behavior by specifying explicitly with this
method whether the input object is an obstacle or not.
Note that an object cannot be a label and an obstacle at the same time.
obj - The object.isObstacle - true if the object should be considered as
an obstacle.
public double getObstacleOverlap(Object label,
IlvRect labelBBox,
Object obstacle,
IlvRect obstacleBBox,
float minDist)
The default implementation compares the bounding boxes of the label with the bounding box of the obstacle.
getObstacleOverlap in class IlvLabelingModellabel - The label.labelBBox - The bounding box of the label, translated to the
speculative position of the label.obstacle - The obstacle.obstacleBBox - The bounding box of the obstacle.minDist - The desired minimal distance between label and obstacle.
public boolean isPolylineObstacle(Object obj)
true if an object is a valid polyline obstacle
and false otherwise.
The default implementation returns true if the object
is an obstacle of one of these types:
If layers were selected for layout (see addLayer(ilog.views.IlvManagerLayer)), then it
returns false if the object is in a layer that is
currently not selected for layout, independent of its type.
isPolylineObstacle in class IlvLabelingModelobj - The object to test.
true if the object is a polyline obstacle.isObstacle(java.lang.Object)public float getPolylineWidth(Object polylineObstacle)
IlvLabelLayout.MANAGER_COORDINATES: returns the width
of the polyline obstacle in the coordinate space of the manager.IlvLabelLayout.VIEW_COORDINATES: returns the width
of the polyline obstacle in the coordinate space of the view
(see getReferenceTransformer()).IlvLabelLayout.INVERSE_VIEW_COORDINATES: returns the width
of the polyline obstacle by calculating the width in the coordinate space
of the view and applying the inverse transformation (using the reference
transformer) to obtain the corresponding value in the coordinate space
of the manager. This complex mechanism is necessary if the obstacle is
not fully zoomable.
getPolylineWidth in class IlvLabelingModelpolylineObstacle - The polyline obstacle.
isPolylineObstacle(java.lang.Object),
IlvGraphic.zoomable()public IlvPoint[] getPolylinePoints(Object polylineObstacle)
IlvLabelLayout.MANAGER_COORDINATES: returns the points
in the coordinate space of the manager.IlvLabelLayout.VIEW_COORDINATES: returns the points
in the coordinate space of the view (see
getReferenceTransformer()).IlvLabelLayout.INVERSE_VIEW_COORDINATES: returns the points
by calculating the points in the coordinate space of the view and
applying the inverse transformation to the points (using the reference
transformer) to obtain the corresponding points in the coordinate space
of the manager. This complex mechanism is necessary if the obstacle is
not fully zoomable.
getPolylinePoints in class IlvLabelingModelpolylineObstacle - The polyline obstacle.
null if the points cannot be determined.isPolylineObstacle(java.lang.Object),
IlvGraphic.zoomable()
public double getPolylineObstacleOverlap(Object label,
IlvRect labelBBox,
Object polylineObstacle,
IlvPoint[] pts,
float lineWidth,
float minDist)
The default implementation compares the bounding box of the label with the polypoint shape of the link.
getPolylineObstacleOverlap in class IlvLabelingModellabel - The label.labelBBox - The bounding box of the label, translated to the
speculative position of the label.polylineObstacle - The polyline obstacle.pts - The points that define the shape of the polyline obstacle.lineWidth - The line width of the polyline obstacle.minDist - The desired minimal distance between label and obstacle.
isPolylineObstacle(java.lang.Object)public IlvManager getManager()
IlvManager that stores the labels and the obstacles.
getManager in class IlvLabelingModelpublic IlvRect boundingBox(Object labelOrObstacle)
IlvLabelLayout.MANAGER_COORDINATES: returns the bounding box
of the graphic object in the coordinate space of the manager, that
is, it calls IlvGraphic.boundingBox(IlvTransformer)
with a null argument.IlvLabelLayout.VIEW_COORDINATES: returns the bounding box
of the graphic object in the coordinate space of the view, that
is, it calls IlvGraphic.boundingBox(IlvTransformer)
with the reference transformer as an argument (see
getReferenceTransformer()).IlvLabelLayout.INVERSE_VIEW_COORDINATES: returns the bounding
box of the graphic object by calculating the bounding box in the
coordinate space of the view and applying to the rectangle the inverse
transformation (using the reference transformer) to obtain the
corresponding rectangle in the coordinate space of the manager. This
complex mechanism is necessary if the object is not fully zoomable.
boundingBox in class IlvLabelingModellabelOrObstacle - The label or obstacle.
public boolean isBoundingBoxDependent()
true if two objects overlap only if their bounding
boxes overlap.
If you override the method getLabelOverlap or
getObstacleOverlap, you may
need to override this method as well.
If the method getLabelOverlap or
getOsbatcleOverlap always returns
0 if the bounding boxes of the objects do not overlap,
then this method may return true.
If the method getLabelOverlap or
getObstacleOverlap may return a nonzero value
even though the bounding boxes of the objects do not overlap, then this
method must return false.
isBoundingBoxDependent in class IlvLabelingModeltrue.public boolean isLayoutNeeded(IlvLabelLayout layout)
true if a given layout that has been already applied
to this manager is still valid.
The method returns true if at least one of the following
holds:
IlvLabelLayout.isParametersUpToDate() called on
layout returns false.
IlvLabelLayout.isGeometryUpToDate() called on
layout returns false.
IlvLabelLayout.isStructureUpToDate() called on
layout returns false.
getReferenceTransformer() returns a different
transformer than the one that had been used the last time the layout
was successfully performed on this manager unless the
difference between the two transformers is a pure translation).
getCoordinatesMode() returns a different value than
the one used the last time the layout was successfully performed
on this manager.
false.
isLayoutNeeded in class IlvLabelingModellayout - The layout.IlvLabelLayout.isLayoutNeeded(),
IlvLabelLayout.isStructureUpToDate(),
IlvLabelLayout.isGeometryUpToDate(),
IlvLabelLayout.isParametersUpToDate()
public void beforeLayout(IlvLabelLayout layout,
boolean redraw)
IlvLabelLayout.performLayout()
before the call to the method IlvLabelLayout.layout(boolean).
It calls IlvManager.setContentsAdjusting to indicate
the start of a sequence of label movements. If the redraw
flag is true, it additionally calls
IlvManager.initReDraws to indicate the start of a sequence
of redraw operations.
You should not call this method directly.
beforeLayout in class IlvLabelingModellayout - The layout instance that is the origin of the notification.redraw - If true, the layout algorithm will ask the
labeling model to redraw the objects when the method
afterLayout is called (that is, it will pass
true for its redraw argument).afterLayout(ilog.views.graphlayout.labellayout.IlvLabelLayout, ilog.views.graphlayout.labellayout.IlvLabelLayoutReport, boolean)
public void afterLayout(IlvLabelLayout layout,
IlvLabelLayoutReport layoutReport,
boolean redraw)
IlvLabelLayout.performLayout()
after the method IlvLabelLayout.layout(boolean) has finished,
even if an exception is thrown during the layout process.
Note that you can detect whether the layout was performed successfully
using the test
layoutReport.getCode() == IlvLabelLayoutReport.LAYOUT_DONE.
This method calls IlvManager.setContentsAdjusting to indicate
the end of a sequence of label movements. If the redraw
flag is true, it additionally calls
IlvManager.reDrawViews to indicate the end of a sequence of
redraw operations. This will redraw the views.
You should not call this method directly.
afterLayout in class IlvLabelingModellayout - The layout instance that is the origin of the
notification.layoutReport - The layout report.redraw - If true, the layout algorithm asks the
labeling model to redraw the graph.beforeLayout(ilog.views.graphlayout.labellayout.IlvLabelLayout, boolean)
public void setProperty(Object labelOrObstacle,
String key,
Object value)
value is null, the property is removed.
Otherwise, the property value is set to value.
setProperty in class IlvLabelingModellabelOrObstacle - The label or obstacle for which the property is to
be set.key - The key string for the property.value - The new value of the property.getProperty(java.lang.Object, java.lang.String)
public Object getProperty(Object labelOrObstacle,
String key)
null if the property does not exist.
getProperty in class IlvLabelingModellabelOrObstacle - The label or obstacle for which the property is to
be retrieved.key - The key string for the property.
setProperty(java.lang.Object, java.lang.String, java.lang.Object)
public void setProperty(String key,
Object value)
value is null, the property is removed.
Otherwise, the property value is set to value.
setProperty in class IlvLabelingModelkey - The key string for the property.value - The new value of the property.getProperty(java.lang.Object, java.lang.String)public Object getProperty(String key)
null if the property does not exist.
getProperty in class IlvLabelingModelkey - The key string for the property.
setProperty(java.lang.Object, java.lang.String, java.lang.Object)public void setCoordinatesMode(int mode)
IlvLabelLayout.MANAGER_COORDINATES -
Labels are placed in the coordinate system of the manager, without
applying any transformation.
This mode should be used if you visualize objects at zoom level 1, or you do not visualize them at all, or the manager contains only fully zoomable objects. Indeed, in all these cases there is no need to take the transformer into account during the layout.
Note that in this mode the dimensional parameters of the layout algorithms are considered as being specified in manager coordinates.
IlvLabelLayout.VIEW_COORDINATES -
Labels are placed in the coordinate system of the manager view.
More exactly, all the coordinates are transformed
using the current reference transformer.
This mode should be used if you want the dimensional parameters of the layout algorithms to be considered as being specified in manager view coordinates.
IlvLabelLayout.INVERSE_VIEW_COORDINATES -
Labels are placed in the coordinate system given by transforming
view coordinates back into the coordinate system of the manager.
This mode is equivalent to the "manager coordinates" mode if the
geometry of the graphic objects strictly obeys the transformer.
(A small difference may exist because of the limited precision of
the computations.)
On the contrary, if some graphic objects are either nonzoomable
(see IlvGraphic.zoomable()) or semizoomable (for example,
links with a maximum line width), this mode gives different results
than the manager's coordinates mode. These results are optimal if the
manager is visualized using the same transformer as the one taken into
account during the layout.
Note that in this mode the dimensional parameters of the layout algorithms are considered as being specified in manager coordinates.
The default value is IlvLabelLayout.INVERSE_VIEW_COORDINATES.
Note: This coordinates mode is used only when the layout is not
running. While the layout is running, the coordinates mode of the layout
instance is used (see IlvLabelLayout.setCoordinatesMode(int)).
mode - The mode.getCoordinatesMode(),
IlvLabelLayout.setCoordinatesMode(int),
setReferenceTransformer(ilog.views.IlvTransformer),
setReferenceView(ilog.views.IlvManagerView)public int getCoordinatesMode()
setCoordinatesMode(int),
IlvLabelLayout.getCoordinatesMode()public void setReferenceTransformer(IlvTransformer transformer)
The reference transformer is the transformer (see the class
IlvTransformer) that is taken into account
by the IlvDefaultLabelingModel when computing the geometry of
the manager if the coordinates mode is either
IlvLabelLayout.VIEW_COORDINATES or
IlvLabelLayout.INVERSE_VIEW_COORDINATES.
If the coordinates mode is IlvLabelLayout.MANAGER_COORDINATES,
the reference transformer is not taken into account.
In this mode, the layout computes the geometry of the manager on the basis
of the manager coordinates of objects, without any transformation.
If the encapsulated manager contains only zoomable graphics
(see IlvGraphic.zoomable()), the geometry will stay valid and
optimal for any transformer.
If the encapsulated manager contains at least one nonzoomable object
(such as IlvLabel), or objects that do not
strictly obey the transformer (such as a link with maximal line width),
the geometry becomes dependent on the transformer that is used to draw the
manager.
Changing the transformer makes the layout invalid so that a re-layout
is necessary to again obtain the optimal layout with respect to the new
transformer.
Calculating the layout in manager coordinates may
yield a nonoptimal result in a zoomed view. In this case the layout must
take the reference transformer into account to obtain an optimal
result.
If the coordinates mode is IlvLabelLayout.VIEW_COORDINATES,
all coordinates are calculated and delivered to the layout
algorithm with respect to the reference transformer.
In this mode, all dimensional layout parameters must be specified in view
coordinates with respect to the reference transformer.
If the coordinates mode is IlvLabelLayout.INVERSE_VIEW_COORDINATES,
all coordinates are calculated with respect to the reference
transformer, but they are delivered to the layout algorithm by
transforming them back into manager coordinates. This has the advantage
that all dimensional layout parameters can be specified in manager
coordinates. If the encapsulated manager contains only zoomable graphics,
the result is the same as when using manager coordinates.
The layout is nearly independent of the view. In a few rare cases, a
slight shifting of the coordinates may occur due to the coordinate
optimization.
If the encapsulated manager contains nonzoomable objects, the calculation
with inverse view coordinates still produces an optimal result with respect
to the reference transformer. However, the layout is no longer independent
of the view, that is, it becomes nonoptimal when the view transformer
is changed.
In most cases it is not necessary to call this method
because the transformer to be taken into account is chosen
using a set of default rules (see getReferenceTransformer()).
If it is called, the transformer specified using this method is returned
by the method getReferenceTransformer(), overriding the default
rules for choosing the transformer.
If the IlvManager contains nonzoomable objects,
you may need to call this method in the following cases:
If a manager containing nonzoomable objects is displayed simultaneously
in several views, you can use the method setReferenceView(ilog.views.IlvManagerView) to
indicate the view for which you want the layout to correspond exactly to
the geometry of the manager.
If you specified a transformer but want to reset this setting and go back
to the default behavior, call the method with a null argument.
Note that if this method is overridden, you must call
super.setReferenceTransformer(transformer)
to notify the manager adapter that the reference transformer
has changed.
Note also that a call to the method setReferenceView(ilog.views.IlvManagerView) overrides
the effect of a call to the method setReferenceTransformer(ilog.views.IlvTransformer).
Similarly, a call to the method setReferenceTransformer(ilog.views.IlvTransformer)
overrides the effect of a call to the method setReferenceView(ilog.views.IlvManagerView).
transformer - The reference transformer.getReferenceTransformer(),
setReferenceView(ilog.views.IlvManagerView),
setCoordinatesMode(int)public IlvTransformer getReferenceTransformer()
This method returns the transformer specified using
setReferenceTransformer(ilog.views.IlvTransformer) if this transformer is not
null.
If no reference transformer is set, it returns the current transformer of
the manager view specified using setReferenceView(ilog.views.IlvManagerView) (if any).
If no reference view is set, it returns the current transformer of the
first manager view attached to the manager (as returned by the method
IlvManager.getViews()).
If the manager is a subgrapher, that is, if it is used as a graphic
object contained in another IlvGrapher, and the subgrapher has no
view directly attached, the first view of the closest parent graph is used.
Otherwise, this method returns an identity transformer.
Note that you should not modify the transformer returned by this method.
setReferenceTransformer(ilog.views.IlvTransformer),
getReferenceView(),
setCoordinatesMode(int)public void setReferenceView(IlvManagerView view)
The reference view is the manager view (see the class
IlvManagerView) whose current transformer
(see the method IlvManagerView.getTransformer()) is
used as a reference transformer (see method
getReferenceTransformer().
Usually, the view argument is the manager view that is
used for displaying the manager, but this is not mandatory.
Call this method with a null argument to reset the setting.
Note that a call to the method setReferenceTransformer(ilog.views.IlvTransformer)
overrides the effect of a call to the method setReferenceView(ilog.views.IlvManagerView).
Similarly, a call to the method setReferenceView(ilog.views.IlvManagerView)
overrides the effect of a call to the method
setReferenceTransformer(ilog.views.IlvTransformer).
getReferenceView(),
setReferenceTransformer(ilog.views.IlvTransformer)public IlvManagerView getReferenceView()
null otherwise.
setReferenceView(ilog.views.IlvManagerView),
setReferenceTransformer(ilog.views.IlvTransformer)public final void addLayer(IlvManagerLayer layer)
getLayers() returns null.
An IllegalArgumentException is thrown if
the layer does not belong to the encapsulated manager.
removeLayer(ilog.views.IlvManagerLayer),
removeAllLayers(),
getLayers(),
isLayerAdded(ilog.views.IlvManagerLayer)public final boolean removeLayer(IlvManagerLayer layer)
An IllegalArgumentException is thrown if
the layer does not belong to the encapsulated manager.
true if the layer is in the list of layers to be
used; false if the layer is not in the list of layers
or if the list of layers is void.addLayer(ilog.views.IlvManagerLayer),
removeAllLayers(),
getLayers()public final boolean removeAllLayers()
false if there are no layers to be removed and
true otherwise.addLayer(ilog.views.IlvManagerLayer),
removeLayer(ilog.views.IlvManagerLayer),
getLayers()public final Enumeration getLayers()
addLayer(IlvManagerLayer), all layers in the encapsulated
IlvManager are used.
In this case, this method returns null.
IlvManagerLayer
instances) to be taken into account during the layout. Returns
null if the list of layers to be used is empty.getLayersCount(),
addLayer(ilog.views.IlvManagerLayer),
removeLayer(ilog.views.IlvManagerLayer),
removeAllLayers(),
isLayerAdded(ilog.views.IlvManagerLayer)public final int getLayersCount()
addLayer(IlvManagerLayer), all layers in the encapsulated
IlvManager are used.
In this case, this method returns 0.
IlvManagerLayer
instances) to be taken into account during the layout. Returns
0 if the list of layers to be used is empty.addLayer(ilog.views.IlvManagerLayer),
getLayers(),
isLayerAdded(ilog.views.IlvManagerLayer)public final boolean isLayerAdded(IlvManagerLayer layer)
true if the manager layer is one of the layers
to be taken into account during the layout. Otherwise, the method
returns false.
If you do not specify any layers using the method
addLayer(IlvManagerLayer), the method returns false
for any argument.
layer - The layer to test.
true if the layer must be taken into account during
the layout.addLayer(ilog.views.IlvManagerLayer),
getLayers()public void setFullLayerNotification(boolean flag)
true is passed, adding or removing a layer
posts a separate event for each object contained in the layer.
If false is passed, adding or removing a layer posts only
one event. This is more efficient. However some layout classes listen to
the events to cleanup memory, so if you disable full layer notification,
you are responsible to call IlvLabelLayout.cleanLabel(ilog.views.graphlayout.labellayout.IlvLabelingModel, java.lang.Object) and
IlvLabelLayout.cleanObstacle(ilog.views.graphlayout.labellayout.IlvLabelingModel, java.lang.Object) yourself to cleanup the memory.
Full layer notification is enabled by default.
flag - Set to true for full layer notification