public class SelfLoopCalculator extends Object
It is used during the layout phase of HierarchicLayoutCore
, but can be used as a stand-alone tool.
Modifier and Type | Field and Description |
---|---|
static EdgeDpKey<Double> |
MINIMUM_EDGE_DISTANCE_DPKEY
A
DataProvider key for specifying the minimum distance to the next edge or node side
|
static EdgeDpKey<Double> |
MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY
A
DataProvider key for specifying the minimum length of the first segment of each edge
|
static EdgeDpKey<Double> |
MINIMUM_LAST_SEGMENT_LENGTH_DPKEY
A
DataProvider key for specifying the minimum length of the last segment of each edge
|
static NodeDpKey<Double> |
MINIMUM_NODE_DISTANCE_DPKEY
A
DataProvider key for defining for each node a minimum distance to the self-loop edges
|
static EdgeDpKey<Double> |
MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY
A
DataProvider key for specifying the minimum length of the octilinear segments of an octilinear edge
|
static EdgeDpKey<Boolean> |
OCTILINEAR_EDGES_DPKEY
A
DataProvider key for specifying whether or not an edge is octilinear
|
Constructor and Description |
---|
SelfLoopCalculator(double minFirstSegmentLength,
double minEdgeDistance)
Creates a new instance of
SelfLoopCalculator using the given parameters. |
Modifier and Type | Method and Description |
---|---|
void |
calculateSelfLoops(LayoutGraph graph,
Node node,
IDataProvider spc,
IDataProvider tpc)
Calculates all self-loops at the given node of the given input graph.
|
void |
calculateSelfLoops(LayoutGraph graph,
Node node,
YList selfLoops,
IDataProvider spc,
IDataProvider 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.
|
public static final EdgeDpKey<Double> MINIMUM_EDGE_DISTANCE_DPKEY
DataProvider
key for specifying the minimum distance to the next edge or node side
public static final EdgeDpKey<Double> MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY
DataProvider
key for specifying the minimum length of the first segment of each edge
public static final EdgeDpKey<Double> MINIMUM_LAST_SEGMENT_LENGTH_DPKEY
DataProvider
key for specifying the minimum length of the last segment of each edge
public static final NodeDpKey<Double> MINIMUM_NODE_DISTANCE_DPKEY
DataProvider
key for defining for each node a minimum distance to the self-loop edges
public static final EdgeDpKey<Double> MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY
DataProvider
key for specifying the minimum length of the octilinear segments of an octilinear edge
public SelfLoopCalculator(double minFirstSegmentLength, double minEdgeDistance)
SelfLoopCalculator
using the given parameters.minFirstSegmentLength
- the minimum length of the first and last segment of an orthogonally routed self-loopminEdgeDistance
- the minimum distance between a pair of self-loopspublic void calculateSelfLoops(LayoutGraph graph, Node node, IDataProvider spc, IDataProvider tpc)
The current port positions will be used for determining the start and end ports. The IDataProvider
instances
hold information about the source/target ports of the edges and can be used for specifying the direction of first and
last segments.
graph
- the input graphnode
- the node whose self-loops will be routedspc
- the IDataProvider
that returns the PortConstraint
object associated with the source ports of the edgestpc
- the IDataProvider
that returns the PortConstraint
object associated with the target ports of the edgespublic void calculateSelfLoops(LayoutGraph graph, Node node, YList selfLoops, IDataProvider spc, IDataProvider tpc)
The current port positions will be used for determining the start and end ports. The IDataProvider
instances
hold information about the source/target ports of the edges and can be used for specifying the direction of first and
last segments.
graph
- the input graphnode
- the node whose self-loops will be routedselfLoops
- a list of Edge
s that will be routedspc
- the IDataProvider
that returns the PortConstraint
object associated with the source ports of the edgestpc
- the IDataProvider
that returns the PortConstraint
object associated with the target ports of the edgesprotected double getMinimumDistance(LayoutGraph graph, Edge edge)
The value is fetched from the corresponding IDataProvider
registered with the graph with key
MINIMUM_EDGE_DISTANCE_DPKEY
.
graph
- the input graphedge
- the given edgeprotected double getMinimumFirstSegmentLength(LayoutGraph graph, Edge edge)
The value is fetched from the corresponding IDataProvider
registered with the graph with key
MINIMUM_FIRST_SEGMENT_LENGTH_DPKEY
.
graph
- the input graphedge
- the given edgeprotected double getMinimumLastSegmentLength(LayoutGraph graph, Edge edge)
The value is fetched from the corresponding IDataProvider
registered with the graph with key
MINIMUM_LAST_SEGMENT_LENGTH_DPKEY
.
graph
- the input graphedge
- the given edgeprotected double getMinimumNodeDistance(LayoutGraph graph, Node node)
The value is fetched from the corresponding IDataProvider
registered with the graph with key
MINIMUM_NODE_DISTANCE_DPKEY
.
graph
- the input graphnode
- the given nodeprotected double getMinimumOctilinearSegmentLength(LayoutGraph graph, Edge edge)
The value is fetched from the corresponding IDataProvider
registered with the graph with key
MINIMUM_OCTILINEAR_SEGMENT_LENGTH_DPKEY
.
graph
- the input graphedge
- the given edgeprotected boolean isOctilinearEdge(LayoutGraph graph, Edge edge)
The value is fetched from the corresponding IDataProvider
registered with the graph with key
OCTILINEAR_EDGES_DPKEY
.
graph
- the input graphedge
- the given edgetrue
if the edge is octilinear, false
otherwise