Class RouteStep

java.lang.Object
com.codename1.maps.routing.RouteStep

public final class RouteStep extends Object

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.

  • 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
      • instruction: a human readable maneuver description

      • roadName: the road this step travels along, possibly empty

      • distanceMeters: the length of the step in meters

      • durationSeconds: the estimated time for the step in seconds

      • start: where the maneuver happens

      • points: the LatLng geometry 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())
      Overrides:
      toString in class Object