HERE Android SDK Developer's Guide

RouteOptions

The class RouteOptions is a member of com.here.android.mpa.routing .

Class Summary

public class RouteOptions

extends java.lang.Object

This is the definition of the RouteOptions class.

[For complete information, see the section Class Details]

Nested Class Summary

Table 1. Nested Classes in RouteOptions
Nested Classes

public static final enumeration RouteOptions.HazardousGoodType

Defines names for different types of hazardous goods that can be transported by a truck.

public static final enumeration RouteOptions.PublicTransportLinkFlag

Public Transport Link Flag.

public static final enumeration RouteOptions.TimeType

Ways that the time can be specified.

public static final enumeration RouteOptions.TransportMode

Represents values describing different mode of transportation a person will be using.

public static final enumeration RouteOptions.TruckRestrictionsMode

Defines way of handling road segments on which violated static truck restriction applies.

public static final enumeration RouteOptions.TruckType

Defines names for different types of trucks.

public static final enumeration RouteOptions.TunnelCategory

Specify the ADR tunnel category to restrict the truck route to.

public static final enumeration RouteOptions.Type

Represents different types of routing, such as by speed or by distance.

Constructor Summary

Table 2. Constructors in RouteOptions
Constructors

RouteOptions ()

Public Constructor

RouteOptions (RouteOptions other)

Copy Constructor

RouteOptions (RouteOptionsImpl pimpl)

Private Constructor

Field Summary

Table 3. Fields in RouteOptions
Fields

public static final int START_DIRECTION_ANY

Defines the value used to indicate routing may start in any direction

protected RouteOptionsImpl m_pimpl

Method Summary

Table 4. Methods in RouteOptions
Methods

public boolean areCarShuttleTrainsAllowed ()

Checks whether Car Shuttle Trains are allowed.

public boolean areDirtRoadsAllowed ()

Checks whether Dirt Roads are allowed.

public boolean areFerriesAllowed ()

Checks whether Ferries are allowed.

public boolean areHighwaysAllowed ()

Checks whether Highways are allowed.

public boolean areParksAllowed ()

Checks whether Parks are allowed.

public boolean areTollRoadsAllowed ()

Checks whether Toll Roads are allowed.

public boolean areTunnelsAllowed ()

Checks whether Tunnels are allowed.

public boolean equals (Object obj)

public boolean getPublicTransportLinkFlag (PublicTransportLinkFlag flag)

Gets the given Public Transport Link Flag.

public int getRouteCount ()

Gets the current desired number of route

public Type getRouteType ()

Gets the Route Type, see RouteOptions.Type for valid values

public int getStartDirection ()

Returns the start direction.

public TimeType getTime (Date date)

Gets the arrival or departure time that has been set.

public int getTransitMaximumChanges ()

Gets the maximum number of vehicle changes allowed during the trip.

public int getTransitMinimumChangeTime ()

Gets transit minimum change time.

public float getTransitWalkTimeMultiplier ()

Gets a multiplier to use for walking times.

public TransportMode getTransportMode ()

Gets the Transport Mode, see RouteOptions.TransportMode for valid values

public float getTruckHeight ()

Gets the truck height in meters.

public float getTruckLength ()

Gets the truck length in meters.

public float getTruckLimitedWeight ()

Gets the limited truck weight in metric tons.

public TruckRestrictionsMode getTruckRestrictionsMode ()

Retrieves currently set RouteOptions.TruckRestrictionsMode.

public java.util.EnumSet <HazardousGoodType> getTruckShippedHazardousGoods ()

Gets the list of hazardous goods transported in the truck.

public int getTruckTrailersCount ()

Returns the number of trailers attached to the truck.

public TunnelCategory getTruckTunnelCategory ()

Gets the tunnel restrictions when calculating the truck route.

public TruckType getTruckType ()

Returns the truck type when calculating the truck route.

public float getTruckWeightPerAxle ()

Gets the truck weight per axle in metric tons.

public float getTruckWidth ()

Gets the truck width in meters.

public int hashCode ()

public boolean isCarpoolAllowed ()

