Search this API

y.layout.hierarchic.incremental
Class SelfloopCalculator

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

public class SelfloopCalculator
extends java.lang.Object

This class calculates bend points for self-loops routed in orthogonal or octilinear fashion.

It is used during the layout phase of HierarchicLayouter, but can be used as a stand-alone tool.

 
Your browser does not support SVG content.

Field Summary
static java.lang.Object IS_OCTILINEAR_DPKEY
          A DataProvider key for specifying whether or not an edge is octilinear
static java.lang.Object MINIMUM_EDGE_DISTANCE_DPKEY
          A DataProvider key for specifying the minimum distance to the next edge or node side
static java.lang.Object MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY
          A DataProvider key for specifying the minimum length of the first segment of each edge
static java.lang.Object MINIMUM_LAST_SEGMENT_LENGTH_DPKEY
          A DataProvider key for specifying the minimum length of the last segment of each edge
static java.lang.Object MINIMUM_NODE_DISTANCE_DPKEY
          A DataProvider key for defining for each node a minimum distance to the self-loop edges
static java.lang.Object MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY
          A DataProvider key for specifying the minimum length of the octilinear segments of an octilinear edge
 
Constructor Summary
SelfloopCalculator(double minFirstSegmentLength, double minEdgeDistance)
          Creates a new instance of SelfloopCalculator using the given parameters.
 
Method Summary
 void calculateSelfLoops(LayoutGraph graph, Node node, DataProvider spc, DataProvider tpc)
          Calculates all self-loops at the given node of the given input 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 associated with the given edge.
protected  double getMinimumFirstSegmentLength(LayoutGraph graph, Edge edge)
          Returns the minimum length of the first segment of the given edge.
protected  double getMinimumLastSegmentLength(LayoutGraph graph, Edge edge)
          Returns the minimum length of the last segment of the given edge.
protected  double getMinimumNodeDistance(LayoutGraph graph, Node node)
          Returns the minimum distance between two nodes associated with the given node.
protected  double getMinimumOctilinearSegmentLength(LayoutGraph graph, Edge edge)
          Returns the minimum octilinear segment length of 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 java.lang.Object MINIMUM_NODE_DISTANCE_DPKEY
A DataProvider key for defining for each node a minimum distance to the self-loop edges


IS_OCTILINEAR_DPKEY

public static final java.lang.Object IS_OCTILINEAR_DPKEY
A DataProvider key for specifying whether or not an edge is octilinear


MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY

public static final java.lang.Object MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY
A DataProvider key for specifying the minimum length of the octilinear segments of an octilinear edge


MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY

public static final java.lang.Object MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY
A DataProvider key for specifying the minimum length of the first segment of each edge


MINIMUM_LAST_SEGMENT_LENGTH_DPKEY

public static final java.lang.Object MINIMUM_LAST_SEGMENT_LENGTH_DPKEY
A DataProvider key for specifying the minimum length of the last segment of each edge


MINIMUM_EDGE_DISTANCE_DPKEY

public static final java.lang.Object MINIMUM_EDGE_DISTANCE_DPKEY
A DataProvider key for specifying the 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.

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 of the given input graph.

The current port positions will be used for determining the start and end ports. The DataProvider instances hold information about the source/target ports of the edges and can be used for specifying the direction of first and last segments.

Parameters:
graph - the input graph
node - the node whose self-loops will be routed
spc - the DataProvider that returns the PortConstraint object associated with the source ports of the edges
tpc - the DataProvider that returns the PortConstraint object associated with 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.

The current port positions will be used for determining the start and end ports. The DataProvider instances hold information about the source/target ports of the edges and can be used for specifying the direction of first and last segments.

Parameters:
graph - the input graph
node - the node whose self-loops will be routed
selfLoops - a list of Edges that will be routed
spc - the DataProvider that returns the PortConstraint object associated with the source ports of the edges
tpc - the DataProvider that returns the PortConstraint object associated with the target ports of the edges

getMinimumFirstSegmentLength

protected double getMinimumFirstSegmentLength(LayoutGraph graph,
                                              Edge edge)
Returns the minimum length of the first segment of the given edge.

The value is fetched from the corresponding DataProvider registered with the graph with key MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY.

Parameters:
graph - the input graph
edge - the given edge
Returns:
the minimum length of the first segment of an edge

isOctilinearEdge

protected boolean isOctilinearEdge(LayoutGraph graph,
                                   Edge edge)
Returns whether or not the given edge is octilinear.

The value is fetched from the corresponding DataProvider registered with the graph with key IS_OCTILINEAR_DPKEY.

Parameters:
graph - the input graph
edge - the given edge
Returns:
true if the edge is octilinear, false otherwise

getMinimumOctilinearSegmentLength

protected double getMinimumOctilinearSegmentLength(LayoutGraph graph,
                                                   Edge edge)
Returns the minimum octilinear segment length of the given edge.

The value is fetched from the corresponding DataProvider registered with the graph with key MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY.

Parameters:
graph - the input graph
edge - the given edge
Returns:
the minimum octilinear segment length of the given edge

getMinimumLastSegmentLength

protected double getMinimumLastSegmentLength(LayoutGraph graph,
                                             Edge edge)
Returns the minimum length of the last segment of the given edge.

The value is fetched from the corresponding DataProvider registered with the graph with key MINIMUM_LAST_SEGMENT_LENGTH_DPKEY.

Parameters:
graph - the input graph
edge - the given edge
Returns:
the minimum length of the last segment of the given edge

getMinimumDistance

protected double getMinimumDistance(LayoutGraph graph,
                                    Edge edge)
Returns the minimum length between two edges associated with the given edge.

The value is fetched from the corresponding DataProvider registered with the graph with key MINIMUM_EDGE_DISTANCE_DPKEY.

Parameters:
graph - the input graph
edge - the given edge
Returns:
the minimum length between two edges

getMinimumNodeDistance

protected double getMinimumNodeDistance(LayoutGraph graph,
                                        Node node)
Returns the minimum distance between two nodes associated with the given node.

The value is fetched from the corresponding DataProvider registered with the graph with key MINIMUM_NODE_DISTANCE_DPKEY.

Parameters:
graph - the input graph
node - the given node
Returns:
the minimum distance between two nodes

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