HERE Android SDK Developer's Guide

MapPolyline

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

Class Summary

public final class MapPolyline

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

A graphical representation of a GeoPolyline that can be rendered on a map.

[For complete information, see the section Class Details]

Nested Class Summary

Table 1. Nested Classes in MapPolyline
Nested Classes

public static final enumeration MapPolyline.CapStyle

Line ending cap rendering styles

Constructor Summary

Table 2. Constructors in MapPolyline
Constructors

MapPolyline ()

Creates a MapPolyline , which is a MapObject in the shape of a polyline.

MapPolyline (GeoPolyline polyline)

Creates a MapPolyline , which is a MapObject in the shape of a polyline.

Method Summary

Table 3. Methods in MapPolyline
Methods

public CapStyle getCapStyle ()

Get the MapPolyline rendering cap style

public int getDashPrimaryLength ()

Returns the current length of the primary dash segment of a dashed MapPolyline , in pixels.

public int getDashSecondaryLength ()

Returns the current length of the secondary (empty) dash segments of a dashed MapPolyline , in pixels.

public boolean getDepthTestEnabled ()

Returns a boolean indicating whether the MapPolyline is rendered with depth test.

public GeoPolyline getGeoPolyline ()

Gets copy of the GeoPolyline rendered by this MapPolyline .

public int getLineColor ()

Gets the current line color for this MapPolyline , returning an ARGB (Alpha/Red/Green/Blue) integer color value.

public int getLineWidth ()

Returns the current line width for this MapPolyline , in pixels.

public int getOutlineColor ()

Gets the current outline color for this MapPolyline , returning an ARGB (Alpha/Red/Green/Blue) integer color value.

public int getOutlineWidth ()

Returns the current outline width for this MapPolyline , in pixels.

public boolean isDashEnabled ()

Returns a boolean indicating whether the MapPolyline appears as a dashed line.

public boolean isGeodesicEnabled ()

Returns a boolean indicating whether each segment of this GeoPolyline is drawn as a geodesic.

public boolean isPerspectiveEnabled ()

Returns a boolean indicating whether the MapPolyline appears thinner further away when the map is tilted.

public MapPolyline setCapStyle (CapStyle style)

Set the MapPolyline rendering cap style.

public MapPolyline setDashEnabled (boolean enabled)

Sets the appearance of this MapPolyline as either a dashed or solid line.

public MapPolyline setDashPrimaryLength (int length)

Sets a length, in pixels, for the primary dash segment of a dashed MapPolyline .

public MapPolyline setDashSecondaryLength (int length)

Sets a length, in pixels, for the secondary (empty) dash segments of a dashed MapPolyline .

public void setDepthTestEnabled (boolean enabled)

Set whether to render MapPolyline with depth test.

public MapPolyline setGeoPolyline (GeoPolyline polyline)

Changes the GeoPolyline rendered by this GeoPolyline

public MapPolyline setGeodesicEnabled (boolean enabled)

Set whether to draw each segment of the represented GeoPolyline as a geodesic.

public MapPolyline setLineColor (int color)

Sets a line color for this MapPolyline , using an ARGB (Alpha/Red/Green/Blue) integer color value.

public MapPolyline setLineWidth (int width)

Sets a line width, in pixels, for this MapPolyline , an int value within the [0..100] range.

public MapPolyline setOutlineColor (int color)

Sets an outline color for this MapPolyline , using an ARGB (Alpha/Red/Green/Blue) integer color value.

public MapPolyline setOutlineWidth (int width)

Sets an outline width, in pixels, for this MapPolyline , an int value within the [0..100] range.

public MapPolyline setPerspectiveEnabled (boolean enabled)

Sets the width of this MapPolyline to be thinner further away when the map is tilted.

Class Details

A graphical representation of a GeoPolyline that can be rendered on a map. A MapPolyline has multiple points that combine to create its path.

Constructor Details

MapPolyline ()

Creates a MapPolyline , which is a MapObject in the shape of a polyline.

MapPolyline (GeoPolyline polyline)

Creates a MapPolyline , which is a MapObject in the shape of a polyline.

Parameters:

  • polyline

    GeoPolyline to construct the MapPolyline.

Method Details

public CapStyle getCapStyle ()

Get the MapPolyline rendering cap style

Returns:

CapStyle cap style.

public int getDashPrimaryLength ()

Returns the current length of the primary dash segment of a dashed MapPolyline , in pixels.

Returns:

The current length of the primary dash

See also:

getDashSecondaryLength()

public int getDashSecondaryLength ()

Returns the current length of the secondary (empty) dash segments of a dashed MapPolyline , in pixels.

Returns:

The current length of the empty dash

See also:

getDashPrimaryLength()

public boolean getDepthTestEnabled ()

Returns a boolean indicating whether the MapPolyline is rendered with depth test. By default, depth test is disabled.

Returns:

True if the MapPolyline is rendered with depth test, false otherwise

