import { EventEmitter, NgModuleRef } from '@angular/core'; import { ImageryCommunicatorService, IImageryMapPosition, IMapSettings } from '@ansyn/imagery'; import { ICoordinatesSystem, LayoutKey, ProjectionConverterService } from '@ansyn/map-facade'; import { Actions } from '@ngrx/effects'; import { Store } from '@ngrx/store'; import { FeatureCollection, Point, Polygon } from 'geojson'; import { Observable } from 'rxjs'; import { IOverlay, IOverlaysCriteria } from '../modules/overlays/models/overlay.model'; import { DataLayersService } from '../modules/menu-items/layers-manager/services/data-layers.service'; export declare type mapIdOrNumber = string | number | undefined; export declare class AnsynApi { protected store: Store; protected actions$: Actions; protected projectionConverterService: ProjectionConverterService; protected imageryCommunicatorService: ImageryCommunicatorService; protected moduleRef: NgModuleRef; private dataLayersService; id: string; /** * the id of the active map. * @var */ activeMapId: any; /** * key-value from the map id to the map itself. * @var {Dictionary} */ mapsEntities: any; /** * the active annotation layer * @var {ILayer} */ activeAnnotationLayer: any; /** * the id of the default layer. * @var {string} */ defaultLayerId: string; events: { /** * fire when the app is ready(map was loaded) */ onReady: EventEmitter; /** * fire when the timeline was load with overlays. * @property overlays - array of the loaded overlays or false if there was error. */ overlaysLoadedSuccess: EventEmitter; /** * fire when an overlay was loaded to the map * @property the loaded overlay or false if there was error on open the overlay. * @property mapId - the id of the map. */ displayOverlaySuccess: EventEmitter<{ overlay: IOverlay | false; mapId: string; }>; }; /** @deprecated onReady as own event was deprecated use events.onReady instead */ onReady: EventEmitter; /** * @return An observable that emits the maps in array. */ getMaps$: Observable; /** * @return an observable that emit the current mouse position on the map. */ onShadowMouseProduce$: Observable; /** * @return An observable that emit when the map layout is change */ onSetLayoutSuccess$: Observable; /** * @return An observable that emit when the center of the map is change * from the search box or the go-to tool */ getActiveCenter$: Observable; private mapList; private features; private activateMap$; private mapsEntities$; private mapList$; private activeAnnotationLayer$; /** Events **/ private ready$; /** Events end **/ private overlaysSearchEnd$; private displayOverlaySuccess$; private displayOverlayFailed$; constructor(store: Store, actions$: Actions, projectionConverterService: ProjectionConverterService, imageryCommunicatorService: ImageryCommunicatorService, moduleRef: NgModuleRef, dataLayersService: DataLayersService, id: string); /** * draw the shadow mouse visualizer in the specific point * @param geoPoint The point where we will draw the visualizer. */ setOutSourceMouseShadow(geoPoint: Point): void; /** * open an overlay on the map * @param overlay the overlay will be display * @param mapId the map number or id. default the active map id. */ displayOverLay(overlay: IOverlay, mapId?: mapIdOrNumber): void; /** * draw the feature collection on the map. * @param featureCollection the features to draw on the map. */ setAnnotations(featureCollection: FeatureCollection): void; /** * delete all the features in the map */ deleteAllAnnotations(): void; /** * feed the timeline with the given overlays * @param overlays array of IOverlay to be load into the timeline */ setOverlays(overlays: IOverlay[]): void; /** * change the application layout * @param layout the new layout key. * @return Observable that emit once the layout successfully change. */ changeMapLayout(layout: LayoutKey): Observable; /** * convert coordinate from one coordinate system to another * @param position the position in the old coordinate system * @param convertFrom the current coordinate system of the position * @param convertTo the new coordinate system to the position * @return the position in the new coordinate system. */ transfromHelper(position: number[], convertFrom: ICoordinatesSystem, convertTo: ICoordinatesSystem): void; /** * @param mapId the map id or number, default the active map id. * @return the position of the map. */ getMapPosition(mapId: mapIdOrNumber): IImageryMapPosition; /** * set the center of the map to the given point * @param geoPoint the new center for the map. * @param mapId the map id or number, default the active map id. */ goToPosition(geoPoint: Point, mapId?: mapIdOrNumber): void; /** * set the map extent to the given polygon * @param rect a rectangle polygon * @param mapId the id of the map to be set. default the active map id. */ setMapPositionByRect(rect: Polygon, mapId?: mapIdOrNumber): any; /** * @return all the overlays in the timeline. */ getOverlays(): Observable; /** * rotate the map by degree. if it is not geo registered image rotate the image. * @param radian The rotation of the map in radians. * @param mapId the id of the map. default to the active map. */ setRotation(radian: number, mapId?: mapIdOrNumber): any; /** * get the current rotation of the map. * @param mapId the id of the map. default to the active map. * @return the map rotation in radians. */ getRotation(mapId?: mapIdOrNumber): number; /** * set the map center to the specific point and scale the map to the radius * @param center GeoJSON point to be set the map to. * @param radiusInMeters set the map scale to radiusInMeters / 10 * @param mapId the id of the map to be set. default the active map id. * @param search does make new search in the new position or not. */ setMapPositionByRadius(center: Point, radiusInMeters: number, mapId: mapIdOrNumber, search?: boolean): void; /** * make a new search with the specific criteria * @param criteria of the search. you can pass only one criterion. * @param [radiusInMetersBuffer] if the region criterion is provide, bump the region by the radius. */ setOverlaysCriteria(criteria: IOverlaysCriteria, radiusInMetersBuffer?: number): any; /** * @return An Observable that emits when the search criteria was change. */ getOverlaysCriteria(): Observable; /** * @return the overlay that display on the map, or undefined if no overlay was display * @param mapId the id of the map. */ getOverlayData(mapId?: mapIdOrNumber): IOverlay; /** * set if the footer(the timeline container) is minimize or maximize. * @param collapse true for minimize the footer, or false to maximize. */ collapseFooter(collapse: boolean): void; /** * set if the menu is minimize or maximize. * @param collapse true for minimize the menu, or false to maximize. */ collapseMenu(collapse: boolean): void; /** * set the app to minimalist view. * minimalist view show only the map the compass and the name of the overlay(or Base map, if there is no overlay display)/ * @param collapse true to set the app to minimalist view, false to set the app to normal view. */ setMinimalistViewMode(collapse: boolean): void; /** * add new layer to the Data Layer * @param layerName the layer name. * @param layerData the features to be add into the layer. * @param isEditable set if this layer was editable or not. default true * @return the layer id. for future deletion of the layer. */ insertLayer(layerName: string, layerData: FeatureCollection, isEditable?: boolean): string; /** * remove the specific layer from the Data layer. * @param layerId the id of the layer who return from */ removeLayer(layerId: string): void; /** * set if the specific layer is show or hide. * @param layerId the id of the layer who return from * @param show true to show the layer, false to hide. */ showLayer(layerId: string, show: boolean): void; init(): void; destroy(): void; private getMapIdFromMapNumber; private removeElement; private generateFeaturesIds; }