Check if usage of HOV/Carpool roads is allowed.

public boolean isPublicTransportTypeAllowed (TransitType type)

Checks whether a Public Transport type is allowed.

public RouteOptions setCarShuttleTrainsAllowed (boolean value)

Sets whether Car Shuttle Trains are allowed.

public RouteOptions setCarpoolAllowed (boolean value)

Allow or disallow usage of HOV/Carpool roads.

public RouteOptions setDirtRoadsAllowed (boolean value)

Sets whether Dirt Roads are allowed.

public RouteOptions setFerriesAllowed (boolean value)

Sets whether Ferries are allowed.

public void setFetchElevationData (boolean fetchElevation)

Deprecated: As of SDK 3.3, this feature will no longer be supported.

When set, elevation data is returned with the route request.

public RouteOptions setHighwaysAllowed (boolean value)

Sets whether Highways are allowed.

public RouteOptions setParksAllowed (boolean value)

Sets whether Parks are allowed.

public RouteOptions setPublicTransportLinkFlag (PublicTransportLinkFlag flag, boolean value)

Sets the given Public Transport Link Flag.

public RouteOptions setPublicTransportTypeAllowed (TransitType type, boolean allow)

Sets whether a Public Transport Type is allowed.

public RouteOptions setRouteCount (int count)

Sets the desired number of route.

public RouteOptions setRouteType (Type routeType)

Sets the Route Type, see RouteOptions.Type for valid values

public RouteOptions setStartDirection (int dirInDegrees)

The direction that routing should start in.

public RouteOptions setTime (Date time, TimeType type)

Sets the arrival or departure time.

public RouteOptions setTollRoadsAllowed (boolean value)

Sets whether Toll Roads are allowed.

public RouteOptions setTransitMaximumChanges (int changes)

Sets the maximum number of vehicle changes allowed during the trip.

public RouteOptions setTransitMinimumChangeTime (int minutes)

Sets transit minimum change time.

public RouteOptions setTransitWalkTimeMultiplier (float value)

Sets a multiplier to use for walking times.

public RouteOptions setTransportMode (TransportMode mode)

Sets the Transport Mode.

public RouteOptions setTruckHeight (float meters)

Sets the truck height in meters.

public RouteOptions setTruckLength (float value)

Sets the truck length in meters.

public RouteOptions setTruckLimitedWeight (float tonnes)

Sets the limited truck weight in metric tons.

public void setTruckRestrictionsMode (TruckRestrictionsMode mode)

Sets truck restrictions handling mode.

public RouteOptions setTruckShippedHazardousGoods (java.util.EnumSet <HazardousGoodType> types)

Sets the list of hazardous goods transported in the truck.

public RouteOptions setTruckTrailersCount (int count)

Sets the number of trailers attached to the truck.

public RouteOptions setTruckTunnelCategory (TunnelCategory category)

Sets the ADR tunnel restrictions when calculating the truck route.

public RouteOptions setTruckType (TruckType truckType)

Truck type when calculating the truck route.

public RouteOptions setTruckWeightPerAxle (float tonnes)

Sets the truck weight per axle in metric tons.

public RouteOptions setTruckWidth (float value)

Sets the truck width in meters.

public RouteOptions setTunnelsAllowed (boolean value)

Sets whether Tunnels are allowed.

Class Details

This is the definition of the RouteOptions class. The class contains options for route calculation.

Constructor Details

RouteOptions ()

Public Constructor

RouteOptions (RouteOptions other)

Copy Constructor

Parameters:

  • other

RouteOptions (RouteOptionsImpl pimpl)

Private Constructor

Parameters:

  • pimpl

Field Details

public static final int START_DIRECTION_ANY

Defines the value used to indicate routing may start in any direction

protected RouteOptionsImpl m_pimpl

Method Details

public boolean areCarShuttleTrainsAllowed ()

Checks whether Car Shuttle Trains are allowed.

Returns:

true if allowed otherwise false.

public boolean areDirtRoadsAllowed ()

Checks whether Dirt Roads are allowed.

Returns:

true if allowed otherwise false.

public boolean areFerriesAllowed ()

