PolygonOptions

public final class PolygonOptions extends Object
implements Parcelable

Defines options for a polygon.

Developer Guide

For more information, read the Shapes developer 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 this PolygonOptions object.
List<List<LatLng>>
getHoles()
Gets the holes set for this PolygonOptions object.
List<LatLng>
getPoints()
Gets the outline set for this PolygonOptions object.
int
getStrokeColor()
Gets the stroke color set for this PolygonOptions object.
int
getStrokeJointType()
Gets the stroke joint type set in this PolygonOptions object for all vertices of the polygon's outline.
List<PatternItem>
getStrokePattern()
Gets the stroke pattern set in this PolygonOptions object for the polygon's outline.
float
getStrokeWidth()
Gets the stroke width set for this PolygonOptions object.
float
getZIndex()
Gets the zIndex set for this PolygonOptions object.
boolean
isClickable()
Gets the clickability setting for this PolygonOptions object.
boolean
isGeodesic()
Gets the geodesic setting for this PolygonOptions object.
boolean
isVisible()
Gets the visibility setting for this PolygonOptions 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.
PolygonOptions
zIndex(float zIndex)
Specifies the polygon's zIndex, i.e., the order in which it will be drawn.

Inherited Method Summary

Public Constructors

public PolygonOptions ()

Creates polygon options.

Public Methods

public PolygonOptions add (LatLng... points)

Adds vertices to the outline of the polygon being built.

Parameters
points
Returns
  • this PolygonOptions object with the given points added to the outline.

public PolygonOptions add (LatLng point)

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

Parameters
point
Returns
  • this PolygonOptions object with the given point added to the outline.

public PolygonOptions addAll (Iterable<LatLng> points)

Adds vertices to the outline of the polygon being built.

Parameters
points
Returns
  • this PolygonOptions object with the given points added to the outline.

public PolygonOptions addHole (Iterable<LatLng> points)

Adds a hole to the polygon being built.

Parameters
points
Returns

public PolygonOptions clickable (boolean clickable)

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

Parameters
clickable
Returns

public PolygonOptions fillColor (int color)

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

Parameters
color
Returns

public PolygonOptions geodesic (boolean geodesic)

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

Parameters
geodesic
Returns

public int getFillColor ()

Gets the fill color set for this PolygonOptions object.

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

public List<List<LatLng>> getHoles ()

Gets the holes set for this PolygonOptions object.

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

public List<LatLng> getPoints ()

Gets the outline set for this PolygonOptions object.

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

public int getStrokeColor ()

Gets the stroke color set for this PolygonOptions object.

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

public int getStrokeJointType ()

Gets the stroke joint type set in this PolygonOptions object for all vertices of the polygon's outline. See JointType for possible values.

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

public List<PatternItem> getStrokePattern ()

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

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

public float getStrokeWidth ()

Gets the stroke width set for this PolygonOptions object.

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

public float getZIndex ()

Gets the zIndex set for this PolygonOptions object.

Returns
  • the zIndex of the polygon.

public boolean isClickable ()

Gets the clickability setting for this PolygonOptions object.

Returns
  • true if the polygon is clickable; false if it is not.

public boolean isGeodesic ()

Gets the geodesic setting for this PolygonOptions object.

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

public boolean isVisible ()

Gets the visibility setting for this PolygonOptions object.

Returns
  • true if the polygon is to be visible; false if it is not.

public PolygonOptions strokeColor (int color)

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

Parameters
color
Returns

public PolygonOptions strokeJointType (int jointType)

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

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

Parameters
jointType
Returns

public PolygonOptions strokePattern (List<PatternItem> pattern)

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

Parameters
pattern
Returns

public PolygonOptions strokeWidth (float width)

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

Parameters
width
Returns

public PolygonOptions visible (boolean visible)

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

Parameters
visible
Returns

public PolygonOptions 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.

Parameters
zIndex
Returns