ilog.views.graphlayout.labellayout.random
Class IlvRandomLabelLayout

java.lang.Object
  extended by ilog.views.graphlayout.labellayout.IlvLabelLayout
      extended by ilog.views.graphlayout.labellayout.random.IlvRandomLabelLayout
All Implemented Interfaces:
LabelingModelListener, Serializable, EventListener

public class IlvRandomLabelLayout
extends IlvLabelLayout

The main class for the Random Label Layout algorithm.

This is the simplest label layout algorithm. The labels are moved at randomly-computed positions inside an user-defined region which can be specified using the method setLayoutRegion(ilog.views.IlvRect). This algorithm exists mainly for demonstration purpose.

See the corresponding chapter of the User's Manual for details on the algorithm, the features and limitations, code samples, and so on.

Since:
JViews 5.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ilog.views.graphlayout.labellayout.IlvLabelLayout
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
 
Constructor Summary
IlvRandomLabelLayout()
          Creates a new instance of the Random Layout algorithm.
IlvRandomLabelLayout(IlvRandomLabelLayout source)
          Creates a new label layout instance by copying an existing one.
 
Method Summary
 IlvLabelLayout copy()
          Copies the layout instance.
 void copyParameters(IlvLabelLayout source)
          Copies the parameters from a given layout instance.
protected  IlvLabelLayoutManagerProperty createLayoutManagerProperty(String name, boolean withDefaults)
          Returns a new instance of IlvRandomLabelLayoutManagerProperty that stores the parameter settings of this layout class.
 IlvRect getLayoutRegion()
          Returns the layout region of the layout.
protected  void init()
          Initializes instance variables.
protected  void layout(boolean redraw)
          Computes the layout using the Random Layout algorithm.
 void setLayoutRegion(IlvRect region)
          Sets the layout region of the layout.
 boolean supportsAllowedTime()
          Indicates that this layout class can stop the layout computation when the user-defined allowed time is exceeded.
 boolean supportsPercentageComplete()
          Indicates that this layout class can estimate the percentage of completion during the run of layout.
 boolean supportsRandomGenerator()
          Indicates that this layout class uses randomly-generated numbers that can be initialized with a user-defined seed value.
 boolean supportsSaveParametersToNamedProperties()
          Indicates whether the layout class can transfer the layout parameters to named properties.
 boolean supportsStopImmediately()
          Indicates that this layout class can interrupt the current run of the layout immediately in a controlled way.
 
Methods inherited from class ilog.views.graphlayout.labellayout.IlvLabelLayout
addLabelLayoutEventListener, addLabelLayoutParameterEventListener, attach, attach, callLayoutStepPerformedIfNeeded, cleanLabel, cleanLabelingModel, cleanObstacle, contentsChanged, createLayoutLabelProperty, createLayoutReport, detach, getAllowedTime, getCoordinatesMode, getInstanceId, getLabelingModel, getLayoutReport, getManager, getMinBusyTime, getSeedValueForRandomGenerator, increasePercentageComplete, isGeometryUpToDate, isInputCheckEnabled, isLayoutNeeded, isLayoutRunning, isLayoutTimeElapsed, isParametersUpToDate, isStoppedImmediately, isStoppedPrematurely, isStructureUpToDate, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, performLayout, performLayout, removeLabelLayoutEventListener, removeLabelLayoutParameterEventListener, setAllowedTime, setCoordinatesMode, setGeometryUpToDate, setInputCheckEnabled, setLayoutReport, setManager, setMinBusyTime, setParametersUpToDate, setSeedValueForRandomGenerator, setStructureUpToDate, setUseDefaultParameters, setUseSeedValueForRandomGenerator, stopImmediately
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvRandomLabelLayout

public IlvRandomLabelLayout()
Creates a new instance of the Random Layout algorithm.
To indicate the manager you want to lay out, use the method attach(IlvManager).
To indicate the labeling model you want to lay out, use the method attach(IlvLabelingModel).
To perform the layout, use the method performLayout.
To modify the layout parameters, use the different methods provided in this class and its superclass.

See Also:
IlvLabelLayout.attach(ilog.views.IlvManager), IlvLabelLayout.attach(IlvLabelingModel), IlvLabelLayout.performLayout()

IlvRandomLabelLayout

public IlvRandomLabelLayout(IlvRandomLabelLayout source)
Creates a new label layout instance by copying an existing one. This constructor is used by the copy() method. Any subclass should provide a copy constructor.

Note that layout parameters which are specific to a label or obstacle are not copied. Global layout parameters are copied.

Parameters:
source - The layout instance that is copied.
Method Detail

init

protected void init()
Initializes instance variables.

You should not call this method directly. The method is called internally by the constructor without arguments and by the copy constructor. The method must be overridden by subclasses that need to initialize additional instance variables.

Overrides:
init in class IlvLabelLayout

copy

public IlvLabelLayout copy()
Copies the layout instance.

This method copies the layout instance by calling the copy constructor.

Note that layout parameters which are specific to a label or obstacle are not copied. Global layout parameters are copied.

