From d05795cb8307051225034264120180c493409d21 Mon Sep 17 00:00:00 2001 From: Andria Capai Date: Fri, 9 Aug 2024 15:08:32 +0200 Subject: [PATCH 1/2] feat: add load file on map component Allow user to load file (geojson for example) in order to preview ZH on map . Reviewed-by: andriacap --- frontend/app/zh-forms/map/map.component.html | 6 ++++++ frontend/app/zh-forms/map/map.component.ts | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/app/zh-forms/map/map.component.html b/frontend/app/zh-forms/map/map.component.html index 5e0b3176..3418354b 100755 --- a/frontend/app/zh-forms/map/map.component.html +++ b/frontend/app/zh-forms/map/map.component.html @@ -7,4 +7,10 @@ [options]="leafletDrawOptions" (layerDrawed)="onDrawn($event)" > + + diff --git a/frontend/app/zh-forms/map/map.component.ts b/frontend/app/zh-forms/map/map.component.ts index 18bef3b5..182d3ffd 100755 --- a/frontend/app/zh-forms/map/map.component.ts +++ b/frontend/app/zh-forms/map/map.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit, AfterViewInit, Output, EventEmitter } from '@angular/core'; import { leafletDrawOption } from '@geonature_common/map/leaflet-draw.options'; +import { CommonService } from '@geonature_common/service/common.service'; import { MapService } from '@geonature_common/map/map.service'; import * as L from 'leaflet'; @@ -12,11 +13,12 @@ export class ZhFormMapComponent implements OnInit, AfterViewInit { public leafletDrawOptions: any; public geometry: any = null; public editedGeometry: any = null; + public firstFileLayerMessage = true; @Output() draw = new EventEmitter(); @Output() edit = new EventEmitter(); @Output() endDraw = new EventEmitter(); - constructor(private _mapService: MapService) {} + constructor(private _mapService: MapService, private _commonService: CommonService) {} ngOnInit() { // overight the leaflet draw object to set options @@ -35,7 +37,7 @@ export class ZhFormMapComponent implements OnInit, AfterViewInit { if (this._mapService.currentExtend) { this._mapService.map.setView( this._mapService.currentExtend.center, - this._mapService.currentExtend.zoom + this._mapService.currentExtend.zoom, ); } @@ -67,4 +69,13 @@ export class ZhFormMapComponent implements OnInit, AfterViewInit { onDrawStop(e) { this.endDraw.emit(e); } + + + // display help toaster for filelayer + infoMessageFileLayer() { + if (this.firstFileLayerMessage) { + this._commonService.translateToaster('info', 'Map.FileLayerInfoMessage'); + } + this.firstFileLayerMessage = false; + } } From a440861efcec4df266658c5da7807c14a0b06488 Mon Sep 17 00:00:00 2001 From: Etienne Delclaux Date: Mon, 16 Sep 2024 16:01:30 +0200 Subject: [PATCH 2/2] lint: run linter --- frontend/app/zh-forms/map/map.component.html | 10 +++++----- frontend/app/zh-forms/map/map.component.ts | 8 +++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/app/zh-forms/map/map.component.html b/frontend/app/zh-forms/map/map.component.html index 3418354b..e06d70fa 100755 --- a/frontend/app/zh-forms/map/map.component.html +++ b/frontend/app/zh-forms/map/map.component.html @@ -7,10 +7,10 @@ [options]="leafletDrawOptions" (layerDrawed)="onDrawn($event)" > - + + [editMode]="true" + (onLoad)="infoMessageFileLayer()" + [style]="{ color: 'green' }" + > diff --git a/frontend/app/zh-forms/map/map.component.ts b/frontend/app/zh-forms/map/map.component.ts index 182d3ffd..888f42cf 100755 --- a/frontend/app/zh-forms/map/map.component.ts +++ b/frontend/app/zh-forms/map/map.component.ts @@ -18,7 +18,10 @@ export class ZhFormMapComponent implements OnInit, AfterViewInit { @Output() edit = new EventEmitter(); @Output() endDraw = new EventEmitter(); - constructor(private _mapService: MapService, private _commonService: CommonService) {} + constructor( + private _mapService: MapService, + private _commonService: CommonService + ) {} ngOnInit() { // overight the leaflet draw object to set options @@ -37,7 +40,7 @@ export class ZhFormMapComponent implements OnInit, AfterViewInit { if (this._mapService.currentExtend) { this._mapService.map.setView( this._mapService.currentExtend.center, - this._mapService.currentExtend.zoom, + this._mapService.currentExtend.zoom ); } @@ -70,7 +73,6 @@ export class ZhFormMapComponent implements OnInit, AfterViewInit { this.endDraw.emit(e); } - // display help toaster for filelayer infoMessageFileLayer() { if (this.firstFileLayerMessage) {