MapTrip SDK Android Manual 9.10.8
 
Loading...
Searching...
No Matches
Navigation Class Reference

This class enables Route calculations and Route Guidance
More...

+ Inheritance diagram for Navigation:

Public Member Functions

void addTaskListener (TaskListener listener)
 
Task< Void > calculateFlavoredRoutes ()
 
Task< Void > calculateRoute ()
 
Task< Void > calculateRoutes (final int numRoutes)
 
boolean equals (Object o)
 
String getFlavor ()
 
native FollowMeRoute getInjectedFollowMeRoute ()
 
native Itinerary getItinerary ()
 
String getNextCrosswayGeometry (final NavGeometryFormat format)
 
Iterable< PolygongetRouteExtents (final boolean fromCurrentRoute, final boolean currentRouteFromCurrentPosition, final double lengthInMeters)
 
Navigation getRouteNumber (final int routeNumber)
 
int getRouteStatistic (final NavRouteStatistic statisticitem, final int firstStop, final int lastStop)
 
int getRouteStatisticForCountry (final String countryIsoCode, final NavRouteStatistic statisticitem, final int firstStop, final int lastStop)
 
Iterable< TrafficgetTrafficEvents ()
 
native ApiError injectFollowMeRoute (FollowMeRoute fmr)
 
Iterable< WaypointlistUsedCountries (final int firstStop, final int lastStop)
 
 Navigation ()
 
void removeAllTaskListeners ()
 
void removeTaskListener (TaskListener listener)
 
native ApiError setItinerary (Itinerary itn)
 
Task< Void > setRoute (final String fileName)
 
ApiError setSimulationPosOnRoute (final double posOnRoute)
 
ApiError startNavigation ()
 
ApiError startSimulatedNavigation ()
 

Static Public Member Functions

static native ApiError activateRecklessRouting (boolean activate)
 
static void addNavigationListener (NavigationListener listener)
 
static ApiError blockRouteBySelection (final Selection selHandle)
 
static Navigation getActiveNavigation ()
 
static native ComputationSite getAllowedComputationSite ()
 
static native ComputationSite getAvailableComputationSites ()
 
static Iterable< PolygongetCurrentRoute ()
 
static native boolean getLezEnabled ()
 
static native LezGermanVignetteType getLezGermanVignette ()
 
static native boolean getRouteAvoidFerry ()
 
static native boolean getRouteAvoidHighway ()
 
static native boolean getRouteAvoidToll ()
 
static native int getRouteRecklessRadiusMeters ()
 
static native boolean getRouteUseOffboardTraffic ()
 
static native RoutingContext getRoutingContext ()
 
static native RoutingType getRoutingType ()
 
static double getTollCosts (final String keyValueDelimString)
 
static native boolean isLezDataAvailable ()
 
static native boolean isRecklessRoutingEnabled ()
 
static void removeAllNavigationListeners ()
 
static void removeNavigationListener (NavigationListener listener)
 
static int removeRouteBlockingSelection ()
 
static ApiError setAllowedComputationSite (final ComputationSite computationSite)
 
static ApiError setLezEnabled (final boolean lezEnabled)
 
static ApiError setLezGermanVignette (final LezGermanVignetteType lezVignette)
 
static ApiError setRouteAvoidFerry (final boolean avoid)
 
static ApiError setRouteAvoidHighway (final boolean avoid)
 
static ApiError setRouteAvoidToll (final boolean avoid)
 
static native ApiError setRouteRecklessRadiusMeters (int recklessRadiusMeters)
 
static ApiError setRouteUseOffboardTraffic (final boolean use)
 
static ApiError setRoutingContext (final RoutingContext routingContext)
 
static ApiError setRoutingType (final RoutingType routingType)
 
static ApiError setTollCosts (final double costsCentPerKm)
 
static native ApiError setUseNextRouteAsReferenceRoute (boolean nextRouteAsReferenceRoute)
 
static ApiError stopNavigation ()
 
static ApiError stopSimulatedNavigation ()
 
static native boolean UsingNextRouteAsReferenceRoute ()
 

Detailed Description

