org.formaria.svg
Class RoutePlotter

java.lang.Object
  extended by org.formaria.svg.RoutePlotter

public class RoutePlotter
extends java.lang.Object

Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.

$Revision: 1.2 $


Field Summary
protected  Circle circle
           
protected  Circle circle2
           
protected  SvgImageMap imageMap
           
protected  java.util.ArrayList lines
           
protected  Path route
           
protected  java.util.ArrayList routeWaypoints
           
protected  java.util.ArrayList waypointFlags
           
protected  java.util.ArrayList waypoints
           
 
Constructor Summary
RoutePlotter(SvgImageMap imageMap, java.util.ArrayList waypoints)
          Creates a new instance of RoutePlotter Used to plot a route on the svg map.
 
Method Summary
 java.awt.geom.Rectangle2D.Double getRouteRect()
          Returns the bounding rectangle of the currently drawn route.
 boolean plotRoute(int startWaypoint, int destinationWaypoint)
          Plots a route from the current location to the selected waypoint.
 void undoRoute()
          Remove the currently drawn route from the svg image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageMap

protected SvgImageMap imageMap

waypoints

protected java.util.ArrayList waypoints

routeWaypoints

protected java.util.ArrayList routeWaypoints

waypointFlags

protected java.util.ArrayList waypointFlags

lines

protected java.util.ArrayList lines

route

protected Path route

circle

protected Circle circle

circle2

protected Circle circle2
Constructor Detail

RoutePlotter

public RoutePlotter(SvgImageMap imageMap,
                    java.util.ArrayList waypoints)
Creates a new instance of RoutePlotter Used to plot a route on the svg map.

Parameters:
imageMap - the SvgImageMap instance that the routes will be plotted on.
waypoints - an ArrayList of waypoints used to construct routes.
Method Detail

plotRoute

public boolean plotRoute(int startWaypoint,
                         int destinationWaypoint)
Plots a route from the current location to the selected waypoint. i.e. the destination

Parameters:
startWaypoint - an int specifying the the index of the starting waypoint.
destinationWaypoint - an int specifying the the index of the destination waypoint.
Returns:
a boolean stating whether a route can be plotted or not.

undoRoute

public void undoRoute()
Remove the currently drawn route from the svg image.


getRouteRect

public java.awt.geom.Rectangle2D.Double getRouteRect()
Returns the bounding rectangle of the currently drawn route.

Returns:
Rectangle2D.Double which bounds the current route.