- add DatasetApiService wit HttpService

- Interfaces for stations and phenomena
This commit is contained in:
Arno Kaimbacher 2021-08-24 13:38:52 +02:00
parent 5740a5ddc3
commit 7857e2c5bb
13 changed files with 2495 additions and 1446 deletions

View file

@ -1,24 +1,21 @@
import { Component, AfterViewInit, OnChanges, SimpleChanges, EventEmitter, Input, Output } from '@angular/core';
import * as L from 'leaflet';
import { MarkerService } from '../services/marker.service';
import { DatasetApiInterface, DatasetApiV2Connector, SplittedDataDatasetApiInterface } from '@helgoland/core';
import { DatasetApiService } from '../services/dataset-api.service';
import { BaseMapComponent } from './base-map.component';
import { HelgolandServicesConnector } from '@helgoland/core';
// 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]
// iconRetinaUrl,
// iconUrl,
// shadowUrl,
// iconSize: [25, 41],
// iconAnchor: [12, 41],
// popupAnchor: [1, -34],
// tooltipAnchor: [16, -28],
// shadowSize: [41, 41]
// });
// L.Marker.prototype.options.icon = iconDefault;
@ -54,11 +51,12 @@ export class MapComponent
protected oldBaseLayer: L.Control.LayersObject = {};
protected map: L.Map;
protected zoomControl: L.Control.Zoom;
protected markerFeatureGroup: L.FeatureGroup;
// constructor() { }
constructor(
protected markerService: MarkerService,
protected servicesConnector: HelgolandServicesConnector) {
protected datasetApiService: DatasetApiService) {
super();
}
// constructor(markerService: MarkerService) {
@ -68,7 +66,30 @@ export class MapComponent
ngAfterViewInit(): void {
this.initMap();
// this.markerService.makeCapitalMarkers(this.map);
this.markerService.makeCapitalCircleMarkers(this.map);
// this.markerService.makeCapitalCircleMarkers(this.map);
this.datasetApiService.getStations('https://geomon.geologie.ac.at/52n-sos-webapp/api/')
.subscribe((res) => {
this.markerFeatureGroup = L.featureGroup();
if (res instanceof Array && res.length > 0) {
res.forEach((entry) => {
//const marker = this.createDefaultGeometry(entry);
// const marker = L.geoJSON(entry.geometry);
const marker = L.geoJSON(entry.geometry, {
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng);
}
})
if (marker) { this.markerFeatureGroup.addLayer(marker); }
});
this.markerFeatureGroup.addTo(this.map);
// this.zoomToMarkerBounds(this.markerFeatureGroup.getBounds());
} else {
// this.onNoResultsFound.emit(true);
}
this.map.invalidateSize();
this.onContentLoadingEvent.emit(false);
});
// this.createStationGeometries();
}
@ -87,18 +108,4 @@ export class MapComponent
// }
}
protected createStationGeometries() {
this.servicesConnector.getPlatforms('https://geomon.geologie.ac.at/52n-sos-webapp/api/')
.subscribe((res) => {
if (res instanceof Array && res.length > 0) {
res.forEach((entry) => {
let test = entry;
});
}
this.onContentLoadingEvent.emit(false);
});
}
}