Search this API

y.layout.router
Class ChannelEdgeRouter

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

public class ChannelEdgeRouter
extends AbstractLayoutStage

This class represents an edge router. It combines two strategic steps of edge routing and executes them after each other. The first strategy is called path finder strategy and will route the edges, potentially with edge overlaps. The second strategy will then split overlapping edge segments inside their channels and distribute them according to the specific distribution strategy. For path finding strategies you can for example use ChannelEdgeRouter.OrthogonalShortestPathPathFinder or OrthogonalPatternEdgeRouter. By default the latter will be used. One possible implementation of an edge distribution strategy is OrthogonalSegmentDistributionStage, which is also used by default. Note: when exchanging only one of the strategies, make sure, that their algorithms will use the same (sub)set of graph objects. The strategies bound to this router by default will use key AFFECTED_EDGES to determine the affected edges.


Nested Class Summary
static class ChannelEdgeRouter.OrthogonalShortestPathPathFinder
          This layouter is a s special version of OrthogonalEdgeRouter that can be used as a path finding strategy in ChannelEdgeRouter.
 
Field Summary
static Object AFFECTED_EDGES
          This field is used as the key to add a DataProvider to the graph, which specifies the edges, that are affected by the edge routing.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
ChannelEdgeRouter()
           
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Returns true iff the given graph can be laid out by this algorithm.
protected  void checkGroupNodeSize(GraphLayout layout, Object node)
          This method throws an IllegalArgumentException if the width/height of the given group node object is zero.
protected  void checkNodeSize(GraphLayout layout, Object node)
          This method throws an IllegalArgumentException if the width/height of the given node object is zero.
 void doLayout(LayoutGraph graph)
          Main layout routine that assigns new layout information to the given graph.
 Layouter getEdgeDistributionStrategy()
          Returns the currently used edge distribution strategy of this router.
 Layouter getPathFinderStrategy()
          Returns the currently used path finder strategy of this router.
 void setEdgeDistributionStrategy(Layouter edgeDistributionStrategy)
          Sets the strategy with which overlapping edge segments will be distributed in their provided channel.
 void setPathFinderStrategy(Layouter pathFinderStrategy)
          Sets the strategy for path finding.
 
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
 

Field Detail

AFFECTED_EDGES

public static final Object AFFECTED_EDGES
This field is used as the key to add a DataProvider to the graph, which specifies the edges, that are affected by the edge routing.

Constructor Detail

ChannelEdgeRouter

public ChannelEdgeRouter()
Method Detail

canLayout

public boolean canLayout(LayoutGraph graph)
Description copied from interface: Layouter
Returns true iff the given graph can be laid out by this algorithm. Calling doLayout with the given graph as its argument will only success if this method returns true.


doLayout

public void doLayout(LayoutGraph graph)
Description copied from interface: Layouter
Main layout routine that assigns new layout information to the given graph.


checkNodeSize

protected void checkNodeSize(GraphLayout layout,
                             Object node)
                      throws IllegalArgumentException
This method throws an IllegalArgumentException if the width/height of the given node object is zero. It is called by the doLayout(LayoutGraph) method for each node object in the input graph.

Throws:
IllegalArgumentException - thrown if the width/height of the node object is zero.
Parameters:
layout - a graph layout object.
node - the node object to test.
See Also:
checkGroupNodeSize(GraphLayout,Object)

checkGroupNodeSize

protected void checkGroupNodeSize(GraphLayout layout,
                                  Object node)
                           throws IllegalArgumentException
This method throws an IllegalArgumentException if the width/height of the given group node object is zero. It is called by the doLayout(LayoutGraph) method for each group node object in the input graph.

Throws:
IllegalArgumentException - thrown if the width/height of the group node object is zero.
Parameters:
layout - a graph layout object.
node - the group node object to test.
See Also:
checkNodeSize(GraphLayout,Object)

setPathFinderStrategy

public void setPathFinderStrategy(Layouter pathFinderStrategy)
Sets the strategy for path finding. Path finding means routing the edges in a first approach. Note: when exchanging only one of the strategies, make sure, that their algorithms will use the same (sub)set of graph objects. The strategies bound to this router by default will us key AFFECTED_EDGES to determine the affected edges.

Parameters:
pathFinderStrategy - the path finding strategy that should be set.

setEdgeDistributionStrategy

public void setEdgeDistributionStrategy(Layouter edgeDistributionStrategy)
Sets the strategy with which overlapping edge segments will be distributed in their provided channel. Note: when exchanging only one of the strategies, make sure, that their algorithms will use the same (sub)set of graph objects. The strategies bound to this router by default will us key AFFECTED_EDGES to determine the affected edges.

Parameters:
edgeDistributionStrategy - the distribution strategy to be set.

getPathFinderStrategy

public Layouter getPathFinderStrategy()
Returns the currently used path finder strategy of this router.

Returns:
the currently used path finder strategy of this router.

getEdgeDistributionStrategy

public Layouter getEdgeDistributionStrategy()
Returns the currently used edge distribution strategy of this router.

Returns:
the currently used edge distribution strategy of this router.

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