java.lang.Object | |
↳ | com.google.android.gms.maps.model.Polygon |
A polygon on the earth's surface. A polygon can be convex or concave, it may span the 180 meridian and it can have holes that are not filled in. It has the following properties:
Color
.
The default value is black (0xff000000
).Color
. The
default value is transparent (0x00000000
). If the polygon geometry is not specified
correctly (see above for Outline and Holes), then no fill will be drawn.Polyline
s, Circle
s, GroundOverlay
s and TileOverlay
s, but
not Marker
s. An overlay with a larger z-index is drawn over overlays with
smaller z-indices. The order of overlays with the same z-index value is arbitrary.
The default is 0.true
, i.e., visible.
Methods that modify a Polygon must be called on the main thread. If not, an
IllegalStateException
will be thrown at runtime.
GoogleMap map;
// ... get a map.
// Add a triangle in the Gulf of Guinea
Polygon polygon = map.addPolygon(new PolygonOptions()
.add(new LatLng(0, 0), new LatLng(0, 5), new LatLng(3, 5), new LatLng(0, 0))
.strokeColor(Color.RED)
.fillColor(Color.BLUE));
For more information, read the Shapes developer guide.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the fill color of this polygon.
| |||||||||||
Returns a snapshot of the holes of this polygon at this time .
| |||||||||||
Gets this polygon's id.
| |||||||||||
Returns a snapshot of the vertices of this polygon at this time .
| |||||||||||
Gets the stroke color of this polygon.
| |||||||||||
Gets the stroke width of this polygon.
| |||||||||||
Gets the zIndex of this polygon.
| |||||||||||
Gets whether each segment of the line is drawn as a geodesic or not.
| |||||||||||
Gets the visibility of this polygon.
| |||||||||||
Removes the polygon from the map.
| |||||||||||
Sets the fill color of this polygon.
| |||||||||||
Sets whether to draw each segment of the line as a geodesic or not.
| |||||||||||
Sets the holes of this polygon.
| |||||||||||
Sets the points of this polygon.
| |||||||||||
Sets the stroke color of this polygon.
| |||||||||||
Sets the stroke width of this polygon.
| |||||||||||
Sets the visibility of this polygon.
| |||||||||||
Sets the zIndex of this polygon.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Gets the fill color of this polygon.
Returns a snapshot of the holes of this polygon at this time . The list returned is a copy of the list of holes and so changes to the polygon's holes will not be reflected by this list, nor will changes to this list be reflected by the polygon.
Gets this polygon's id. The id will be unique amongst all Polygons on a map.
Returns a snapshot of the vertices of this polygon at this time . The list returned is a copy
of the list of vertices and so changes to the polygon's vertices will not be reflected by
this list, nor will changes to this list be reflected by the polygon. To change the vertices
of the polygon, call setPoints(List)
.
Gets the stroke color of this polygon.
Gets the stroke width of this polygon.
Gets the zIndex of this polygon.
Gets whether each segment of the line is drawn as a geodesic or not.
true
if each segment is drawn as a geodesic; false
if each segment is
drawn as a straight line on the Mercator projection.
Gets the visibility of this polygon.
Removes the polygon from the map.
Sets the fill color of this polygon.
color | the color in ARGB format |
---|
Sets whether to draw each segment of the line as a geodesic or not.
geodesic | if true , then each segment is drawn as a geodesic; if false ,
each segment is drawn as a straight line on the Mercator projection.
|
---|
Sets the holes of this polygon. This method will take a copy of the holes, so further
mutations to holes
will have no effect on this polygon.
holes | an list of holes, where a hole is an list of LatLng s.
|
---|
Sets the points of this polygon. This method will take a copy of the points, so further
mutations to points
will have no effect on this polygon.
points | a list of LatLng s that are the vertices of the polygon.
|
---|
Sets the stroke color of this polygon.
color | the color in ARGB format |
---|
Sets the stroke width of this polygon.
width | the width in display pixels. |
---|
Sets the visibility of this polygon. When not visible, a polygon is not drawn, but it keeps all its other properties.
visible | if true , then the polygon is visible; if false , it is not.
|
---|
Sets the zIndex of this polygon. Polygons with higher zIndices are drawn above those with lower indices.
zIndex | the zIndex of this polygon. |
---|