Search this API

y.layout.hierarchic
Class SimplexDrawer

java.lang.Object
  extended by y.layout.hierarchic.AbstractDrawer
      extended by y.layout.hierarchic.SimplexDrawer
All Implemented Interfaces:
Drawer

public class SimplexDrawer
extends AbstractDrawer

This class implements a Drawer based on rank assignment.

The drawer works only with integer values and rounds double values to integers.

 

Field Summary
 
Fields inherited from class y.layout.hierarchic.AbstractDrawer
distanceToNextNode, dummyMap, edgeLengthKey, graph, minimalEdgeDistance, minimalLayerDistance, minimalMultiEdgeDistance, minimalNodeDistance
 
Fields inherited from interface y.layout.hierarchic.Drawer
NODE_BORDER_BOTTOM, NODE_BORDER_LEFT, NODE_BORDER_RIGHT, NODE_BORDER_TOP, NODE_DISTANCE
 
Constructor Summary
SimplexDrawer()
          Creates a new instance of SimplexDrawer with default settings.
 
Method Summary
protected  void assignCoordinates(NodeList[] layerLists, DataProvider layerID)
          Assigns the coordinates to the nodes of the graph.
protected  int getCost(Graph graph, NodeMap rank, EdgeMap weight, EdgeMap minLength)
          Deprecated.  
 long getMaximalDuration()
          Returns the time limit (in milliseconds) set for the layout algorithm.
 int getStraighteningFactor()
          Returns the straightening factor.
protected static boolean isDummy(LayoutGraph graph, Node node)
          Returns whether or not the given node is a dummy node.
 void setMaximalDuration(long maximalDuration)
          Specifies the time limit (in milliseconds) set for the layout algorithm.
 void setStraighteningFactor(int bendStraighteningFactor)
          Specifies the straightening factor.
 
Methods inherited from class y.layout.hierarchic.AbstractDrawer
assignCoordinates, assignYCoords, assignYCoords, dispose, getBottomBorder, getBottomHalf, getBottomY, getDistanceToNextNode, getFullHeight, getFullWidth, getLeftBorder, getLeftHalf, getLeftX, getMinimalEdgeDistance, getMinimalLayerDistance, getMinimalMultiEdgeDistance, getMinimalNodeDistance, getRightBorder, getRightHalf, getRightX, getTopBorder, getTopHalf, getTopY, initializeDistancesToNextNode, setDummyMap, setEdgeLengthKey, setMinimalEdgeDistance, setMinimalLayerDistance, setMinimalMultiEdgeDistance, setMinimalNodeDistance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplexDrawer

public SimplexDrawer()
Creates a new instance of SimplexDrawer with default settings.

Method Detail

getStraighteningFactor

public int getStraighteningFactor()
Returns the straightening factor.

 
Higher values will result in longer straight-line routings.
Returns:
the current straightening factor
See Also:
setStraighteningFactor(int)

setStraighteningFactor

public void setStraighteningFactor(int bendStraighteningFactor)
Specifies the straightening factor.

 
Higher values will result in longer straight-line routings.
Default Value:
The default value is 32000.
Parameters:
bendStraighteningFactor - the given straightening factor

getMaximalDuration

public long getMaximalDuration()
Returns the time limit (in milliseconds) set for the layout algorithm.

Values have to be greater than or equal to 0.

 
Restricting the maximum duration may result in a lower layout quality. Furthermore, the real runtime may exceed the maximum duration since the layout algorithm still has to find a valid solution.
Returns:
a non-negative value that specifies the time limit
See Also:
setMaximalDuration(long)

setMaximalDuration

public void setMaximalDuration(long maximalDuration)
Specifies the time limit (in milliseconds) set for the layout algorithm.

Values have to be greater than or equal to 0.

 
Restricting the maximum duration may result in a lower layout quality. Furthermore, the real runtime may exceed the maximum duration since the layout algorithm still has to find a valid solution.
Default Value:
The default value is Long.MAX_VALUE. The layout algorithm runs unrestricted.
Parameters:
maximalDuration - a non-negative value that specifies the time limit
Throws:
java.lang.IllegalArgumentException - if the maximum duration is negative

assignCoordinates

protected void assignCoordinates(NodeList[] layerLists,
                                 DataProvider layerID)
Assigns the coordinates to the nodes of the graph.

Specified by:
assignCoordinates in class AbstractDrawer
Parameters:
layerLists - the array of NodeLists each of which contains nodes that belong to the same layer
layerID - the DataProvider that returns the zero-based index of the layer to which each node belongs

getCost

protected int getCost(Graph graph,
                      NodeMap rank,
                      EdgeMap weight,
                      EdgeMap minLength)
Deprecated. 

Returns the overall edge cost for the edges (sum over all single costs) of the graph based on node ranking and edge weight and length.

The length of an edge is equal to the difference of the ranks of its two endpoints. The slack of an edge is equal to its length decreased by its minimum length. The cost of an edge is equal to the product of its slack and weight.

Parameters:
graph - the graph
rank - the NodeMap that returns an integer value (rank) for each node
weight - the EdgeMap that returns an integer value (weight) for each edge
minLength - the EdgeMap that returns an integer value (minimum length) for each edge
Returns:
the total overall edge cost

isDummy

protected static boolean isDummy(LayoutGraph graph,
                                 Node node)
Returns whether or not the given node is a dummy node.

Parameters:
graph - the graph
node - the node
Returns:
true if the node is a dummy node, false otherwise

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