AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.Navigation Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.Navigation:
com.google.appinventor.components.runtime.AndroidNonvisibleComponent com.google.appinventor.components.runtime.Component com.google.appinventor.components.runtime.Component

Classes

enum  TransportMethod
 

Public Member Functions

 Navigation (ComponentContainer container)
 
void RequestDirections ()
 
void ServiceURL (String url)
 
void ApiKey (String key)
 
void StartLatitude (double latitude)
 
double StartLatitude ()
 
void StartLongitude (double longitude)
 
double StartLongitude ()
 
void StartLocation (MapFeature feature)
 
void EndLatitude (double latitude)
 
double EndLatitude ()
 
void EndLongitude (double longitude)
 
double EndLongitude ()
 
String TransportationMethod ()
 
void TransportationMethod (String method)
 
void EndLocation (MapFeature feature)
 
void Language (String language)
 
String Language ()
 
YailDictionary ResponseContent ()
 
void GotDirections (YailList directions, YailList points, double distance, double duration)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
HandlesEventDispatching getDispatchDelegate ()
 

Static Public Attributes

static final String OPEN_ROUTE_SERVICE_URL
 
- Static Public Attributes inherited from com.google.appinventor.components.runtime.Component
static final String ASSET_DIRECTORY = "component"
 
static final int ALIGNMENT_NORMAL = 0
 
static final int ALIGNMENT_CENTER = 1
 
static final int ALIGNMENT_OPPOSITE = 2
 
static final int ACCELEROMETER_SENSITIVITY_WEAK = 1
 
static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2
 
static final int ACCELEROMETER_SENSITIVITY_STRONG = 3
 
static final int BUTTON_SHAPE_DEFAULT = 0
 
static final int BUTTON_SHAPE_ROUNDED = 1
 
static final int BUTTON_SHAPE_RECT = 2
 
static final int BUTTON_SHAPE_OVAL = 3
 
static final int COLOR_NONE = 0x00FFFFFF
 
static final int COLOR_BLACK = 0xFF000000
 
static final int COLOR_BLUE = 0xFF0000FF
 
static final int COLOR_CYAN = 0xFF00FFFF
 
static final int COLOR_DKGRAY = 0xFF444444
 
static final int COLOR_GRAY = 0xFF888888
 
static final int COLOR_GREEN = 0xFF00FF00
 
static final int COLOR_LTGRAY = 0xFFCCCCCC
 
static final int COLOR_MAGENTA = 0xFFFF00FF
 
static final int COLOR_ORANGE = 0xFFFFC800
 
static final int COLOR_PINK = 0xFFFFAFAF
 
static final int COLOR_RED = 0xFFFF0000
 
static final int COLOR_WHITE = 0xFFFFFFFF
 
static final int COLOR_YELLOW = 0xFFFFFF00
 
static final int COLOR_DEFAULT = 0x00000000
 
static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF"
 
static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000"
 
static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF"
 
static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF"
 
static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444"
 
static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888"
 
static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00"
 
static final String DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC"
 
static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF"
 
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
 
static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF"
 
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
 
static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF"
 
static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00"
 
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
 
static final float FONT_DEFAULT_SIZE = 14
 
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
 
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
 
static final int SCALING_SCALE_PROPORTIONALLY = 0
 
static final int SCALING_SCALE_TO_FIT = 1
 
static final int TYPEFACE_DEFAULT = 0
 
static final int TYPEFACE_SANSSERIF = 1
 
static final int TYPEFACE_SERIF = 2
 
static final int TYPEFACE_MONOSPACE = 3
 
static final int LENGTH_PREFERRED = -1
 
static final int LENGTH_FILL_PARENT = -2
 
static final int LENGTH_UNKNOWN = -3
 
static final int LENGTH_PERCENT_TAG = -1000
 
static final int TOAST_LENGTH_SHORT = 0
 
static final int TOAST_LENGTH_LONG = 1
 
static final int DIRECTION_NORTH = 1
 
static final int DIRECTION_NORTHEAST = 2
 
static final int DIRECTION_EAST = 3
 
static final int DIRECTION_SOUTHEAST = 4
 
static final int DIRECTION_SOUTH = -1
 
static final int DIRECTION_SOUTHWEST = -2
 
static final int DIRECTION_WEST = -3
 
static final int DIRECTION_NORTHWEST = -4
 
static final int DIRECTION_NONE = 0
 
static final int DIRECTION_MIN = -4
 
static final int DIRECTION_MAX = 4
 
static float SLIDER_MIN_VALUE = 10
 
static float SLIDER_MAX_VALUE = 50
 
static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = ""
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = ""
 

Additional Inherited Members

- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
 AndroidNonvisibleComponent (Form form)
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
final Form form
 

Detailed Description

The Navigation component generates directions between two locations using a service called OpenRouteService. You must provide a valid API key from that service in order for this component to work.

Definition at line 56 of file Navigation.java.

Constructor & Destructor Documentation

◆ Navigation()

com.google.appinventor.components.runtime.Navigation.Navigation ( ComponentContainer  container)

Creates a Navigation component.

