Skip to content

Commit

Permalink
Merge pull request #68 from PnX-SI/feat/pf_geom_map
Browse files Browse the repository at this point in the history
Feat/pf geom map
  • Loading branch information
joelclems authored Dec 11, 2023
2 parents 7aacf7a + c6a8f97 commit cecc1b8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 534 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ layout:
items:
type: object
display: geojson
deflate: true
open_popup: true
popup_fields: __SITE_MAP_POPUP_FIELDS__

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class ModulesLayoutObjectGeoJSONComponent
pane: paneName,
zoom: bZoom,
key: this.computedLayout.key,
deflate: this.computedLayout.deflate,
pk_field_name,
title: utils.capitalize(this.computedLayout.title || this.objectConfig().display.labels),
style: layerStyle,
Expand Down
1 change: 1 addition & 0 deletions frontend/app/services/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ModulesLayoutService } from './layout.service';
import { MapService } from '@geonature_common/map/map.service';

import * as L from '@librairies/leaflet';
import 'Leaflet.Deflate';
import '@geoman-io/leaflet-geoman-free';

L.PM.initialize({ optIn: true }); // Property 'PM' does not exist on type 'typeof import(".../node_modules/@types/leaflet/index")'.ts(2339)
Expand Down
13 changes: 9 additions & 4 deletions frontend/app/services/map/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,14 @@ export default {
let layerGroup = this.getLayerData(mapId, key);

if (!layerGroup) {
layerGroup = new this.L.FeatureGroup();
// layerGroup.key = key;
map.addLayer(layerGroup);
layerGroup = layerOptions?.deflate
? this.L.deflate({
minsize: layerOptions.deflate.minSize || 10,
markerType: this.L.circleMarker,
})
: new this.L.FeatureGroup();
layerGroup.addTo(map);

map.controls.addOverlay(
layerGroup,
`<span class="fa fa-circle-o" style="color: ${
Expand Down Expand Up @@ -253,7 +258,7 @@ export default {
// creation et ajout des nouveaux layers
const newLayers = this.createlayersFromGeojson(newGeojson, layerOptions);
for (const layer of Object.values(newLayers._layers)) {
layerGroup.addLayer(layer);
(layer as any).addTo(layerGroup);
}

// mise à jour des layer existants ?????
Expand Down
Loading

0 comments on commit cecc1b8

Please sign in to comment.