public class RoadInstruction extends Instruction<RoadInstruction>
RoadInstruction contains episodes with classic-style turn
navigations for street-based modes of transport such as walking, cycling and
driving (keep straight, turn left/right, make a u-turn).
In its minimal form it consists of a position, a getSubType() and at
least one of getOntoStreetName() and getOntoFormOfWay().
Exemplary EBNF of how this instruction can be transformed into human-readable text and what's mandatory / optional. Elements ending with STRING are terminal (not defined any further).
UNTIL_LANDMARK_STRING must be retrieved from the next Instruction, it
can be a classic landmark or also the type of the next instruction, e.g.
roundabout.
ROAD_INSTRUCTION = ROUTE_START | ROUTE_START_UNMENTIONED | ROUTE_END | STRAIGHT | TURN | U_TURN | SWITCH_SIDE_OF_ROAD;
ROUTE_START = "Start", [LANDMARK_PART], "on", NAME_TYPE, [HEADING], [CONTINUE];
ROUTE_START_UNMENTIONED = [LANDMARK_PART], "on", NAME_TYPE, [HEADING], [CONTINUE];
STRAIGHT = [LANDMARK_PART], "Go straight", [CROSSING_PART], "on", NAME_TYPE, [HEADING], [CONTINUE];
TURN = [LANDMARK_PART], "Turn", ["slight"], DIRECTION, [CROSSING_PART], "on", NAME_TYPE, [HEADING], [CONTINUE];
U_TURN = [LANDMARK_PART], "Make a u-turn", [CROSSING_PART], "on", NAME_TYPE, [HEADING], [CONTINUE];
SWITCH_SIDE_OF_ROAD = [LANDMARK_PART], "Switch to the", DIRECTION, "side of", NAME_TYPE, [CROSSING_PART], [HEADING], [CONTINUE];
ROUTE_END = "You reached your destination", [LANDMARK_PART], "on", NAME_TYPE;
NAME_TYPE = [STREET_NAME_STRING], [FORM_OF_WAY_STRING], [onto the bridge], [into the TUNNEL_STRING];
CROSSING_PART = "over the intersection" | "at the traffic light" | ...
HEADING = "heading", COMPASS_STRING;
CONTINUE = "and continue", [ROAD_SIDE], ["for", UNIT], [CONFIRMATION_LANDMARK_PART], [UNTIL]; (* at least one of the options *)
ROAD_SIDE = "on the", "left" | "right", "side of the road;
UNIT = [DISTANCE_STRING], [TIME_STRING]; (* at least one of the two *)
UNTIL = "until", [INTERSECTING_ROAD_STRING], [UNTIL_LANDMARK_PART];
LANDMARK_PART = PREPOSITION, LANDMARK_STRING;
CONFIRMATION_LANDMARK_PART = CONFIRMATION_PREPOSITION, CONFIRMATION_LANDMARK_STRING;
UNTIL_LANDMARK_PART = PREPOSITION, UNTIL_LANDMARK_STRING;
PREPOSITION = "before" | "at" | "after";
CONFIRMATION_PREPOSITION = "towards" | "through" | "along" | "past";
DIRECTION = "left" | "right";
| Modifier and Type | Class and Description |
|---|---|
static class |
RoadInstruction.SubType |
| Constructor and Description |
|---|
RoadInstruction() |
getAdditionalInfo, getConfirmationTriggerPosition, getPosition, getPreviewTriggerPosition, getText, setAdditionalInfo, setConfirmationTriggerPosition, setConfirmationTriggerPosition, setPosition, setPosition, setPreviewTriggerPosition, setPreviewTriggerPosition, setTextpublic RoadInstruction.SubType getSubType()
public Optional<Constants.GeneralizedModeOfTransportType> getModeOfTransport()
public Optional<Constants.TurnDirection> getTurnDirection()
public Optional<Constants.CompassDirection> getCompassDirection()
public Optional<Boolean> getRoadChange()
true if the road name or type has changedpublic Optional<Constants.FormOfWay> getOntoFormOfWay()
public Optional<Boolean> getEnterBridge()
public Optional<Constants.Tunnel> getEnterTunnel()
public Optional<Boolean> getOntoRightSideOfRoad()
true for the right side, false for the
left side of the road (in moving direction), empty if unknown or
not relevantpublic Optional<Constants.RoadCrossing> getCrossing()
Constants.RoadCrossing in case the instruction starts with a road
crossingpublic Optional<String> getContinueUntilIntersectingStreetName()
public Optional<Landmark> getLandmark()
RoadInstruction.SubType.ROUTE_START) or at the end (for
RoadInstruction.SubType.ROUTE_END) of the route. At the same time this
landmark is the continue-landmark for the previous instruction,
i.e. the landmark after getContinueMeters().public Optional<Landmark> getConfirmationLandmark()
public RoadInstruction setSubType(RoadInstruction.SubType subType)
public RoadInstruction setModeOfTransport(Constants.GeneralizedModeOfTransportType modeOfTransport)
public RoadInstruction setTurnDirection(Constants.TurnDirection turnDirection)
public RoadInstruction setCompassDirection(Constants.CompassDirection compassDirection)
public RoadInstruction setRoadChange(Boolean roadChange)
public RoadInstruction setOntoStreetName(String ontoStreetName)
public RoadInstruction setOntoFormOfWay(Constants.FormOfWay ontoFormOfWay)
public RoadInstruction setEnterBridge(Boolean enterBridge)
public RoadInstruction setEnterTunnel(Constants.Tunnel enterTunnel)
public RoadInstruction setOntoRightSideOfRoad(Boolean ontoRightSideOfRoad)
public RoadInstruction setCrossing(Constants.RoadCrossing crossing)
public RoadInstruction setContinueMeters(Integer continueMeters)
public RoadInstruction setContinueSeconds(Integer continueSeconds)
public RoadInstruction setContinueUntilIntersectingStreetName(String continueUntilIntersectingStreetName)
public RoadInstruction setLandmark(Landmark landmark)
landmark - the landmark at the start point, end point, or decision pointpublic RoadInstruction setConfirmationLandmark(Landmark confirmationLandmark)
public static RoadInstruction createMinimalRouteStart(GeoJSONCoordinate position, Optional<String> ontoStreetName, Optional<Constants.FormOfWay> ontoFormOfWay)
public static RoadInstruction createMinimalOnRoute(GeoJSONCoordinate position, Constants.TurnDirection turnDirection, Optional<String> ontoStreetName, Optional<Constants.FormOfWay> ontoFormOfWay)
public static RoadInstruction createMinimalRouteEnd(GeoJSONCoordinate position, Optional<String> onStreetName, Optional<Constants.FormOfWay> onFormOfWay)
public void validate()
ValidatableIllegalArgumentException including a description of the
invalid state is thrown.validate in interface Validatablevalidate in class Instruction<RoadInstruction>public int hashCode()
hashCode in class Instruction<RoadInstruction>public boolean equals(Object obj)
equals in class Instruction<RoadInstruction>public String toString()
toString in class Instruction<RoadInstruction>Copyright © 2018. All rights reserved.