Class Info |
|---|
public final class Circle Defines a circle on a map. A circle can either be solid or hollow. An instance of this type will be returned when the addCircle method in the HuaweiMap class is called. |
Qualifier and Type | Method Name and Description |
|---|---|
boolean | Clears all animations. |
| Obtains the latitude and longitude of the center of a circle. | |
int | Obtains the fill color of a circle. |
String | getId() Obtains the ID of a circle on a map. |
double | Obtains the radius of a circle. |
int | Obtains the stroke color of a circle's outline. |
List<PatternItem> | Obtains the stroke pattern of a circle's outline. |
float | Obtains the stroke width of a circle's outline. |
Object | getTag() Obtains the tag attribute of a circle. |
float | Obtains the z-index of a circle. |
boolean | Checks whether a circle is clickable. |
boolean | Checks whether a circle is visible. |
void | remove() Removes a circle from a map. After the circle is removed, the behavior of its methods is invalid. |
void | setAnimation(Animation animation) Sets the animation for a circle. |
void | Sets the longitude and latitude of the center of a circle. |
void | setClickable(boolean clickable) Sets whether a circle is clickable. |
void | setFillColor(int color) Sets the fill color of a circle. |
void | setRadius(double radius) Sets the radius of a circle. |
void | setStrokeColor(int color) Sets the stroke color of a circle's outline. |
void | setStrokePattern(List<PatternItem> pattern) Sets the stroke pattern of a circle's outline. |
void | setStrokeWidth(float width) Sets the stroke width of a circle's outline. |
<T> void | setTag(T tag) Sets the tag attribute of a circle. |
void | setVisible(boolean visible) Sets whether a circle is visible. |
void | setZIndex(float zIndex) Sets the z-index of a circle. |
void | Starts the animation. |
Method |
|---|
public boolean clearAnimation() Clears all animations. |
Returns
Type | Description |
|---|---|
boolean | true if all animations are cleared successfully; false otherwise. |
Method |
|---|
public LatLng getCenter() Obtains the latitude and longitude of the center of a circle. |
Returns
Type | Description |
|---|---|
Longitude and latitude of the center of a circle. |
Method |
|---|
public int getFillColor() Obtains the fill color of a circle. |
Returns
Type | Description |
|---|---|
int | Color 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. |
Returns
Type | Description |
|---|---|
String | ID of a circle. |
Method |
|---|
public double getRadius() Obtains the radius of a circle. |
Returns
Type | Description |
|---|---|
double | Radius of a circle, in meters. |
Method |
|---|
public int getStrokeColor() Obtains the stroke color of a circle's outline. |
Returns
Type | Description |
|---|---|
int | Color in ARGB format. |
Method |
|---|
public List<PatternItem> getStrokePattern() Obtains the stroke pattern of a circle's outline. |
Returns
Type | Description |
|---|---|
List<PatternItem> | Stroke pattern of a circle's outline. |
Method |
|---|
public float getStrokeWidth() Obtains the stroke width of a circle's outline. |
Returns
Type | Description |
|---|---|
float | Stroke width of a circle's outline, in pixels. |
Method |
|---|
public Object getTag() Obtains the tag attribute of a circle. |
Returns
Type | Description |
|---|---|
Object | Object if a tag has been set; null otherwise. |
Method |
|---|
public float getZIndex() Obtains the z-index of a circle. |
Returns
Type | Description |
|---|---|
float | Z-index, which indicates the overlapping order of a circle. |
Method |
|---|
public boolean isClickable() Checks whether a circle is clickable. |
Returns
Type | Description |
|---|---|
boolean | true if a circle is clickable; false otherwise. |
Method |
|---|
public boolean isVisible() Checks whether a circle is visible. |
Returns
Type | Description |
|---|---|
boolean | true if a circle is visible; false otherwise. |
Method |
|---|
public void remove() Removes a circle from a map. After the circle is removed, the behavior of its methods is invalid. |
Method |
|---|
public void setAnimation(Animation animation) Sets the animation for a circle. NOTE: Only TranslateAnimation is supported. |
Parameters
Name | Description |
|---|---|
Animation object. |
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. NOTE: A circle can be drawn only when the latitude of the circle center is within the range from -85.051119 to 85.051119. If the latitude of the circle center is -85.051119 or 85.051119, a circle with a radius of 1 meter can be drawn. |
Parameters
Name | Description |
|---|---|
center | Center of a circle. |
Throws
Name | Description |
|---|---|
NullPointerException | If the passed center is null. |
Method |
|---|
public void setClickable(boolean clickable) Sets whether a circle is clickable. |
Parameters
Name | Description |
|---|---|
clickable | Indicates whether a circle is clickable.
|
Method |
|---|
public void setFillColor(int color) Sets the fill color of a circle. If it is set as transparent (Color.TRANSPARENT), the circle will not be filled with a color. |
Parameters
Name | Description |
|---|---|
color | Color in ARGB format. By default, the fill color is transparent (0x00000000). |
Method |
|---|
public void setRadius(double radius) Sets the radius of a circle. NOTE: A circle can be drawn only when the latitude of the circle center is within the range from -85.051119 to 85.051119. If the latitude of the circle center is -85.051119 or 85.051119, a circle with a radius of 1 meter can be drawn. |
Parameters
Name | Description |
|---|---|
radius | Radius of a circle, in meters. The value must be greater than or equal to 0. The default value is 0. |
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
Name | Description |
|---|---|
color | Color in ARGB format. By default, the stroke color is black (0xff000000). |
Method |
|---|
public void setStrokePattern(List<PatternItem> pattern) Sets the stroke pattern of a circle's outline. |
Parameters
Name | Description |
|---|---|
pattern | PatternItem object set. The default value is null, indicating that the stroke is in the solid pattern. |
Method |
|---|
public void setStrokeWidth(float width) Sets the stroke width of a circle's outline. |
Parameters
Name | Description |
|---|---|
width | Stroke width of a circle's outline, in pixels. The value must be greater than or equal to 0. The default value is 10. |
Throws
Name | Description |
|---|---|
IllegalArgumentException | If the passed width is a negative number. |
Method |
|---|
public <T> void setTag(T tag) Sets the tag attribute of a circle. The tag attribute can be any object. If null is passed, the tag attribute will be cleared. If you no longer use the tag attribute, call setTag(null) to clear it to prevent memory leakage from occurring on the app. |
Parameters
Name | Description |
|---|---|
tag | Tag of a circle. |
Method |
|---|
public void setVisible(boolean visible) Sets 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
Name | Description |
|---|---|
visible | Indicates whether a circle is visible.
The default value is true. |
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 by the order in which they are added. By default, the z-index is 0. NOTE: The following formula must be met: Number of circles and polygons x 2 + Number of polylines and ground overlays ≤ 1450. If the formula is not met, overlapping errors may occur. |
Parameters
Name | Description |
|---|---|
zIndex | Z-index, which indicates the overlapping order of a circle. The default value is 0. |