TransitRoutingEngine (API Reference)
Class TransitRoutingEngine
Use the TransitRoutingEngine to calculate a public transit route from A to B with a number of waypoints in between. Route calculation is done asynchronously and requires an online connection. The resulting route contains various information such as the polyline, route length in meters, estimated time to traverse along the route and maneuver data.
Note: Clients need to explicitly call dispose() in order to prevent a possible, though
unlikely, deadlock on destruction.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of this class.TransitRoutingEngine(SDKNativeEngine sdkEngine) Creates a new instance of TransitRoutingEngine. -
Method Summary
Modifier and TypeMethodDescriptioncalculateRoute(TransitWaypoint startingPoint, TransitWaypoint destination, TransitRouteOptions routeOptions, CalculateRouteCallback callback) Asynchronously calculates a public transit route from the origin to the destination.voiddispose()Cancels pending requests and closes the background worker thread.
-
Constructor Details
-
TransitRoutingEngine
Creates a new instance of this class.
- Throws:
InstantiationErrorException-Indicates what went wrong when the instantiation was attempted.
-
TransitRoutingEngine
Creates a new instance of TransitRoutingEngine.
- Parameters:
sdkEngine-An SDKEngine instance.
- Throws:
InstantiationErrorException-Indicates what went wrong when the instantiation was attempted.
-
-
Method Details
-
calculateRoute
@NonNull public TaskHandle calculateRoute(@NonNull TransitWaypoint startingPoint, @NonNull TransitWaypoint destination, @NonNull TransitRouteOptions routeOptions, @NonNull CalculateRouteCallback callback) Asynchronously calculates a public transit route from the origin to the destination.
- Parameters:
startingPoint-Position of starting point.
destination-Position of destination.
routeOptions-Options for public transit route calculation.
callback-Callback object that will be invoked after route calculation. It is always invoked on the main thread.
- Returns:
Handle that will be used to manipulate the execution of the task.
-
dispose
public void dispose()Cancels pending requests and closes the background worker thread. Note: This method should be called from main thread.
-