@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
186 lines (185 loc) • 7.36 kB
TypeScript
import { Collection, Feature, Map, MapBrowserEvent, MapEvent } from 'ol';
import { Style } from 'ol/style.js';
import { ProjectionLike } from 'ol/proj.js';
import VectorSource from 'ol/source/Vector.js';
import VectorLayer from 'ol/layer/Vector.js';
import { DragBox } from 'ol/interaction.js';
import { DragBoxEvent } from 'ol/interaction/DragBox.js';
import { Geometry } from 'ol/geom.js';
import { Extent } from 'ol/extent.js';
import SwipeManager from './tools/swipemanager.js';
import WmsManager3d from './tools/wmsmanager3d.js';
import OsmManager from './tools/osmmanager.js';
import VectorTilesManager from './tools/vectortilesmanager.js';
import WmtsManager from './tools/wmtsmanager.js';
import ViewManager from './tools/viewmanager.js';
import CogManager from './tools/cogmanager.js';
import DrawingManager from './tools/drawingmanager.js';
import GirafeHTMLElement from '../../base/GirafeHTMLElement.js';
import Basemap from '../../models/basemaps/basemap.js';
import Layer from '../../models/layers/layer.js';
import BaseLayer from '../../models/layers/baselayer.js';
import { FocusFeature } from './tools/focusfeature.js';
import XyzManager from './tools/xyzmanager.js';
import SelectionParam from '../../models/selectionparam.js';
import { CameraConfig } from '../../tools/state/globe.js';
import { Callback } from '../../tools/state/statemanager.js';
import { StyleFunction } from 'ol/style/Style.js';
declare global {
interface Window {
Cesium: unknown;
}
}
export default class MapComponent extends GirafeHTMLElement {
protected templateUrl: string | null;
protected styleUrls: string[] | null;
template: () => import("uhtml").Hole;
olMap: Map;
mapTarget: HTMLDivElement;
map3d: any;
map3dTarget: HTMLDivElement;
map3dShadowsTimestamp: number;
loading: boolean;
swiper: HTMLInputElement;
closeSwiperButton: HTMLButtonElement;
swipeManager: SwipeManager;
wmtsManager: WmtsManager;
wmsManager3d: WmsManager3d | null;
osmManager: OsmManager;
cogManager: CogManager;
xyzManager: XyzManager;
drawingManager: DrawingManager;
viewManager: ViewManager;
vectorTilesManager: VectorTilesManager;
defaultSrid: ProjectionLike;
crosshairFeature: Feature;
crosshairLayer: VectorLayer<VectorSource>;
geolocationSource: VectorSource;
private readonly markerSource;
private readonly markerLayer;
private mapMarkerUnderCursor;
private previousMapCursorStyle;
get projection(): import("ol/proj.js").Projection;
get config(): import("../../tools/main.js").GirafeConfig;
get onMobile(): boolean;
/**
*
* @param path Overridden to make those methods public for this component
* @param callback
*/
subscribe(path: string, callback: Callback): Callback;
subscribe(path: RegExp, callback: Callback): Callback;
selectedFeaturesCollection: Collection<Feature<Geometry>>;
highlightedFeaturesCollection: Collection<Feature<Geometry>>;
selectionLayer: VectorLayer<VectorSource>;
selectionLayerStyle: Style;
selectionLayerStyleFunc: StyleFunction;
highlightLayer: VectorLayer<VectorSource>;
pixelTolerance: number;
dragbox: DragBox;
focusFeature: FocusFeature;
mapTargetResizeObserver: ResizeObserver;
constructor();
/**
* The Map needs to be displayed in Fullscreen Mode.
*/
protected get isFullscreenComponent(): boolean;
resetAllSwipedLayers(layers: BaseLayer[]): void;
registerEvents(): void;
locateUser(): void;
getCurrentLocation(): void;
disableLocateUser: () => void;
/**
* Toggles the application fullscreen mode.
* The button is displayed over the map, like the geolocation button.
*/
toggleFullscreen(): void;
/**
* Shows the matching fullscreen button (enter or exit) depending on the current mode.
*/
private updateFullscreenButton;
readonly updateGeolocation: (position: GeolocationPosition) => void;
render(): void;
listenOpenLayersEvents(): void;
onLoadStart(_e: MapEvent): void;
onLoadEnd(_e: MapEvent): void;
onPointerMove(e: MapBrowserEvent<PointerEvent>): void;
onMoveEnd(_e: MapEvent): void;
onClick(e: MapBrowserEvent<PointerEvent>): void;
onDragSelection(_e: DragBoxEvent): void;
select(extent: number[]): void;
selectNone(): void;
onSelectFeatures(selectionParams: SelectionParam[]): Promise<void>;
protected connectedCallback(): void;
onCustomGirafeEvent(details: {
action: string;
layer: Layer;
extent: Extent;
}): void;
onChangeSwiped(layer: Layer): void;
/**
* updates icon position when swipe is moved
*/
updateCloseSwiperPosition(): void;
private setSelectLayerStyle;
private setHighlightLayerStyle;
private setCrosshairStyle;
create3dMap(): Promise<void>;
addAllActiveLayers3dMap(layer: BaseLayer): void;
onGlobeToggled(): Promise<void>;
onShadowsToggled(shadows: boolean): void;
onShadowsTimestampChanged(shadowsTimestamp: number): void;
onFeaturesSelected(features: Feature[]): void;
onFeatureHighlighted(features: Feature[]): void;
onCameraChanged(camera: CameraConfig | null): void;
zoomToExtent(extent: Extent): void;
onChangeProjection(_oldSrid: string, newSrid: string): void;
onChangeDarkMode(): void;
private onLayerToggled;
private onAddLayers;
onRemoveLayers(layerInfos: Layer[]): void;
onChangeOrder: () => void;
private reorderLayers;
private onChangeLayerOpacity;
private onChangeBasemapOpacity;
/**
* Change filter configuration on layer (only LayerWMS are affected)
*/
private onChangeFilter;
/**
* Change time configuration on layer (only LayerWMS are affected)
*/
private onChangeTime;
private setTimeRestrictionOnChildren;
removeAllBasemapLayers(): void;
onChangeBasemaps(basemaps: Basemap[]): void;
/**
* This method checks for the presence of an initial selection originating from a shared state.
* If present, it applies the query-based or bbox-based selection to the map.
*/
private applyFeatureSelectionFromSharedState;
/**
* Applies a feature selection based on the query parameters present in the URL starting with `wfs_`.
* If the specified layer does not exist in the current tree, it's fetched from the themes and added to the tree.
* If the layer is resolution-restricted, the map is zoomed to a resolution where the layer is visible.
*/
private applyFeatureSelectionFromPermalink;
/**
* Selects features based on the given list of wfs filters for a specified WMS layer
* and optionally moves the map to the selection. The WFS client combines the WFS filters with an AND operator.
*/
private selectFeaturesByQuery;
/**
* Centers the map view on the given features. If the features' extent doesn't fit in the current zoom level,
* the zoom level is adjusted.
*/
private centerMapOnFeatures;
/**
* Moves the map to the position defined in the permalink, making sure the map is initialized and ready to be moved.
*/
private applyMapPositionFromPermalink;
private clearAllMarkers;
private addMarker;
private showCrosshair;
private onFeaturesTypeChanged;
}