y.layout.hierarchic
Class AsIsLayerer

java.lang.Object
  extended by y.layout.hierarchic.AsIsLayerer
All Implemented Interfaces:
Layerer

public class AsIsLayerer
extends Object
implements Layerer

This layerer implementation assigns layers by analyzing already existing node coordinates. Nodes whose bounding boxes intersect a common y-coordinate are assigned to the same layer.

 

Constructor Summary
AsIsLayerer()
           
 
Method Summary
 int assignNodeLayer(LayoutGraph g, NodeMap layerMap, EdgeList reversedEdges)
          This method assigns the nodes in the graph to layers.
 double getHalo()
          Gets the size of the halo around a node or the insets respectively that are used to calculate layer overlaps.
protected  double getMax(LayoutGraph graph, Node node)
          Callback used to calculate the lower (max) value of a node.
 double getMaximumNodeSize()
          Gets the maximum size of a node that is used to calculate layer overlaps.
protected  double getMin(LayoutGraph graph, Node node)
          Callback used to calculate the upper (min) value of a node.
 double getMinimumNodeSize()
          Gets the minimum size of a node that is used to calculate layer overlaps.
 double getNodeScalingFactor()
          Gets the scaling factor that is used to scale the nodes' height.
 void setMaximumNodeSize(double max)
          Sets the maximum size of a node that is used to calculate layer overlaps.
 void setMinimumNodeSize(double min)
          Sets the minimum size of a node that is used to calculate layer overlaps.
 void setNodeHalo(double halo)
          Sets the size of the halo around a node or the insets respectively that are used to calculate layer overlaps.
 void setNodeScalingFactor(double factor)
          Sets the scaling factor that is used to scale the nodes' height.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsIsLayerer

public AsIsLayerer()
Method Detail

getNodeScalingFactor

public double getNodeScalingFactor()
Gets the scaling factor that is used to scale the nodes' height. Nodes are being scaled from their center. This can be used for more fuzzy layering. The default is 1.0d which results in no scaling.

Returns:
the scaling factor

setNodeScalingFactor

public void setNodeScalingFactor(double factor)
Sets the scaling factor that is used to scale the nodes' height. Nodes are being scaled from their center. This can be used for more fuzzy layering.

Parameters:
factor - the new scaling factor [0.0d .. Double.MAX_VALUE]

getMaximumNodeSize

public double getMaximumNodeSize()
Gets the maximum size of a node that is used to calculate layer overlaps. This can be used for more fuzzy layering. The default is Double.MAX_VALUE which results in no restriction being set.

Returns:
the maximum size of a node
See Also:
setNodeScalingFactor(double), setNodeHalo(double)

setMaximumNodeSize

public void setMaximumNodeSize(double max)
Sets the maximum size of a node that is used to calculate layer overlaps. This can be used for more fuzzy layering.

Parameters:
max - the maximum size of a node [0.0d .. Double.MAX_VALUE]
See Also:
setNodeScalingFactor(double), setNodeHalo(double)

getMinimumNodeSize

public double getMinimumNodeSize()
Gets the minimum size of a node that is used to calculate layer overlaps. This can be used for more fuzzy layering. The default is 0.0d which results in no restriction being set.

Returns:
the minimum size of a node
See Also:
setNodeScalingFactor(double), setNodeHalo(double)

setMinimumNodeSize

public void setMinimumNodeSize(double min)
Sets the minimum size of a node that is used to calculate layer overlaps. This can be used for more fuzzy layering.

Parameters:
min - the minimum size of a node [0.0d .. Double.MAX_VALUE]
See Also:
setNodeScalingFactor(double), setNodeHalo(double)

setNodeHalo

public void setNodeHalo(double halo)
Sets the size of the halo around a node or the insets respectively that are used to calculate layer overlaps. This can be used for more fuzzy layering.

Parameters:
halo - the size of a node's halo [-Double.MAX_VALUE .. Double.MAX_VALUE]

getHalo

public double getHalo()
Gets the size of the halo around a node or the insets respectively that are used to calculate layer overlaps. The default is 0.0d which results in no modification

Returns:
the size of the halo around a node [0.0d .. Double.MAX_VALUE]

assignNodeLayer

public int assignNodeLayer(LayoutGraph g,
                           NodeMap layerMap,
                           EdgeList reversedEdges)
Description copied from interface: Layerer
This method assigns the nodes in the graph to layers.

Specified by:
assignNodeLayer in interface Layerer
Parameters:
g - the graph for which the layers are determined.
layerMap - here the layers are stored
reversedEdges - here the edges are stored which had been reversed.
Returns:
the number of layers

getMin

protected double getMin(LayoutGraph graph,
                        Node node)
Callback used to calculate the upper (min) value of a node.


getMax

protected double getMax(LayoutGraph graph,
                        Node node)
Callback used to calculate the lower (max) value of a node.


© Copyright 2000-2008,
yWorks GmbH.
All rights reserved.