edu.jhu.ece.iacl.jist.pipeline.graph
Class AvoidanceRouting

java.lang.Object
  extended by DefaultRouting
      extended by edu.jhu.ece.iacl.jist.pipeline.graph.AvoidanceRouting

public class AvoidanceRouting
extends DefaultRouting

Algorithm for routing connectors so that they avoid intersecting graph modules.

Author:
Blake Lucas (bclucas@jhu.edu)

Nested Class Summary
protected static class AvoidanceRouting.Dir
          The Enum Dir.
 
Field Summary
protected static double BORDER_SPACE
          The BORDE r_ space.
protected static int DEPTH_LIMIT
          The DEPT h_ limit.
protected static int MAX_PATHS
          The MA x_ paths.
protected  java.util.ArrayList<java.awt.geom.Rectangle2D> obstacles
          The obstacles.
 
Constructor Summary
AvoidanceRouting()
           
 
Method Summary
protected  java.util.Vector computeRoute(GraphLayoutCache cache, java.awt.geom.Point2D from, java.awt.geom.Point2D to, AvoidanceRouting.Dir direction)
          Compute avoidance route.
protected  java.util.ArrayList<java.awt.geom.Rectangle2D> getObstacles(GraphLayoutCache cache, java.awt.geom.Point2D from, java.awt.geom.Point2D to)
          Get list of rectangular obstacles in graph.
protected  java.awt.geom.Rectangle2D getPathBounds(java.awt.geom.Point2D from, java.awt.geom.Point2D to)
          Get rectangular bounds around start and end locations.
 java.util.List route(GraphLayoutCache cache, EdgeView edge)
           
protected  java.util.List routeEdge(GraphLayoutCache cache, EdgeView edge)
          Route edge.
protected  void simplifyPath(java.util.Vector<java.awt.geom.Point2D> path, int parity)
          The avoidance path may have lots of unnecessary bends in it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BORDER_SPACE

protected static double BORDER_SPACE
The BORDE r_ space.


DEPTH_LIMIT

protected static int DEPTH_LIMIT
The DEPT h_ limit.


MAX_PATHS

protected static int MAX_PATHS
The MA x_ paths.


obstacles

protected java.util.ArrayList<java.awt.geom.Rectangle2D> obstacles
The obstacles.

Constructor Detail

AvoidanceRouting

public AvoidanceRouting()
Method Detail

computeRoute

protected java.util.Vector computeRoute(GraphLayoutCache cache,
                                        java.awt.geom.Point2D from,
                                        java.awt.geom.Point2D to,
                                        AvoidanceRouting.Dir direction)
Compute avoidance route.

Parameters:
cache - layout cache
from - start point
to - end point
direction - initial direction
Returns:
list of control points

getObstacles

protected java.util.ArrayList<java.awt.geom.Rectangle2D> getObstacles(GraphLayoutCache cache,
                                                                      java.awt.geom.Point2D from,
                                                                      java.awt.geom.Point2D to)
Get list of rectangular obstacles in graph.

Parameters:
cache - layout cache
from - start point
to - end point
Returns:
list of rectangular obstacles

getPathBounds

protected java.awt.geom.Rectangle2D getPathBounds(java.awt.geom.Point2D from,
                                                  java.awt.geom.Point2D to)
Get rectangular bounds around start and end locations.

Parameters:
from - the from
to - the to
Returns:
the path bounds

route

public java.util.List route(GraphLayoutCache cache,
                            EdgeView edge)

routeEdge

protected java.util.List routeEdge(GraphLayoutCache cache,
                                   EdgeView edge)
Route edge.

Parameters:
cache - the cache
edge - the edge
Returns:
the list

simplifyPath

protected void simplifyPath(java.util.Vector<java.awt.geom.Point2D> path,
                            int parity)
The avoidance path may have lots of unnecessary bends in it. This method removes those unnecessary bends

Parameters:
path - original path
parity - Zero indicates inital direction is up/down and one indicates left/right