- npm updates
- add favicon via template - add popup.service.ts
This commit is contained in:
parent
bc44385846
commit
72cc5241af
9 changed files with 135 additions and 122 deletions
|
@ -1,25 +1,11 @@
|
|||
import { Component, AfterViewInit, Directive, OnChanges, SimpleChanges, EventEmitter, Input, Output, OnInit } from '@angular/core';
|
||||
import * as L from 'leaflet';
|
||||
import { Directive, OnChanges, SimpleChanges, EventEmitter, Input, Output, OnInit } from '@angular/core';
|
||||
import { Map, Control, MapOptions, LatLngBoundsExpression, tileLayer } from 'leaflet';
|
||||
// import { MarkerService } from '../services/marker.service';
|
||||
import { LayerOptions, LayerMap } from './map-options';
|
||||
|
||||
const DEFAULT_BASE_LAYER_NAME = 'BaseLayer';
|
||||
const DEFAULT_BASE_LAYER_URL = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
const DEFAULT_BASE_LAYER_ATTRIBUTION = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors';
|
||||
// const iconRetinaUrl = 'assets/marker-icon-2x.png';
|
||||
// const iconUrl = 'assets/marker-icon.png';
|
||||
// const shadowUrl = 'assets/marker-shadow.png';
|
||||
// const iconDefault = L.icon({
|
||||
// iconRetinaUrl,
|
||||
// iconUrl,
|
||||
// shadowUrl,
|
||||
// iconSize: [25, 41],
|
||||
// iconAnchor: [12, 41],
|
||||
// popupAnchor: [1, -34],
|
||||
// tooltipAnchor: [16, -28],
|
||||
// shadowSize: [41, 41]
|
||||
// });
|
||||
// L.Marker.prototype.options.icon = iconDefault;
|
||||
|
||||
// @Component({
|
||||
// selector: 'app-map',
|
||||
|
@ -48,20 +34,20 @@ export abstract class BaseMapComponent implements OnChanges, OnInit {
|
|||
* The corresponding leaflet map options (see: https://leafletjs.com/reference-1.3.4.html#map-option)
|
||||
*/
|
||||
@Input()
|
||||
public mapOptions: L.MapOptions;
|
||||
public mapOptions: MapOptions;
|
||||
|
||||
// markerService: MarkerService
|
||||
/**
|
||||
* Bounds for the map
|
||||
*/
|
||||
@Input()
|
||||
public fitBounds: L.LatLngBoundsExpression;
|
||||
public fitBounds: LatLngBoundsExpression;
|
||||
|
||||
/**
|
||||
* Describes the the zoom control options (see: https://leafletjs.com/reference-1.3.4.html#control-zoom)
|
||||
*/
|
||||
@Input()
|
||||
public zoomControlOptions: L.Control.ZoomOptions;
|
||||
public zoomControlOptions: Control.ZoomOptions;
|
||||
|
||||
@Input()
|
||||
public baseMaps: LayerMap;
|
||||
|
@ -72,9 +58,9 @@ export abstract class BaseMapComponent implements OnChanges, OnInit {
|
|||
@Output()
|
||||
public onMapInitializedEvent: EventEmitter<string> = new EventEmitter();
|
||||
|
||||
protected oldBaseLayer: L.Control.LayersObject = {};
|
||||
protected map: L.Map;
|
||||
protected zoomControl: L.Control.Zoom;
|
||||
protected oldBaseLayer: Control.LayersObject = {};
|
||||
protected map: Map;
|
||||
protected zoomControl: Control.Zoom;
|
||||
|
||||
constructor() { }
|
||||
// constructor(private markerService: MarkerService) { }
|
||||
|
@ -98,7 +84,7 @@ export abstract class BaseMapComponent implements OnChanges, OnInit {
|
|||
}
|
||||
|
||||
protected initMap(): void {
|
||||
this.map = L.map(this.mapId, {
|
||||
this.map = new Map(this.mapId, {
|
||||
center: [48.208174, 16.373819],
|
||||
zoom: 3
|
||||
});
|
||||
|
@ -128,7 +114,7 @@ export abstract class BaseMapComponent implements OnChanges, OnInit {
|
|||
layerOptions = {
|
||||
label: DEFAULT_BASE_LAYER_NAME,
|
||||
visible: true,
|
||||
layer: L.tileLayer(DEFAULT_BASE_LAYER_URL, {
|
||||
layer: tileLayer(DEFAULT_BASE_LAYER_URL, {
|
||||
attribution: DEFAULT_BASE_LAYER_ATTRIBUTION
|
||||
})
|
||||
};
|
||||
|
@ -160,7 +146,7 @@ export abstract class BaseMapComponent implements OnChanges, OnInit {
|
|||
private updateZoomControl() {
|
||||
if (this.zoomControl) { this.map.removeControl(this.zoomControl); }
|
||||
if (this.zoomControlOptions) {
|
||||
this.zoomControl = L.control.zoom(this.zoomControlOptions).addTo(this.map);
|
||||
this.zoomControl = new Control.Zoom(this.zoomControlOptions).addTo(this.map);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue