public class ChannelEdgeRouter extends AbstractLayoutStage
Compared to the routing algorithm implemented by class
EdgeRouter
, this implementation is usually faster but supports less
constraints and, by default, may produce node-edge overlaps.
During the routing process, the positions of the nodes are considered to be fixed and the routing algorithm will not modify their locations or their sizes in any way.
The edge routing algorithm can be applied wherever it is required to route the edges as orthogonal segments, while keeping the positions of the nodes in the diagram fixed. Some potential applications include electric circuit design, floor planning, UML class diagrams/inheritance diagrams and navigation maps.
Sample output of the orthogonal edge routing algorithm with default settings
The default path finding strategy is OrthogonalPatternEdgeRouter
. The default edge distribution strategy is
OrthogonalSegmentDistributionStage
.
This class itself has no special routing options except from specifying the path finding
and edge distribution
strategy. Most of the features like minimum
element distances, grid spacing and path restrictions have to be set on the used instances for the two routing steps.
For incremental edge routing, IDataProvider
key AFFECTED_EDGES_DPKEY
has to be registered with the
graph to mark all edges that should be routed by the algorithm. The routes of the other edges remain unchanged. If there
is no such key registered, the algorithm routes all edges.
AFFECTED_EDGES_DPKEY
to
determine the affected edges.Modifier and Type | Field and Description |
---|---|
static EdgeDpKey<Boolean> |
AFFECTED_EDGES_DPKEY
A
DataProvider key for marking the edges that should be routed.
|
Constructor and Description |
---|
ChannelEdgeRouter()
Creates a new
ChannelEdgeRouter instance with default settings. |
Modifier and Type | Method and Description |
---|---|
void |
applyLayout(LayoutGraph graph)
Performs the orthogonal routing of the edges of the input graph.
|
protected void |
checkNodeSize(LayoutGraph g)
Checks the sizes of the nodes to be non-zero.
|
ILayoutAlgorithm |
getEdgeDistributionStrategy()
Gets the strategy for the edge distribution step.
|
ILayoutAlgorithm |
getPathFinderStrategy()
Gets the strategy for the path finding step.
|
void |
setEdgeDistributionStrategy(ILayoutAlgorithm value)
Sets the strategy for the edge distribution step.
|
void |
setPathFinderStrategy(ILayoutAlgorithm value)
Sets the strategy for the path finding step.
|
applyLayoutCore, getCoreLayout, setCoreLayout
public ChannelEdgeRouter()
ChannelEdgeRouter
instance with default settings.public void applyLayout(LayoutGraph graph)
applyLayout
in interface ILayoutAlgorithm
applyLayout
in class AbstractLayoutStage
graph
- the input graphprotected void checkNodeSize(LayoutGraph g)
g
- The graph to check.public ILayoutAlgorithm getEdgeDistributionStrategy()
This step distributes overlapping edge segments in their channel. The channel in which the segments can be distributed is defined by the surrounding graph elements.
AFFECTED_EDGES_DPKEY
to
determine the affected edges.OrthogonalSegmentDistributionStage
setEdgeDistributionStrategy(ILayoutAlgorithm)
public ILayoutAlgorithm getPathFinderStrategy()
This step routes the edges and may produce edge overlaps which are later resolved in the edge distribution
step.
AFFECTED_EDGES_DPKEY
to
determine the affected edges.OrthogonalPatternEdgeRouter
setPathFinderStrategy(ILayoutAlgorithm)
public void setEdgeDistributionStrategy(ILayoutAlgorithm value)
This step distributes overlapping edge segments in their channel. The channel in which the segments can be distributed is defined by the surrounding graph elements.
AFFECTED_EDGES_DPKEY
to
determine the affected edges.OrthogonalSegmentDistributionStage
value
- the edge distribution strategygetEdgeDistributionStrategy()
public void setPathFinderStrategy(ILayoutAlgorithm value)
This step routes the edges and may produce edge overlaps which are later resolved in the edge distribution
step.
AFFECTED_EDGES_DPKEY
to
determine the affected edges.OrthogonalPatternEdgeRouter
value
- the path finder strategygetPathFinderStrategy()