Search this API

y.layout.hierarchic.incremental
Class SelfloopCalculator

java.lang.Object
  extended by y.layout.hierarchic.incremental.SelfloopCalculator

public class SelfloopCalculator
extends Object

This class can be used to calculate bend points for orthogonally routed self loops. It is used during the layout phase of HierarchicLayouter, but can be used as a stand-alone tool.


Field Summary
static Object IS_OCTILINEAR_DPKEY
          A key used for a DataProvider bound to the graph that returns for each edge whether or not it is octilinear.
static Object MINIMUM_EDGE_DISTANCE_DPKEY
          A key used for a DataProvider bound to the graph that yields for each edge a minimum distance to the next edge or node side.
static Object MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY
          A key used for a DataProvider bound to the graph that yields for each edge a minimum length of its first segment.
static Object MINIMUM_LAST_SEGMENT_LENGTH_DPKEY
          A key used for a DataProvider bound to the graph that yields for each edge a minimum length of its last segment.
static Object MINIMUM_NODE_DISTANCE_DPKEY
          A key used for a DataProvider bound to the graph that yields for each node a minimum distance to the self loop edges.
static Object MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY
          A key used for a DataProvider bound to the graph that yields for each octilinear edge a minimum length of its octilinear segments.
 
Constructor Summary
SelfloopCalculator(double minFirstSegmentLength, double minEdgeDistance)
          Creates a new instance of SelfloopCalculator using the given parameters for minimum first segment length and minimum distance between each pair of edges.
 
Method Summary
 void calculateSelfLoops(LayoutGraph graph, Node node, DataProvider spc, DataProvider tpc)
          Calculates all self loops at the given node the given graph.
 void calculateSelfLoops(LayoutGraph graph, Node node, YList selfLoops, DataProvider spc, DataProvider tpc)
          Convenience method that calculates a list of self-loops that belong to a given node.
protected  double getMinimumDistance(LayoutGraph graph, Edge edge)
          Returns the minimum length between two edges.
protected  double getMinimumFirstSegmentLength(LayoutGraph graph, Edge edge)
          Returns the minimum length for the first segment of an edge.
protected  double getMinimumLastSegmentLength(LayoutGraph graph, Edge edge)
          Returns the minimum length for the last segment of an edge.
protected  double getMinimumNodeDistance(LayoutGraph graph, Node node)
          Returns the minimum length between two nodes.
protected  double getMinimumOctilinearSegmentLength(LayoutGraph graph, Edge edge)
          Returns the minimum octilinear segment length for the given edge.
protected  boolean isOctilinearEdge(LayoutGraph graph, Edge edge)
          Returns whether or not the given edge is octilinear.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM_NODE_DISTANCE_DPKEY

public static final Object MINIMUM_NODE_DISTANCE_DPKEY
A key used for a DataProvider bound to the graph that yields for each node a minimum distance to the self loop edges.


IS_OCTILINEAR_DPKEY

public static final Object IS_OCTILINEAR_DPKEY
A key used for a DataProvider bound to the graph that returns for each edge whether or not it is octilinear.


MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY

public static final Object MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY
A key used for a DataProvider bound to the graph that yields for each octilinear edge a minimum length of its octilinear segments.


MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY

public static final Object MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY
A key used for a DataProvider bound to the graph that yields for each edge a minimum length of its first segment.


MINIMUM_LAST_SEGMENT_LENGTH_DPKEY

public static final Object MINIMUM_LAST_SEGMENT_LENGTH_DPKEY
A key used for a DataProvider bound to the graph that yields for each edge a minimum length of its last segment.


MINIMUM_EDGE_DISTANCE_DPKEY

public static final Object MINIMUM_EDGE_DISTANCE_DPKEY
A key used for a DataProvider bound to the graph that yields for each edge a minimum distance to the next edge or node side.

Constructor Detail

SelfloopCalculator

public SelfloopCalculator(double minFirstSegmentLength,
                          double minEdgeDistance)
Creates a new instance of SelfloopCalculator using the given parameters for minimum first segment length and minimum distance between each pair of edges.

Parameters:
minFirstSegmentLength - the minimum length of the first and last segment of an orthogonally routed self loop
minEdgeDistance - the minimum distance between a pair of self loops
Method Detail

calculateSelfLoops

public void calculateSelfLoops(LayoutGraph graph,
                               Node node,
                               DataProvider spc,
                               DataProvider tpc)
Calculates all self loops at the given node the given graph. The current port positions will be used to determine the start and end ports. The DataProvider instances can be used to specify the direction of first and last segments.

Parameters:
graph - the graph that contains the node
node - the node whose self loops will be routed
spc - a DataProvider that contains PortConstraint information for the source ports of the edges
tpc - a DataProvider that contains PortConstraint information for the target ports of the edges

calculateSelfLoops

public void calculateSelfLoops(LayoutGraph graph,
                               Node node,
                               YList selfLoops,
                               DataProvider spc,
                               DataProvider tpc)
Convenience method that calculates a list of self-loops that belong to a given node.

Parameters:
graph - the graph that contains the node
node - the node whose self loops will be routed
selfLoops - a list of Edges that will be routed
spc - a DataProvider that contains PortConstraint information for the source ports of the edges
tpc - a DataProvider that contains PortConstraint information for the target ports of the edges

getMinimumFirstSegmentLength

protected double getMinimumFirstSegmentLength(LayoutGraph graph,
                                              Edge edge)
Returns the minimum length for the first segment of an edge. The value is fetched from the corresponding data provider.


isOctilinearEdge

protected boolean isOctilinearEdge(LayoutGraph graph,
                                   Edge edge)
Returns whether or not the given edge is octilinear. The value is fetched from the corresponding data provider.


getMinimumOctilinearSegmentLength

protected double getMinimumOctilinearSegmentLength(LayoutGraph graph,
                                                   Edge edge)
Returns the minimum octilinear segment length for the given edge. The value is fetched from the corresponding data provider.


getMinimumLastSegmentLength

protected double getMinimumLastSegmentLength(LayoutGraph graph,
                                             Edge edge)
Returns the minimum length for the last segment of an edge. The value is fetched from the corresponding data provider.


getMinimumDistance

protected double getMinimumDistance(LayoutGraph graph,
                                    Edge edge)
Returns the minimum length between two edges. The value is fetched from the corresponding data provider.


getMinimumNodeDistance

protected double getMinimumNodeDistance(LayoutGraph graph,
                                        Node node)
Returns the minimum length between two nodes. The value is fetched from the corresponding data provider.


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