ilog.views.graphlayout.labellayout.annealing
Class IlvOverlappingLabelMovementPolicy

java.lang.Object
  extended by ilog.views.graphlayout.labellayout.annealing.IlvOverlappingLabelMovementPolicy
All Implemented Interfaces:
IlvLabelMovementPolicy

public class IlvOverlappingLabelMovementPolicy
extends Object
implements IlvLabelMovementPolicy

A label movement policy that allows a label to be moved by the label layout algorithm only if the label initially overlaps other labels or obstacles. Labels that are initially overlap-free are prohibited to move. The parameters of the policy allow to tailor whether small overlaps play a role, and whether the offsets specified for the annealing label layout are considered when checking for overlaps. Notice that this label movement policy works only for the annealing label layout.

Since:
JViews 5.5
See Also:
IlvAnnealingLabelLayout.setLabelMovementPolicy(ilog.views.graphlayout.labellayout.IlvLabelMovementPolicy)

Constructor Summary
IlvOverlappingLabelMovementPolicy()
          Creates a new label movement policy that prohibits the movement of labels that are overlap-free.
IlvOverlappingLabelMovementPolicy(double maxOverlapValue, boolean checkOverlapWithLabels, boolean considerOffsets)
          Creates a new label movement policy that prohibits the movement of labels that are nearly overlap-free.
 
Method Summary
 boolean allowMove(IlvLabelingModel labelingModel, Object label)
          Allows or prohibits the movement of a label.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvOverlappingLabelMovementPolicy

public IlvOverlappingLabelMovementPolicy()
Creates a new label movement policy that prohibits the movement of labels that are overlap-free. This is independent from the offset parameters of the label layout. Notice that this label movement policy works only for the annealing label layout.


IlvOverlappingLabelMovementPolicy

public IlvOverlappingLabelMovementPolicy(double maxOverlapValue,
                                         boolean checkOverlapWithLabels,
                                         boolean considerOffsets)
Creates a new label movement policy that prohibits the movement of labels that are nearly overlap-free. This policy calculates the overlap value per label, and allows the layout algorithm to move the label only if the overlap value is larger than the specified maximal overlap value. Set the maximal overlap value to 0 if you want only overlapping labels to move.

The decision whether a label is allowed to move depends on the overlaps with obstacles. If the parameter checkOverlapWithLabels is true, it also depends on the overlaps with other labels. If the parameter is false, overlaps between label pairs are ignored. In this case, labels that only overlap other labels will be prohibited to move.

The policy can consider or ignore the label and obstacle offset parameters of the layout algorithm. If the offsets are considered, the overlap value is calculated by using the label and obstacle offset parameters. This means that a label gets also a high overlap value and hence is allowed to move if it is too close to another obstacle or label while not yet really overlapping it. If the offsets are ignored, a label gets only a nonzero overlap value if it really overlaps another obstacle or label, therefore labels that are closer than the specified offsets to obstacles or other labels but don't overlap anything are prohibited to move.

Notice that this label movement policy works only for the annealing label layout.

Parameters:
maxOverlapValue - The maximal overlap value so that a label is prohibited to move.
checkOverlapWithLabels - If true, the overlap value is calculated including overlaps between label pairs. If false, the overlap value is calculated excluding overlaps between label pairs.
considerOffsets - If true, the label and obstacle offset parameters of the layout algorithm are considered, otherwise they are ignored in the decision whether it is allowed to move a label.
Method Detail

allowMove

public boolean allowMove(IlvLabelingModel labelingModel,
                         Object label)
Allows or prohibits the movement of a label.

Specified by:
allowMove in interface IlvLabelMovementPolicy
Parameters:
labelingModel - The labeling model to which the label belongs.
label - The label.
Returns:
true if it is allowed to move the label, and false otherwise.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.