The Navigation class allow route calculation based on Itineraries. These Routes can be

  • displayed on the map by using Mapviewer.showRoute().
  • used for a navigation (route guidance) with audio instructions, automatic rerouting and feedback on the progress like Estimated Time of Arrival, distance to destination, lane info, speed warnings and more.
    After navigation has been started (Navigation.startNavigation()), the used route is displayed automatically in the map.

    The route calculation is an asynchronous process. A call to Navigation.calculateRoute() will return a Task object. The Navigation instance provides a set of listeners which can be registered and which provide information on the progress ( TaskListener.taskProgress() ) and finished state ( TaskListener.taskFinished() ) A task for a routing process can be created in different scenarios:
  • By the Navigation.calculateRoute() method, a task will be returned that indicates the routing progress and finished events when the route is calculated.
  • By the NavigationListener.rerouting() callback which indicates a rerouting for the navigation instance.

Each navigation instance can have one callback for the task progress and finished events. Therefore tasks can be compared with the isIdentical method For example: The task initiated with Navigation.calculateRoute() can be stored and compared to the task received in the TaskListener.taskFinished() to differ initial routing results from rerouting results.

Constructor & Destructor Documentation

◆ Navigation()

Member Function Documentation

◆ activateRecklessRouting()

static native ApiError activateRecklessRouting ( boolean  activate)
static

Enables or disables the reckless routing; aka emergency routing; aka blue light routing! If modified while a navigation is running a re-routing will be started.

If the reckless routing is activated, the routing (onboard and offboard) uses the settings.ini parameter [ROUTING] ProfileBLROutside=-oneway,+blocked,-residential,+buslanes,-turns ProfileBLRInside=+oneway,+blocked,-residential,+buslanes,+turns

If the reckless routing is deactivated, the routing (onboard and offboard) uses the settings.ini parameter [ROUTING] ProfileNormalRouting=-oneway,-blocked,-residential,-buslanes,-turns

Parameters
activate
Returns
Errorcode

◆ addNavigationListener()

static void addNavigationListener ( NavigationListener  listener)
static

◆ addTaskListener()

void addTaskListener ( TaskListener  listener)

◆ blockRouteBySelection()

static ApiError blockRouteBySelection ( final Selection  selHandle)
static

Blocks the route by all polylines, contained in the Selection.

Parameters
selHandle- The Selection object

◆ calculateFlavoredRoutes()

Task< Void > calculateFlavoredRoutes ( )

Like calculateRoute a set of routes based on the Itinerary is calculated. The amount of calculated routes is defined by the following settings parameters of the [ROUTING] section AlternativeRoutesFlavorsTruck, AlternativeRoutesFlavorsBus or AlternativeRoutesFlavorsCar, according to the current vehicle type. Each of these parameters contain a list of flavor names separated by semicolons. The following flavors are supported: DYNAMIC Normal route calculation DIRECT Route calculation without traffic and only using the average speeds from the statistical traffic data. However, the statistical traffic data and the current traffic are taken into account for the ETA calculation. LESS_TOLL Toll roads are not avoided, but are included in the calculation at a slightly higher cost. Additional parameters are required for this. See below.

Returns
a task that asynchronously calculates the route. By registering the task callbacks for a navigation instance, the state of the route calculation can be retrieved.
The task can return (BaseTask.getReturnValue()) the following Errorcodes Additionally the route calculation can return error codes that indicate a warning. In this case a route is calculated but the user should be informed about an exceptional situation e.g. if the destination can not be reached with the configured vehicle. If you get the warning code ApiError.WARNING_ROUTE_OBST_FOUND, you can still use the calculated route. In this case, you can call mta_tsk_getLastErrorDescription, to get a separated string with all obstacles codes found on the route. E.g.: If you have calculated three routes, and the first and the third route use blocked roads, and the first and the second route are violating some truck attributes you get a string like this: 'ROUTE_LIST[MTA_WARNING_ROUTE_OBST{7,8};MTA_WARNING_ROUTE_OBST{7};MTA_WARNING_ROUTE_OBST{8}]' See MTA_OBSTACLES_ON_ROUTE for more details about the obstacle codes.
 @arg @ref MTA_ERROR "ApiError.WARNING_ROUTE_OBST_FOUND" The route contains one or more obstacles

◆ calculateRoute()

Task< Void > calculateRoute ( )

Calculates a route based on the Itinerary

Precondition
Requires: previous call to Navigation.setItinerary() with a valid Itinerary.

