Class Router
- java.lang.Object
-
- Router
-
public class Router extends java.lang.Object
This class provides ashortestPath
method androuteDirections
for finding routes between two points on the map.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Router.NavigationDirection
Class to represent a navigation direction, which consists of 3 attributes: a direction to go, a way, and the distance to travel for.
-
Constructor Summary
Constructors Constructor Description Router()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<Router.NavigationDirection>
routeDirections(GraphDB g, java.util.List<java.lang.Long> route)
Given aroute
of vertex IDs, return aList
ofNavigationDirection
objects representing the travel directions in order.static java.util.List<java.lang.Long>
shortestPath(GraphDB g, double stlon, double stlat, double destlon, double destlat)
Return aList
of vertex IDs corresponding to the shortest path from a given starting coordinate and destination coordinate.
-
-
-
Method Detail
-
shortestPath
public static java.util.List<java.lang.Long> shortestPath(GraphDB g, double stlon, double stlat, double destlon, double destlat)
Return aList
of vertex IDs corresponding to the shortest path from a given starting coordinate and destination coordinate.- Parameters:
g
-GraphDB
data source.stlon
- The longitude of the starting coordinate.stlat
- The latitude of the starting coordinate.destlon
- The longitude of the destination coordinate.destlat
- The latitude of the destination coordinate.- Returns:
- The
List
of vertex IDs corresponding to the shortest path.
-
routeDirections
public static java.util.List<Router.NavigationDirection> routeDirections(GraphDB g, java.util.List<java.lang.Long> route)
Given aroute
of vertex IDs, return aList
ofNavigationDirection
objects representing the travel directions in order.- Parameters:
g
-GraphDB
data source.route
- The shortest-path route of vertex IDs.- Returns:
- A new
List
ofNavigationDirection
objects.
-
-