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
).null
) or a sequence of PatternItem
objects to
be repeated along the circle's outline. Available PatternItem
types: Gap
(defined by gap length in pixels), Dash
(defined by stroke width and dash length in
pixels) and Dot
(circular, centered on the circle's outline, diameter defined by stroke
width in pixels).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.Object
associated with the circle. For example, the Object
can contain
data about what the circle represents. This is easier than storing a separate
Map<Circle, Object>
. As another example, you can associate a String
ID
corresponding to the ID from a data set. Google Maps Android API neither reads nor writes this
property.
Methods in this class must be called on the Android UI 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 pattern of this circle's outline.
| |||||||||||
Returns the stroke width.
| |||||||||||
Gets the tag for the circle.
| |||||||||||
Returns the zIndex.
| |||||||||||
Gets the clickability of the circle.
| |||||||||||
Checks whether the circle is visible.
| |||||||||||
Removes this circle from the map.
| |||||||||||
Sets the center using a
LatLng . | |||||||||||
Sets the clickability of the circle.
| |||||||||||
Sets the fill color.
| |||||||||||
Sets the radius in meters.
| |||||||||||
Sets the stroke color.
| |||||||||||
Sets the stroke pattern of the circle's outline.
| |||||||||||
Sets the stroke width.
| |||||||||||
Sets the tag for the circle.
| |||||||||||
Sets the visibility of the circle.
| |||||||||||
Sets the zIndex.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Returns the fill color of this Circle.
Returns | |
---|---|
int |
The fill color of the circle in ARGB format. |
Gets this circle's id. The id will be unique amongst all Circles on a map.
Returns | |
---|---|
String |
Returns the circle's radius, in meters.
Returns | |
---|---|
double |
The radius in meters. |
Returns the stroke color.
Returns | |
---|---|
int |
The color of the circle in ARGB format. |
Returns the stroke pattern of this circle's outline.
Returns | |
---|---|
List<PatternItem> |
the stroke pattern. |
Returns the stroke width.
Returns | |
---|---|
float |
The width in screen pixels. |
Gets the tag for the circle.
Returns | |
---|---|
Object |
the tag if a tag was set with setTag ; null if no tag has been set.
|
Returns the zIndex.
Returns | |
---|---|
float |
The zIndex of this circle. |
Gets the clickability of the circle. If the circle is clickable, your app
will receive notifications to the GoogleMap.OnCircleClickListener
when the
user clicks the circle. The event listener is registered through
setOnCircleClickListener(GoogleMap.OnCircleClickListener)
.
Returns | |
---|---|
boolean |
true if the circle is clickable; false if it is not clickable.
|
Checks whether the circle is visible.
Returns | |
---|---|
boolean |
true if the circle is visible; false if it is invisible.
|
Removes this circle from the map. After a circle has been removed, the behavior of all its methods is undefined.
Sets the clickability of the circle. If the circle is clickable, your app will receive
notifications to the GoogleMap.OnCircleClickListener
when the user clicks the
circle. The event listener is registered through
setOnCircleClickListener(GoogleMap.OnCircleClickListener)
.
Parameters | |
---|---|
clickable |
boolean :
New clickability setting for the circle.
|
Sets the radius in meters.
The radius must be zero or greater.
Parameters | |
---|---|
radius |
double :
The radius, in meters. |
Throws | |
---|---|
IllegalArgumentException |
if radius is negative |
Sets the stroke pattern of the circle's outline. The default stroke pattern is solid,
represented by null
.
Parameters | |
---|---|
pattern |
List :
the stroke pattern.
|
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.
Parameters | |
---|---|
width |
float :
The stroke width, in screen pixels. |
Throws | |
---|---|
IllegalArgumentException |
if width is negative |
Sets the tag for the circle.
You can use this property to associate an arbitrary Object
with this circle. For
example, the Object
can contain data about what the circle represents. This is easier
than storing a separate Map<Circle, Object>
. As another example, you can associate a
String
ID corresponding to the ID from a data set. Google Maps Android API neither
reads nor writes this property. It is your responsibility to call setTag(null)
to
clear the tag when you no longer need it, to prevent memory leaks in your app.
Parameters | |
---|---|
tag |
Object :
if null, the tag is cleared.
|
Sets the visibility of the circle.
If this circle is not visible then it will not be drawn. All other state is preserved. Circles are visible by default.
Parameters | |
---|---|
visible |
boolean :
true to make this circle visible; false to make it invisible.
|
Sets the zIndex.
Overlays (such as circles) with higher zIndices are drawn above those with lower indices.
Parameters | |
---|---|
zIndex |
float :
The zIndex value.
|