Specified by:
copy in class IlvLabelLayout
Returns:
A copy of the layout instance.
See Also:
IlvRandomLabelLayout(IlvRandomLabelLayout), copyParameters(ilog.views.graphlayout.labellayout.IlvLabelLayout)

copyParameters

public void copyParameters(IlvLabelLayout source)
Copies the parameters from a given layout instance.

Note that layout parameters which are specific to a label or obstacle are not copied. Global layout parameters are copied.

Overrides:
copyParameters in class IlvLabelLayout
Parameters:
source - The layout instance from which the parameters are copied.
See Also:
copy()

layout

protected void layout(boolean redraw)
Computes the layout using the Random Layout algorithm. To start the layout, call the method IlvLabelLayout.performLayout().

Specified by:
layout in class IlvLabelLayout
Parameters:
redraw - If true, the attached labeling model will be asked to redraw the manager after layout. When the layout algorithm moves the labels, it is required to pass the value of the redraw argument to the method IlvLabelingModel.moveLabel(java.lang.Object, float, float, boolean).
See Also:
IlvLabelLayout.performLayout()

setLayoutRegion

public void setLayoutRegion(IlvRect region)
Sets the layout region of the layout.


getLayoutRegion

public IlvRect getLayoutRegion()
Returns the layout region of the layout.


supportsPercentageComplete

public final boolean supportsPercentageComplete()
Indicates that this layout class can estimate the percentage of completion during the run of layout.

Overrides:
supportsPercentageComplete in class IlvLabelLayout
Returns:
always true.
See Also:
IlvLabelLayout.increasePercentageComplete(int), IlvLabelLayoutReport.getPercentageComplete()

supportsRandomGenerator

public final boolean supportsRandomGenerator()
Indicates that this layout class uses randomly-generated numbers that can be initialized with a user-defined seed value. When you perform the layout several times on the same graph and use the same user-defined seed value, you obtain the same drawing of the grapher. If you want different drawings each time you perform the layout, you should modify the seed value and call the method useSeedValueForRandomGenerator with a true argument.

Overrides:
supportsRandomGenerator in class IlvLabelLayout
Returns:
always true.
See Also:
IlvLabelLayout.setSeedValueForRandomGenerator(long), IlvLabelLayout.getSeedValueForRandomGenerator(), IlvLabelLayout.setUseSeedValueForRandomGenerator(boolean), IlvLabelLayout.isUseSeedValueForRandomGenerator()

supportsAllowedTime

public final boolean supportsAllowedTime()
Indicates that this layout class can stop the layout computation when the user-defined allowed time is exceeded. The result code in the layout report is IlvLabelLayoutReport.STOPPED_AND_INVALID in this case.

Overrides:
supportsAllowedTime in class IlvLabelLayout
Returns:
always true.
See Also:
IlvLabelLayout.setAllowedTime(long), IlvLabelLayout.getAllowedTime(), IlvLabelLayoutReport.getCode()

supportsStopImmediately

public boolean supportsStopImmediately()
Indicates that this layout class can interrupt the current run of the layout immediately in a controlled way. The result code in the layout report is IlvLabelLayoutReport.STOPPED_AND_INVALID in this case.

Overrides:
supportsStopImmediately in class IlvLabelLayout
Returns:
always true.
See Also:
IlvLabelLayout.stopImmediately(), IlvLabelLayout.isStoppedImmediately(), IlvLabelLayoutReport.getCode()

supportsSaveParametersToNamedProperties

public boolean supportsSaveParametersToNamedProperties()
Indicates whether the layout class can transfer the layout parameters to named properties. This mechanism can be used if layout parameters must be stored persistently in an .ivl file.

Overrides:
supportsSaveParametersToNamedProperties in class IlvLabelLayout
Returns:
Always true.
See Also:
IlvDefaultLabelingModel.saveParametersToNamedProperties(ilog.views.graphlayout.labellayout.IlvLabelLayout, boolean), IlvDefaultLabelingModel.loadParametersFromNamedProperties(ilog.views.graphlayout.labellayout.IlvLabelLayout), IlvDefaultLabelingModel.removeParametersFromNamedProperties()

createLayoutManagerProperty

protected IlvLabelLayoutManagerProperty createLayoutManagerProperty(String name,
                                                                    boolean withDefaults)
Returns a new instance of IlvRandomLabelLayoutManagerProperty that stores the parameter settings of this layout class.

The method is used by IlvDefaultLabelingModel.saveParametersToNamedProperties(IlvLabelLayout, boolean) to create a named property that contains parameter settings of this layout instance.

Overrides:
createLayoutManagerProperty in class IlvLabelLayout
See Also:
IlvLabelLayoutManagerProperty, IlvDefaultLabelingModel.saveParametersToNamedProperties(ilog.views.graphlayout.labellayout.IlvLabelLayout, boolean), IlvDefaultLabelingModel.loadParametersFromNamedProperties(ilog.views.graphlayout.labellayout.IlvLabelLayout), IlvDefaultLabelingModel.removeParametersFromNamedProperties()


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