libs/map/src/lib/selector/map-selector.component.ts
Properties |
|
Methods |
|
Inputs |
Outputs |
constructor(mapCache: MapCache, kvDiffers: KeyValueDiffers, cd: ChangeDetectorRef)
|
||||||||||||
Parameters :
|
Private _baseMaps |
Type : LayerMap
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:84
|
Private _differBaseMaps |
Type : KeyValueDiffer<string | LayerOptions>
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:85
|
Private _differOverlayMaps |
Type : KeyValueDiffer<string | LayerOptions>
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:83
|
Private _overlayMaps |
Type : LayerMap
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:82
|
Protected layerControl |
Type : L.Control.Layers
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:79
|
Protected map |
Type : L.Map
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:75
|
The map object. |
Protected oldBaseLayer |
Type : L.Control.LayersObject
|
Default value : {}
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:78
|
Protected oldOverlayLayer |
Type : L.Control.LayersObject
|
Default value : {}
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:77
|
Protected zoomControl |
Type : L.Control.Zoom
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:80
|
Protected Abstract drawGeometries |
drawGeometries()
|
Draws the geometries
Returns :
void
|
Public ngAfterViewInit |
ngAfterViewInit()
|
Returns :
void
|
Public ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Parameters :
Returns :
void
|
Protected zoomToMarkerBounds | ||||||||
zoomToMarkerBounds(bounds: L.LatLngBoundsExpression)
|
||||||||
Zooms to the given bounds
Parameters :
Returns :
void
|
Private addBaseMap | ||||||
addBaseMap(layerOptions?: LayerOptions)
|
||||||
Inherited from
CachedMapComponent
|
||||||
Defined in
CachedMapComponent:180
|
||||||
Parameters :
Returns :
void
|
Private addOverlayMap | ||||||
addOverlayMap(layerOptions: LayerOptions)
|
||||||
Inherited from
CachedMapComponent
|
||||||
Defined in
CachedMapComponent:164
|
||||||
Parameters :
Returns :
void
|
Protected createMap |
createMap()
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:137
|
Returns :
void
|
Private generateUUID |
generateUUID()
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:155
|
Returns :
string
|
Public ngDoCheck |
ngDoCheck()
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:112
|
Returns :
void
|
Public ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Inherited from
CachedMapComponent
|
||||||
Defined in
CachedMapComponent:101
|
||||||
Parameters :
Returns :
void
|
Public ngOnDestroy |
ngOnDestroy()
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:131
|
Returns :
void
|
Public ngOnInit |
ngOnInit()
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:95
|
Returns :
void
|
Private removeBaseMap | ||||||
removeBaseMap(layerOptions: LayerOptions)
|
||||||
Inherited from
CachedMapComponent
|
||||||
Defined in
CachedMapComponent:198
|
||||||
Parameters :
Returns :
void
|
Private removeOverlayMap | ||||||
removeOverlayMap(layerOptions: LayerOptions)
|
||||||
Inherited from
CachedMapComponent
|
||||||
Defined in
CachedMapComponent:173
|
||||||
Parameters :
Returns :
void
|
Private updateLayerControl |
updateLayerControl()
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:205
|
Returns :
void
|
Private updateZoomControl |
updateZoomControl()
|
Inherited from
CachedMapComponent
|
Defined in
CachedMapComponent:218
|
Returns :
void
|
avoidZoomToSelection | |
Type : boolean
|
|
filter | |
Type : HelgolandParameterFilter
|
|
fitBoundsMarkerOptions | |
Type : L.FitBoundsOptions
|
|
markerSelectorGenerator | |
Type : MarkerSelectorGenerator
|
|
serviceUrl | |
Type : string
|
|
onContentLoading | |
Type : EventEmitter<boolean>
|
|
onNoResultsFound | |
Type : EventEmitter<boolean>
|
|
onSelected | |
Type : EventEmitter<T>
|
|
import {
AfterViewInit,
ChangeDetectorRef,
EventEmitter,
Input,
KeyValueDiffers,
OnChanges,
Output,
SimpleChanges,
} from '@angular/core';
import { HelgolandParameterFilter } from '@helgoland/core';
import * as L from 'leaflet';
import { CachedMapComponent } from '../base/cached-map-component';
import { MapCache } from '../base/map-cache.service';
import { MarkerSelectorGenerator } from './model/marker-selector-generator';
export abstract class MapSelectorComponent<T>
extends CachedMapComponent
implements OnChanges, AfterViewInit {
/**
* @input The serviceUrl, where the selection should be loaded.
*/
@Input()
public serviceUrl: string;
/**
* @input The filter which should be used, while fetching the selection.
*/
@Input()
public filter: HelgolandParameterFilter;
@Input()
public avoidZoomToSelection: boolean;
@Input()
public markerSelectorGenerator: MarkerSelectorGenerator;
@Output()
public onSelected: EventEmitter<T> = new EventEmitter<T>();
@Output()
public onContentLoading: EventEmitter<boolean> = new EventEmitter();
/**
* @input Additional configuration for the marker zooming (https://leafletjs.com/reference-1.3.4.html#fitbounds-options)
*/
@Input()
public fitBoundsMarkerOptions: L.FitBoundsOptions;
@Output()
public onNoResultsFound: EventEmitter<boolean> = new EventEmitter();
constructor(
protected mapCache: MapCache,
protected kvDiffers: KeyValueDiffers,
protected cd: ChangeDetectorRef
) {
super(mapCache, kvDiffers);
}
public ngAfterViewInit() {
this.createMap();
setTimeout(() => {
this.drawGeometries();
this.cd.detectChanges();
}, 10);
}
public ngOnChanges(changes: SimpleChanges) {
super.ngOnChanges(changes);
if (this.map) {
if (changes.serviceUrl || changes.filter || changes.cluster) {
this.drawGeometries();
}
}
}
/**
* Draws the geometries
*
* @protected
* @abstract
*/
protected abstract drawGeometries(): void;
/**
* Zooms to the given bounds
*
* @protected
* @param bounds where to zoom
*/
protected zoomToMarkerBounds(bounds: L.LatLngBoundsExpression) {
if (!this.avoidZoomToSelection) {
this.map.fitBounds(bounds, this.fitBoundsMarkerOptions || {});
}
}
}