@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
156 lines • 7.54 kB
TypeScript
import { IIdentified, IManagedObject, InventoryService, IResultList } from '@c8y/client';
import { OptionsService, ServiceRegistry } from '@c8y/ngx-components';
import type { MapDefaultConfig, MapTileLayer } from '@c8y/options';
import type * as L from 'leaflet';
import { Observable } from 'rxjs';
import { ClusterSize, PositionManagedObject } from './map.model';
import * as i0 from "@angular/core";
export declare class MapService {
private inventory;
private options;
private serviceRegistry;
/**
* Returns asset icon status for highest alarm severity found in device object.
* @param device Device that contains alarms information.
* @returns Status string according to alarm severity
*/
static getStatus(device: PositionManagedObject): "text-muted" | "status critical" | "status major" | "status minor" | "status warning";
/**
* The devices that are maximal displayed in one cluster.
*/
MAX_DEVICE_PER_CLUSTER: number;
/**
* The count until the cluster is sized. There are a maximum of
* three clusters: 1, 4 or 16.
*/
CLUSTER_LEVEL_THRESHOLD: number;
/**
* @ignore: Only DI.
*/
constructor(inventory: InventoryService, options: OptionsService, serviceRegistry: ServiceRegistry);
/**
* Returns the leaflet instance used by the cumulocity core.
*/
getLeaflet(): Promise<typeof L>;
/**
* Verifies if a given managed object is a device with a position fragment.
* @param mo The given managed object.
*/
isPositionedDevice(mo: IIdentified): boolean;
/**
* Verifies if a given managed object has a position fragment.
* @param mo The given managed object.
*/
hasPosition(mo: IIdentified): any;
getMapTileLayerProviders(): CumulocityServiceRegistry.MapTileLayerProvider[];
getMapTileLayersFromHookedProviders$(layerProviders: CumulocityServiceRegistry.MapTileLayerProvider[]): Observable<MapTileLayer[]>;
/**
* Returns the layers available in this application.
* Layers are taken from plugins installed to this application.
* In case none of the plugins override the default layers, the default layers are also considered.
* @returns The layers.
*/
getMapTileLayers$(): Observable<MapTileLayer[]>;
/**
* Returns the layers configured in the current platform via tenant options.
* @returns The layers. If not set in tenant options the default layers.
*/
getDefaultLayers(): Observable<MapTileLayer[]>;
/**
* Returns the map configuration configured on the tenant.
* @returns The configuration. If not set in tenant options the default configuration.
*/
getDefaultConfig(): Observable<MapDefaultConfig>;
/**
* Counts all managed objects in a given bound with a c8y_Position fragment.
* @param bound The lat lng bound to request the managed objects for.
* @param byGroupIdMO The group managed object of which direct children should be searched for.
* @returns The number of all position managed objects in the given bound (and group).
*/
getPositionMOsFromBoundCount(bound: L.LatLngBounds, byGroupIdMO?: IManagedObject): Promise<number>;
/**
* Returns all managed objects with a c8y_Position fragment in a certain boundary.
* @param bound The lat lng bound to request the managed objects for.
* @returns All position managed objects in the given bound.
*/
getPositionMOsFromBound(bound: L.LatLngBounds): Promise<PositionManagedObject[]>;
/**
* Returns all managed objects with a c8y_Position fragment in a certain boundary that belongs to a certain group.
* @param bound The lat lng bound to request the managed objects for.
* @param byGroupIdMO The group managed object of which direct children should be searched for.
* @returns All position managed objects in the given bound that are children of the given group.
*/
getPositionMOsFromBound(bound: L.LatLngBounds, byGroupIdMO: IManagedObject): Promise<PositionManagedObject[]>;
/**
* Counts the managed objects in a certain boundary belonging to a group.
* @param bound The lat lng bound to request the managed objects for.
* @param byGroupIdMO The group managed object of which direct children should be searched for.
* @return The count of the managed objects.
*/
getPositionMOsFromBound(bound: L.LatLngBounds, byGroupIdMO: IManagedObject, count: true): Promise<number>;
/**
* Returns all devices with c8y_Position.
*/
getPositionDevices(): Promise<PositionManagedObject[]>;
/**
* Returns all devices with c8y_Position.
* @param pageSize The page size to return.
*/
getPositionDevices(pageSize: number): Promise<PositionManagedObject[]>;
/**
* Returns all devices with c8y_Position.
* @param pageSize The page size to return.
* @param count Counting is disabled
*/
getPositionDevices(pageSize: number, count: false): Promise<PositionManagedObject[]>;
/**
* Returns the number of all devices with c8y_Position.
* @param pageSize The page size to return.
* @param count Counting is enabled
*/
getPositionDevices(pageSize: number, count: true): Promise<number>;
/**
* Returns all managed object with a c8y_Position fragment.
* @param byGroupIdMO The group managed object of which direct children should be searched for.
* @param pageSize Defines how many results should be returned.
* @returns The managed objects with position.
*/
getAllPositionMOs(byGroupIdMO?: IIdentified, pageSize?: number): Promise<IResultList<PositionManagedObject>>;
/**
* Determines a rectangular geographical area based on the positions of all devices.
*
* @returns A [[LatLngBounds]] object fitting all devices' geo positions.
*/
getAllDevicesBounds(): Promise<L.LatLngBounds>;
getAssetsBounds(assets: PositionManagedObject[]): Promise<L.LatLngBounds | undefined>;
/**
* Returns the cluster size for clustered maps. Counting the position MOs in a bounding
* and if it reach a threshold, returning a [[ClusterSize]].
* @param bound The bounding to check for cluster size.
* @returns The cluster size, can be NONE, FOUR or SIXTEEN.
*/
getClusterSize(bound: L.LatLngBounds): Promise<ClusterSize>;
private getMapOption;
/**
* Shifts longitudes received from Leaflet.js in the [-180 - k*360; 180 + k*360] rangewhen
* `noWrap` is enabled to the [-180; 180] range expected for values of the c8y_Position fragment.
*
* @param lng Longitude to shift.
* @returns Longitude value in the [-180; 180] range
*/
private normalizeLongitude;
/**
* Shifts longitudes in the [-180; 180] range expected for values of the c8y_Position fragment
* the the [-180 - k*360; 180 + k*360] range expected from Leaflet.js when `noWrap` is enabled.
*
* The method naively adds/subtracts 360 degrees to the original value until the position fits in the expected bounds.
*
* @param pmo A managed object with a `c8y_Position` fragment
* @param bounds The bounds where the position should fit
* @returns A managed object whose `c8y_Position`'s `lng` values has been shifted to fit in bounds
*/
private denormalizePMO;
static ɵfac: i0.ɵɵFactoryDeclaration<MapService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<MapService>;
}
//# sourceMappingURL=map.service.d.ts.map