Class GLRouteTracker

java.lang.Object
globus.glmap.GLNativeObject
globus.glroute.GLRouteTracker

public class GLRouteTracker extends GLNativeObject
GLMapRouteTracker tracks user location on route and returns statistics and maneuver info
  • Constructor Details

    • GLRouteTracker

      public GLRouteTracker(GLRoute data)
      Initializes new tracker
      Parameters:
      data - route data
    • GLRouteTracker

      public GLRouteTracker(GLRoute[] routes, int currentRoute)
      Initializes a tracker with array of routes. Tracker will automatically switch to other routes if possible.
      Parameters:
      routes - array of routes to track
      currentRoute - index of current route
  • Method Details

    • updateLocation

      public GLRouteManeuver updateLocation(double lat, double lon, float bearing)
      Finds the next maneuver and refreshes cached navigation stats for the current position.
      Parameters:
      lat - Latitude of the current user location in degrees.
      lon - Longitude of the current user location in degrees.
      bearing - Direction of motion in degrees clockwise from true north.
      Returns:
      Next maneuver of the route or null if there are no more maneuvers.
    • getDistanceToNextManeuver

      public double getDistanceToNextManeuver()
      Returns distance to the next maneuver.
      Returns:
      Distance to the next maneuver in meters.
    • getDistanceToLastPoint

      public double getDistanceToLastPoint()
      Returns distance to the last point of the active route.
      Returns:
      Distance to the last point of route in meters.
    • getRemainingDistance

      public double getRemainingDistance()
      Returns the remaining distance of the route.
      Returns:
      Distance to the target location in meters.
    • getDistanceFromRoute

      public double getDistanceFromRoute()
      Returns the lateral distance from the user to the route geometry.
      Returns:
      Distance from the route to the user in meters.
    • isOnRoute

      public boolean isOnRoute()
      Returns true if user on route
      Returns:
      true if user on route
    • getRemainingDuration

      public double getRemainingDuration()
      Returns the remaining travel time to the end of the route.
      Returns:
      Estimated remaining duration in seconds.
    • getBearingAngleOnRoute

      public double getBearingAngleOnRoute()
      Returns the bearing angle of the current route segment.
      Returns:
      Bearing angle in degrees clockwise from north.
    • getLocationOnRoute

      @NonNull public MapPoint getLocationOnRoute()
      Returns the user's projected location on the route.
      Returns:
      Location on the route in internal map coordinates.
    • getProgressIndex

      public double getProgressIndex()
      Returns the progress index of the current route.
      Returns:
      Value in range [0, 1] describing how much of the route has been completed.
    • getCurrentTargetPointIndex

      public int getCurrentTargetPointIndex()
      Index of current target point
      Returns:
      index of current target point
    • setCurrentTargetPointIndex

      public void setCurrentTargetPointIndex(int index)
      Sets index of current target point
      Parameters:
      index - index of current target point
    • setCurrentRoute

      public void setCurrentRoute(int index)
      Sets index of current route
      Parameters:
      index - index of current route
    • getCurrentRoute

      public int getCurrentRoute()
      Returns index of current route
      Returns:
      index of current route
    • didPassPoint

      public boolean didPassPoint(MapGeoPoint point, double maxDistance)
      Checks whether the user has passed the specified point along the tracked route.
      Parameters:
      point - Point to check (latitude/longitude in degrees).
      maxDistance - Max distance from route to point in meters.
      Returns:
      true if the user passed the point, false otherwise.
    • didPassRoute

      public boolean didPassRoute(int routeIndex)
      Checks if user pass the route
      Parameters:
      routeIndex - Index of route to check
      Returns:
      true if user pass the route.
    • bboxForSegment

      public GLMapBBox bboxForSegment(GLMapBBox bbox, double length)
      Calculates the bounding box of a route segment from the last location.
      Parameters:
      bbox - object to fill with data
      length - The length in meters of the segment.
      Returns:
      The box with filled data for segment.
    • bboxForSegment

      public GLMapBBox bboxForSegment(double length)
      Calculates the bounding box of a route segment from the last location.
      Parameters:
      length - The length in meters of the segment.
      Returns:
      The bounding box of the segment.