public final class

PolygonOptions

extends Object
java.lang.Object
   ↳ com.amazon.geo.mapsv2.model.PolygonOptions

Class Overview

An object for defining the initial options for a Polygon object. Use this to define all the properties of a Polygon before calling the addPolygon(PolygonOptions) method to add the Polygon to the map.

Modifying PolygonOptions after the Polygon has been added to the map has no effect on the appearance of the Polygon.

See Polygon for details on creating a valid Polygon.

Note that PolygonOptions methods do not need to be called on the main thread.

Summary

Public Constructors
PolygonOptions()
Creates a new PolygonOptions object with default values.
Public Methods
PolygonOptions add(LatLng... points)
Adds multiple vertices to the end of the new Polygon.
PolygonOptions add(LatLng point)
Adds a vertex to the end of the new Polygon.
PolygonOptions addAll(Iterable<LatLng> points)
Adds all vertices in points to the end of the new Polygon.
PolygonOptions addHole(Iterable<LatLng> points)
Adds a hole to the new Polygon.

Holes are not supported in Amazon Maps API v2.5.

int describeContents()
boolean equals(Object obj)
PolygonOptions fillColor(int color)
Sets the fill color to use for the new Polygon in ARGB format.
PolygonOptions geodesic(boolean geodesic)
Sets whether the line segments for the new Polygon are drawn geodesic or non-geodesic.

Geodesic is not supported in Amazon Maps API v2.5

int getFillColor()
Gets the fill color to use for the new Polygon.
List<List<LatLng>> getHoles()
Gets a list of the holes that have been added with addHole(Iterable).

Holes are not supported in Amazon Maps API v2.5.

List<LatLng> getPoints()
Gets the list of the vertices to use to represent the new Polygon.
int getStrokeColor()
Gets the stroke color to use for the new Polygon.
float getStrokeWidth()
Gets the stroke width to use for the new Polygon.
float getZIndex()
Gets the z-index to use for the new Polygon.
int hashCode()
boolean isGeodesic()
Retrieves a boolean value indicating whether the new Polygon line segments are drawn as geodesic (curved to correspond to the shortest path between two points on the surface of the Earth) or as straight lines.

Geodesic is not supported in Amazon Maps API v2.5

boolean isVisible()
Retrieves a boolean value indicating whether the new Polygon is visible or hidden.
PolygonOptions strokeColor(int color)
Sets the stroke color to use for the new Polygon in ARGB format.
PolygonOptions strokeWidth(float width)
Sets the stroke width to use for the new Polygon's outline in screen pixels.
PolygonOptions visible(boolean visible)
Sets the visibility to use for the new Polygon.
void writeToParcel(Parcel out, int flags)
PolygonOptions zIndex(float zIndex)
Sets the z-index to use for the new the Polygon.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PolygonOptions ()

Creates a new PolygonOptions object with default values.

Public Methods

public PolygonOptions add (LatLng... points)

Adds multiple vertices to the end of the new Polygon.

Parameters
points The vertices to add as multiple LatLng objects. Must not be null.
Returns
  • This PolygonOptions object.

public PolygonOptions add (LatLng point)


This method is still under development and the API is subject to change or removal at any time without notice.
The API may change on your device if it is flashed with a new build or receives an OTA update.

Adds a vertex to the end of the new Polygon.

Parameters
point The vertex to add as a LatLng object. Must not be null.
Returns
  • This PolygonOptions object.

public PolygonOptions addAll (Iterable<LatLng> points)

Adds all vertices in points to the end of the new Polygon.

Parameters
points An Iterable of LatLng objects to add. Must not be null.
Returns
  • This PolygonOptions object.

public PolygonOptions addHole (Iterable<LatLng> points)

Adds a hole to the new Polygon. A valid hole has three or more points and is completely contained within the Polygon. To be valid, line segments drawn between each consecutive point must not overlap.

Holes are not supported in Amazon Maps API v2.5.

Parameters
points An Iterable of LatLng objects that represent a hole. Must not be null.
Returns
  • This PolygonOptions object.

public int describeContents ()

public boolean equals (Object obj)

