HERE Android SDK Developer's Guide

MapPolygon

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

Class Summary

public final class MapPolygon

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

A graphical representation of a GeoPolygon to be rendered on a map.

[For complete information, see the section Class Details]

See also:

GeoPolygon

Constructor Summary

Table 1. Constructors in MapPolygon
Constructors

MapPolygon ()

Creates a MapPolygon , which is a MapObject in the shape of a polygon.

MapPolygon (GeoPolygon polygon)

Creates a MapPolygon , which is a MapObject in the shape of a polygon.

Method Summary

Table 2. Methods in MapPolygon
Methods

public boolean getDepthTestEnabled ()

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

public int getFillColor ()

Returns the current fill color for this MapPolygon , returning an ARGB (Alpha/Red/Green/Blue) integer color value.

public GeoPolygon getGeoPolygon ()

Gets a copy of the GeoPolygon rendered by this MapPolygon .

public int getLineColor ()

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

public int getLineWidth ()

Returns the current border line width for the MapPolygon , in pixels.

public boolean isGeodesicEnabled ()

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

public void setDepthTestEnabled (boolean enabled)

Set whether to render MapPolygon with depth test.

public MapPolygon setFillColor (int color)

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

public MapPolygon setGeoPolygon (GeoPolygon polygon)

Changes the GeoPolygon rendered by this MapPolygon .

public MapPolygon setGeodesicEnabled (boolean enabled)

Specifies whether to draw each segment of the represented GeoPolygon as a geodesic.

public MapPolygon setLineColor (int color)

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

public MapPolygon setLineWidth (int width)

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

Class Details

A graphical representation of a GeoPolygon to be rendered on a map. In contrast to a MapPolyline, it is assumed that the last coordinate within the path is connected with the first coordinate, thereby constructing an enclosed geometry. Self-intersecting polygons rendering are not supported.

See also:

GeoPolygon

Constructor Details

MapPolygon ()

Creates a MapPolygon , which is a MapObject in the shape of a polygon.

MapPolygon (GeoPolygon polygon)

Creates a MapPolygon , which is a MapObject in the shape of a polygon.

Parameters:

  • polygon

    GeoPolygon to construct the MapPolygon

Throws:

  • IllegalArgumentException

    if the input GeoPolygon is invalid, it is a self-intersecting polygon or vertices are at different altitudes.

Method Details

public boolean getDepthTestEnabled ()

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

Returns:

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

public int getFillColor ()

Returns the current fill color for this MapPolygon , 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 GeoPolygon getGeoPolygon ()

Gets a copy of the GeoPolygon rendered by this MapPolygon .

Returns:

rendered GeoPolygon.

public int getLineColor ()

Returns the current border line color for this MapPolygon , 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 border line width for the MapPolygon , in pixels.

Returns:

The current width of the line defining the border of the MapPolygon

public boolean isGeodesicEnabled ()

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

Returns:

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

public void setDepthTestEnabled (boolean enabled)

Set whether to render MapPolygon 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 MapPolygon is rendered with depth test

public MapPolygon setFillColor (int color)

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

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

See also:

android.graphics.Color

public MapPolygon setGeoPolygon (GeoPolygon polygon)

Changes the GeoPolygon rendered by this MapPolygon .

Parameters:

  • polygon

    GeoPolygon to be rendered

Returns:

The updated MapPolygon itself.

Throws:

  • IllegalArgumentException

    if the input GeoPolygon is invalid, it is a self-intersecting polygon or vertices are at different altitudes.

public MapPolygon setGeodesicEnabled (boolean enabled)

Specifies whether to draw each segment of the represented GeoPolygon as a geodesic.

Parameters:

  • enabled

    true if GeoPolygon segments will be drawn as a geodesic

Returns:

The updated @ code MapPolygon} itself.

public MapPolygon setLineColor (int color)

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

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 @ code MapPolygon} itself.

See also:

android.graphics.Color

public MapPolygon setLineWidth (int width)

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

Parameters:

  • width

    Width of the line defining the border of the MapPolygon

Returns:

The updated @ code MapPolygon} itself.

Throws:

  • IllegalArgumentException

    is width is out of range.