Returns
a task that asynchronously calculates the route. By registering the task callbacks for a navigation instance, the state of the route calculation can be retrieved.
The task can return (BaseTask.getReturnValue()) the following Errorcodes Additionally the route calculation can return error codes that indicate a warning. In this case a route is calculated but the user should be informed about an exceptional situation e.g. if the destination can not be reached with the configured vehicle. If you get the warning code ApiError.WARNING_ROUTE_OBST_FOUND, you can still use the calculated route. In this case, you can call mta_tsk_getLastErrorDescription, to get a separated string with all obstacles codes found on the route. E.g.: If you have calculated three routes, and the first and the third route use blocked roads, and the first and the second route are violating some truck attributes you get a string like this: 'ROUTE_LIST[MTA_WARNING_ROUTE_OBST{7,8};MTA_WARNING_ROUTE_OBST{7};MTA_WARNING_ROUTE_OBST{8}]' See MTA_OBSTACLES_ON_ROUTE for more details about the obstacle codes.
 @arg @ref MTA_ERROR "ApiError.WARNING_ROUTE_OBST_FOUND" The route contains one or more obstacles

◆ calculateRoutes()

Task< Void > calculateRoutes ( final int  numRoutes)

Calculates numRoutes routes based on the Itinerary

Returns
a task that asynchronously calculates the route. By registering the task callbacks for a navigation instance, the state of the route calculation can be retrieved.
The task can return (BaseTask.getReturnValue()) the following Errorcodes Additionally the route calculation can return error codes that indicate a warning. In this case a route is calculated but the user should be informed about an exceptional situation e.g. if the destination can not be reached with the configured vehicle. If you get the warning code ApiError.WARNING_ROUTE_OBST_FOUND, you can still use the calculated route. In this case, you can call mta_tsk_getLastErrorDescription, to get a separated string with all obstacles codes found on the route. E.g.: If you have calculated three routes, and the first and the third route use blocked roads, and the first and the second route are violating some truck attributes you get a string like this: 'ROUTE_LIST[MTA_WARNING_ROUTE_OBST{7,8};MTA_WARNING_ROUTE_OBST{7};MTA_WARNING_ROUTE_OBST{8}]' See MTA_OBSTACLES_ON_ROUTE for more details about the obstacle codes.
 @arg @ref MTA_ERROR "ApiError.WARNING_ROUTE_OBST_FOUND" The route contains one or more obstacles

◆ equals()

boolean equals ( Object  o)
inherited

◆ getActiveNavigation()

static Navigation getActiveNavigation ( )
static

Returns
The active navigation. If there is no active navigation, then the returned object is invalid. Call Api.getLastError() to check whether the returned object is valid.

◆ getAllowedComputationSite()

static native ComputationSite getAllowedComputationSite ( )
static

Returns
Retrieves the routing sites, which are currently allowed.

◆ getAvailableComputationSites()

static native ComputationSite getAvailableComputationSites ( )
static

Returns
the routing sites, which are possible with this configuration.

◆ getCurrentRoute()

static Iterable< Polygon > getCurrentRoute ( )
static

Returns
an iterator of the segments of the currently used route.

See documentation "navigation.md", chapter "Get detailed route information for each route segment" for more details on how to use this function to get detailed information about the current route.

Precondition
Requires: previous successful call to Navigation.startNavigation() or Navigation.startSimulatedNavigation().

Returns
Errorcode

◆ getFlavor()

String getFlavor ( )

Returns the flavor of the current route.

◆ getInjectedFollowMeRoute()

native FollowMeRoute getInjectedFollowMeRoute ( )

Returns the FollowMeRoute, that is injected by Navigation.injectFollowMeRoute() If no FollowMeRoute was injected, ApiError.OBJ_NOT_FOUND is returned.

◆ getItinerary()

native Itinerary getItinerary ( )

Returns
the itinerary of the current navigation.

◆ getLezEnabled()

static native boolean getLezEnabled ( )
static

Returns
true if routing for Low emission zones is active

◆ getLezGermanVignette()

static native LezGermanVignetteType getLezGermanVignette ( )
static

Get german vignette type (Umweltzonenplakettentyp) for low emission zones routing.

Returns
LezGermanVignetteType

◆ getNextCrosswayGeometry()

