Skip to content

Commit f8a198a

Browse files
committed
Hide observation edit layers in layer control
1 parent 3ba3261 commit f8a198a

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

public/app/mage/leaflet.directive.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,6 @@ function LeafletController($rootScope, $scope, $interval, $timeout, MapService,
3636
editable: true // turn on Leaflet.Editable
3737
});
3838

39-
// TODO why are we calling back into the map service to do this, cause don't
40-
MapService.createVectorLayer({
41-
name: 'New',
42-
group: 'MAGE',
43-
type: 'geojson',
44-
options: {
45-
selected: true
46-
}
47-
});
48-
49-
MapService.createVectorLayer({
50-
name: 'Edit',
51-
group: 'MAGE',
52-
type: 'geojson',
53-
options: {
54-
selected: true
55-
}
56-
});
57-
5839
// Create a map pane for our base layers
5940
var BASE_LAYER_PANE = 'baseLayerPane';
6041
map.createPane(BASE_LAYER_PANE);
@@ -111,6 +92,16 @@ function LeafletController($rootScope, $scope, $interval, $timeout, MapService,
11192
MapService.overlayAdded(layer);
11293
});
11394

95+
// Edit layer, houses features that are being created or modified
96+
createGeoJsonLayer({
97+
name: 'Edit',
98+
type: 'geojson',
99+
options: {
100+
selected: true,
101+
hidden: true
102+
}
103+
});
104+
114105
function onLocation(location, broadcast) {
115106
// no need to do anything if the location has not changed
116107
if (currentLocation &&
@@ -326,8 +317,11 @@ function LeafletController($rootScope, $scope, $interval, $timeout, MapService,
326317
layers[data.name] = layerInfo;
327318
if (data.options.temporal) temporalLayers.push(layerInfo);
328319

329-
layerControl.addOverlay(layerInfo.layer, data.name, data.group);
330320
if (data.options.selected) layerInfo.layer.addTo(map);
321+
322+
if (!data.options.hidden) {
323+
layerControl.addOverlay(layerInfo.layer, data.name, data.group);
324+
}
331325
}
332326

333327
function onEdit(edit) {

0 commit comments

Comments
 (0)