Checks whether Ferries are allowed.

Returns:

true if allowed otherwise false.

public boolean areHighwaysAllowed ()

Checks whether Highways are allowed.

Returns:

true if allowed otherwise false.

public boolean areParksAllowed ()

Checks whether Parks are allowed.

Returns:

true if allowed otherwise false.

public boolean areTollRoadsAllowed ()

Checks whether Toll Roads are allowed.

Returns:

true if allowed otherwise false.

public boolean areTunnelsAllowed ()

Checks whether Tunnels are allowed.

Returns:

true if allowed otherwise false.

public boolean equals (Object obj)

Parameters:

  • obj

public boolean getPublicTransportLinkFlag (PublicTransportLinkFlag flag)

Gets the given Public Transport Link Flag.

Parameters:

Returns:

true if set, otherwise false.

public int getRouteCount ()

Gets the current desired number of route

Returns:

current desired number of route

public Type getRouteType ()

Gets the Route Type, see RouteOptions.Type for valid values

Returns:

The current Type.

public int getStartDirection ()

Returns the start direction. Defaults to RouteOptions::START_DIRECTION_ANY which means route in any direction in order to obtain the shortest/fastest possible route.

Returns:

The start direction in degrees, in the range 0..359, or RouteOptions::START_DIRECTION_ANY to route in any direction.

public TimeType getTime (Date date)

Gets the arrival or departure time that has been set.

Parameters:

  • date

    Output parameter where the date will be set. This may be null if the caller is only interested in the RouteOptions.TimeType.

Returns:

The TimeType of the parameter upon completion.

public int getTransitMaximumChanges ()

Gets the maximum number of vehicle changes allowed during the trip.

Returns:

number of vehicle changes

public int getTransitMinimumChangeTime ()

Gets transit minimum change time. Any connection time below this value will be bumped up to the minimum. The default is zero.

Returns:

time in minutes

public float getTransitWalkTimeMultiplier ()

Gets a multiplier to use for walking times. A higher number means a slower walking speed. The default is 1.0.

Returns:

multiplier

public TransportMode getTransportMode ()

Gets the Transport Mode, see RouteOptions.TransportMode for valid values

Returns:

The TransportMode to be used for this RouteOptions.

public float getTruckHeight ()

Gets the truck height in meters. Applicable to truck routing only.

Returns:

