diva.canvas.connector
Class BasicManhattanRouter

java.lang.Object
  extended by diva.canvas.connector.BasicManhattanRouter
All Implemented Interfaces:
ManhattanRouter, Router

public class BasicManhattanRouter
extends java.lang.Object
implements ManhattanRouter

A basic manhattan router.

Version:
$Id: BasicManhattanRouter.java 44140 2006-10-26 21:45:01Z cxh $
Author:
Steve Neuendorffer

Field Summary
private  double MINDIST
           
private  double TOL
           
 
Constructor Summary
BasicManhattanRouter()
           
 
Method Summary
private  Polyline2D _route(java.awt.geom.Point2D head, int headDir, java.awt.geom.Point2D tail, int tailDir)
           
private  int getManhattanDirection(double xDiff, double yDiff)
          Return the direction between two points who differ by the given amounts.
 void reroute(Connector c, java.awt.Shape s)
          Reroute the given shape, given that both the head the tail sites moved.
 void rerouteHead(Connector c, java.awt.Shape s)
          Reroute the given Shape, given that the head site moved.
 void rerouteTail(Connector c, java.awt.Shape s)
          Reroute the given Shape, given that the tail site moved.
 java.awt.Shape route(Connector c)
          Route the given connector, returning a Shape.
 Polyline2D routeManhattan(ManhattanConnector c)
          Route the given connector, returning a Polyline2D.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOL

private double TOL

MINDIST

private double MINDIST
Constructor Detail

BasicManhattanRouter

public BasicManhattanRouter()
Method Detail

rerouteHead

public void rerouteHead(Connector c,
                        java.awt.Shape s)
Reroute the given Shape, given that the head site moved.

Specified by:
rerouteHead in interface Router

rerouteTail

public void rerouteTail(Connector c,
                        java.awt.Shape s)
Reroute the given Shape, given that the tail site moved.

Specified by:
rerouteTail in interface Router

reroute

public void reroute(Connector c,
                    java.awt.Shape s)
Reroute the given shape, given that both the head the tail sites moved. The shape is modified by the router.

Specified by:
reroute in interface Router

route

public java.awt.Shape route(Connector c)
Route the given connector, returning a Shape.

Specified by:
route in interface Router

routeManhattan

public Polyline2D routeManhattan(ManhattanConnector c)
Route the given connector, returning a Polyline2D. This method is the same as route(), except that the return type is tighter.

Specified by:
routeManhattan in interface ManhattanRouter

_route

private Polyline2D _route(java.awt.geom.Point2D head,
                          int headDir,
                          java.awt.geom.Point2D tail,
                          int tailDir)

getManhattanDirection

private int getManhattanDirection(double xDiff,
                                  double yDiff)
Return the direction between two points who differ by the given amounts. The direction returned is restricted to the closest orthogonal direction. The integer returned is from SwingUtilities.