Package globus.glroute
Class GLRouteRequest
java.lang.Object
globus.glmap.GLNativeObject
globus.glroute.GLRouteRequest
public class GLRouteRequest
extends globus.glmap.GLNativeObject
GLMapRouteData used request online or offline route.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback that will be called when request is finished -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorGLRouteRequest(String userJSON) Constructor with custom json request to valhalla -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExcludeLocation(GLRoutePoint point) A location to exclude or avoidvoidaddExcludePolygon(globus.glmap.MapGeoPoint[] points) Roads intersecting this polygon will be avoided during path finding.voidaddPoint(GLRoutePoint point) Adds pointstatic intbikeTypeFromString(String type) Converts string representation of BikeType to it's valuestatic StringbikeTypeToString(int type) Converts BikeType to it's string representationstatic voidcancel(long requestID) Cancels request that was startedintGet number of alternatesgetJson()intgetMode()By default `GLRoute.Mode.AUTO`booleanintvoidsetAlternates(int alternates) A number denoting how many alternate routes should be provided.voidsetAutoWithOptions(CostingOptions.Auto options) Sets navigation mode to autovoidSets navigation mode to cyclevoidSets navigation mode to bikesharevoidsetBusWithOptions(CostingOptions.Auto options) Sets navigation mode to busvoidLocale for instructions By default equals to `Locale.getDefault().getLanguage()`voidSets navigation mode to motorcyclevoidSets navigation mode to scootervoidsetOfflineWithConfig(String config) Makes request offlinevoidsetOptimize(boolean optimize) If `true`, then order of middle points can be changed to make route faster.voidSets navigation mode to walkvoidsetRequestID(String requestID) Name your route request.voidSets navigation mode to straightvoidsetTaxiWithOptions(CostingOptions.Auto options) Sets navigation mode to taxivoidsetTruckWithOptions(CostingOptions.Truck options) Sets navigation mode to truckvoidsetUnitSystem(int unitSystem) Unit system for instructions.longstart(GLRouteRequest.ResultsCallback callback) Start requestMethods inherited from class globus.glmap.GLNativeObject
dispose
-
Constructor Details
-
GLRouteRequest
public GLRouteRequest()Default constructor -
GLRouteRequest
Constructor with custom json request to valhalla- Parameters:
userJSON- json request to valhalla
-
-
Method Details
-
start
Start request- Parameters:
callback- results callback- Returns:
- id of task
-
cancel
public static void cancel(long requestID) Cancels request that was started- Parameters:
requestID- ID of request to cancel
-
addPoint
Adds point- Parameters:
point- point to add
-
addExcludeLocation
A location to exclude or avoid- Parameters:
point- point to add
-
addExcludePolygon
public void addExcludePolygon(@NonNull globus.glmap.MapGeoPoint[] points) Roads intersecting this polygon will be avoided during path finding. If you only need to avoid a few specific roads, it's much more efficient to use exclude locations.- Parameters:
points- points of polygon exterior ring
-
setRequestID
Name your route request. If id is specified, the naming will be sent thru to the response.- Parameters:
requestID- request id
-
setOfflineWithConfig
Makes request offline- Parameters:
config- Contents of configuration file for routing engine Valhalla. See valhalla3.json inside the demoApp.
-
setAutoWithOptions
Sets navigation mode to auto- Parameters:
options- options
-
setBicycleWithOptions
Sets navigation mode to cycle- Parameters:
options- options
-
setPedestrianWithOptions
Sets navigation mode to walk- Parameters:
options- options
-
setStraightWithOptions
Sets navigation mode to straight- Parameters:
options- options
-
setBusWithOptions
Sets navigation mode to bus- Parameters:
options- options
-
setTruckWithOptions
Sets navigation mode to truck- Parameters:
options- options
-
setTaxiWithOptions
Sets navigation mode to taxi- Parameters:
options- options
-
setMotorScooterWithOptions
Sets navigation mode to scooter- Parameters:
options- options
-
setMotorcycleWithOptions
Sets navigation mode to motorcycle- Parameters:
options- options
-
setOptimize
public void setOptimize(boolean optimize) If `true`, then order of middle points can be changed to make route faster. By default is false.- Parameters:
optimize- reorder middle points for better route
-
getOptimize
public boolean getOptimize()- Returns:
- current set value
-
getMode
public int getMode()By default `GLRoute.Mode.AUTO`- Returns:
- Mode of the route
-
setUnitSystem
public void setUnitSystem(int unitSystem) Unit system for instructions. By default `GLUnitSystem.International`- Parameters:
unitSystem- unit system for instruction
-
getUnitSystem
public int getUnitSystem()- Returns:
- Unit system for instructions.
-
setLocale
Locale for instructions By default equals to `Locale.getDefault().getLanguage()`- Parameters:
locale- locale for instructions
-
getLocale
- Returns:
- Locale for instructions
-
getJson
- Returns:
- Json request that will be sent to valhalla
-
setAlternates
public void setAlternates(int alternates) A number denoting how many alternate routes should be provided. There may be no alternates or less alternates than the user specifies. Alternates are not yet supported on multipoint routes (that is, routes with more than 2 locations). They are also not supported on time dependent routes. By default = 2- Parameters:
alternates- alternates to set
-
getAlternates
public int getAlternates()Get number of alternates- Returns:
- number of alternates
-
bikeTypeToString
Converts BikeType to it's string representation- Parameters:
type- type to convert- Returns:
- string representation of type
-
bikeTypeFromString
Converts string representation of BikeType to it's value- Parameters:
type- type to convert- Returns:
- value
-