Skip to content

Commit

Permalink
Merge pull request #76 from naturalsolutions/feat/add-load-file-on-ma…
Browse files Browse the repository at this point in the history
…p-component

feat: add the "load geosjon feature" when creating a new zh
  • Loading branch information
edelclaux authored Sep 16, 2024
2 parents edeb6db + a440861 commit 354309c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions frontend/app/zh-forms/map/map.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@
[options]="leafletDrawOptions"
(layerDrawed)="onDrawn($event)"
></pnx-leaflet-draw>

<pnx-leaflet-filelayer
[editMode]="true"
(onLoad)="infoMessageFileLayer()"
[style]="{ color: 'green' }"
></pnx-leaflet-filelayer>
</pnx-map>
15 changes: 14 additions & 1 deletion frontend/app/zh-forms/map/map.component.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -12,11 +13,15 @@ export class ZhFormMapComponent implements OnInit, AfterViewInit {
public leafletDrawOptions: any;
public geometry: any = null;
public editedGeometry: any = null;
public firstFileLayerMessage = true;
@Output() draw = new EventEmitter<any>();
@Output() edit = new EventEmitter<any>();
@Output() endDraw = new EventEmitter<any>();

constructor(private _mapService: MapService) {}
constructor(
private _mapService: MapService,
private _commonService: CommonService
) {}

ngOnInit() {
// overight the leaflet draw object to set options
Expand Down Expand Up @@ -67,4 +72,12 @@ 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;
}
}

0 comments on commit 354309c

Please sign in to comment.