Search this API

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, 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
 void assignLayers(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          This method assigns all nodes in the graph to layers and registers them in the Layers instance.
 int assignNodeLayer(LayoutGraph g, NodeMap layerMap, EdgeList reversedEdges)
           
 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.

Throws:
IllegalArgumentException - if the specified value is less than 0.
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.

Throws:
IllegalArgumentException - if the specified value is less than 0.
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.

Throws:
IllegalArgumentException - if the specified value is less than 0.
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)

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.


assignLayers

public void assignLayers(LayoutGraph graph,
                         Layers layers,
                         LayoutDataProvider ldp)
Description copied from interface: Layerer
This method assigns all nodes in the graph to layers and registers them in the Layers instance. In order to create new layers, the factory method Layers.insert(byte, int) must be used.

Specified by:
assignLayers in interface Layerer
Parameters:
graph - the graph that contains the nodes that should be distributed into the layers
layers - the object that will be filled with the results of the calculation
ldp - LayoutDataProvider that can be used to query information about the nodes - note that positional information (see NodeData.getPosition() and NodeData.getLayer()) cannot be available at any time.
See Also:
Layers.insert(byte, int), Layer.add(y.base.Node)

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