- add npm packages: "@fortawesome/angular-fontawesome, @fortawesome/fontawesome-svg-core, @fortawesome/free-solid-svg-icons

- add locate.service.ts, map-cache.service.ts
- add mapCache Service to map component
- notes
This commit is contained in:
Arno Kaimbacher 2021-09-08 14:40:57 +02:00
parent df3561235d
commit feab502c1d
21 changed files with 239 additions and 36 deletions

View file

@ -8,7 +8,7 @@
<nav class="navbar has-shadow" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="" href="http://geomon.geologie.ac.at/" target="_blank">
<img src="assets/Tethys-icon.png">
<img src="assets/geomon_logo.png">
</a>
<a role="button" id="menu-icon" class="navbar-burger" aria-label="menu" aria-expanded="false"
data-target="navbarBasicExample">

View file

@ -17,9 +17,9 @@ import { HttpService } from "./services/http.service";
import { StationService } from "./services/station.service";
import { MessagesComponent } from './messages/messages.component';
import { MessageService } from "./services/message.service";
// import { HelgolandMapModule } from '@helgoland/map';
// import { LocateService } from '@helgoland/map';
import { MapCache } from '../common/components/services/map-cache.service';
// import { LocateService } from '@helgoland/map';
// import { MapCache } from '@helgoland/map';
// siehe https://52north.github.io/helgoland-toolbox/additional-documentation/how-tos/integrate-a-map-component.html
// https://52north.github.io/helgoland-toolbox/components/LocateControlComponent.html#source
@ -28,6 +28,7 @@ import { MessageService } from "./services/message.service";
// DatasetApiInterface, ApiV3InterfaceService, SplittedDataDatasetApiInterface, DatasetApiV3Connector, HelgolandServicesConnector
// } from '@helgoland/core';
// import { HelgolandCoreModule } from "@helgoland/core";
// import { HelgolandMapModule } from '@helgoland/map';
// import 'core-js';
@ -37,7 +38,7 @@ import { MessageService } from "./services/message.service";
// imports: Other modules whose exported classes are needed by component templates declared in this NgModule.
imports: [BrowserModule, HttpClientModule, AppRoutingModule, ComponentsModule],
providers: [
MarkerService, PopupService, HttpService, DatasetApiService, StationService, MessageService
MarkerService, PopupService, HttpService, DatasetApiService, StationService, MessageService, MapCache
// {
// provide: DatasetApiInterface,
// useClass: SplittedDataDatasetApiInterface,

View file

@ -3,6 +3,8 @@ import { Map, Control, MapOptions, LatLngBoundsExpression, tileLayer, TileLayer
// import { MarkerService } from '../services/marker.service';
import { LayerOptions, LayerMap } from './map-options';
import { MapCache } from '../../common/components/services/map-cache.service';
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 = '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors';
@ -62,7 +64,7 @@ export abstract class BaseMapComponent implements OnChanges, OnInit {
protected map: Map;
protected zoomControl: Control.Zoom;
constructor() { }
constructor(protected mapCache: MapCache) { }
// constructor(private markerService: MarkerService) { }
// constructor(markerService: MarkerService) {
// this.markerService = markerService;
@ -88,7 +90,7 @@ export abstract class BaseMapComponent implements OnChanges, OnInit {
center: [48.208174, 16.373819],
zoom: 3
});
this.mapCache.setMap(this.mapId, this.map);
this.onMapInitializedEvent.emit(this.mapId);
if (this.baseMaps && this.baseMaps.size > 0) {
this.baseMaps.forEach((layerOptions, key) => this.addBaseMap(layerOptions));

View file

@ -4,4 +4,5 @@
</div>
</div> -->
<div [attr.id]="mapId" class="map-container mapDesktop">
<gba-locate-button [mapId]="mapId"></gba-locate-button>
</div>

View file

@ -5,6 +5,7 @@ import { MarkerService } from '../services/marker.service';
import { DatasetApiService } from '../services/dataset-api.service';
import { BaseMapComponent } from './base-map.component';
import { PopupService } from '../services/popup.service';
import { MapCache } from '../../common/components/services/map-cache.service';
@Component({
selector: 'app-map',
@ -16,8 +17,7 @@ export class MapComponent
extends BaseMapComponent
implements OnChanges, AfterViewInit {
/**
* @input The serviceUrl, where the selection should be loaded.
*/
@ -43,10 +43,11 @@ export class MapComponent
// constructor() { }
constructor(
protected mapCache: MapCache,
protected markerService: MarkerService,
private popupService: PopupService,
protected datasetApiService: DatasetApiService) {
super();
super(mapCache);
this.markerFeatureGroup = new FeatureGroup();
}