Class RouteRequest
java.lang.Object
com.codename1.maps.routing.RouteRequest
Describes the journey to route: where it starts, where it ends, anything it must pass through on the way, and how the traveller moves.
The setters return this so a request reads as one expression:
RouteRequest req = new RouteRequest(home, office)
.addWaypoint(daycare)
.setTravelMode(TravelMode.DRIVING)
.setAlternatives(true);
-
Constructor Summary
ConstructorsConstructorDescriptionRouteRequest(LatLng origin, LatLng destination) Creates a request for the direct journey fromorigintodestination. -
Method Summary
Modifier and TypeMethodDescriptionaddWaypoint(LatLng waypoint) Adds an intermediate point the route must pass through, in visiting order.Where the journey ends.Where the journey starts.How the traveller moves;TravelMode.DRIVINGunless changed.The unmodifiable intermediate points (LatLng) in visiting order; empty for a direct journey.booleanWhether the service may return more than one route.booleanisSteps()Whether turn-by-turn steps are requested; true unless changed.setAlternatives(boolean alternatives) Asks the service for alternative routes in addition to the best one.setSteps(boolean steps) Requests (or suppresses) turn-by-turnRouteSteps.setTravelMode(TravelMode travelMode) Sets how the traveller moves.toString()Returns a string representation of the object.
-
Constructor Details
-
RouteRequest
-
-
Method Details
-
getOrigin
Where the journey starts. -
getDestination
Where the journey ends. -
addWaypoint
Adds an intermediate point the route must pass through, in visiting order. Backends route through waypoints in the order added; none of them reorder to optimize the trip. -
getWaypoints
The unmodifiable intermediate points (LatLng) in visiting order; empty for a direct journey. Add to it throughaddWaypoint(LatLng), which drops anull; the view being unmodifiable is what stops anything else being slipped in behind it for aRouteServiceto choke on. -
getTravelMode
How the traveller moves;TravelMode.DRIVINGunless changed. -
setTravelMode
Sets how the traveller moves. Anullmode restoresTravelMode.DRIVING. -
isAlternatives
public boolean isAlternatives()Whether the service may return more than one route. -
setAlternatives
Asks the service for alternative routes in addition to the best one. Backends treat this as a hint -- most return a single route when no meaningfully different alternative exists. -
isSteps
public boolean isSteps()Whether turn-by-turn steps are requested; true unless changed. -
setSteps
Requests (or suppresses) turn-by-turnRouteSteps. Turn them off when you only need the line on the map -- the response is much smaller. -
toString
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-