import * as i6 from '@angular/cdk/drag-drop'; import { CdkDragDrop } from '@angular/cdk/drag-drop'; import { LayerListItem } from 'hslayers-ng/services/layer-shifting'; import { Layer } from 'ol/layer'; import { Source } from 'ol/source'; import { Control } from 'ol/control'; import * as i0 from '@angular/core'; import * as i3 from 'hslayers-ng/common/panels'; import { HsPanelBaseComponent } from 'hslayers-ng/common/panels'; import * as i2 from '@angular/common'; import * as i4 from '@angular/forms'; import * as i5 from '@ngx-translate/core'; /** * Original code from https://github.com/Viglino/ol-ext/blob/master/src/control/Swipe.js */ /** * Initialization options for SwipeControl * @param leftLayers - layer to swipe on the left side * @param rightLayer - layer to swipe on right side * @param className - control class name * @param position - position property of the swipe [0,1], default 0.5 * @param orientation - orientation property (vertical|horizontal), default vertical */ type SwipeControlOptions = { leftLayers?: LayerListItem[]; rightLayers?: LayerListItem[]; className?: string; position?: number; orientation?: string; app?: string; }; declare class SwipeControl extends Control { options: SwipeControlOptions; leftLayers: LayerListItem[]; rightLayers: LayerListItem[]; isMoving: boolean; listeners: Map; constructor(options?: SwipeControlOptions); /** * Set the map instance the control associated with. * @param map - The map instance. */ setTargetMap(map: any): void; private enableEvents; private disableEvents; private isLayerAdded; /** * Add layers array to clip * @param layers - to clip * @param right - layers in the right part of the map, default left. */ addLayers(layers: LayerListItem[], right?: boolean): void; /** * Add a layer to clip * @param layer - to clip * @param right - layer in the right part of the map, default left. */ addLayer(layer: LayerListItem, right?: boolean): void; /** * Sets available layer events to enabled/disabled * @param enabled - (Optional) If true, map swipe control is enabled, else it is removed */ setEvents(enabled?: boolean): void; /** * Remove all layers */ removeLayers(): void; /** * Remove a specific layer from swipe control completely */ removeCompletely(layerToRm: Layer): void; /** * Remove a layer to clip * @param layer - to clip * @param right - layer from right side to clip */ removeLayer(layer: LayerListItem, right?: boolean): void; private move; private drawRect; precomposeLeft(e: any): void; precompose(e: any, pts: any): void; precomposeRight(e: any): void; postcompose(e: any): void; /** * Get the position of an element or event action relative to the map * @param mapSize - OL Map size (width or height) * @param coord - Coordinate provided (X or Y) * @returns Position relative to map size */ getPosValue(mapSize: number, coord: number): number; } declare enum SwipeSide { Left = "left", Right = "right", Full = "full" } declare class HsMapSwipeService { private hsMapService; private hsConfig; private hsLayerShiftingService; private hsEventBusService; private hsLayerManagerService; private hsShareUrlService; private hsLayoutService; private hsLayerEditorService; private hsLog; private zone; swipeCtrl: SwipeControl; rightLayers: LayerListItem[]; leftLayers: LayerListItem[]; entireMapLayers: LayerListItem[]; movingSide: SwipeSide; wasMoved: boolean; swipeControlActive: boolean; orientation: 'vertical' | 'horizontal'; orientationVertical: boolean; constructor(); /** * Get layer manager update along with the current mainPanel */ private getLayerUpdateWithCurrentPanel; /** * Remove duplicate layerManagerUpdates to get one update per layer */ private removeDuplicateUpdates; /** * Set initial map-swipe control state */ setInitCtrlActive(): void; /** * Set initial orientation value */ setInitOri(): void; /** * Initializes swipe control add adds it to the map */ initSwipeControl(): void; /** * Update local storage orientation value */ updateStorageOri(): void; /** * Update url params to include map swipe state */ updateUrlParam(): void; /** * Check if any layers are added to the swipe control */ layersAvailable(): boolean; /** * Set swipe control orientation */ setOrientation(): void; /** * Fill swipe control layers * @param layer - layer or array of layers issued from layerManagerUpdates event */ fillSwipeLayers(input: Layer | Layer[] | void): void; /** * Move a layer to swipe control * @param layerItem - layer issued from layerManagerUpdates event */ addSwipeLayer(layerItem: LayerListItem): void; /** * Crate queryFilter callback function for layer and set it as layer's property * Query will work for the layer, if the user's click was made on the same map swipe panel * where the layer is being rendered * If the layer swipe side is not specified, query will work by default * @param layerItem - layer issued from layerManagerUpdates event */ createQueryFilter(layerItem: LayerListItem): void; /** * Move a layer to swipe control * @param lyrListItem - layer issued from layerManagerUpdates event */ moveSwipeLayer(lyrListItem: LayerListItem): void; /** * Move a layer to swipe control right side * @param layer - layer issued from layerManagerUpdates event */ moveRight(layer: LayerListItem): void; /** * Move a layer to swipe control left side * @param layer - layer issued from layerManagerUpdates event */ moveLeft(layer: LayerListItem): void; /** * Set map swipe control status enabled/disabled */ setControl(): void; /** * Remove layer completely * @param layer - layer issued from layerManagerUpdates event */ removeCompletely(layerToRm: Layer): void; /** * Set layer as active (last dragged) * @param layer - layer issued from layerManagerUpdates event */ setLayerActive(layer: LayerListItem): void; /** * Set and add initial swipe control layers */ setInitialSwipeLayers(): void; /** * Check if any layer is left out from swipe control and add it */ checkForMissingLayers(): void; /** * Sort layers to resemble layer order by ZIndex on the map */ sortLayers(): void; /** * Change layer visibility * @param layerItem - Layer item selected */ changeLayerVisibility(layerItem: LayerListItem): void; /** * Act upon layer visibility changes * @param e - Event description */ layerVisibilityChanged(e: any): void; /** * Find layer based on layer source * @param targetLayer - Layer to be found */ findLayer(targetLayer: Layer): { l: LayerListItem; arr: string; }; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class HsMapSwipeComponent extends HsPanelBaseComponent { hsMapSwipeService: HsMapSwipeService; private hsLayerShiftingService; swipeSide: typeof SwipeSide; placeholders: { entire: boolean; left: boolean; right: boolean; }; name: string; swipeOptions: string[]; /** * Return label for button changing map swipe state from enabled to disabled */ getEnabledButtonString(): string; /** * Return label for button changing swipe orientation from horizontal swipe to vertical swipe */ getOrientationButtonString(): string; /** * Reset swipe slider position to default */ resetSwipePos(): void; /** * Modify arrays after drag and drop * @param event - CdkDragDrop drop event * @param right - (Optional) Item dragged to right */ drop(event: CdkDragDrop, side?: SwipeSide): void; /** * Change selected layer visibility * @param layer - Selected layer from the list */ changeLayerVisibility(layer: LayerListItem): void; /** * Set map-swipe swipe element orientation */ setOrientation(): void; /** * Check if layers for map-swipe component are available */ layersAvailable(): boolean; /** * Set control for map-swipe component */ setControl(): void; /** * Get rightLayers for map-swipe component */ getRightLayers(): LayerListItem[]; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class HsMapSwipeModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { HsMapSwipeComponent, HsMapSwipeModule, HsMapSwipeService, SwipeControl, SwipeSide }; export type { SwipeControlOptions };