y.layout.router
Class OrganicEdgeRouter

java.lang.Object
  |
  +--y.layout.router.OrganicEdgeRouter
All Implemented Interfaces:
Layouter, LayoutStage

public class OrganicEdgeRouter
extends Object
implements LayoutStage

This algorithm routes edges using an organic-like layout approach and style. It is implemented as a LayoutStage so that it can easily be appended to another stage, by setting the other stage as the core of this one. Note that this algorithm only works correctly if it is guaranteed that nodes are at least approximately twice as far away from each other as the minimal edge distance, which has been set for this algorithm. This can be achieved by using the OrganicEdgeRouter.createNodeEnlargementStage() layout stage in combination with a stage that removes node overlaps as the core of this layouter.

Here is a sample output of the router using as input a straight-line drawing created by SmartOrganicLayouter:


Field Summary
static Object ROUTE_EDGE_DPKEY
          use this key to provide the alogrithm with boolean values for each edge, specifying the ones which should be rerouted.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
OrganicEdgeRouter()
          Creates a new instance of OrganicEdgeRouter with an inital minimal distance of 10
OrganicEdgeRouter(double minNodeDistance)
          Creates a new instance of OrganicEdgeRouter using the given initial minimal distance
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Returns true iff the given graph can be layed out by this algorithm.
 LayoutStage createNodeEnlargementStage()
          This will return a layout stage which can be given a core layouter, which itself should assure that the nodes do not overlap.
 void doLayout(LayoutGraph graph)
          Assigns a new graph layout to the given layout graph.
 Layouter getCoreLayouter()
          Returns the core layouter.
 double getMinimalDistance()
          Getter for property minimalDistance.
 boolean isRoutingAll()
          Getter for property routingAll.
 boolean isUsingBends()
          Getter for property usingBends.
 void setCoreLayouter(Layouter l)
          Sets the core layouter.
 void setMinimalDistance(double minimalDistance)
          Setter for property minimalDistance.
 void setRoutingAll(boolean routingAll)
          Setter for property routingAll.
 void setUsingBends(boolean usingBends)
          Setter for property usingBends.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUTE_EDGE_DPKEY

public static final Object ROUTE_EDGE_DPKEY
use this key to provide the alogrithm with boolean values for each edge, specifying the ones which should be rerouted.

Constructor Detail

OrganicEdgeRouter

public OrganicEdgeRouter()
Creates a new instance of OrganicEdgeRouter with an inital minimal distance of 10


OrganicEdgeRouter

public OrganicEdgeRouter(double minNodeDistance)
Creates a new instance of OrganicEdgeRouter using the given initial minimal distance

Method Detail

canLayout

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

Specified by:
canLayout in interface Layouter

doLayout

public void doLayout(LayoutGraph graph)
Description copied from interface: Layouter
Assigns a new graph layout to the given layout graph.

Specified by:
doLayout in interface Layouter

getCoreLayouter

public Layouter getCoreLayouter()
Returns the core layouter.

Specified by:
getCoreLayouter in interface LayoutStage

setCoreLayouter

public void setCoreLayouter(Layouter l)
Sets the core layouter.

Specified by:
setCoreLayouter in interface LayoutStage

getMinimalDistance

public double getMinimalDistance()
Getter for property minimalDistance.

Returns:
Value of property minimalDistance.

setMinimalDistance

public void setMinimalDistance(double minimalDistance)
Setter for property minimalDistance. This is the minimal distance this algorithm should guarantee between nodes and non-adjacent edges. Values should be larger than 10.

Parameters:
minimalDistance - New value of property minimalDistance.

isUsingBends

public boolean isUsingBends()
Getter for property usingBends. If set to true, initially available bends will be used for the initial placement.

Returns:
Value of property usingBends.

setUsingBends

public void setUsingBends(boolean usingBends)
Setter for property usingBends. If set to true, initially available bends will be used for the initial placement.

Parameters:
usingBends - New value of property usingBends.

isRoutingAll

public boolean isRoutingAll()
Getter for property routingAll. Determines whether edges should be rerouted even if they do no obey all constraints initially.

Returns:
Value of property routingAll.

setRoutingAll

public void setRoutingAll(boolean routingAll)
Setter for property routingAll. Determines whether edges should be rerouted even if they do no obey all constraints initially.

Parameters:
routingAll - New value of property routingAll.

createNodeEnlargementStage

public LayoutStage createNodeEnlargementStage()
This will return a layout stage which can be given a core layouter, which itself should assure that the nodes do not overlap. This ensures that OrganicEdgeRouter has enough empty space for routing edges. The enlargement stage itself can be used as the core of the edgerouter.


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

2003