String getNextCrosswayGeometry ( final NavGeometryFormat  format)

Returns the geometry of the next crossway of interest of an active guidance.

Parameters
format- The format of the result (see NavGeometryFormat)
Returns
The result string

◆ getRouteAvoidFerry()

static native boolean getRouteAvoidFerry ( )
static

Returns
true if avoiding Ferries

◆ getRouteAvoidHighway()

static native boolean getRouteAvoidHighway ( )
static

Returns
true if avoiding highways

◆ getRouteAvoidToll()

static native boolean getRouteAvoidToll ( )
static

Returns
true if avoiding toll roads

◆ getRouteExtents()

Iterable< Polygon > getRouteExtents ( final boolean  fromCurrentRoute,
final boolean  currentRouteFromCurrentPosition,
final double  lengthInMeters 
)

Parameters
fromCurrentRoute-true to calculate the extend only for the current interstation, false to calculate over all interstations
currentRouteFromCurrentPosition- true to calculate the extend from the current position, false to calculate for the whole route
lengthInMeters- maximum route length in meters that the extend will cover
Returns
A polygon for every interstation defining the routes extent.
Precondition
Requires: previous successful call to Navigation.calculateRoute().

◆ getRouteNumber()

Navigation getRouteNumber ( final int  routeNumber)

Returns a new navigation object with the given route (routeNumber) selected.

Parameters
rootNavHandle- The navigation handle on which multiple routes have been calculated
rootNumber- The route number to select (beginning with 0)
Returns
Errorcode

◆ getRouteRecklessRadiusMeters()

static native int getRouteRecklessRadiusMeters ( )
static

Get the emergency routing (reckless driving) radius in meters.

Returns
reckless radius in meters (0 when deactivated)
Errorcode

◆ getRouteStatistic()

int getRouteStatistic ( final NavRouteStatistic  statisticitem,
final int  firstStop,
final int  lastStop 
)

Calculates a statistic of a selected type (e.g. fuel consumption or route length) for a specific start Waypoint to a specific end Waypoint in the Itinerary.

Parameters
statisticitem- Defines which statistic item shall be calculated like driving time or route length (see NavRouteStatistic)
firstStop- Index of the first Waypoint in the Itinerary that shall be included in the statistic calculations.
lastStop- Index of the last Waypoint in the Itinerary that shall be included in the statistic calculations
Returns
  • if > 0 a summarized statistic value for the selected statisticitem and the given range of stops
  • if < 0 an errorcode of ApiError

◆ getRouteStatisticForCountry()

int getRouteStatisticForCountry ( final String  countryIsoCode,
final NavRouteStatistic  statisticitem,
final int  firstStop,
final int  lastStop 
)

Retrieves the toll length of a specific country for the selected routes.

Parameters
countryIsoCode- The country iso code ISO 3166-1 alpha-3 (e.g. "deu" for Germany)
statisticitem- Defines which statistic item shall be calculated like driving time or route length (see NavRouteStatistic)
firstStop- Index of the first Waypoint in the Itinerary that shall be included in the statistic calculations.
lastStop- Index of the last Waypoint in the Itinerary that shall be included in the statistic calculations
Returns
  • if > 0 a summarized toll length for the given range of stops
  • if < 0 an errorcode of ApiError

◆ getRouteUseOffboardTraffic()

static native boolean getRouteUseOffboardTraffic ( )
static

See Navigation.setRouteUseOffboardTraffic() for a detailed description.

Returns
true if the offboard routing will take the current traffic for the route calculation into account.

◆ getRoutingContext()

static native RoutingContext getRoutingContext ( )
static

Retrieves the (offboard) routing context for navigation

Returns
Routing context. See RoutingContext

◆ getRoutingType()

static native RoutingType getRoutingType ( )
static

Returns
Retrieves the routing objective for navigation (fastest, shortest...)

◆ getTollCosts()

static double getTollCosts ( final String  keyValueDelimString)
static

Retrieve Toll costs in cent per kilometer for a given vehicle type and weight. Currently the toll costs are only available for Germany (TollCollect).

