MassPointOverlay object. An instance of this type will be returned when the addMassPointOverlay 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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Example:
let items: mapCommon.MassPointItem[] = [];
for (let i = 0; i < 1000; i++) {
// Save massive points to items.
items.push({
// itemId is a custom identifier.
itemId: 'test' + i,
// Longitude-latitude coordinates.
position: {
longitude: 118.11111 + Math.random() * 1 - 0.5,
latitude: 32.11111 + Math.random() * 1 - 0.5
},
snippet: 'test' + i,
title: 'test' + i
})
}
let params: mapCommon.MassPointOverlayParams = {
id: 'test',
items: items,
// The icon is stored in resources/rawfile. Set icon to the relative path of the icon file within the rawfile folder.
icon: 'icon/maps_blue_dot.png'
}
let massPointOverlay = await this.mapController?.addMassPointOverlay(params); getId(): string
Obtains the MassPointOverlay ID.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Returns:
| Type | Description |
|---|---|
| string | MassPointOverlay ID. |
Example:
let Id = massPointOverlay.getId();
setItems(items: mapCommon.MassPointItem[]): void
Sets the massive point list.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| items | mapCommon.MassPointItem[] | Yes | Massive point list (it is recommended that the number of massive points be less than 100,000). |
Example:
let items: mapCommon.MassPointItem[] = [
{
itemId: '1',
position: { latitude: 32.11111, longitude: 118.11111 }
},
{
itemId: '2',
position: { latitude: 32.22222, longitude: 118.22222 }
}
];
massPointOverlay.setItems(items); getItems(): mapCommon.MassPointItem[]
Obtains the massive point list.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Returns:
| Type | Description |
|---|---|
| mapCommon.MassPointItem[] | Massive point list. |
Example:
let MassPointItem: mapCommon.MassPointItem[] = this.massPointOverlay.getItems();
setAnchorU(anchorU: number): void
Sets the horizontal position of the icon anchor.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| anchorU | number | Yes | Horizontal position of the icon anchor. The value ranges from 0 to 1. |
Example:
massPointOverlay.setAnchorU(0.6);
getAnchorU(): number
Obtains the horizontal position of the icon anchor.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Returns:
| Type | Description |
|---|---|
| number | Horizontal position of the icon anchor. |
Example:
let AnchorU: number = this.massPointOverlay.getAnchorU();
setAnchorV(anchorV: number): void
Sets the vertical position of the icon anchor.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| anchorV | number | Yes | Vertical position of the icon anchor. The value ranges from 0 to 1. |
Example:
massPointOverlay.setAnchorV(0.6);
getAnchorV(): number
Obtains the vertical position of the icon anchor.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Returns:
| Type | Description |
|---|---|
| number | Vertical position of the icon anchor. |
Example:
let AnchorV: number = this.massPointOverlay.getAnchorV();
setVisible(visible: boolean): void
Sets whether the MassPointOverlay is visible.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| visible | boolean | Yes | Indicates whether the MassPointOverlay is visible. - true: yes - false: no |
Example:
massPointOverlay.setVisible(true);
isVisible(): boolean
Checks whether the MassPointOverlay is visible.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Returns:
| Type | Description |
|---|---|
| boolean | Indicates whether the MassPointOverlay is visible. - true: yes - false: no |
Example:
let isVisible: boolean = massPointOverlay.isVisible();
remove(): void
Deletes a MassPointOverlay.
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 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Example:
massPointOverlay.remove();