目录

PolygonOptions

Class Info

public class PolygonOptions

Defines attributes for a Polygon object.

Public Constructor Summary

Constructor Name

PolygonOptions()

Default constructor of the PolygonOptions class.

Public Method Summary

Qualifier and Type

Method Name and Description

PolygonOptions

add(LatLng... points)

Sets multiple vertices of a polygon.

PolygonOptions

add(LatLng point)

Adds a vertex to a polygon.

PolygonOptions

addAll(Iterable<LatLng> points)

Adds multiple vertices to a polygon.

PolygonOptions

addHole(Iterable<LatLng> points)

Adds multiple holes to a polygon.

PolygonOptions

clickable(boolean clickable)

Sets whether a polygon is tappable.

PolygonOptions

fillColor(int color)

Sets the fill color of a polygon.

PolygonOptions

geodesic(boolean geodesic)

Sets whether to draw each segment of a polygon as a geodesic.

List<List<LatLng>>

getHoles()

Obtains holes in a polygon on a map.

List<LatLng>

getPoints()

Obtains all vertices of a polygon.

List<PatternItem>

getStrokePattern()

Obtains the stroke pattern of a polygon's outline.

PolygonOptions

strokeColor(int color)

Sets the stroke color of a polygon's outline.

PolygonOptions

strokeJointType(int jointType)

Sets the joint type of a polygon.

PolygonOptions

strokePattern(List<PatternItem> pattern)

Sets the stroke pattern of a polygon's outline.

PolygonOptions

strokeWidth(float width)

Sets the stroke width of a polygon's outline.

PolygonOptions

visible(boolean visible)

Sets whether a polygon is visible.

PolygonOptions

zIndex(float zIndex)

Sets the z-index of a polygon.

Public Methods

[h2]add(LatLng... points)

Method

public PolygonOptions add(LatLng... points)

Sets multiple vertices of a polygon.

Parameters

Name

Description

points

Coordinates of multiple vertices.

Returns

Type

Description

PolygonOptions

PolygonOptions object containing the specified vertices.

[h2]add(LatLng point)

Method

public PolygonOptions add(LatLng point)

Adds a vertex to a polygon.

Parameters

Name

Description

point

Coordinates of a vertex.

Returns

Type

Description

PolygonOptions

PolygonOptions object containing the specified vertex.

[h2]addAll

Method

public PolygonOptions addAll(Iterable<LatLng> points)

Adds multiple vertices to a polygon.

Parameters

Name

Description

points

Multiple vertices.

Returns

Type

Description

PolygonOptions

PolygonOptions object containing the specified vertices.

[h2]addHole

Method

public PolygonOptions addHole(Iterable<LatLng> points)

Adds multiple holes to a polygon.

Parameters

Name

Description

points

Multiple holes.

Returns

Type

Description

PolygonOptions

PolygonOptions object containing multiple specified holes.

[h2]clickable

Method

public PolygonOptions clickable(boolean clickable)

Sets whether a polygon is tappable.

Parameters

Name

Description

clickable

Indicates whether a polygon is tappable.

  • true: yes
  • false: no

The default value is false.

Returns

Type

Description

PolygonOptions

PolygonOptions object with the new tappability setting.

[h2]fillColor

Method

public PolygonOptions fillColor(int color)

Sets the fill color of a polygon.

Parameters

Name

Description

color

Color in ARGB format. By default, the fill color is transparent (0x00000000).

Returns

Type

Description

PolygonOptions

PolygonOptions object with the new fill color.

[h2]geodesic

Method

public PolygonOptions geodesic(boolean geodesic)

Sets whether to draw each segment of a polygon as a geodesic.

Parameters

Name

Description

geodesic

Indicates whether to draw each segment of a polygon as a geodesic.

  • true: yes
  • false: no

The default value is false.

Returns

Type

Description

PolygonOptions

PolygonOptions object with the new geodesic attribute setting.

[h2]getHoles

Method

public List<List<LatLng>> getHoles()

Obtains holes in a polygon on a map.

Returns

Type

Description

List<List<LatLng>>

Holes in a polygon.

[h2]getPoints

Method

public List<LatLng> getPoints()

Obtains all vertices of a polygon.

Returns

Type

Description

List<LatLng>

All vertices of a polygon.

[h2]getStrokePattern

Method

public List<PatternItem> getStrokePattern()

Obtains the stroke pattern of a polygon's outline.

Returns

Type

Description

List<PatternItem>

Stroke pattern of a polygon's outline.

[h2]strokeColor

Method

public PolygonOptions strokeColor(int color)

Sets the stroke color of a polygon's outline.

Parameters

Name

Description

color

Color in ARGB format. By default, the stroke color is black (0xff000000).

Returns

Type

Description

PolygonOptions

PolygonOptions object with the new outline stroke color.

[h2]strokeJointType

Method

public PolygonOptions strokeJointType(int jointType)

Sets the joint type of a polygon.

Parameters

Name

Description

jointType

Joint type. The default value is DEFAULT.

Returns

Type

Description

PolygonOptions

PolygonOptions object with the new joint type.

[h2]strokePattern

Method

public PolygonOptions strokePattern(List<PatternItem> pattern)

Sets the stroke pattern of a polygon's outline.

Parameters

Name

Description

pattern

PatternItem object set. The default value is null, indicating that the stroke is in the solid pattern.

Returns

Type

Description

PolygonOptions

PolygonOptions object with the new outline pattern.

[h2]strokeWidth

Method

public PolygonOptions strokeWidth(float width)

Sets the stroke width of a polygon's outline.

Parameters

Name

Description

width

Stroke width of a polygon's outline, in pixels. The default value is 10.

Returns

Type

Description

PolygonOptions

PolygonOptions object with the new outline stroke width.

[h2]visible

Method

public PolygonOptions visible(boolean visible)

Sets whether a polygon is visible. If the polygon is invisible, it will not be drawn but all other states will be preserved.

Parameters

Name

Description

visible

Indicates whether a polygon is visible. By default, a polygon is visible.

Returns

Type

Description

PolygonOptions

PolygonOptions object with the new visibility setting.

[h2]zIndex

Method

public PolygonOptions zIndex(float zIndex)

Sets the z-index of a polygon. The z-index indicates the overlapping order of a polygon. A polygon with a larger z-index overlaps that with a smaller z-index. Polygons with the same z-index overlap each other by the order in which they are added.

Parameters

Name

Description

zIndex

Z-index, which indicates the overlapping order of a polygon. By default, the z-index is 0.

Returns

Type

Description

PolygonOptions

PolygonOptions object with the new z-index.