Search this API

y.layout.router
Class EdgeGroupRouterStage

java.lang.Object
  extended by y.layout.AbstractLayoutStage
      extended by y.layout.router.EdgeGroupRouterStage
All Implemented Interfaces:
Layouter, LayoutStage

public class EdgeGroupRouterStage
extends AbstractLayoutStage

EdgeGroupRouterStage adds support for a bus-like routing style for OrthogonalEdgeRouter.

Edges that are assigned to edge groups using DataProviders registered with PortConstraintKeys.SOURCE_GROUPID_KEY and PortConstraintKeys.TARGET_GROUPID_KEY will share parts of their paths. This stage tries to route grouped edges on a vertical or horizontal bus. The edges will connect to their common node at the same port coordinates.

There are some limitations to this stage:

Graph containing edge groups

 
EdgeGroupRouterStage will not have an effect with edge routing algorithms other than OrthogonalEdgeRouter.
See Also:
OrthogonalEdgeRouter, PortConstraintKeys.SOURCE_GROUPID_KEY, PortConstraintKeys.TARGET_GROUPID_KEY
 

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
EdgeGroupRouterStage(Layouter coreLayouter)
          Creates a new instance of EdgeGroupRouterStage using the given core layout algorithm.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Accepts all graphs that are accepted by the core layout algorithm.
 void doLayout(LayoutGraph graph)
          Handles edge grouping for the core layout algorithm.
 double getMinimalBusDistance()
          Returns the minimum distance between a bus formed by an edge group and the nodes to which the grouped edges connect.
 void setMinimalBusDistance(double minimalBusDistance)
          Specifies the minimum distance between a bus formed by an edge group and the nodes to which the grouped edges connect.
 
Methods inherited from class y.layout.AbstractLayoutStage
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EdgeGroupRouterStage

public EdgeGroupRouterStage(Layouter coreLayouter)
Creates a new instance of EdgeGroupRouterStage using the given core layout algorithm.

 
EdgeGroupRouterStage provides an optimization step for OrthogonalEdgeRouter and will not work with other edge routing algorithms.
Parameters:
coreLayouter - the given core layout algorithm
Method Detail

getMinimalBusDistance

public double getMinimalBusDistance()
Returns the minimum distance between a bus formed by an edge group and the nodes to which the grouped edges connect.

The minimum bus distance needs to be non-negative.

Returns:
the minimum distance of the bus to its connected nodes
See Also:
setMinimalBusDistance(double)

setMinimalBusDistance

public void setMinimalBusDistance(double minimalBusDistance)
Specifies the minimum distance between a bus formed by an edge group and the nodes to which the grouped edges connect.

The minimum bus distance needs to be non-negative.

Default Value:
The default value is 15.0.
Parameters:
minimalBusDistance - the minimum distance of the bus to its connected nodes
Throws:
java.lang.IllegalArgumentException - if the specified distance is negative

canLayout

public boolean canLayout(LayoutGraph graph)
Accepts all graphs that are accepted by the core layout algorithm.

Parameters:
graph - the input graph
Returns:
true if the core layout algorithm can handle the graph, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

doLayout

public void doLayout(LayoutGraph graph)
Handles edge grouping for the core layout algorithm.

Precondition:
The core layout algorithm must be an instance of OrthogonalEdgeRouter or at least must have such an instance in its layout pipeline.
Parameters:
graph - the input graph
See Also:
Layouter.canLayout(LayoutGraph)

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