From 4601f7494ee75f28ab5d854414f7ddc19e041176 Mon Sep 17 00:00:00 2001 From: webgisdeveloper Date: Tue, 6 Apr 2021 10:14:31 -0400 Subject: [PATCH] #103 restore worksapce ... --- .../templates/simccs_maptool/build.html | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/simccs_maptool/templates/simccs_maptool/build.html b/simccs_maptool/templates/simccs_maptool/build.html index 9467896..5376e0f 100644 --- a/simccs_maptool/templates/simccs_maptool/build.html +++ b/simccs_maptool/templates/simccs_maptool/build.html @@ -686,13 +686,49 @@ function re_create_scenario(scenario_data) { var panelid = scenario_data['scenario_id']; var title = scenario_data['title']; + + // displayselecteddata(panelid) + // sourceselection + // sinkselection + sourceselection = []; + sinkselection = []; + var datalayerid; + var selected_ids = []; + // collect all selected ids + for (const entry of scenario_data['sources']) { + datalayerid = entry['dataset']; + selected_ids.push(entry['source_id']); + } + var sourceLayer = mplayers[datalayerid]; + var feature_id; + sourceLayer.eachLayer(function(layer) { + feature_id = layer.feature.properties['ID'].toString(); + if (selected_ids.includes(feature_id)) { + sourceselection.push(layer); + } + }); + + selected_ids = []; + // collect all selected sinks + for (const entry of scenario_data['sinks']) { + datalayerid = entry['dataset']; + selected_ids.push(entry['source_id']); + } + var sinkLayer = mylayers[datalayerid]; + sinkLayer.eachLayer(function(layer) { + feature_id = layer.feature.properties['ID'].toString(); + if (selected_ids.includes(feature_id)) { + sinkselection.push(layer); + } + }); + var panediv = displayselecteddata(panelid); sidebar.addPanel({ id: panelid, tab: '', title: title, - pane: '
' + "data" +"
", + pane: '
' + panediv.innerHTML +"
", }); - + } // load workspace id