java.lang.Object | |
↳ | com.google.android.gms.maps.model.Circle |
A circle on the earth's surface (spherical cap).
A circle has the following properties.
LatLng
.Color
. The default value is black
(0xff000000
).Color
. The default value is transparent
(0x00000000
).GroundOverlay
s, TileOverlay
s, Polyline
s, and Polygon
s but
not Marker
s). An overlay with a larger z-index is drawn over overlays with smaller
z-indices. The order of overlays with the same z-index is arbitrary.
The default zIndex is 0.true
, i.e., visible.Methods that modify a Circle must be called on the main thread. If not, an
IllegalStateException
will be thrown at runtime.
GoogleMap map;
// ... get a map.
// Add a circle in Sydney
Circle circle = map.addCircle(new CircleOptions()
.center(new LatLng(-33.87365, 151.20689))
.radius(10000)
.strokeColor(Color.RED)
.fillColor(Color.BLUE));
Note that the current map renderer is unable to draw the circle fill if the circle encompasses either the North or South pole. However, the outline will still be drawn correctly.
For more information, read the Shapes developer guide.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the center as a
LatLng . | |||||||||||
Returns the fill color of this Circle.
| |||||||||||
Gets this circle's id.
| |||||||||||
Returns the circle's radius, in meters.
| |||||||||||
Returns the stroke color.
| |||||||||||
Returns the stroke width.
| |||||||||||
Returns the zIndex.
| |||||||||||
Checks whether the circle is visible.
| |||||||||||
Removes this circle from the map.
| |||||||||||
Sets the center using a
LatLng . | |||||||||||
Sets the fill color.
| |||||||||||
Sets the radius in meters.
| |||||||||||
Sets the stroke color.
| |||||||||||
Sets the stroke width.
| |||||||||||
Sets the visibility of the circle.
| |||||||||||
Sets the zIndex.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Returns the fill color of this Circle.
Gets this circle's id. The id will be unique amongst all Circles on a map.
Returns the circle's radius, in meters.
Returns the stroke color.
Returns the stroke width.
Returns the zIndex.
Checks whether the circle is visible.
Removes this circle from the map.
Sets the radius in meters.
The radius must be zero or greater.
radius | The radius, in meters. |
---|
IllegalArgumentException | if radius is negative |
---|
Sets the stroke width.
The stroke width is the width (in screen pixels) of the circle's outline. It must be zero or greater. If it is zero then no outline is drawn. The default value is 10.
width | The stroke width, in screen pixels. |
---|
IllegalArgumentException | if width is negative |
---|
Sets the visibility of the circle.
If this circle is not visible then it will not be drawn. All other state is preserved. Defaults to True.
visible | false to make this circle invisible. |
---|
Sets the zIndex.
Overlays (such as circles) with higher zIndices are drawn above those with lower indices.
zIndex | The zIndex value. |
---|