Skip to content
We're currently creating a lot of content. Sign up to get notified when it's ready.

UI

The UI API lets you interact with the Qatium UI.

Sends a message from the plugin to its UI panel. Use onMessage in the Panel SDK to receive it on the panel side.

sendMessage<T>(message: T): void
  • message: T: an arbitrary message to be sent to the UI. Check the documentation of structuredClone to verify what can be sent.

Send a message to the UI panel

const numOfValves = sdk.network.getValves().length
sdk.ui.sendMessage(numOfValves)

Returns true if map view mode is active, or false if it isn’t.

isMapView(): boolean

Returns true if synoptic view mode is active, or false if it isn’t.

isSynopticView(): boolean

Returns true if the plugin’s panel is open, or false if it isn’t.

isPanelOpen(): boolean

Opens the plugin’s panel.

openPanel(): void

Closes the plugin’s panel.

closePanel(): void

Returns true if the plugin’s custom visuals (highlights, map overlays and styles) are visible, or false if they aren’t.

isPluginVisible(): boolean

Returns true if the given network level is visible in the map, or false if it isn’t.

isNetworkLevelVisible(level: "arterial" | "distribution"): boolean

Returns true if the layer for the AssetType, and optionally its group, is visible in the map. Use sdk.map.showMapLayer() and sdk.map.hideMapLayer() to change it.

isMapLayerVisible(
type: AssetType,
layer?: ValveGroup | JunctionGroup | PipeGroup
): boolean
const areCustomerPointsVisible = sdk.ui.isMapLayerVisible("Junction", "customerPoint")

Returns the ISO 639 code of the language active in the Qatium UI. Currently supports English, Spanish, Portuguese, French and Catalan.

getLanguage(): "es" | "en" | "pt" | "fr" | "ca"