Package globus.glroute
Class GLRouteTracker
java.lang.Object
globus.glmap.GLNativeObject
globus.glroute.GLRouteTracker
GLMapRouteTracker tracks user location on route and returns statistics and maneuver
info-
Constructor Summary
ConstructorsConstructorDescriptionGLRouteTracker(GLRoute data) Initializes new trackerGLRouteTracker(GLRoute[] routes, int currentRoute) Initializes a tracker with array of routes. -
Method Summary
Modifier and TypeMethodDescriptionbboxForSegment(double length) Calculates the bounding box of a route segment from the last location.bboxForSegment(GLMapBBox bbox, double length) Calculates the bounding box of a route segment from the last location.booleandidPassPoint(MapGeoPoint point, double maxDistance) Checks whether the user has passed the specified point along the tracked route.booleandidPassRoute(int routeIndex) Checks if user pass the routedoubleReturns the bearing angle of the current route segment.intReturns index of current routeintIndex of current target pointdoubleReturns the lateral distance from the user to the route geometry.doubleReturns distance to the last point of the active route.doubleReturns distance to the next maneuver.Returns the user's projected location on the route.doubleReturns the progress index of the current route.doubleReturns the remaining distance of the route.doubleReturns the remaining travel time to the end of the route.booleanReturns true if user on routevoidsetCurrentRoute(int index) Sets index of current routevoidsetCurrentTargetPointIndex(int index) Sets index of current target pointupdateLocation(double lat, double lon, float bearing) Finds the next maneuver and refreshes cached navigation stats for the current position.Methods inherited from class globus.glmap.GLNativeObject
dispose
-
Constructor Details
-
GLRouteTracker
Initializes new tracker- Parameters:
data- route data
-
GLRouteTracker
Initializes a tracker with array of routes. Tracker will automatically switch to other routes if possible.- Parameters:
routes- array of routes to trackcurrentRoute- index of current route
-
-
Method Details
-
updateLocation
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
nullif 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
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
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:
trueif the user passed the point,falseotherwise.
-
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
Calculates the bounding box of a route segment from the last location.- Parameters:
bbox- object to fill with datalength- The length in meters of the segment.- Returns:
- The box with filled data for segment.
-
bboxForSegment
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.
-