From 48f9e849db78429b2cfcf031946bb7607af5ea89 Mon Sep 17 00:00:00 2001 From: Eric Duminil <eric.duminil@gmail.com> Date: Thu, 6 Oct 2022 15:34:15 +0200 Subject: [PATCH] slight refactor. --- .../website/script/simstadt_openlayers.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js b/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js index cfa7880..d4eedc1 100644 --- a/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js +++ b/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js @@ -234,12 +234,13 @@ var regionChooser = (function(){ dataPanel.prepend("<h2 class='error'>Sorry, the CityGML files should all be written with the same coordinate system.</h2><br/>\n"); } + document.documentElement.className = 'wait'; + var citygmlNames = features.map(f => f.get("name")); // Waiting 100ms in order to let the cursor change setTimeout(function() { var start = new Date().getTime(); if (proj4.defs(srsName)){ - document.documentElement.className = 'wait'; console.log("Selected region is written in " + srsName + " coordinate system."); try { fxapp.downloadRegionFromCityGMLs(sketchAsWKT(srsName), project, citygmlNames.join(";"), srsName); @@ -374,13 +375,10 @@ var regionChooser = (function(){ } publicScope.downloadFromSelectedCityGMLs = function() { + document.getElementById("download_region_button").disabled = true; var checkedBoxes = Array.from(document.querySelectorAll("input.select_citygml")).filter(c => c.checked); - if (checkedBoxes.length === 0){ - console.log("You should select at least one citygml, though."); - } else{ - document.getElementById("download_region_button").disabled = true; - publicScope.downloadRegionFromCityGMLs(checkedBoxes.map(c => c.id)); - } + // CheckBoxes isn't empty, because otherwise the button cannot be clicked. + publicScope.downloadRegionFromCityGMLs(checkedBoxes.map(c => c.id)); } publicScope.checkCityGMLS = function(allOrNone) { -- GitLab