目录

Interface (MapSignalLine)

Modules to Import

import { map, mapCommon } from '@kit.MapKit';

MapSignalLine

Signal line management object, which inherits from BaseOverlay. An instance of this type will be returned when the addSignalLine 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 API version 26.0.0.

System capability: SystemCapability.Map.Core

Since: 26.0.0

Example:

let mapSignalParams: mapCommon.MapSignalParams = {
  signalId: 'signalId1'
};
mapSignalParams.points =
  [{ longitude: 118.553695, latitude: 32.050789 },
    { longitude: 118.553738, latitude: 32.050884 },
    { longitude: 118.548506, latitude: 32.048543 },
    { longitude: 118.548413, latitude: 32.048374 },
    { longitude: 118.547185, latitude: 32.048252 },
    { longitude: 118.546939, latitude: 32.048296 }]
// Add a signal line.
let mapSignalLine1 = await mapController.addSignalLine(mapSignalParams);

[h2]setColors

setColors(colors: number[]): void

Sets the colors of a signal line.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 26.0.0.

System capability: SystemCapability.Map.Core

Since: 26.0.0

Parameters:

Name Type Mandatory Description
colors number[] Yes Signal line colors. The three colors correspond to weak, medium, and strong signals, respectively. The array must contain exactly 3 elements in ARGB format, for example, [0xFF000000, 0xFFFFDF42, 0xFF42B0FF]. Invalid values are not processed.

Example:

// Set the colors of a signal line.
signalLine.setColors([0xFF000000, 0xFFFFDF42, 0xFF42B0FF]);

[h2]getColors

getColors(): number[]

Obtains the colors of a signal line.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 26.0.0.

System capability: SystemCapability.Map.Core

Since: 26.0.0

Returns:

Type Description
number[] Colors of the signal line.

Example:

// Obtain the colors of a signal line.
let colors: number[] = signalLine.getColors()

[h2]setWidth

setWidth(width: number): void

Sets the width of a signal line.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 26.0.0.

System capability: SystemCapability.Map.Core

Since: 26.0.0

Parameters:

Name Type Mandatory Description
width number Yes Width of the signal line, in px. The value range is [0, 512]. Invalid values are not processed.

Example:

// Set the line width to 20.
signalLine.setWidth(20);

[h2]getWidth

getWidth(): number

Obtains the width of a signal line.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 26.0.0.

System capability: SystemCapability.Map.Core

Since: 26.0.0

Returns:

Type Description
number Width of the signal line.

Example:

// Obtain the width of a signal line.
let width: number = signalLine.getWidth()