目录

public final class Circle

Defines a circle on a map. There are two types of circles: solid circle and hollow circle.

Public Fields

None.

Constructor

None.

Public Method Summary

Return typeMethod name
LatLnggetCenter()
intgetFillColor()
StringgetId()
doublegetRadius()
intgetStrokeColor()
floatgetStrokeWidth()
ObjectgetTag()
floatgetZIndex()
List<PatternItem>getStrokePattern()
booleanisClickable()
booleanisVisible()
voidremove()
voidsetCenter(LatLng center)
voidsetClickable(boolean clickable)
voidsetFillColor(int color)
voidsetRadius(double radius)
voidsetStrokeColor(int color)
voidsetStrokePattern(@Nullable List<PatternItem> pattern)
voidsetStrokeWidth(float width)
<T> voidsetTag(@Nullable T tag)
voidsetVisible(boolean visible)
voidsetZIndex(float zIndex)

Public Methods

Method
public LatLng getCenter()
Obtains the latitude and longitude of the center of a circle.


Parameters:
None.
Return:

Return typeParameter desc
LatLngLongitude and latitude of the center of a circle.
Method
public int getFillColor()
Obtains the fill color of a circle.


Parameters:
None.
Return:

Return typeParameter desc
intColor in ARGB format.
Method
public String getId()
Obtains the ID of a circle on a map. The ID will be unique among all circles on a map.


Parameters:
None.
Return:

Return typeParameter desc
StringID of a circle.
Method
public double getRadius()
Obtains the radius of a circle.


Parameters:
None.
Return:

Return typeParameter desc
doubleRadius of a circle, in meters.
Method
public int getStrokeColor()
Obtains the stroke color of a circle's outline.


Parameters:
None.
Return:

Return typeParameter desc
intColor in ARGB format.
Method
public float getStrokeWidth()
Obtains the stroke width of a circle's outline.


Parameters:
None.
Return:

Return typeParameter desc
floatStroke width of a circle's outline, in pixels.
Method
public Object getTag()
Obtains the tag that has been set for a circle.


Parameters:
None.
Return:

Return typeParameter desc
ObjectTag of a circle. If no tag has been set, null is returned.
Method
public float getZIndex()
Obtains the z-index of a circle.


Parameters:
None.
Return:

Return typeParameter desc
floatZ-index, which indicates the overlapping order of a circle.
Method
public List<PatternItem> getStrokePattern()
Obtains the stroke pattern of a circle's outline.


Parameters:
None.
Return:

Return typeParameter desc
List<PatternItem>Stroke pattern of a circle's outline.
Method
public boolean isClickable()
Checks whether a circle is tappable.


Parameters:
None.
Return:

Return typeParameter desc
booleanIf a circle is tappable, true is returned. Otherwise, false is returned.
Method
public boolean isVisible()
Checks whether a circle is visible.


Parameters:
None.
Return:

Return typeParameter desc
booleanIf a circle is visible, true is returned. Otherwise, false is returned.
Method
public void remove()
Removes a circle from a map. After the circle is removed, the behavior of its methods is invalid.


Parameters:
None.
Return:
None.


Method
public void setCenter(LatLng center)
Sets the longitude and latitude of the center of a circle. The center cannot be null because there is no default value.


Parameters:

Parameter nameParameter desc
centerCenter of a circle.


Return:
None.
Exception:

Exception typeScenario
NullPointerExceptionThe center is null.
Method
public void setClickable(boolean clickable)
Specifies whether a circle is tappable.


Parameters:

Parameter nameParameter desc
clickableIndicates whether a circle is tappable.


Return:
None.


Method
public void setFillColor(int color)
Sets the fill color of a circle. If it is set as transparent, the circle will not be filled.


Parameters:

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


Return:
None.


Method
public void setRadius(double radius)
Sets the radius of a circle.


Parameters:

Parameter nameParameter desc
radiusRadius of a circle, in meters. The value must be greater than or equal to 0.


Return:
None.


Method
public void setStrokeColor(int color)
Sets the stroke color of a circle's outline. If it is set as transparent, no outline will be drawn for the circle.


Parameters:

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


Return:
None.


Method
public void setStrokePattern(@Nullable List<PatternItem> pattern)
Sets the stroke pattern of a circle's outline. By default, the stroke pattern is solid, represented by null.


Parameters:

Parameter nameParameter desc
patternPatternItem object set.


Return:
None.


Method
public void setStrokeWidth(float width)
Sets the stroke width of a circle's outline.


Parameters:

Parameter nameParameter desc
widthStroke width in pixels. The value must be greater than or equal to 0.


Return:
None.
Exception:

Exception typeScenario
IllegalArgumentExceptionThe stroke width is negative.
Method
public <T> void setTag(@Nullable T tag)
Sets the tag of a circle. If null is passed, the existing tag is cleared.


Parameters:

Parameter nameParameter desc
tagTag of a circle.


Return:
None.

Method
public void setVisible(boolean visible)
Specifies whether a circle is visible. If the circle is invisible, it will not be drawn but all other states will be preserved. By default, a circle is visible.


Parameters:

Parameter nameParameter desc
visibleVisibility of a circle.


Return:
None.

Method
public void setZIndex(float zIndex)
Sets the z-index of a circle. The z-index indicates the overlapping order of a circle. A circle with a larger z-index overlaps that with a smaller z-index. Circles 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 circle.


Return:
None.