UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

160 lines 4.9 kB
import { InjectionToken } from '@angular/core'; import { IEvent, IManagedObject } from '@c8y/client'; import type { MapDefaultConfig, MapTileLayer } from '@c8y/options'; import type * as L from 'leaflet'; import { Observable } from 'rxjs'; import { GlobalAutoRefreshWidgetConfig } from '@c8y/ngx-components'; /** * Utility function to assign asset and event information to a Leaflet marker. * @param marker The Leaflet marker instance. * @param asset The managed object representing the asset (optional). * @param event The event associated with the marker (optional). * @returns The marker with asset and/or event information attached. */ export declare function getC8yMarker(marker: L.Marker, asset?: PositionManagedObject, event?: IEvent): C8yMarker; /** * Injection token for providing map tile layers as an observable. */ export declare const MAP_TILE_LAYER: InjectionToken<Observable<MapTileLayer[]>>; /** * Utility type to require only one of the specified keys in a type. * @ignore */ type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & { [K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>; }[Keys]; /** * Attributes that can be attached to a Cumulocity marker. */ interface C8yMarkerAttr { asset: PositionManagedObject; event: IEvent; } /** * Type representing the attribute keys for a Cumulocity marker. */ export type C8yMarkerAttributes = keyof C8yMarkerAttr; /** * Leaflet marker extended with either asset or event information. */ export type C8yMarker = L.Marker & RequireOnlyOne<C8yMarkerAttr, 'asset' | 'event'>; /** * Enum for supported cluster sizes on the map. */ export declare enum ClusterSize { /** No clustering. */ NONE = 0, /** Cluster of 4. */ FOUR = 1, /** Cluster of 16. */ SIXTEEN = 2 } /** * Enum for map tenant option keys used in configuration. */ export declare enum MapTenantOptionKeys { /** Map configuration key. */ CONFIG = "map-config", /** Map layers key. */ LAYERS = "map-layers" } /** * Managed object with position and optional alarm status and icon for map display. */ export interface PositionManagedObject extends IManagedObject { /** * Position information (latitude, longitude, optional altitude). */ c8y_Position: { lat: number; lng: number; alt?: number; }; /** * Optional active alarms status for the asset. */ c8y_ActiveAlarmsStatus?: { minor: number; major: number; warning: number; critical: number; }; /** * Optional icon information for the asset. */ icon?: { name: string; }; } /** * Configuration for the cluster map, including center and refresh interval. */ export type ClusterMapConfig = MapConfig & { /** * Center coordinates of the map [latitude, longitude]. */ center: [number, number]; /** * Optional refresh interval in milliseconds (null for no auto-refresh). */ refreshInterval?: number | null; }; /** * General map configuration, including options for following, real-time, icon, color, zoom, pan, and bounds. */ export type MapConfig = MapDefaultConfig & { /** Whether the map should follow the selected asset. */ follow?: boolean; /** Whether the map should update in real-time. */ realtime?: boolean; /** Optional icon name for the map. */ icon?: string; /** Optional color for the map or marker. */ color?: string; /** Disable zoom controls. */ disableZoom?: boolean; /** Disable pan controls. */ disablePan?: boolean; /** Optional map bounds. */ bounds?: L.LatLngBounds; /** Optional fit bounds options. */ fitBoundsOptions?: L.FitBoundsOptions; } & GlobalAutoRefreshWidgetConfig; /** * Injection token for providing the default map configuration as an observable. */ export declare const MAP_DEFAULT_CONFIG: InjectionToken<Observable<MapDefaultConfig>>; /** * Default map tile layer configuration (OpenStreetMap). */ export declare const defaultLayer: MapTileLayer; /** * Default map configuration (centered on Düsseldorf, zoom level 2). */ export declare const defaultMapConfig: MapDefaultConfig; /** * Default options for fitting map bounds (padding). */ export declare const defaultFitBoundsOptions: L.FitBoundsOptions; /** * Configuration for the status buttons shown on the map UI. */ export type MapStatusButtonsConfig = { /** Real-time button configuration. */ realtime: { show: boolean; disabled?: boolean; }; /** Fit to bounds button configuration. */ fitToBounds: { show: boolean; disabled?: boolean; }; /** Center button configuration. */ center: { show: boolean; disabled?: boolean; }; }; export {}; //# sourceMappingURL=map.model.d.ts.map