目录

public class PolygonOptions

Defines attributes for a Polygon.

Public Fields

None.

Constructor

Construction Method
PolygonOptions()

Public Method Summary

Return typeMethod name
PolygonOptionsadd(LatLng… points)
PolygonOptionsadd(LatLng point)
PolygonOptionsaddAll(Iterable<LatLng> points)
PolygonOptionsaddHole(Iterable<LatLng> points)
PolygonOptionsclickable(boolean clickable)
PolygonOptionsfillColor(int color)
PolygonOptionsgeodesic(boolean geodesic)
intgetFillColor()
List<List<LatLng>>getHoles()
List<LatLng>getPoints()
intgetStrokeColor()
intgetStrokeJointType()
List<PatternItem>getStrokePattern()
floatgetStrokeWidth()
floatgetZIndex()
booleanisClickable()
booleanisGeodesic()
booleanisVisible()
PolygonOptionsstrokeColor(int color)
PolygonOptionsstrokeJointType(int jointType)
PolygonOptionsstrokePattern(List<PatternItem> pattern)
PolygonOptionsstrokeWidth(float width)
PolygonOptionsvisible(boolean visible)
PolygonOptionszIndex(float zIndex)

Public Methods

Method
public PolygonOptions add(LatLng… points)
Sets multiple vertices of a polygon.


Parameters:

Parameter nameParameter desc
pointsCoordinates of multiple vertices.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with multiple specified vertices.
Method
public PolygonOptions add(LatLng point)
Adds a vertex to a polygon.


Parameters:

Parameter nameParameter desc
pointCoordinates of a vertex.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a specified vertex.
Method
public PolygonOptions addAll(Iterable<LatLng> points)
Adds multiple vertices to a polygon.


Parameters:

Parameter nameParameter desc
pointsMultiple vertices.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with multiple specified vertices.
Method
public PolygonOptions addHole(Iterable<LatLng> points)
Adds multiple holes to a polygon.


Parameters:

Parameter nameParameter desc
pointsMultiple holes.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with multiple specified holes.
Method
public PolygonOptions clickable(boolean clickable)
Specifies whether a polygon is tappable.


Parameters:

Parameter nameParameter desc
clickableIndicates whether a polygon is tappable.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a new tappability setting.
Method
public PolygonOptions fillColor(int color)
Sets the fill color of a polygon.


Parameters:

Parameter nameParameter desc
colorColor in ARGB format. By default, the fill color is transparent (0x00000000).


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a new fill color.
Method
public PolygonOptions geodesic(boolean geodesic)
Specifies whether to draw each segment of a polygon as a geodesic.


Parameters:

Parameter nameParameter desc
geodesicIndicates whether to draw each segment of a polygon as a geodesic. The options are true (yes) and false (no).


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a new geodesic setting.
Method
public int getFillColor()
Obtains the fill color of a polygon.


Parameters:
None.
Return:

Return typeParameter desc
intColor in ARGB format.
Method
public List<List<LatLng>> getHoles()
Obtains holes of a polygon on a map.


Parameters:
None.
Return:

Return typeParameter desc
List<List<LatLng>>Holes of a polygon.
Method
public List<LatLng> getPoints()
Obtains a set of all vertices of a polygon.


Parameters:
None.
Return:

Return typeParameter desc
List<LatLng>Set of all vertices of a polygon.
Method
public int getStrokeColor()
Obtains the stroke color of a polygon's outline, in ARGB format.


Parameters:
None.
Return:

Return typeParameter desc
intColor in ARGB format.
Method
public int getStrokeJointType()
Obtains the joint type of a polygon.


Parameters:
None.
Return:

Return typeParameter desc
intJoint type of a polygon.
Method
public List<PatternItem> getStrokePattern()
Obtains the stroke pattern of a polygon's outline.


Parameters:
None.
Return:

Return typeParameter desc
List<PatternItem>Stroke pattern of a polygon's outline.
Method
public float getStrokeWidth()
Obtains the stroke width of a polygon's outline.


Parameters:
None.
Return:

Return typeParameter desc
floatStroke width of a polygon's outline, in pixels.
Method
public float getZIndex()
Obtains the z-index of a polygon.


Parameters:
None.
Return:

Return typeParameter desc
floatZ-index, which indicates the overlapping order of a polygon.
Method
public boolean isClickable()
Checks whether a polygon is tappable.


Parameters:
None.
Return:

Return typeParameter desc
booleanIf a polygon is tappable, true is returned. Otherwise, false is returned.
Method
public boolean isGeodesic()
Checks whether each segment of a polygon is drawn as a geodesic.


Parameters:
None.
Return:

Return typeParameter desc
booleanIf each segment is drawn as a geodesic, true is returned. Otherwise, false is returned.
Method
public boolean isVisible()
Checks whether a polygon is visible.


Parameters:
None.
Return:

Return typeParameter desc
booleanIf a polygon is visible, true is returned. Otherwise, false is returned.
Method
public PolygonOptions strokeColor(int color)
Sets the stroke color of a polygon's outline.


Parameters:

Parameter nameParameter desc
colorColor in ARGB format. By default, the stroke color is black (0xff000000).


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a new stroke color.
Method
public PolygonOptions strokeJointType(int jointType)
Sets the joint type of a polygon.


Parameters:

Parameter nameParameter desc
jointTypeJoint type.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a new joint type.
Method
public PolygonOptions strokePattern(List<PatternItem> pattern)
Sets the stroke pattern of a polygon's outline. By default, the stroke pattern is solid, represented by null.


Parameters:

Parameter nameParameter desc
patternPatternItem object set.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a new stroke pattern.
Method
public PolygonOptions strokeWidth(float width)
Sets the stroke width of a polygon's outline.


Parameters:

Parameter nameParameter desc
widthStroke width of a polygon's outline, in pixels. The default value is 10.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a new stroke width.
Method
public PolygonOptions visible(boolean visible)
Specifies whether a polygon is visible. If the polygon is invisible, it will not be drawn but all other states will be preserved.


Parameters:

Parameter nameParameter desc
visibleIndicates whether a polygon is visible.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a new visibility setting.
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 in a random order. By default, the z-index is 0.


Parameters:

Parameter nameParameter desc
zIndexZ-index, which indicates the overlapping order of a polygon.


Return:

Return typeParameter desc
PolygonOptionsPolygonOptions object with a new z-index.