Parameters
containercontainer, component will be placed in

Definition at line 93 of file Navigation.java.

Member Function Documentation

◆ ApiKey()

void com.google.appinventor.components.runtime.Navigation.ApiKey ( String  key)

API Key for Open Route Service. Obtain an API key at https://openrouteservice.org.

Parameters
keythe API key to use for authentication requests

Definition at line 150 of file Navigation.java.

◆ EndLatitude() [1/2]

double com.google.appinventor.components.runtime.Navigation.EndLatitude ( )

Definition at line 220 of file Navigation.java.

◆ EndLatitude() [2/2]

void com.google.appinventor.components.runtime.Navigation.EndLatitude ( double  latitude)

Definition at line 209 of file Navigation.java.

◆ EndLocation()

void com.google.appinventor.components.runtime.Navigation.EndLocation ( MapFeature  feature)

Definition at line 269 of file Navigation.java.

◆ EndLongitude() [1/2]

double com.google.appinventor.components.runtime.Navigation.EndLongitude ( )

Definition at line 238 of file Navigation.java.

◆ EndLongitude() [2/2]

void com.google.appinventor.components.runtime.Navigation.EndLongitude ( double  longitude)

Definition at line 227 of file Navigation.java.

◆ GotDirections()

void com.google.appinventor.components.runtime.Navigation.GotDirections ( YailList  directions,
YailList  points,
double  distance,
double  duration 
)

Event indicating that a request has finished and has returned data. The following parameters are provided:

  • directions: A list of text directions, such as "Turn left at Massachusetts Avenue".
  • points: A list of (latitude, longitude) points that represent the path to take. This can be passed to LineString#Points(YailList) to draw the line on a Map.
  • distance: Estimated distance for the route, in meters.
  • duration: Estimated duration for the route, in seconds.
Parameters
directionsa list of navigation statements
pointsa YailList containing the coordinates of a geojson LineString of the path
distancethe distance of the route, in meters
durationthe estimated duration to travel the route, in seconds

Definition at line 327 of file Navigation.java.

◆ Language() [1/2]

String com.google.appinventor.components.runtime.Navigation.Language ( )

Definition at line 296 of file Navigation.java.

◆ Language() [2/2]

void com.google.appinventor.components.runtime.Navigation.Language ( String  language)

The language to use for textual directions. Default is "en" for English.

Parameters
languagethe language to use for generating directions

Definition at line 291 of file Navigation.java.

◆ RequestDirections()

void com.google.appinventor.components.runtime.Navigation.RequestDirections ( )

Request directions from the routing service using the values of StartLatitude(), StartLongitude(), EndLatitude(), and EndLongitude(). On success, the GotDirections(YailList, YailList, double, double) event block will run. If an error occurs, the error will be reported via the Screen's ErrorOccurred event.

Definition at line 109 of file Navigation.java.

◆ ResponseContent()

YailDictionary com.google.appinventor.components.runtime.Navigation.ResponseContent ( )

The raw response from the server. This can be used to access more details beyond what the GotDirections(YailList, YailList, double, double) event provides.

Returns
the content of the response

Definition at line 307 of file Navigation.java.

◆ ServiceURL()

void com.google.appinventor.components.runtime.Navigation.ServiceURL ( String  url)

Reserved for future use in case we decide to run our own service some day.

Definition at line 138 of file Navigation.java.

◆ StartLatitude() [1/2]

double com.google.appinventor.components.runtime.Navigation.StartLatitude ( )

Definition at line 168 of file Navigation.java.

◆ StartLatitude() [2/2]

void com.google.appinventor.components.runtime.Navigation.StartLatitude ( double  latitude)

Definition at line 157 of file Navigation.java.

◆ StartLocation()

void com.google.appinventor.components.runtime.Navigation.StartLocation ( MapFeature  feature)

Definition at line 191 of file Navigation.java.

◆ StartLongitude() [1/2]

double com.google.appinventor.components.runtime.Navigation.StartLongitude ( )

Definition at line 186 of file Navigation.java.

◆ StartLongitude() [2/2]

void com.google.appinventor.components.runtime.Navigation.StartLongitude ( double  longitude)

Definition at line 175 of file Navigation.java.

◆ TransportationMethod() [1/2]

String com.google.appinventor.components.runtime.Navigation.TransportationMethod ( )

Definition at line 243 of file Navigation.java.

◆ TransportationMethod() [2/2]

void com.google.appinventor.components.runtime.Navigation.TransportationMethod ( String  method)

The transportation method used for determining the route. Valid options are:

  • foot-walking: Route based on walking paths
  • driving-car: Route based on vehicle paths
  • cycling-regular: Route based on bicycle paths
  • wheelchair: Route based on wheelchair accessible paths
Parameters
methodthe method to use

Definition at line 260 of file Navigation.java.

Member Data Documentation

◆ OPEN_ROUTE_SERVICE_URL

final String com.google.appinventor.components.runtime.Navigation.OPEN_ROUTE_SERVICE_URL
static
Initial value:
=
"https://api.openrouteservice.org/v2/directions/"

Definition at line 60 of file Navigation.java.


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