Class Instruction

java.lang.Object
com.graphhopper.util.Instruction
Direct Known Subclasses:
FinishInstruction, RoundaboutInstruction, ViaInstruction

public class Instruction extends Object
  • Field Details

  • Constructor Details

    • Instruction

      public Instruction(int sign, String name, PointList pl)
      The points, distances and times have exactly the same count. The last point of this instruction is not duplicated here and should be in the next one.
  • Method Details

    • setUseRawName

      public void setUseRawName()
      This method does not perform translation or combination with the sign - it just uses the provided name as instruction.
    • getSign

      public int getSign()
      The instruction for the person/driver to execute.
    • setSign

      public void setSign(int sign)
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getExtraInfoJSON

      public Map<String,Object> getExtraInfoJSON()
    • setExtraInfo

      public void setExtraInfo(String key, Object value)
    • getDistance

      public double getDistance()
      Distance in meter until no new instruction
    • setDistance

      public Instruction setDistance(double distance)
    • getTime

      public long getTime()
      Duration until the next instruction, in milliseconds
    • setTime

      public Instruction setTime(long time)
    • getPoints

      public PointList getPoints()
    • setPoints

      public void setPoints(PointList points)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLength

      public int getLength()
      This method returns the length of an Instruction. The length of an instruction is defined by [the index of the first point of the next instruction] - [the index of the first point of this instruction].

      In general this will just resolve to the size of the PointList, except for ViaInstruction and FinishInstruction, which are only virtual instructions, in a sense that they don't provide a turn instruction, but only an info ("reached via point or destination").

      See #1216 and #1138

    • getTurnDescription

      public String getTurnDescription(Translation tr)