public PolygonOptions fillColor (int color)

Sets the fill color to use for the new Polygon in ARGB format. Fill color is the color drawn inside the Polygon. To draw no fill, use TRANSPARENT. The default value is TRANSPARENT.

Parameters
color The color in ARGB format. See Color for more details.
Returns
  • This PolygonOptions object.

public PolygonOptions geodesic (boolean geodesic)

Sets whether the line segments for the new Polygon are drawn geodesic or non-geodesic. The default is false to draw straight lines.

Geodesic line segments are drawn as a curve that corresponds to the shortest path between two points on the surface of the Earth. The curve is drawn assuming that the Earth is a sphere.

Non-geodesic line segments are drawn as straight lines on top of the map's projection.

Geodesic is not supported in Amazon Maps API v2.5

Parameters
geodesic true to draw geodesic line segments, or false to draw straight lines on the map.
Returns
  • This PolygonOptions object.

public int getFillColor ()

Gets the fill color to use for the new Polygon.

Returns
  • The fill color of the Polygon in ARGB format. See Color for more details.

public List<List<LatLng>> getHoles ()

Gets a list of the holes that have been added with addHole(Iterable). The list returned is a shallow copy, so adding additional holes to the returned list has no effect. However, modifying individual holes in the list does change the resulting Polygon defined by this PolygonOptions object.

Holes are not supported in Amazon Maps API v2.5.

Returns
  • A list of the Polygon's holes. Each hole is represented as a list of LatLng objects.

public List<LatLng> getPoints ()

Gets the list of the vertices to use to represent the new Polygon.

Returns
  • A list of LatLng objects that represents the Polygon.

public int getStrokeColor ()

Gets the stroke color to use for the new Polygon.

Returns
  • The Polygon's stroke color in ARGB format. See Color for more details.

public float getStrokeWidth ()

Gets the stroke width to use for the new Polygon.

Returns
  • The Polygon's stroke width in screen pixels.

public float getZIndex ()

Gets the z-index to use for the new Polygon.

Returns
  • The Polygon's z-index.

public int hashCode ()

public boolean isGeodesic ()

Retrieves a boolean value indicating whether the new Polygon line segments are drawn as geodesic (curved to correspond to the shortest path between two points on the surface of the Earth) or as straight lines.

Geodesic is not supported in Amazon Maps API v2.5

Returns
  • true if each segment is drawn geodesic, or false if each segment is drawn as a straight line.

public boolean isVisible ()

Retrieves a boolean value indicating whether the new Polygon is visible or hidden.

Returns
  • true if the Polygon is visible, or false if it is invisible.

public PolygonOptions strokeColor (int color)

Sets the stroke color to use for the new Polygon in ARGB format. Stroke color is the color of the Polygon's outline. To draw no outline, use TRANSPARENT. The default value is BLACK.

Parameters
color The color in ARGB format. See Color for more details.
Returns
  • This PolygonOptions object.

public PolygonOptions strokeWidth (float width)

Sets the stroke width to use for the new Polygon's outline in screen pixels. Must be zero or greater. Setting a negative stroke width causes addPolygon(PolygonOptions) to throw an IllegalArgumentException. No outline is drawn if the stroke width is set to zero. The default value is 10.

Parameters
width The stroke width of the new Polygon in screen pixels.
Returns
  • This PolygonOptions object

public PolygonOptions visible (boolean visible)

Sets the visibility to use for the new Polygon. The default value is true.

Parameters
visible true to make the Polygon visible, or false to make it invisible.
Returns
  • This PolygonOptions object.

public void writeToParcel (Parcel out, int flags)

public PolygonOptions zIndex (float zIndex)

Sets the z-index to use for the new the Polygon. Z-index determines the order in which overlays are drawn. Overlays with higher indices are drawn over overlays with lower indices. Overlays with the same z-index are drawn in an arbitrary order.

Overlays that are affected by z-index include GroundOverlay, TileOverlay, Circle, Polyline, and Polygon.

Marker overlays are not affected by the z-index of other overlays.

The default value is zero.

Parameters
zIndex The z-index for the new Polygon.
Returns
  • This PolygonOptions object.