java.lang.Object | |
↳ | com.amazon.geo.mapsv2.model.Polygon |
A polygon overlay that can be drawn on the map. A Polygon
is a list
of three or more points with line segments drawn between each consecutive
point, and a line segment that closes the shape drawn from the first point to
the last point. A valid Polygon
is filled in with its fill color. A
Polygon
can also have holes, which are regions inside the shape that
are not filled in.
Obtain a Polygon
by creating a PolygonOptions
object with the
initial properties and then passing it to
addPolygon(PolygonOptions)
.
You can change the properties of the Polygon
using the setter methods
after the Polygon
is created. Note that all getter and setter methods
must be called on the main thread or an IllegalStateException
is
thrown.
A valid Polygon
must have at least three unique vertices such that
none of its line segments overlap. All added holes must also be valid
polygons that do not overlap with each other, and all holes must be
completely contained within the border of the Polygon
. An invalid
Polygon
is still drawn, but is not filled in with the fill color.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public constructor.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the fill color of this
Polygon . | |||||||||||
Gets a list of the holes that have been added to this
Polygon .Holes are not supported in Amazon Maps API v2.5. | |||||||||||
Gets the unique ID for this
Polygon . | |||||||||||
Gets a list of the geographic points that comprise the vertices of this
Polygon . | |||||||||||
Gets the stroke color of this
Polygon . | |||||||||||
Gets the stroke width of this
Polygon . | |||||||||||
Gets the z-index of this
Polygon . | |||||||||||
Retrieves a boolean value indicating whether the
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 | |||||||||||
Retrieves a boolean value indicating whether the
Polygon is
visible or hidden. | |||||||||||
Removes this
Polygon from the map. | |||||||||||
Sets the fill color in ARGB format.
| |||||||||||
Sets whether the line segments of this
Polygon are drawn geodesic
or non-geodesic.Geodesic is not supported in Amazon Maps API v2.5 | |||||||||||
Sets the holes in this
Polygon .Holes are not supported in Amazon Maps API v2.5. | |||||||||||
Sets the vertices of this
Polygon . | |||||||||||
Sets the stroke color in ARGB format.
| |||||||||||
Sets the stroke width of this
Polygon 's outline in screen pixels. | |||||||||||
Sets the visibility of the
Polygon . | |||||||||||
Sets the z-index of the
Polygon . | |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public constructor. Instead of using this constructor, use
AmazonMap.addPolygon(PolygonOptions)
to create a Polygon
.
Gets the fill color of this Polygon
.
Color
for more details.
Gets a list of the holes that have been added to this Polygon
.
Holes are automatically closed so each hole may not be equal to holes
added with addHole(Iterable)
or
setHoles(List)
.
The returned list is a copy, so any subsequent changes to the holes are
not reflected in this list, and any changes to this list do not change
the appearance of the Polygon
. To update the holes, use
setHoles(List)
.
Holes are not supported in Amazon Maps API v2.5.
Polygon
. Each hole is represented
as a list of LatLng
objects.
Gets the unique ID for this Polygon
. The ID is unique for all
Polygon
objects currently added to the map. This method may be
called on a background thread.
Polygon
's ID as a String
.
Gets a list of the geographic points that comprise the vertices of this
Polygon
. Each point in the list is represented by a
LatLng
. The Polygon
is automatically closed, so the
returned list may not be equal to the points added with
PolygonOptions
or set with setPoints(List)
.
The returned list is a copy, so any subsequent changes to the vertices of
the Polygon
are not reflected in this list, and any changes to
this list do not change the appearance of the Polygon
. To update
the points of the Polygon
, use setPoints(List)
.
LatLng
objects representing the vertices for
this Polygon
.
Gets the stroke color of this Polygon
.
Polygon
's stroke color in ARGB format. See
Color
for more details.
Gets the stroke width of this Polygon
.
Polygon
's stroke width in screen pixels.
Gets the z-index of this Polygon
.
Polygon
's z-index.
Retrieves a boolean value indicating whether the 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
true
if each segment is drawn geodesic, or false
if each segment is drawn as a straight line.
Retrieves a boolean value indicating whether the Polygon
is
visible or hidden.
true
if this Polygon
is visible, or false
if it is hidden.
Removes this Polygon
from the map. After calling this method,
calling other methods on the object has no effect on the appearance of
the map.
Sets the fill color in ARGB format. Fill color is the color drawn inside
the Polygon
. Holes are not filled in. To draw no fill, use
TRANSPARENT
. The default value is TRANSPARENT
.
color | The color in ARGB format. See Color for more
details.
|
---|
Sets whether the line segments of this 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
geodesic | true to draw geodesic line segments, or
false to draw straight lines on the map.
|
---|
Sets the holes in this Polygon
. The list of holes passed to this
method is copied, so modifying the contents of holes
after
calling this method has no effect. Each hole provided in the list of
holes is represented by a list of LatLng
objects.
Holes are automatically closed, so only unique vertices need to be
included in the list of LatLng
objects. Although manually closing
the holes does not make the Polygon
invalid, it is unnecessary.
Holes are not supported in Amazon Maps API v2.5.
holes | A list of holes. Each hole is represented as a list of
LatLng objects representing the vertices of the hole.
Must not be null . Use an empty list to remove all
holes.
|
---|
Sets the vertices of this Polygon
. The list of points passed to
this method is copied, so modifying the contents of points
after
calling this method has no effect.
The Polygon
is automatically closed, so only unique vertices need
to be included in the list of LatLng
objects. Although manually
closing the Polygon
does not make it invalid, it is unnecessary.
points | A list of LatLng objects that represent the
vertices of this Polygon . Must not be null or
empty.
|
---|
Sets the stroke color in ARGB format. Stroke color is the color of the
Polygon
's outline. To draw no outline, use
TRANSPARENT
. The default value is is BLACK
.
color | The color in ARGB format. See Color for more
details.
|
---|
Sets the stroke width of this Polygon
's outline in screen pixels.
Must be zero or greater. No outline is drawn if stroke width is set to
zero. The default value is 10.
width | The stroke width in screen pixels. |
---|
IllegalArgumentException | if width is less than zero. |
---|
Sets the visibility of the Polygon
. If false
, the
Polygon
is hidden, but all state is preserved. The default value
is true
.
visible | true to make this Polygon visible, or
false to make it hidden.
|
---|
Sets the z-index of 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.
zIndex | The z-index. |
---|