public final class RouteStep
- Object
- RouteStep
One maneuver of a RouteLeg – “turn left onto Elm Street and continue for
300 m” – together with the piece of road geometry it covers.
Instances are immutable and are produced by a RouteService; applications
read them to build a turn-by-turn list beside the map.
Constructors
public RouteStep(String instruction, String roadName, double distanceMeters, double durationSeconds, LatLng start, List points) | Creates a step. |
Methods
public String getInstruction() | A human readable description of the maneuver, for example "Turn left onto Elm Street". |
public String getRoadName() | The name of the road travelled during this step; empty when unnamed. |
public double getDistanceMeters() | The length of this step in meters. |
public double getDurationSeconds() | The estimated time for this step in seconds. |
public LatLng getStart() | Where the maneuver takes place, or null when the backend omits it. |
public List getPoints() | The unmodifiable LatLng geometry travelled by this step, useful to highlight the upcoming maneuver on the map. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Constructor details
RouteStep
public RouteStep(String instruction, String roadName, double distanceMeters, double durationSeconds, LatLng start, List points)Creates a step. Called by
RouteService implementations.Parameters
instructionString- a human readable maneuver description
roadNameString- the road this step travels along, possibly empty
distanceMetersdouble- the length of the step in meters
durationSecondsdouble- the estimated time for the step in seconds
startLatLng- where the maneuver happens
pointsList- the
LatLnggeometry of the step, defensively copied
Method details
getInstruction
public String getInstruction()A human readable description of the maneuver, for example
"Turn left onto Elm Street". Never null, but may be empty when the
backend supplies no phrasing.getRoadName
public String getRoadName()The name of the road travelled during this step; empty when unnamed.
getDistanceMeters
public double getDistanceMeters()The length of this step in meters.
getDurationSeconds
public double getDurationSeconds()The estimated time for this step in seconds.
getStart
public LatLng getStart()Where the maneuver takes place, or
null when the backend omits it.getPoints
public List getPoints()The unmodifiable
LatLng geometry travelled by this step, useful to
highlight the upcoming maneuver on the map.toString
public String 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())