The truck height in meters ( java.lang.Float#NaN if undefined).

public float getTruckLength ()

Gets the truck length in meters. Applicable to truck routing only.

Returns:

The truck length in meters ( java.lang.Float#NaN if undefined).

public float getTruckLimitedWeight ()

Gets the limited truck weight in metric tons. Applicable to truck routing only.

Returns:

The limited truck weight in metric tons ( java.lang.Float#NaN if undefined).

public TruckRestrictionsMode getTruckRestrictionsMode ()

Retrieves currently set RouteOptions.TruckRestrictionsMode.

Returns:

Truck restrictions mode.

public java.util.EnumSet <HazardousGoodType> getTruckShippedHazardousGoods ()

Gets the list of hazardous goods transported in the truck. Applicable to truck routing only.

Returns:

Set of RouteOptions.HazardousGoodTypes transported by the truck.

public int getTruckTrailersCount ()

Returns the number of trailers attached to the truck. Applicable to truck routing only.

Returns:

number of trailers attached to the truck.

public TunnelCategory getTruckTunnelCategory ()

Gets the tunnel restrictions when calculating the truck route. Applicable to truck routing only.

Returns:

ADR tunnel category.

public TruckType getTruckType ()

Returns the truck type when calculating the truck route. Applicable to truck routing only.

Returns:

truck type.

public float getTruckWeightPerAxle ()

Gets the truck weight per axle in metric tons. Applicable to truck routing only.

Returns:

The truck weight per axle in metric tons ( java.lang.Float#NaN if undefined).

public float getTruckWidth ()

Gets the truck width in meters. Applicable to truck routing only.

Returns:

The truck width in meters ( java.lang.Float#NaN if undefined).

public int hashCode ()

public boolean isCarpoolAllowed ()

Check if usage of HOV/Carpool roads is allowed.

Returns:

true if allowed, otherwise false.

public boolean isPublicTransportTypeAllowed (TransitType type)

Checks whether a Public Transport type is allowed.

Parameters:

  • type

    One of the public transport TransitType values to check if it is allowed.

Returns:

true if allowed, otherwise false.

public RouteOptions setCarShuttleTrainsAllowed (boolean value)

Sets whether Car Shuttle Trains are allowed.

Parameters:

  • value

    true if allowed otherwise false.

Returns:

The modified RouteOptions itself.

public RouteOptions setCarpoolAllowed (boolean value)

Allow or disallow usage of HOV/Carpool roads.

Parameters:

  • value

    Use true if allowed, otherwise false.

Returns:

The modified RouteOptions itself.

public RouteOptions setDirtRoadsAllowed (boolean value)

Sets whether Dirt Roads are allowed.

Parameters:

  • value

    true if allowed otherwise false.

Returns:

The modified RouteOptions itself.

public RouteOptions setFerriesAllowed (boolean value)

Sets whether Ferries are allowed.

Parameters:

  • value

    true if allowed otherwise false.

Returns:

The modified RouteOptions itself.

public void setFetchElevationData (boolean fetchElevation)

Deprecated: As of SDK 3.3, this feature will no longer be supported.

Elevation data will be requested for all routes automatically in online/offline modes. The data will be returned in the Route geometry, when available.

When set, elevation data is returned with the route request. Elevation data returned as altitude and a part of route geometry.

Parameters:

  • fetchElevation

    true if data should be fetched

public RouteOptions setHighwaysAllowed (boolean value)

Sets whether Highways are allowed.

Parameters:

  • value

    true if allowed otherwise false.

Returns:

The modified RouteOptions itself.

public RouteOptions setParksAllowed (boolean value)

Sets whether Parks are allowed.

Parameters:

  • value

    Use true if allowed, otherwise false.

Returns:

The modified RouteOptions itself.

public RouteOptions setPublicTransportLinkFlag (PublicTransportLinkFlag flag, boolean value)

Sets the given Public Transport Link Flag.

Parameters:

Returns:

The modified RouteOptions itself.

public RouteOptions setPublicTransportTypeAllowed (TransitType type, boolean allow)

Sets whether a Public Transport Type is allowed. By default all types are allowed.

Parameters:

  • type

    public transport type, see TransitType for valid values.

  • allow

    a boolean to allow/disallow a transit type

Returns:

The modified RouteOptions itself.

public RouteOptions setRouteCount (int count)

Sets the desired number of route. The default is 1.

Values greater than 10 are ignored if RouteOptions.TransportMode is set to public transport and online timetables are enabled. Only one route will be returned for routes with more than two RouteWaypoint.

NOTE: If UMRouter is used, then allowed range is [1, 6]. Using unsupported value will result error response in route calculation.

Parameters:

  • count

    route count

Returns:

The modified RouteOptions itself.

public RouteOptions setRouteType (Type routeType)

Sets the Route Type, see RouteOptions.Type for valid values

Parameters:

  • routeType

    Type

Returns:

The modified RouteOptions itself.

public RouteOptions setStartDirection (int dirInDegrees)

The direction that routing should start in. Use values between 0..359. If a value greater than 359 is specified, the modulus of 360 is used. Specify RouteOptions::START_DIRECTION_ANY (or greater) to route in any direction.

Parameters:

  • dirInDegrees

    Start direction in degrees. 0 is north, increases clockwise (ie. 90 is east).

Returns:

The modified RouteOptions itself.

public RouteOptions setTime (Date time, TimeType type)

Sets the arrival or departure time.

Parameters:

  • time

    The time to set.

  • type

    The type of time to set.

Returns:

The modified RouteOptions itself.

public RouteOptions setTollRoadsAllowed (boolean value)

Sets whether Toll Roads are allowed.

Parameters:

  • value

    true if allowed otherwise false.

Returns:

The modified RouteOptions itself.

public RouteOptions setTransitMaximumChanges (int changes)

Sets the maximum number of vehicle changes allowed during the trip.

Note: For UMRouteOptions case maximum supported changes is 6.

Parameters:

  • changes

    number of vehicle changes

Returns:

The modified RouteOptions itself.

public RouteOptions setTransitMinimumChangeTime (int minutes)

Sets transit minimum change time. Any connection time below this value will be bumped up to the minimum. The default is zero.

Parameters:

  • minutes

    time in minutes

Returns:

The modified RouteOptions itself.

public RouteOptions setTransitWalkTimeMultiplier (float value)

Sets a multiplier to use for walking times. A higher number means a slower walking speed. The default is 1.0.

Note: For UMRouteOptions case supported range is [0.5, 2.0].

Parameters:

  • value

    multiplier

Returns:

The modified RouteOptions itself.

public RouteOptions setTransportMode (TransportMode mode)

Sets the Transport Mode.

Parameters:

Returns:

The modified RouteOptions itself.

public RouteOptions setTruckHeight (float meters)

Sets the truck height in meters. Applicable to truck routing only.

Parameters:

  • meters

    The truck height in meters. A value of Float#NaN will unset this option.

Returns:

The modified RouteOptions itself.

Throws:

  • IllegalArgumentException

    if height is not greater than zero.

public RouteOptions setTruckLength (float value)

Sets the truck length in meters. Applicable to truck routing only.

Parameters:

  • value

    The truck length in meters. A value of Float#NaN will unset this option.

Returns:

The modified RouteOptions itself.

Throws:

  • IllegalArgumentException

    if length is not greater than zero.

public RouteOptions setTruckLimitedWeight (float tonnes)

Sets the limited truck weight in metric tons. Applicable to truck routing only.

Parameters:

  • tonnes

    The limited truck weight in metric tons. A value of Float#NaN will unset this option.

Returns:

The modified RouteOptions itself.

Throws:

  • IllegalArgumentException

    if weight is not greater than zero.

public void setTruckRestrictionsMode (TruckRestrictionsMode mode)

Sets truck restrictions handling mode. If no mode is explicitly set then NO_VIOLATIONS option will be used.

Parameters:

  • mode

public RouteOptions setTruckShippedHazardousGoods (java.util.EnumSet <HazardousGoodType> types)

Sets the list of hazardous goods transported in the truck. Applicable to truck routing only.

Parameters:

Returns:

The modified RouteOptions itself.

Throws:

  • IllegalArgumentException

    if value is null.

public RouteOptions setTruckTrailersCount (int count)

Sets the number of trailers attached to the truck. Applicable to truck routing only.

Parameters:

  • count

Returns:

The modified RouteOptions itself.

Throws:

  • IllegalArgumentException

    if the count is negative.

public RouteOptions setTruckTunnelCategory (TunnelCategory category)

Sets the ADR tunnel restrictions when calculating the truck route. Applicable to truck routing only.

Parameters:

  • category

    The ADR tunnel category.

Returns:

The modified RouteOptions itself.

public RouteOptions setTruckType (TruckType truckType)

Truck type when calculating the truck route. Applicable to truck routing only.

Parameters:

  • truckType

    The truck type.

Returns:

The modified RouteOptions itself.

public RouteOptions setTruckWeightPerAxle (float tonnes)

Sets the truck weight per axle in metric tons. Applicable to truck routing only.

Parameters:

  • tonnes

    The truck weight per axle in metric tons. A value of Float#NaN will unset this option.

Returns:

The modified RouteOptions itself.

Throws:

  • IllegalArgumentException

    if weight is not greater than zero.

public RouteOptions setTruckWidth (float value)

Sets the truck width in meters. Applicable to truck routing only.

Parameters:

  • value

    The truck width in meters. A value of Float#NaN will unset this option.

Returns:

The modified RouteOptions itself.

Throws:

  • IllegalArgumentException

    if width is not greater than zero.

public RouteOptions setTunnelsAllowed (boolean value)

Sets whether Tunnels are allowed.

Parameters:

  • value

    true if allowed otherwise false.

Returns:

The modified RouteOptions itself.