Parameters
keyValueDelimStringa string containing key-value pairs separated by ';' and key and value separated by '='. Valid keys are currently VEHICLE_TOTAL_WEIGHT_KG, VEHICLE_NUMBER_OF_AXLES, CO2_EMISSION_CLASS and EURO_POLLUTION_CLASS example: "VEHICLE_TOTAL_WEIGHT_KG=12000;VEHICLE_NUMBER_OF_AXLES=2;CO2_EMISSION_CLASS=4;EURO_POLLUTION_CLASS=5" should return the toll costs for a truck with 12t total weight, 2 axles, CO2 emission class 4 and Euro pollution class 5 which is currently 22.5 cent per kilometer. The TollCosts.xml file in the 'res' folder contains all possible costs, as well as a list of all permitted parameters.
Returns
Toll costs in cent per kilometer

◆ getTrafficEvents()

Iterable< Traffic > getTrafficEvents ( )

Get all traffic events along the current route from the current position. If the current position in inside of an event, you get the full event with the complete delay and length!

◆ injectFollowMeRoute()

native ApiError injectFollowMeRoute ( FollowMeRoute  fmr)

Instead of setting an itinerary, you may inject a FollowMeRoute as a "destination". If you start a Navigation with an injected FollowMeRoute, some things change:

  • The route calculation uses the starting point of the FollowMeRoute as the destination.
  • The distance to the destination and the remaining driving time is the sum of the ordinary route and the FollowMeRoute.
  • If you show this Navigation o a map, the FollowMeRoute is shown too. It is still possible to calculate alternative routes an you still get route updates, if you use online routing.
    Parameters
    fmr- the FollowMeRoute, that should be injected.
    Returns
    Errorcode

◆ isLezDataAvailable()

static native boolean isLezDataAvailable ( )
static

Returns
true if Low emission zone data is available in the dataset

◆ isRecklessRoutingEnabled()

static native boolean isRecklessRoutingEnabled ( )
static

Returns true, if reckless routing is enabled.

◆ listUsedCountries()

Iterable< Waypoint > listUsedCountries ( final int  firstStop,
final int  lastStop 
)

Lists all countries that are used by this route.

Parameters
firstStop- Index of the first Waypoint in the Itinerary that shall be included in the statistic calculations.
lastStop- Index of the last Waypoint in the Itinerary that shall be included in the statistic calculations
Returns
iterator of Waypoints containing country information (No valid geocoordinates). Elements are ordered by country code.

◆ removeAllNavigationListeners()

static void removeAllNavigationListeners ( )
static

◆ removeAllTaskListeners()

void removeAllTaskListeners ( )

◆ removeNavigationListener()

static void removeNavigationListener ( NavigationListener  listener)
static

◆ removeRouteBlockingSelection()

static int removeRouteBlockingSelection ( )
static

Releases the blocking performed by Navigation.blockRouteBySelection().

Returns
Errorcode

◆ removeTaskListener()

void removeTaskListener ( TaskListener  listener)

◆ setAllowedComputationSite()

static ApiError setAllowedComputationSite ( final ComputationSite  computationSite)
static

Sets the allowed routing sites.

Parameters
computationSiteSee ComputationSite
Returns
Errorcode

◆ setItinerary()

native ApiError setItinerary ( Itinerary  itn)

Parameters
itn- the itinerary for the navigation. It is not possible to change the itinerary of the running navigation. Call mta_nav_stopNavigation before.
Returns
Errorcode

◆ setLezEnabled()

static ApiError setLezEnabled ( final boolean  lezEnabled)
static

Parameters
lezEnabled- true to enable low emission zones routing
Returns
Errorcode

◆ setLezGermanVignette()

static ApiError setLezGermanVignette ( final LezGermanVignetteType  lezVignette)
static

Parameters
lezVignettetype of the german Vignette (Umweltzonenplakettentyp) that will be respected by routing
Returns
Errorcode

◆ setRoute()

Task< Void > setRoute ( final String  fileName)

Use this function instead of Navigation.calculateRoute(), if you have already an advised route from a iwRouting server. This function opens the route (with the path, provided by the fileName parameter), creates an itinerary with the first an the last point of the route file and does some internal wiring to handle this route as an ordinary calculated route. Beware, that there will only survive the destination, if a rerouting occours.

Returns
a task, containing the result, equal to the task, returned by Navigation.calculateRoute(). By registering the task callbacks for a navigation instance, the state of the route calculation can be retrieved.
The task can return (BaseTask.getReturnValue()) the following Errorcodes

