|
Eclipse Draw2d 3.0.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.draw2d.graph.ShortestPathRouter
Bends a collection of Paths
around rectangular obstacles. This class
maintains a list of paths and obstacles. Updates can be made to the paths and/or
obstacles, and then an incremental solve can be invoked.
The algorithm will attempt to find the shortest non-intersecting path between each path's start and end points. Once all paths have been found, they will be offset based on how many paths bend around the same corner of each obstacle.
The worst-case performance of this algorithm is p * n^2, where p is the number of paths, and n is the number of obstacles.
This class is not intended to be subclassed.
Constructor Summary | |
ShortestPathRouter()
Creates a new shortest path routing. |
Method Summary | |
boolean |
addObstacle(Rectangle rect)
Adds an obstacle with the given bounds to the obstacles. |
void |
addPath(Path path)
Adds a path to the routing. |
boolean |
removeObstacle(Rectangle rect)
Removes the obstacle with the rectangle's bounds from the routing. |
boolean |
removePath(Path path)
Removes the given path from the routing. |
List |
solve()
Updates the points in the paths in order to represent the current solution with the given paths and obstacles. |
boolean |
updateObstacle(Rectangle oldBounds,
Rectangle newBounds)
Updates the position of an existing obstacle. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ShortestPathRouter()
Method Detail |
public boolean addObstacle(Rectangle rect)
rect
- the bounds of this obstacle
true
if the added obstacle has dirtied one or more pathspublic void addPath(Path path)
path
- the path to add.public boolean removeObstacle(Rectangle rect)
rect
- the bounds of the obstacle to remove
true
if the removal has dirtied one or more pathspublic boolean removePath(Path path)
path
- the path to remove.
true
if the removal may have affected one of the remaining pathspublic List solve()
public boolean updateObstacle(Rectangle oldBounds, Rectangle newBounds)
oldBounds
- the old bounds(used to find the obstacle)newBounds
- the new bounds
true
if the change the current results to become stale
|
Eclipse Draw2d 3.0.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |