PolygonOptions

public final classPolygonOptionsextendsObject
implementsParcelable

Defines options for a polygon.

Developer Guide

For more information, read theShapesdeveloper guide.

Inherited Constant Summary

Public Constructor Summary

PolygonOptions()
Creates polygon options.

Public Method Summary

PolygonOptions
add(LatLng... points)
Adds vertices to the outline of the polygon being built.
PolygonOptions
add(LatLng point)
Adds a vertex to the outline of the polygon being built.
PolygonOptions
addAll(Iterable<LatLng> points)
Adds vertices to the outline of the polygon being built.
PolygonOptions
addHole(Iterable<LatLng> points)
Adds a hole to the polygon being built.
PolygonOptions
clickable(boolean clickable)
Specifies whether this polygon is clickable.
PolygonOptions
fillColor(int color)
Specifies the polygon's fill color, as 32-bit ARGB.
PolygonOptions
geodesic(boolean geodesic)
Specifies whether to draw each segment of this polygon as a geodesic.
int
getFillColor()
Gets the fill color set for thisPolygonOptions object.
List<List<LatLng>>
getHoles()
Gets the holes set for thisPolygonOptions object.
List<LatLng>
getPoints()
Gets the outline set for thisPolygonOptions object.
int
getStrokeColor()
Gets the stroke color set for thisPolygonOptions object.
int
getStrokeJointType()
Gets the stroke joint type set in thisPolygonOptions object for all vertices of the polygon's outline.
List<PatternItem>
getStrokePattern()
Gets the stroke pattern set in thisPolygonOptions object for the polygon's outline.
float
getStrokeWidth()
Gets the stroke width set for thisPolygonOptions object.
float
getZIndex()
Gets the zIndex set for thisPolygonOptions object.
boolean
isClickable()
Gets the clickability setting for thisPolygonOptions object.
boolean
isGeodesic()
Gets the geodesic setting for thisPolygonOptions object.
boolean
isVisible()
Gets the visibility setting for thisPolygonOptions object.
PolygonOptions
strokeColor(int color)
Specifies the polygon's stroke color, as 32-bit ARGB.
PolygonOptions
strokeJointType(int jointType)
Specifies the joint type for all vertices of the polygon's outline.
PolygonOptions
strokePattern(List<PatternItem> pattern)
Specifies a stroke pattern for the polygon's outline.
PolygonOptions
strokeWidth(float width)
Specifies the polygon's stroke width, in display pixels.
PolygonOptions
visible(boolean visible)
Specifies the visibility for the polygon.
void
writeToParcel(Parcelout, int flags)
PolygonOptions
zIndex(float zIndex)
Specifies the polygon's zIndex, i.e., the order in which it will be drawn.

Inherited Method Summary

Public Constructors

publicPolygonOptions()

Creates polygon options.

Public Methods

publicPolygonOptions add(LatLng... points)

Adds vertices to the outline of the polygon being built.

Parameters
points an array ofLatLngs that are added to the outline of the polygon. Must not benull.
Returns
  • thisPolygonOptions object with the given points added to the outline.

publicPolygonOptions add(LatLng point)

Adds a vertex to the outline of the polygon being built.

Parameters
point aLatLng that is added to the outline of the polygon. Must not benull.
Returns
  • thisPolygonOptions object with the given point added to the outline.

publicPolygonOptions addAll(Iterable<LatLng> points)

Adds vertices to the outline of the polygon being built.

Parameters
points a list ofLatLngs that are added to the outline of the polygon. Must not benull.
Returns
  • thisPolygonOptions object with the given points added to the outline.

publicPolygonOptions addHole(Iterable<LatLng> points)

Adds a hole to the polygon being built.

Parameters
points an iterable ofLatLngs that represents a hole. Must not benull.
Returns

publicPolygonOptions clickable(boolean clickable)

Specifies whether this polygon is clickable. The default setting is false

Returns

publicPolygonOptions fillColor(int color)

Specifies the polygon's fill color, as 32-bit ARGB. The default color is black ( 0xff000000).

Returns

publicPolygonOptions geodesic(boolean geodesic)

Specifies whether to draw each segment of this polygon as a geodesic. The default setting isfalse

Returns

public intgetFillColor()

Gets the fill color set for thisPolygonOptions object.

Returns
  • the fill color of the polygon in screen pixels.

publicList<List<LatLng>> getHoles()

Gets the holes set for thisPolygonOptions object.

Returns
  • the list ofList<LatLng>s specifying the holes of the polygon.

publicList<LatLng> getPoints()

Gets the outline set for thisPolygonOptions object.

Returns
  • the list ofLatLngs specifying the vertices of the outline of the polygon.

public intgetStrokeColor()

Gets the stroke color set for thisPolygonOptions object.

Returns
  • the stroke color of the polygon in screen pixels.

public intgetStrokeJointType()

Gets the stroke joint type set in thisPolygonOptions object for all vertices of the polygon's outline. SeeJointType for possible values.

Returns
  • the stroke joint type of the polygon's outline.

publicList<PatternItem> getStrokePattern()

Gets the stroke pattern set in thisPolygonOptions object for the polygon's outline.

Returns
  • the stroke pattern of the polygon's outline.

public floatgetStrokeWidth()

Gets the stroke width set for thisPolygonOptions object.

Returns
  • the stroke width of the polygon in screen pixels.

public floatgetZIndex()

Gets the zIndex set for thisPolygonOptions object.

Returns
  • the zIndex of the polygon.

public booleanisClickable()

Gets the clickability setting for thisPolygonOptions object.

Returns
  • trueif the polygon is clickable;falseif it is not.

public booleanisGeodesic()

Gets the geodesic setting for thisPolygonOptions object.

Returns
  • trueif the polygon segments should be geodesics;false if they should not be.

public booleanisVisible()

Gets the visibility setting for thisPolygonOptions object.

Returns
  • trueif the polygon is to be visible;falseif it is not.

publicPolygonOptions strokeColor(int color)

Specifies the polygon's stroke color, as 32-bit ARGB. The default color is black ( 0xff000000).

Returns

publicPolygonOptions strokeJointType(int jointType)

Specifies the joint type for all vertices of the polygon's outline.

SeeJointType for allowed values. The default valueJointType.DEFAULT will be used if joint type is undefined or is not one of the allowed values.

Returns

publicPolygonOptions strokePattern(List<PatternItem> pattern)

Specifies a stroke pattern for the polygon's outline. The default stroke pattern is solid, represented bynull.

Returns

publicPolygonOptions strokeWidth(float width)

Specifies the polygon's stroke width, in display pixels. The default width is 10.

Returns

publicPolygonOptions visible(boolean visible)

Specifies the visibility for the polygon. The default visibility is true.

Returns

public voidwriteToParcel(Parcelout, int flags)

publicPolygonOptions zIndex(float zIndex)

Specifies the polygon's zIndex, i.e., the order in which it will be drawn. See the documentation at the top of this class for more information about zIndex.

Returns