public GeoPolyline getGeoPolyline ()

Gets copy of the GeoPolyline rendered by this MapPolyline .

Returns:

rendered GeoPolyline.

public int getLineColor ()

Gets the current line color for this MapPolyline , returning an ARGB (Alpha/Red/Green/Blue) integer color value.

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

Returns the current line width for this MapPolyline , in pixels.

Returns:

The current line width for this MapPolyline

public int getOutlineColor ()

Gets the current outline color for this MapPolyline , returning an ARGB (Alpha/Red/Green/Blue) integer color value.

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

Returns the current outline width for this MapPolyline , in pixels.

Returns:

The current line width for this MapPolyline

public boolean isDashEnabled ()

Returns a boolean indicating whether the MapPolyline appears as a dashed line. By default, dash is disabled.

Returns:

True if the MapPolyline is dashed, false otherwise

public boolean isGeodesicEnabled ()

Returns a boolean indicating whether each segment of this GeoPolyline is drawn as a geodesic. By default, GeoDesic is disabled.

Returns:

true if GeoPolyline segments are drawn as a geodesic, false otherwise.

public boolean isPerspectiveEnabled ()

Returns a boolean indicating whether the MapPolyline appears thinner further away when the map is tilted. By default, perspective is disabled.

Returns:

true if the MapPolyline has perspective enabled, false otherwise

public MapPolyline setCapStyle (CapStyle style)

Set the MapPolyline rendering cap style.

Parameters:

  • style

    CapStyle

Returns:

The updated MapPolyline itself.

public MapPolyline setDashEnabled (boolean enabled)

Sets the appearance of this MapPolyline as either a dashed or solid line.

Parameters:

  • enabled

    A boolean specifying whether the MapPolyline should be dashed

Returns:

The updated MapPolyline itself.

public MapPolyline setDashPrimaryLength (int length)

Sets a length, in pixels, for the primary dash segment of a dashed MapPolyline . By default, the primary dash length is 1.

Parameters:

  • length

    Desired length of the primary dash

Returns:

The updated MapPolyline itself.

Throws:

  • IllegalArgumentException

    if length is less than or equal to 0.

See also:

setDashSecondaryLength(int)

public MapPolyline setDashSecondaryLength (int length)

Sets a length, in pixels, for the secondary (empty) dash segments of a dashed MapPolyline . By default, the secondary dash length is 1.

Parameters:

  • length

    Desired length of the empty dash

Returns:

The updated MapPolyline itself.

Throws:

  • IllegalArgumentException

    if length is less than or equal 0.

See also:

setDashPrimaryLength(int)

public void setDepthTestEnabled (boolean enabled)

Set whether to render MapPolyline with depth test.

Rendering with depth test should be used if map object altitude is relevant in your application. Rendering objects with different heights while disabling depth test may cause object occlusion.

Parameters:

  • enabled

    true if MapPolyline is rendered with depth test

public MapPolyline setGeoPolyline (GeoPolyline polyline)

Changes the GeoPolyline rendered by this GeoPolyline

Parameters:

  • polyline

    GeoPolyline to be rendered

Returns:

The updated MapPolyline itself.

public MapPolyline setGeodesicEnabled (boolean enabled)

Set whether to draw each segment of the represented GeoPolyline as a geodesic.

Parameters:

  • enabled

    true if GeoPolyline segments will be drawn as a geodesic

Returns:

The updated MapPolyline itself.

public MapPolyline setLineColor (int color)

Sets a line color for this MapPolyline , using an ARGB (Alpha/Red/Green/Blue) integer color value. The default line color is Color.BLUE .

Parameters:

  • color

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

See also:

android.graphics.Color

public MapPolyline setLineWidth (int width)

Sets a line width, in pixels, for this MapPolyline , an int value within the [0..100] range. By default, the line width is 1.

Parameters:

  • width

    Desired width of the line defining the MapPolyline

Returns:

The updated MapPolyline itself.

Throws:

  • IllegalArgumentException

    is width is out of range.

public MapPolyline setOutlineColor (int color)

Sets an outline color for this MapPolyline , using an ARGB (Alpha/Red/Green/Blue) integer color value. The default line color is Color.TRANSPARENT .

Parameters:

  • color

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

See also:

android.graphics.Color

public MapPolyline setOutlineWidth (int width)

Sets an outline width, in pixels, for this MapPolyline , an int value within the [0..100] range. By default, the line width is 0.

Parameters:

  • width

    Desired width of the outline defining the MapPolyline

Returns:

The updated MapPolyline itself.

Throws:

  • IllegalArgumentException

    is width is out of range.

public MapPolyline setPerspectiveEnabled (boolean enabled)

Sets the width of this MapPolyline to be thinner further away when the map is tilted.

Parameters:

  • enabled

    A boolean specifying whether the MapPolyline should have perspective enabled

Returns:

The updated MapPolyline 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.