@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
116 lines • 5.49 kB
TypeScript
import { ElementRef, EventEmitter, IterableDiffers, SimpleChange, SimpleChanges } from '@angular/core';
import { IManagedObject } from '@c8y/client';
import type { MapDefaultConfig, MapTileLayer } from '@c8y/options';
import { ColorService, CountdownIntervalComponent, DatePipe, GeoService, ManagedObjectRealtimeService, WidgetGlobalAutoRefreshService, DynamicComponent, DynamicComponentAlertAggregator } from '@c8y/ngx-components';
import { TranslateService } from '@ngx-translate/core';
import type * as L from 'leaflet';
import { BehaviorSubject, Observable } from 'rxjs';
import { MapComponent } from './map.component';
import { ClusterMapConfig, PositionManagedObject } from './map.model';
import { MapService } from './map.service';
import * as i0 from "@angular/core";
/**
* Smart map component for that clusters devices together when there are too many to display individually.
* Unlike the basic map, this component loads device data dynamically and manages cluster rendering and updates.
* Extends the base MapComponent with clustering, dynamic data loading, and advanced refresh logic.
*/
export declare class ClusterMapComponent extends MapComponent implements DynamicComponent {
protected moRealtimeService: ManagedObjectRealtimeService;
protected mapService: MapService;
protected layers$: Observable<MapTileLayer[]>;
protected defaultConfig$: Observable<MapDefaultConfig>;
protected translateService: TranslateService;
protected widgetGlobalAutoRefreshService: WidgetGlobalAutoRefreshService;
private iterable;
private colorService;
/** Emits true while the map is loading or refreshing clusters. */
isLoading$: BehaviorSubject<boolean>;
/** @ignore */
countdownIntervalComp: CountdownIntervalComponent;
/**
* Cluster map configuration, including clustering thresholds and refresh intervals.
*/
config: ClusterMapConfig;
/**
* The root managed object (e.g., group or device) for which to load and cluster data.
*/
rootNode: IManagedObject;
/**
* Single asset to display (if not clustering). Used for following a specific device.
* If provided, clusters will not be used, and the asset will be displayed individually.
* If not provided, the component will cluster devices based on the root node.
*/
assets: PositionManagedObject;
/**
* Whether to show a color overlay for each cluster rectangle. This can be useful for debugging or visualizing clusters.
*/
showClusterColor: boolean;
/**
* Emits Leaflet map change events (move, moveend) for external listeners.
*/
mapChange: EventEmitter<L.LeafletEvent>;
/** Reference to the map element in the template. */
mapElement: ElementRef;
/** Aggregator for dynamic component alerts. */
alerts: DynamicComponentAlertAggregator;
/** @ignore */
errorNotifier: BehaviorSubject<any>;
private reloadTrigger$;
private clusters;
private readonly EVENT_THROTTLE_TIME;
/**
* Constructs the ClusterMapComponent, injecting required services and initializing the base map.
*/
constructor(moRealtimeService: ManagedObjectRealtimeService, mapService: MapService, layers$: Observable<MapTileLayer[]>, defaultConfig$: Observable<MapDefaultConfig>, translateService: TranslateService, widgetGlobalAutoRefreshService: WidgetGlobalAutoRefreshService, iterable: IterableDiffers, colorService: ColorService, geo: GeoService, datePipe: DatePipe);
/**
* @ignore
*/
ngOnChanges(changes: SimpleChanges): Promise<void>;
/**
* Handles changes to the map configuration, including follow and refresh interval.
* Cancels reload on follow, triggers reload on refresh interval change, and delegates to base config change logic.
* @param change The config change object.
*/
changeConfig(change: SimpleChange): void;
/**
* @ignore
*/
ngAfterViewInit(): Promise<void>;
/**
* Resets the map and clusters, re-initializing the component.
*/
reset(): Promise<void>;
/**
* Triggers a reload of cluster data.
*/
reload(): void;
/**
* Cancels an ongoing reload operation.
*/
cancelReload(): void;
/**
* Subscribes to cluster and interval changes, updating clusters as needed.
* Handles auto-refresh and global refresh loading.
*/
listenToClusterAndIntervalChanges(): void;
/**
* Subscribes to map change events for cluster updates.
*/
listenToClusterMapChanges(): void;
/**
* Refreshes markers or clusters, depending on whether a single asset or clusters are shown.
*/
refreshMarkers(): void;
private changeRootNode;
private getClusterRects;
private getRect;
private clearClusters;
private updateCluster;
private createOrUpdateCluster;
private getMapChangeObservable;
private isLeafletEventInterface;
private handleGlobalRefreshLoading;
static ɵfac: i0.ɵɵFactoryDeclaration<ClusterMapComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ClusterMapComponent, "c8y-cluster-map", never, { "config": { "alias": "config"; "required": false; }; "rootNode": { "alias": "rootNode"; "required": false; }; "assets": { "alias": "asset"; "required": false; }; "showClusterColor": { "alias": "showClusterColor"; "required": false; }; }, { "mapChange": "mapChange"; }, never, ["*"], true, never>;
}
//# sourceMappingURL=cluster-map.component.d.ts.map