import * as i0 from '@angular/core'; import { AfterViewInit, OnDestroy, QueryList, OnInit } from '@angular/core'; import * as MapBox from 'maplibre-gl'; import { MapLibreEvent, ExpressionSpecification, CircleLayerSpecification, SymbolLayerSpecification, ExpressionInputType } from 'maplibre-gl'; import { Observable, BehaviorSubject } from 'rxjs'; interface MapFeature { /** * An unique id for the GeoJSONFeature per source, to take this id in charge set * MapPoints.disableAutoGenerateFeatureId = true */ featureId?: number; mapboxSourceId?: string; } /** * Points Entity to display on the map. * Points events get emitted by application using ngx-map-gl. */ interface MapPoints extends MapFeature { pointProperties: PointProperties[]; disableAutoGenerateFeatureId?: boolean; mapboxSourceId: string; } /** * Describes a point, contains a position and data injected by the application using ngx-map-gl. */ interface PointProperties extends MapFeature { lng: number; lat: number; data?: any; } /** * Line String entity to display on the map. * Line String events get emitted by application using ngx-map-gl. */ interface MapLineString extends MapFeature { geometry: string; data?: any; mapboxSourceId: string; } /** * FlyTo Entity to make map fly to given point. * FlyTo events get emitted by application using ngx-map-gl. */ interface FlyTo { longitude: number; latitude: number; zoom: number; bearing: number; pitch: number; } /** * Consumers of the ngx-map-gl library use LayerDescription to describe MapBox Gl Layers. * (used in MapSourceLayersDirective) */ interface LayerDescription { layer: MapBox.LayerSpecification; changeCursorStyleByMouseOver?: boolean; updateFeatureStateByMouseOver?: boolean; logFeaturesByMouseOver?: boolean; } /** * Consumers of the ngx-map-gl library use SourceDescription to describe MapBox Gl Sources * (used in MapSourceLayersDirective) */ interface SourceDescription { name: string; source: MapBox.SourceSpecification; } /** * FeaturesState is used to append state to features (geojson). * A feature (geojson) is identified by a sourceId and a featureId. * The featureId is either passed by application or generated by the library. * If the featureId is passed by application then MapPoints.disableAutoGenerateFeatureId must be true. */ interface FeaturesState { sourceIdsAndFeatureIds: [string, number][]; state: any; } interface VectorMapStyles { styles: VectorMapStyle[]; } interface VectorMapStyle { name: string; path: string; } declare class MapSourceLayersDirective { /*************************************************************************** * * * Fields * * * **************************************************************************/ sourceDescription: SourceDescription; layerDescriptions: LayerDescription[]; /*************************************************************************** * * * Constructor * * * **************************************************************************/ constructor(); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare enum MapControlPosition { top = "top", bottom = "bottom", left = "left", right = "right", topLeft = "top-left", topRight = "top-right", bottomRight = "bottom-right", bottomLeft = "bottom-left" } declare const DEFAULT_MAP_GL_CONFIG: ElderMapConfig; type LngLatLike = [ number, number ] | { lng: number; lat: number; } | { lon: number; lat: number; }; interface ElderMapConfig { /*************************************************************************** * * * Orientation * * * **************************************************************************/ /** Initial map center in WGS84 format. */ center?: LngLatLike; /** Initial zoom level. */ zoom?: number; /** Minimum zoom of the map. */ minZoom?: number; /** Maximum zoom of the map. */ maxZoom?: number; /** * The initial pitch (tilt) of the map, measured in degrees away from the plane of the * screen (0-60). */ pitch?: number; /** Minimum pitch of the map. */ minPitch?: number; /** Maximum pitch of the map. */ maxPitch?: number; /** Map rotation bearing in degrees counter-clockwise from north. */ bearing?: number; /*************************************************************************** * * * Controls * * * **************************************************************************/ /** If controls should be disabled. */ disableControls?: boolean; /** Disables zoom, tilt and rotate control. */ disableZoomAndCompassControls?: boolean; /*************************************************************************** * * * Navigation Reset Control * * * **************************************************************************/ /** If Navigation Reset control should be shown. */ navigationResetShown?: boolean; /** If Navigation Reset control should be enabled. */ navigationResetEnabled?: boolean; /** Position of Navigation Reset control. */ navigationResetPosition?: MapControlPosition | string; /*************************************************************************** * * * Map Style Chooser Control * * * **************************************************************************/ /** If Map Style Chooser control should be shown. */ mapStyleChooserShown?: boolean; /** * If the Map Style Chooser control should be enabled. * The first VectorMapStyle in VectorMapStyles.styles is used as default. */ mapStyleChooserEnabled?: boolean; /** Position of Map Style Chooser control. */ mapStyleChooserPosition?: MapControlPosition | string; /*************************************************************************** * * * FlyTo Control * * * **************************************************************************/ /** If FlyTo control should be shown. */ flyToShown?: boolean; /** If FlyTo control should be enabled. */ flyToEnabled?: boolean; /** Position of FlyTo control. */ flyToPosition?: MapControlPosition | string; /** Bearing of a fly to movement. */ flyToBearing?: number; /** Pitch of a fly to movement. */ flyToPitch?: number; /** Width of FlyTo control input panel. */ flyToPanelWidth?: string; /** Placeholder of the FlyTo control input field. */ flyToInputPlaceholder?: string; /** API used for auto complete resolution. Enables FlyTo control if set. */ autoCompleteBackend?: string; /*************************************************************************** * * * Interactions * * * **************************************************************************/ /** Disables rectangle select functionality. */ disableRectangleSelect?: boolean; /** Debounce in milliseconds for map mouse events. */ mouseEventDebounceMs?: number; /*************************************************************************** * * * Security * * * **************************************************************************/ solumTilesAuthPath?: string; solumTilesKey?: string; /*************************************************************************** * * * Style & Resources * * * **************************************************************************/ /** Stylesheet location */ style?: any; /** * Map key: Name of source with type vector * Map value: Url for vector data * * Eg. ("openmaptiles", "https://.../{z}/{x}/{y}.pbf") */ vectorTileUrls: Map; /** * Configure typography definition */ glyphsUrl: string; /** * OpenMapTiles comes with a variety of different styles optimized for the OpenMapTiles vector tile schema. * The styles and schema are free and open-source and you can adapt the design and code for your project or * commercial product however you like. * The first VectorMapStyle in VectorMapStyles.styles is used as default. */ vectorMapStyles: VectorMapStyles; /** * Image identifiers and paths that mapbox gl has to prepare for their usage in layer definitions */ imagesToLoad?: Map; /*************************************************************************** * * * Layers * * * **************************************************************************/ /** * Layer identifiers describing the layer order bottom (first) to top (last) * layersOrder may contain less elements than defined layers. */ layersOrder?: string[]; } declare class ElderMapComponent implements AfterViewInit, OnDestroy { private readonly httpClient; private readonly mapStyleBuilderService; private mapController; /*************************************************************************** * * * @Input() - Downstream Events * * **************************************************************************/ featuresStateEvents$: Observable; /*************************************************************************** * * * Fields * * * **************************************************************************/ private readonly log; private readonly _unsubscribe$; private readonly _sourceDataBuffers; private readonly _sourceDataBufferSubs; private readonly _rectangleSelectHandler; readonly Pos: typeof MapControlPosition; readonly controlPositions: MapControlPosition[]; private _mapConfigurator; private _mapDownstreamEvents; private _config; /** Reference to the main DIV container in which the map is rendered. */ private _mapContainer; /** Reference to the selection box container. */ private _selectionBoxContainer; /** Reference to the fly-to control. */ private _flyToCtrl; /** * Source and layer definitions passed as children directives in * Relation: Source 1:n Layers */ sourceLayers: QueryList; /*************************************************************************** * * * Constructor * * * **************************************************************************/ constructor(); /*************************************************************************** * * * Life Cycle * * * **************************************************************************/ ngAfterViewInit(): void; private startMap; ngOnDestroy(): void; /*************************************************************************** * * * Properties * * * **************************************************************************/ set config(conf: ElderMapConfig); get config(): ElderMapConfig; set updateMapFeature(feature: MapLineString | MapPoints); get mouseMove$(): Observable; get mouseMoveGeo$(): Observable; get mouseClick$(): Observable; get mouseClickGeo$(): Observable; /** * Rectangle select returning Observable. * Returns features of all layers. */ get rectangleSelectGeo$(): Observable; /*************************************************************************** * * * Component Events * * * **************************************************************************/ onMapStyleChange(vectorMapStyle: VectorMapStyle): void; onMapFlyToEvent(flyTo: FlyTo): void; onMapNavigationReset(o: any): void; onKeyEvent(event: KeyboardEvent): void; /*************************************************************************** * * * Public API * * * **************************************************************************/ showFlyToAt(pos: MapControlPosition): boolean; showNavigationResetAt(pos: MapControlPosition): boolean; showMapStyleChooserAt(pos: MapControlPosition): boolean; focusFlyToCtrl(): void; replaceMapFeature(feature: MapLineString | MapPoints): void; /*************************************************************************** * * * Private Methods * * * **************************************************************************/ private initMap; private initMapInternal; /** * Gets called after init map and style load * and * gets called after style changed */ private mapBootstrap; private ensureBufferSubscriptions; private onStyleChange; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ElderMapController { /*************************************************************************** * * * Fields * * * **************************************************************************/ private readonly log; private readonly _mouseMoveEvents$; private readonly _mouseClickEvents$; private readonly _moveEvents$; private readonly _moveEndEvents$; private readonly _updateMapFeature$; private mapAvailable$; mapReady$: BehaviorSubject; mapFundamentalsSet$: BehaviorSubject; /** The main map object. */ private _map; /** Map config. */ private _config; /*************************************************************************** * * * Constructor * * * **************************************************************************/ constructor(); /*************************************************************************** * * * Properties * * * **************************************************************************/ setMap(mapObj: MapBox.Map): void; get map(): MapBox.Map; setConfig(config: ElderMapConfig): void; getConfig(): ElderMapConfig; /** * Stream of mouse movement events. */ getMouseMoveEvents$(): Observable; /** * Stream of geo features hovered by mouse. */ getMouseMoveGeoEvents$(layers?: string[], filter?: any): Observable; getMoveEvents$(): Observable & Object>; getMoveEndEvents(): Observable & Object>; /** * Stream of mouse click events. */ getMouseClickEvents$(): Observable; /** * Stream of geo features clicked by mouse. */ getMouseClickGeoEvents$(layers?: string[], filter?: any): Observable; get updateMapFeature$(): Observable; /*************************************************************************** * * * Public API * * * **************************************************************************/ flyTo(flyTo: FlyTo): void; fitBounds(polyLine: string, options?: MapBox.FitBoundsOptions): void; resetNavigation(): void; resize(): void; updateMapFeature(feature: MapLineString | MapPoints): void; /** * Updates feature states for features identified by sourceId and featureId. * The featureId must be unique within a source. * The featureId can either passed by application using PointProperties.featureId or auto generated by the library. * If PointProperties.featureId is provided then MapPoints.disableAutoGenerateFeatureId must be true. */ updateFeatureState(featuresState: FeaturesState): void; addMapMarker(sourceDescription: SourceDescription, layerDescriptions: LayerDescription[], beforeLayerId?: string): void; /*************************************************************************** * * * Private Methods * * * **************************************************************************/ private cleanup; private registerMapEventListeners; private deregisterMapEventListeners; private onMapClick; private onMapMouseMove; private onMove; private onMoveEnd; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ElderMapModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } interface RadiusOffsetCaseSpec { condition: boolean | ExpressionSpecification; radius: number; } interface RadialOffsetCaseExpressionSpec { cases: RadiusOffsetCaseSpec[]; fallbackRadius: number; } interface RadialOffsetConfig { radius?: number; radiusCaseExpression?: RadialOffsetCaseExpressionSpec; } interface ElderMapMarkerConfig { changeCursorStyleByMouseOver?: boolean; updateFeatureStateByMouseOver?: boolean; logFeaturesByMouseOver?: boolean; /** ID of Layer that is going to be placed before this marker. * * Useful for single layers like MapLineStrings. Can be used for elder-map-markers * as well, but make sure that the layers are loaded beforehand. If you only need * to sort elder-map-markers, it's better to place them after each-other in the html. **/ beforeLayerId?: string; innerCircle?: ElderMapMarkerInnerCircleConfig; outerCircle?: ElderMapMarkerOuterCircleConfig; /** General config for clustering behavior + cluster properties.**/ cluster?: ElderMapMarkerClusterConfig; /** * General offset config for feature symbols. */ featureSymbolOffsetConfig?: RadialOffsetConfig; /** General offset config for labels outside the main marker. */ featureLabelOffsetConfig?: RadialOffsetConfig; /** Filter config for the marker. **/ filter?: any[]; } interface ElderMapMarkerInnerCircleConfig { layerId?: string; paint?: CircleLayerSpecification['paint']; clustered?: { paint?: CircleLayerSpecification['paint']; }; filter?: ExpressionSpecification; } interface ElderMapMarkerOuterCircleConfig { layerId?: string; enabled?: boolean; widthFactor?: number; paint?: CircleLayerSpecification['paint']; clustered?: { paint?: CircleLayerSpecification['paint']; }; filter?: ExpressionSpecification; } interface ElderMapMarkerClusterConfig { enabled?: boolean; clusterProperties?: object; clusterRadius?: number; clusterMaxZoom?: number; } interface ElderMapMarkerSymbolConfig { layerId?: string; enabled?: boolean; offsetConfig?: RadialOffsetConfig; layout?: SymbolLayerSpecification['layout']; paint?: SymbolLayerSpecification['paint']; clustered?: { layout?: SymbolLayerSpecification['layout']; paint?: SymbolLayerSpecification['paint']; }; filter?: ExpressionSpecification; minzoom?: number; maxzoom?: number; } declare const DEFAULT_MAP_MARKER_INNER_CIRCLE_CONFIG: ElderMapMarkerInnerCircleConfig; declare const DEFAULT_MAP_MARKER_OUTER_CIRCLE_CONFIG: ElderMapMarkerOuterCircleConfig; declare const DEFAULT_MAP_MARKER_CLUSTER_CONFIG: ElderMapMarkerClusterConfig; declare const DEFAULT_FEATURE_SYMBOL_OFFSET_CONFIG: RadialOffsetConfig; declare const DEFAULT_FEATURE_LABEL_OFFSET_CONFIG: RadialOffsetConfig; declare class ElderMapMarkerComponent implements OnInit, OnDestroy, AfterViewInit { private elderMapController; /*************************************************************************** * * * Fields * * * **************************************************************************/ static readonly SOURCE_DEFAULT_ELDER_POINTS = "defaultElderSourceId"; static readonly MARKER_LAYER_PREFIX = "elder-map-marker"; private readonly _log; private readonly _destroy$; private _sourceId; private _config; private _featureSymbolComponents; private _labelComponents; private _mainSymbolComponent; /*************************************************************************** * * * Life Cycle * * * **************************************************************************/ ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; /*************************************************************************** * * * Properties * * * **************************************************************************/ set sourceId(value: string); get sourceId(): string; set config(value: ElderMapMarkerConfig); get config(): ElderMapMarkerConfig; /*************************************************************************** * * * Layer and Source Descriptions * * * **************************************************************************/ private buildSources; private buildLayers; private buildFeatureSymbolLayers; private buildLabelLayers; private buildBaseLayers; /*************************************************************************** * * * Private methods * * * **************************************************************************/ private addMouseOverEvents; private buildFeatureSymbolLayer; private buildLabelLayer; private buildMainSymbolLayer; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare enum ElderMapMarkerPosition { North = "north", NorthNorthEast = "northNorthEast", NorthEast = "northEast", EastNorthEast = "eastNorthEast", East = "east", EastSouthEast = "eastSouthEast", SouthEast = "southEast", SouthSouthEast = "southSouthEast", South = "south", SouthSouthWest = "southSouthWest", SouthWest = "southWest", WestSouthWest = "westSouthWest", West = "west", WestNorthWest = "westNorthWest", NorthWest = "northWest", NorthNorthWest = "northNorthWest" } declare class MarkerFeatureSymbolComponent { /*************************************************************************** * * * Fields * * * **************************************************************************/ private _name; private _config; private _mapMarkerPosition; /*************************************************************************** * * * Properties * * * **************************************************************************/ get name(): string; set name(value: string); get config(): ElderMapMarkerSymbolConfig; set config(value: ElderMapMarkerSymbolConfig); get mapMarkerPosition(): ElderMapMarkerPosition; set mapMarkerPosition(value: ElderMapMarkerPosition); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class MarkerLabelComponent { /*************************************************************************** * * * Fields * * * **************************************************************************/ private _name; private _config; private _mapMarkerPosition; /*************************************************************************** * * * Properties * * * **************************************************************************/ get name(): string; set name(value: string); get config(): ElderMapMarkerSymbolConfig; set config(value: ElderMapMarkerSymbolConfig); get mapMarkerPosition(): ElderMapMarkerPosition; set mapMarkerPosition(value: ElderMapMarkerPosition); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class MarkerMainSymbolComponent { /*************************************************************************** * * * Fields * * * **************************************************************************/ private _config; /*************************************************************************** * * * Properties * * * **************************************************************************/ get config(): ElderMapMarkerSymbolConfig; set config(value: ElderMapMarkerSymbolConfig); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } interface ElderMapMarker { label: string; } declare class ElderMapMarkerModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare class ColorExpressionUtil { /** * Returns an expression that returns either white or black depending on the brightness of the given color. */ static getHighContrastColor(color: string | ExpressionSpecification): ExpressionSpecification; /** * Returns a case expression with brightCase (true) and darkCase (false) depending on the brightness of the given color. */ static ifBrightOrElse(color: string | ExpressionSpecification, brightCase: ExpressionSpecification | ExpressionInputType, darkCase: ExpressionSpecification | ExpressionInputType): ExpressionSpecification; /** * Returns an expression that checks if the given color is bright. * * The formula ((Red value X 299) + (Green value X 587) + (Blue value X 114)) / 1000 is used to determine the brightness of a color. * See: https://www.w3.org/TR/AERT/#color-contrast */ static isColorBright(color: string | ExpressionSpecification): ExpressionSpecification; } export { ColorExpressionUtil, DEFAULT_FEATURE_LABEL_OFFSET_CONFIG, DEFAULT_FEATURE_SYMBOL_OFFSET_CONFIG, DEFAULT_MAP_GL_CONFIG, DEFAULT_MAP_MARKER_CLUSTER_CONFIG, DEFAULT_MAP_MARKER_INNER_CIRCLE_CONFIG, DEFAULT_MAP_MARKER_OUTER_CIRCLE_CONFIG, ElderMapComponent, ElderMapController, ElderMapMarkerComponent, ElderMapMarkerModule, ElderMapMarkerPosition, ElderMapModule, MapSourceLayersDirective, MarkerFeatureSymbolComponent, MarkerLabelComponent, MarkerMainSymbolComponent }; export type { ElderMapConfig, ElderMapMarker, ElderMapMarkerClusterConfig, ElderMapMarkerConfig, ElderMapMarkerInnerCircleConfig, ElderMapMarkerOuterCircleConfig, ElderMapMarkerSymbolConfig, FeaturesState, FlyTo, LayerDescription, LngLatLike, MapFeature, MapLineString, MapPoints, PointProperties, RadialOffsetCaseExpressionSpec, RadialOffsetConfig, RadiusOffsetCaseSpec, SourceDescription, VectorMapStyle, VectorMapStyles };