HERE Android SDK Developer's Guide

MapRoute

The class MapRoute is a member of com.here.android.mpa.mapping .

Class Summary

public final class MapRoute

extends com.here.android.mpa.mapping.MapObject, com.here.android.mpa.common.ViewObject, java.lang.Object

Represents a Route that can be displayed on a Map.

[For complete information, see the section Class Details]

Nested Class Summary

Table 1. Nested Classes in MapRoute
Nested Classes

public static final enumeration MapRoute.RenderType

Render classification of the route.

Constructor Summary

Table 2. Constructors in MapRoute
Constructors

MapRoute ()

Creates a MapRoute object.

MapRoute (Route route)

Creates a MapRoute with a specified Route .

Method Summary

Table 3. Methods in MapRoute
Methods

public int getColor ()

Returns the current ARGB (Alpha/Red/Green/Blue) integer color value used to display this route.

public RenderType getRenderType ()

Get the RenderType associated with this MapRoute.

public Route getRoute ()

Returns the Route that has been displayed on the Map .

public boolean isManeuverNumberVisible ()

Returns a boolean indicating whether maneuver numbers are displayed along with this route.

public boolean isTrafficEnabled ()

Checks if traffic is enabled for this route.

public MapRoute setColor (int argbColor)

Sets a color for displaying the route, using an ARGB (Alpha/Red/Green/Blue) integer color value.

public MapRoute setManeuverNumberVisible (boolean visible)

Sets maneuver numbers to be either displayed along with this route or not displayed.

public MapRoute setRenderType (RenderType type)

Sets the RenderType associated with this MapRoute.

public MapRoute setRoute (Route route)

Sets a Route that will be displayed on the Map .

public MapRoute setTrafficEnabled (boolean enable)

Enable display of traffic on this MapRoute .

Class Details

Represents a Route that can be displayed on a Map.

Constructor Details

MapRoute ()

Creates a MapRoute object.

MapRoute (Route route)

Creates a MapRoute with a specified Route .

Typically, a MapRoute is created after a Route has been calculated. An application can pass a calculated Route as a parameter to this method instead of making an explicit call to setRoute(Route). Adding the new MapRoute object to a Map can be done by way of the addMapObject(MapObject) method.

Parameters:

  • route

    A calculated Route used to set to the MapRoute

Method Details

public int getColor ()

Returns the current ARGB (Alpha/Red/Green/Blue) integer color value used to display this route.

Returns:

The current ARGB integer color value. The packed integer is made up of 4 bytes: alpha, red, green, blue. Each color component has a value range from [0..255], with 0 meaning no contribution for that component and 255 meaning 100% contribution

See also:

android.graphics.Color

public RenderType getRenderType ()

Get the RenderType associated with this MapRoute.

Returns:

RenderType

public Route getRoute ()

Returns the Route that has been displayed on the Map .

Returns:

The Route

public boolean isManeuverNumberVisible ()

Returns a boolean indicating whether maneuver numbers are displayed along with this route.

Returns:

True if maneuver numbers are displayed with the route, false otherwise

public boolean isTrafficEnabled ()

Checks if traffic is enabled for this route.

Returns:

True if traffic is enabled for this MapRoute, false otherwise.

public MapRoute setColor (int argbColor)

Sets a color for displaying the route, using an ARGB (Alpha/Red/Green/Blue) integer color value.

Note: calling setRenderType(RenderType) will reset any color previously set by using this method.

Parameters:

  • argbColor

    The ARGB integer color value. The packed integer is made up of 4 bytes: alpha, red, green, blue. Each color component has a value range from [0..255], with 0 meaning no contribution for that component and 255 meaning 100% contribution.

Returns:

The updated MapRoute itself.

See also:

android.graphics.Color

public MapRoute setManeuverNumberVisible (boolean visible)

Sets maneuver numbers to be either displayed along with this route or not displayed. By default, maneuver number is invisible.

Parameters:

  • visible

    A boolean specifying whether maneuver numbers are displayed

Returns:

The updated MapRoute itself.

public MapRoute setRenderType (RenderType type)

Sets the RenderType associated with this MapRoute. Note that MapRoute must be added to a Map before calling this method.

Note: route color can be customized by setColor(int)

Parameters:

  • type

    RenderType

Returns:

The updated MapRoute itself.

Throws:

  • IllegalArgumentException

    if type is invalid.

  • IllegalStateException

    if MapRoute is not added to Map.

public MapRoute setRoute (Route route)

Sets a Route that will be displayed on the Map .

Parameters:

  • route

    A Route representing the route to be displayed on the Map.

Returns:

The updated MapRoute itself.

public MapRoute setTrafficEnabled (boolean enable)

Enable display of traffic on this MapRoute . By default traffic on route is disabled.

NOTE: Truck routes and public transport timetable routes are unsupported.

Parameters:

Returns:

The updated MapRoute itself.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.