Android Java SDK for Sygic 3D
ApiItinerary Class Reference

Static Public Member Functions

static void addItinerary (ArrayList< StopOffPoint > pointArr, String itineraryName, int maxTime) throws GeneralException
 Creates itinerary and fills it with items from array of waypoints. More...
 
static void addItinerary (String itineraryJson, String itineraryName, int maxTime) throws GeneralException
 Creates itinerary from JSON string. More...
 
static void setRoute (String itineraryName, int flags, int maxTime) throws NavigationException
 Computes route based on given itinerary, and it starts navigation when there is a valid GPS signal, otherwise it waits for a valid signal. More...
 
static void addEntryToItinerary (String itineraryName, StopOffPoint stopOffPoint, int index, int maxTime) throws GeneralException
 Adds new waypoint to taken itinerary. More...
 
static void deleteEntryInItinerary (String itineraryName, int index, int maxTime) throws GeneralException
 Deletes waypoint from itinerary at taken position. More...
 
static void deleteItinerary (String itineraryName, int maxTime) throws GeneralException
 Deletes taken itinerary. More...
 
static ArrayList< StopOffPointgetItineraryList (String itineraryName, int maxTime) throws GeneralException
 Returns list of waypoints in itinerary. More...
 
static void skipNextWaypoint (int maxTime) throws GeneralException
 Skips the next waypoint. More...
 
static boolean optimizeRoute (int maxTime) throws GeneralException
 Optimizes route comprised of waypoints. More...
 
static String calculateRoute (String route, int maxTime) throws GeneralException
 

Member Function Documentation

◆ addEntryToItinerary()

static void addEntryToItinerary ( String  itineraryName,
StopOffPoint  stopOffPoint,
int  index,
int  maxTime 
) throws GeneralException
static

Adds new waypoint to taken itinerary.

Parameters
itineraryNameName of itinerary where new item will be added.
stopOffPointmodel.StopOffPoint instance which contains information about waypoint to be added to itinerary.
indexIndex of position where new waypoint will be inserted.
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Exceptions
GeneralExceptionthe general exception

References Api.getInstance(), Api.getService(), and StopOffPoint.writeBundle().

◆ addItinerary() [1/2]

static void addItinerary ( ArrayList< StopOffPoint pointArr,
String  itineraryName,
int  maxTime 
) throws GeneralException
static

Creates itinerary and fills it with items from array of waypoints.

Parameters
pointArrArrayList of model.StopOffPoint items which will be inserted into itinerary.
itineraryNameItinerary name.
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Exceptions
GeneralExceptionthe general exception
See also
setRoute ApiNavigation.getRouteStatus

References Api.getInstance(), Api.getService(), and StopOffPoint.writeBundle().

◆ addItinerary() [2/2]

static void addItinerary ( String  itineraryJson,
String  itineraryName,
int  maxTime 
) throws GeneralException
static

Creates itinerary from JSON string.

Parameters
itineraryJsonItinerary in JSON format.
itineraryNameItinerary name.
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Exceptions
GeneralExceptionGeneralException#getCode()
Remarks
See the documentation about the JSON structure
See also
setRoute ApiNavigation.getRouteStatus

References Api.getInstance(), and Api.getService().

◆ calculateRoute()

static String calculateRoute ( String  route,
int  maxTime 
) throws GeneralException
static

◆ deleteEntryInItinerary()

static void deleteEntryInItinerary ( String  itineraryName,
int  index,
int  maxTime 
) throws GeneralException
static

Deletes waypoint from itinerary at taken position.

Parameters
itineraryNameName of itinerary where item will be deleted.
indexIndex in itinerary list which defines which waypoint will be deleted.
maxTimeMaximum of time (in milliseconds) function can take. If maxTime=0 function execution is not time limited.
Exceptions
GeneralExceptionthe general exception

References Api.getInstance(), and Api.getService().

◆ deleteItinerary()

static void deleteItinerary ( String  itineraryName,
int  maxTime 
) throws GeneralException
static

Deletes taken itinerary.

Parameters
itineraryNameName of itinerary to delete.
maxTimeMaximum of time (in milliseconds) function can take. If maxTime=0 function execution is not time limited.
Exceptions
GeneralExceptionthe general exception

References Api.getInstance(), and Api.getService().

◆ getItineraryList()

static ArrayList<StopOffPoint> getItineraryList ( String  itineraryName,
int  maxTime 
) throws GeneralException
static

Returns list of waypoints in itinerary.

Parameters
itineraryName>Name of itinerary from which waypoints will be retrieved. If the name of itinerary is "default", function returns the list of waypoints from current route.
maxTimeMaximum of time (in milliseconds) function can take. If maxTime=0 function execution is not time limited.
Returns
ArrayList of model.StopOffPoint items which will contain waypoints of itinerary after function execution.
Exceptions
GeneralExceptionthe general exception

References Api.getInstance(), Api.getService(), and StopOffPoint.readBundle().

◆ optimizeRoute()

static boolean optimizeRoute ( int  maxTime) throws GeneralException
static

Optimizes route comprised of waypoints.

Parameters
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Exceptions
GeneralExceptionthe general exception
Returns
true if the optimization was successful, otherwise false (route is not calculated, or internet connectivity problem)
Remarks
The optimization rearanges the waypoints and recalculates the route so that the final route yields the best result in length.
When the optimization is finished the navigation sends the event EVENT_OPTIMIZATION_FINISHED, see events.ApiEvents.
The data associated with the event equals to the string "0" if the operation is successful, otherwise an error is indicated.
Please note that this function requires internet connectivity as it is the online function.
The usage of this function requires setting of credentials in settings.ini. So if you do not have it, please contact your sales representative.

References Api.getInstance(), and Api.getService().

◆ setRoute()

static void setRoute ( String  itineraryName,
int  flags,
int  maxTime 
) throws NavigationException
static

Computes route based on given itinerary, and it starts navigation when there is a valid GPS signal, otherwise it waits for a valid signal.

Parameters
itineraryNameName of the itinerary which will be used to compute route.
flagsParameter flags determines route computing properties.
maxTimeMaximum of time (in milliseconds) function can take. If maxTime=0 function execution is not time limited.
Exceptions
NavigationExceptionthe navigation exception
Remarks
Parameter flags determines route computing preferences. Possible values are enumerated in ApiNavigation class. For example it is possible to ask user to avoid toll roads or (later) notify user that not all toll roads can be avoided.
To join more flags together use logical "or" operator.
Itinerary used to compute route must contain a waypoint of the type "finish". If you do not have valid GPS position a route will only be calculated when the first waypoint is of the type "start".

Example

This code starts computing route from the itinerary MyItin. When computed route contains toll roads, navigation asks user to avoid them. If toll roads can not be avoided, navigation notifies user about this.

  String strItineraryName = "MyItin";
  int flags = ApiNavigation.MESSAGE_AVOID_TOLL_ROADS_ENABLE;
  int maxTime = 3000;
  ApiItinerary.setRoute(strItineraryName, flags, maxTime);
See also
ApiNavigation.getRouteStatus

References Api.getInstance(), and Api.getService().

◆ skipNextWaypoint()

static void skipNextWaypoint ( int  maxTime) throws GeneralException
static

Skips the next waypoint.

Parameters
maxTimeMaximum of time (in milliseconds) function can take. If maxTime=0 function execution is not time limited.
Exceptions
GeneralExceptionthe general exception

References Api.getInstance(), and Api.getService().