public final class

DirectionsApi

extends Object
java.lang.Object
   ↳ com.steerpath.sdk.directions.DirectionsApi

Class Overview

The Directions API is the main entry point to the directions subsystem of the Steerpath platform. The typical use is to obtain a reference to it using the getInstance() static method.

For directions there are two separate but related steps: Calculating a route and estimating the time of travel when taking that route.

Routes are calculated based on a network of possible paths that can be taken. In this network, different route types are marked, such as elevators, escalators and even buses and trains. Each different type is assigned two different costs, a cost to enter it and a cost along it.

While cost is an abstract concept, for simplicity, cost in routing can be thought of as time spent, so the cost to enter is the time spent waiting and the cost along is the time it will take to walk a given length of on the path: e.g. the time spent waiting for an elevator and the time spent moving whilst on an elevator. However these costs are not the same as the estimated travel time shown to users. The reason why they differ is that in some cases a route segment may need to be made more or less attractive without affecting the shown estimated time. For example walking past a some waste disposal area may be a fast route, but one that should generally not be used unless the user is very near by.

The current default costs are as follows:

  • Elevator: 20 to enter, 0.5 per meter
  • Stairs: 0 to enter, 3.0 per meter
  • Escalator: 0 to enter, 3.0 per meter
  • Train, bus: 10 to enter, 0.4 per meter


For the time estimation a much more simple system is currently used. This system estimates pedestrian movement to happen at 1 meter per second on average.

Summary

Public Methods
void addRouteTile(File file)
Adds synchronously single route tile.
void cancelTask(DirectionsRequestImpl request)
Unfortunate internal method made public.
void clearRouteTileCache()
A utility function to clear downloaded cached data.
static DirectionsApi getInstance()
Obtain a reference to the directions api implementation.
DirectionsRequest startCalculatingDirections(Context context, DirectionsRequest directionsRequest, DirectionsListener directionsListener)
Start calculating a solution to a DirectionsRequest.
void updateRouteDatabase(Context context)
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void addRouteTile (File file)

Adds synchronously single route tile. Don't call this from the main thread.

public void cancelTask (DirectionsRequestImpl request)

Unfortunate internal method made public. Do not call.

public void clearRouteTileCache ()

A utility function to clear downloaded cached data. Subsequent call to startCalculatingDirections() will download fresh directions data from the server.

public static DirectionsApi getInstance ()

Obtain a reference to the directions api implementation.

Returns
  • a singleton instance of the directions api

public DirectionsRequest startCalculatingDirections (Context context, DirectionsRequest directionsRequest, DirectionsListener directionsListener)

Start calculating a solution to a DirectionsRequest.

Parameters
context the context in which this directions calculation should be performed.
directionsRequest the request for directions to be fulfilled by this calculation
directionsListener the listener implementation which will get the result
Returns
  • the DirectionsRequest provided which can be used to monitor the progress

public void updateRouteDatabase (Context context)