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 style 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 int getOutlineColor ()

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

public RenderType getRenderType ()

Returns the RenderType associated with this MapRoute .

public Route getRoute ()

Returns the Route that has been displayed on the Map .

public int getTraveledColor ()

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

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 setOutlineColor (int argbColor)

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

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 .

public MapRoute setTraveledColor (int argbColor)

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

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.

If MapRoute.RenderType is set to USER_DEFINED getting this property will return the value you set. If MapRoute.RenderType is not USER_DEFINED getting this property will return 0 if the MapRoute has not been added to a map. After being added to the map it will return the pre-defined value for the current map scheme.

Note: Alpha-value transparency is supported.

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 int getOutlineColor ()

Returns the current ARGB (Alpha/Red/Green/Blue) integer color value used to display the outline route. If MapRoute.RenderType is set to USER_DEFINED getting this property will return the value you set, otherwise 0.

Note: Alpha-value transparency is supported.

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 ()

Returns the RenderType associated with this MapRoute .

Default value is PRIMARY.

Returns:

The RenderType associated with the MapRoute.

public Route getRoute ()

Returns the Route that has been displayed on the Map .

Returns:

The Route

public int getTraveledColor ()

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

If MapRoute.RenderType is set to USER_DEFINED getting this property will return the value you set. If MapRoute.RenderType is not USER_DEFINED getting this property will return 0 if the MapRoute has not been added to a map. After being added to the map it will return the pre-defined value for the current map scheme.

Note: Alpha-value transparency is supported.

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 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.

Setting this property will change the color of the MapRoute and change the RenderType to USER_DEFINED. Calling setRenderType(MapRoute.RenderType) other than USER_DEFINED will reset any color previously set by using this method.

Note: Alpha-value transparency is supported.

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 setOutlineColor (int argbColor)

Sets a color for displaying the route outline, using an ARGB (Alpha/Red/Green/Blue) integer color value. Outline is rendered as a solid line, which is wider than the route line. Hence, transparent route colors will be blended with the underlying outline color. Setting this property will change the outline color of the MapRoute and change the MapRoute.RenderType to USER_DEFINED. Calling setRenderType(MapRoute.RenderType) other than USER_DEFINED will reset any color previously set by using this method. The outline color will be applied to upcoming and traveled portions of a route. setOutlineColor(int) is not supported by Transit and UrbanMobility routes.

Note: Alpha-value transparency is supported.

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 setRenderType (RenderType type)

Sets the RenderType associated with this MapRoute . Note: setting setColor(int) or setTraveledColor(int) or setOutlineColor(int) will reset MapRoute.RenderType to USER_DEFINED. Default value is PRIMARY.

Note: MapRoute must be added to a Map before calling this method. Otherwise, its value will not be changed.

Parameters:

  • type

    The RenderType to be used.

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.

public MapRoute setTraveledColor (int argbColor)

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

Setting this property will change the traveled color of the MapRoute and change the RenderType to USER_DEFINED. Calling setRenderType(MapRoute.RenderType) other than USER_DEFINED will reset any color previously set by using this method.

setTraveledColor(int) is not supported by Transit and UrbanMobility routes.

Note: Alpha-value transparency is supported.

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