Updates and queries MapCircles. This API inherits from BaseOverlay. An instance of this type will be returned when the addCircle method in the map.MapComponentController class is called.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Example:
let mapCircleOptions: mapCommon.MapCircleOptions = {
center: {
latitude: 39.9,
longitude: 116.4
},
radius: 5000,
fillColor: 0XFF00FFFF,
strokeColor: 0xFFFF0000,
strokeWidth: 10,
zIndex: 15
};
let mapCircle = await this.mapController.addCircle(mapCircleOptions); getCenter(): mapCommon.LatLng
Obtains the longitude and latitude of the center of a MapCircle.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Returns:
| Type | Description |
|---|---|
| mapCommon.LatLng | Longitude and latitude of the MapCircle center. |
Example:
let center: mapCommon.LatLng = mapCircle.getCenter();
getFillColor(): number
Obtains the fill color of a MapCircle.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Returns:
| Type | Description |
|---|---|
| number | Fill color of a MapCircle. |
Example:
let fillColor: number = mapCircle.getFillColor();
getRadius(): number
Obtains the radius of a MapCircle.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Returns:
| Type | Description |
|---|---|
| number | Radius of a MapCircle, in meters. |
Example:
let radius: number = mapCircle.getRadius();
getStrokeColor(): number
Obtains the stroke color of a MapCircle's outline.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Returns:
| Type | Description |
|---|---|
| number | Color in ARGB format. |
Example:
let strokeColor: number = mapCircle.getStrokeColor();
getPatterns(): Array<mapCommon.PatternItem>
Obtains the pattern of a MapCircle's outline.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Returns:
| Type | Description |
|---|---|
| Array<mapCommon.PatternItem> | Patterns of a MapCircle's outline. |
Example:
let patterns: Array<mapCommon.PatternItem> = mapCircle.getPatterns();
getStrokeWidth(): number
Obtains the stroke width of a MapCircle's outline.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Returns:
| Type | Description |
|---|---|
| number | Stroke width of a MapCircle's outline, in pixels. |
Example:
let strokeWidth: number = mapCircle.getStrokeWidth();
isClickable(): boolean
Checks whether a MapCircle is tappable.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Returns:
| Type | Description |
|---|---|
| boolean | Indicates whether a MapCircle is tappable. - true: yes - false: no |
Example:
let clickable: boolean = mapCircle.isClickable();
setCenter(center: mapCommon.LatLng): void
Sets the longitude and latitude of the center of a MapCircle.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| center | mapCommon.LatLng | Yes | Longitude-latitude coordinates of the center of a MapCircle. A MapCircle can be drawn only when the latitude of its center is within the range from -85.051119 to 85.051119. If the latitude of the center is -85.051119 or 85.051119, a MapCircle with a radius of 1 meter can be drawn exactly. |
Example:
let center: mapCommon.LatLng = {latitude: 31.98, longitude: 116.4};
mapCircle.setCenter(center); setClickable(clickable: boolean): void
Sets whether a MapCircle is tappable.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| clickable | boolean | Yes | Indicates whether a MapCircle is tappable. Invalid values are not processed. - true: yes - false: no |
Example:
let clickable = true; mapCircle.setClickable(clickable);
setFillColor(color: number): void
Sets the fill color of a MapCircle.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| color | number | Yes | Fill color of a MapCircle, in ARGB format. Invalid values are not processed. |
Example:
let fillColor = 0xFF00FFFF; mapCircle.setFillColor(fillColor);
setRadius(radius: number): void
Sets the radius of a MapCircle.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| radius | number | Yes | Radius of a MapCircle, in meters. The value must be greater than or equal to 0. Invalid values are not processed. |
Example:
let radius = 300; mapCircle.setRadius(radius);
setStrokeColor(color: number): void
Sets the stroke color of a MapCircle's outline.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| color | number | Yes | Stroke color of a MapCircle's outline, in ARGB format. Invalid values are not processed. |
Example:
let strokeColor = 0xFFFF0000; mapCircle.setStrokeColor(strokeColor);
setPatterns(patterns: Array<mapCommon.PatternItem>): void
Sets the pattern of a MapCircle's outline.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| patterns | Array<mapCommon.PatternItem> | Yes | Patterns of a MapCircle's outline. |
Example:
let patterns: Array<mapCommon.PatternItem> = [
{ type: 0, length: 100 },
{ type: 1, length: 100 },
{ type: 2, length: 100 }];
mapCircle.setPatterns(patterns); setStrokeWidth(width: number): void
Sets the stroke width of a MapCircle's outline.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| width | number | Yes | Stroke width of a MapCircle's outline, in pixels. The value must be greater than or equal to 0. |
Example:
let width = 10; mapCircle.setStrokeWidth(width);