public class Route extends Object implements Validatable
Route represents a way from A to B using one (unimodal route) or
several (intermodal route) modes of transport. Its attributes such as the
length refer to the whole route, which is further split up into
RouteSegments for each mode of transport. A route can also consist
only of a single Location, i.e. be a route from A to A, see
createFromLocation(Location, ZonedDateTime).
In its minimal form nearly all attributes are set. The exceptions are
getId(), getOptimizedFor(), getAdditionalInfo()
and only one of the geometries is guaranteed to be set. Since this is a lot
no createMinimal method is offered as its invocations would be
hardly readable. Instead for easy construction
createFromSegments(List) is recommended.
| Constructor and Description |
|---|
Route() |
public Location<?> getFrom()
public Location<?> getTo()
public int getDistanceMeters()
public int getDurationSeconds()
public List<RouteSegment> getSegments()
public String getStartTime()
public ZonedDateTime getStartTimeAsZonedDateTime()
public String getEndTime()
public ZonedDateTime getEndTimeAsZonedDateTime()
public Optional<String> getOptimizedFor()
RoutingRequest (and typically set when a
RoutingResponse contains several (alternative) routes for
one request.public Optional<GeoJSONFeature<GeoJSONPolygon>> getBoundingBox()
public Optional<String> getSimplifiedGeometryEncodedPolyLine()
public Optional<GeoJSONFeature<GeoJSONLineString>> getSimplifiedGeometryGeoJson()
public Route setDistanceMeters(int distanceMeters)
public Route setDurationSeconds(int durationSeconds)
public Route setSegments(List<RouteSegment> segments)
public Route setStartTime(ZonedDateTime startTime)
public Route setEndTime(ZonedDateTime endTime)
public Route setBoundingBox(GeoJSONFeature<GeoJSONPolygon> boundingBox)
public Route setSimplifiedGeometryEncodedPolyLine(String simplifiedGeometryEncodedPolyLine)
public Route setSimplifiedGeometryGeoJson(GeoJSONFeature<GeoJSONLineString> simplifiedGeometryGeoJson)
public static Route createFromLocation(Location<?> location, ZonedDateTime time)
public static Route createFromSegments(List<RouteSegment> segments)
public void validate()
ValidatableIllegalArgumentException including a description of the
invalid state is thrown.validate in interface Validatablepublic void validate(boolean strongValidation)
strongValidation - with strong validation even for minor errors an
IllegalArgumentException is thrown (instead of a
logged warning)Copyright © 2018. All rights reserved.