Class Router


  • public class Router
    extends java.lang.Object
    This class provides a shortestPath method and routeDirections 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 a route of vertex IDs, return a List of NavigationDirection 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 a List of vertex IDs corresponding to the shortest path from a given starting coordinate and destination coordinate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Router

        public Router()
    • Method Detail

      • shortestPath

        public static java.util.List<java.lang.Long> shortestPath​(GraphDB g,
                                                                  double stlon,
                                                                  double stlat,
                                                                  double destlon,
                                                                  double destlat)
        Return a List 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 a route of vertex IDs, return a List of NavigationDirection objects representing the travel directions in order.
        Parameters:
        g - GraphDB data source.
        route - The shortest-path route of vertex IDs.
        Returns:
        A new List of NavigationDirection objects.