◆ setRouteAvoidFerry()

static ApiError setRouteAvoidFerry ( final boolean  avoid)
static

Parameters
avoidif true the routing will avoid Ferries. If set while a navigation is running a re-routing will be started.
Returns
Errorcode

◆ setRouteAvoidHighway()

static ApiError setRouteAvoidHighway ( final boolean  avoid)
static

Parameters
avoidif true the routing will avoid highways. If set while a navigation is running a re-routing will be started.
Returns
Errorcode

◆ setRouteAvoidToll()

static ApiError setRouteAvoidToll ( final boolean  avoid)
static

Parameters
avoidif true the routing will avoid Toll routes. If set while a navigation is running a re-routing will be started.
Returns
Errorcode

◆ setRouteRecklessRadiusMeters()

static native ApiError setRouteRecklessRadiusMeters ( int  recklessRadiusMeters)
static

Set the emergency routing (reckless driving) radius in meters. If set while a navigation is running a re-routing will be started.

When set to a value greater then 0, forbidden maneuvers and one-way streets that lie within the given radius around the destination are ignored, i.e. can be used for navigation. When set to 0 then emergency routing is deactivated. This functionality is intended for police or emergency services to reach the location of an emergency as fast as possible.

Parameters
recklessRadiusMeters
Returns
Errorcode

◆ setRouteUseOffboardTraffic()

static ApiError setRouteUseOffboardTraffic ( final boolean  use)
static

If you have a license for offboard route calculation, the SDK will get all routes from the infoware routing servers. These servers take by default the current traffic for the route calculation into account. With this setter, you may switch off the usage of the traffic information. Then, the routing server will only use statistical traffic information for every further route calculation, unless you switch it on again. Be aware, that this setting will be persisted in the settings.ini (section '[ROUTING]', key name 'UseOffboardTraffic') and therefore is still active after a new start of your application.

Parameters
useif false, the offboard routing will not take the current traffic for the route calculation into account.
Returns
Errorcode

◆ setRoutingContext()

static ApiError setRoutingContext ( final RoutingContext  routingContext)
static

Sets the (offboard) routing context for navigation

Parameters
routingContextSee RoutingContext
Returns
Errorcode

◆ setRoutingType()

static ApiError setRoutingType ( final RoutingType  routingType)
static

Sets the routing objective for navigation

Parameters
routingTypeSee RoutingType
Returns
Errorcode

◆ setSimulationPosOnRoute()

ApiError setSimulationPosOnRoute ( final double  posOnRoute)

Sets the start position of the next OR current simulated navigation

Returns
Errorcode

◆ setTollCosts()

static ApiError setTollCosts ( final double  costsCentPerKm)
static

Sets the toll costs persistent for every further route calculation. The unit is cent per kilometer.

◆ setUseNextRouteAsReferenceRoute()

static native ApiError setUseNextRouteAsReferenceRoute ( boolean  nextRouteAsReferenceRoute)
static

Sets whether the next calculated route should be used as reference route for rerouting. If set to true, the next calculated route will be stored as reference route and used for future rerouting operations. Default is false.

Parameters
nextRouteAsReferenceRoute- true to use the next calculated route as reference route
Returns
Errorcode

◆ startNavigation()

ApiError startNavigation ( )

Non-blocking call
Starts the navigation (route guidance) process. If a navigation shall be started based on a GPS log see Gps.

Precondition
Requires: previous successful call to Navigation.calculateRoute().

Returns
Errorcode

◆ startSimulatedNavigation()

ApiError startSimulatedNavigation ( )

The navigation is started along the calculated route with a fake GPS signal along the calculated route.
This feature is meant to be used for development and debugging purpose.

Precondition
Requires: previous successful call to Navigation.calculateRoute().

Returns
Errorcode

◆ stopNavigation()

static ApiError stopNavigation ( )
static

Stops the navigation (route guidance) process

Returns
Errorcode

◆ stopSimulatedNavigation()

static ApiError stopSimulatedNavigation ( )
static

Stops the simulated navigation.

Returns
Errorcode

◆ UsingNextRouteAsReferenceRoute()

static native boolean UsingNextRouteAsReferenceRoute ( )
static

Returns
true if the next calculated route will be used as reference route for rerouting

The documentation for this class was generated from the following file: