Commit 8d3aef30 authored by Eric Duminil's avatar Eric Duminil
Browse files

Hide "select all" and "none" when required.

Refresh after download.
No related merge requests found
Showing with 17 additions and 12 deletions
+17 -12
......@@ -95,6 +95,8 @@ public void downloadRegionFromCityGMLs(String wktPolygon, String project, String
}
}
}
refreshHulls();
}
public void selectRepository() {
......
......@@ -163,7 +163,7 @@ var regionChooser = (function(){
intersections.addFeature(intersection);
var link = '<li>'
// TODO: If possible, highlight the corresponding polygon when hovering above a name.
link += '<input type="checkbox" id="citygml_' + feature.getId() + '" class="select_citygml" onclick="regionChooser.canDownload();"><label for="citygml_' + feature.getId() + '">' + feature['name'] + '</label>';
link += '<input type="checkbox" id="citygml_' + feature.getId() + '" class="select_citygml" onclick="regionChooser.isDownloadPossible();"><label for="citygml_' + feature.getId() + '">' + feature['name'] + '</label>';
link += " (" + citygml_percentage + "%";
if (sketch_percentage == 100) {
......@@ -172,15 +172,14 @@ var regionChooser = (function(){
dataPanel.append(link + ")\n");
}
publicScope.canDownload = function(){
publicScope.isDownloadPossible = function(){
var count = 0;
console.log("...");
document.querySelectorAll("input.select_citygml").forEach(c => {
if (c.checked){
count += 1;
}
});
document.getElementById("download").disabled = (count == 0);
document.getElementById("download_region_button").disabled = (count == 0);
}
function findIntersection(feature, polygon) {
......@@ -210,10 +209,10 @@ var regionChooser = (function(){
});
if (intersection_found) {
document.getElementById("download").style.visibility = 'visible';
document.getElementById("download_region").style.visibility = 'visible';
}
else {
document.getElementById("download").style.visibility = 'hidden';
document.getElementById("download_region").style.visibility = 'hidden';
dataPanel.append("No intersection found with any CityGML file.<br/>\n");
}
}
......@@ -248,8 +247,9 @@ var regionChooser = (function(){
var time = end - start;
console.log('Download Execution time: ' + (time / 1000).toFixed(3) + 's');
setTimeout(function() {
document.getElementById("download").disabled = false;
document.getElementById("download_region_button").disabled = false;
document.documentElement.className = ''; // Stop waiting
resetDrawing();
}, 100);
} else {
var msg = "ERROR : Unknown coordinate system : \"" + srsName + "\". Cannot extract any region";
......@@ -277,10 +277,13 @@ var regionChooser = (function(){
dataPanel.append("WGS84 Coordinates<br/>");
dataPanel.append(wgs84_coords + "<br/>\n");
}
//NOTE: Could show m², ha or km² depending on magnitude
dataPanel.append("<h3 class='clean'>Area : " + (area / 10000).toFixed(1) + " ha\n");
dataPanel.append('<button type="button" onclick="regionChooser.downloadFromSelectedCityGMLs()" id="download" style="visibility:hidden" disabled>Download Region</button><br/>\n');
dataPanel.append('<a href="#" onclick="regionChooser.checkCityGMLS(true);">(Select All)</a>');
dataPanel.append('<a href="#" onclick="regionChooser.checkCityGMLS(false);">(Select None)</a>');
dataPanel.append('<div style="visibility:hidden" id="download_region">' +
'<button type="button" onclick="regionChooser.downloadFromSelectedCityGMLs()" id="download_region_button" disabled>Download Region</button><br/>\n' +
'<a href="#" onclick="regionChooser.checkCityGMLS(true);">(Select All)</a>\n' +
'<a href="#" onclick="regionChooser.checkCityGMLS(false);">(Select None)</a>\n'+
'</div><br/>\n');
dataPanel.append('<br/>\n');
findIntersections();
}
......@@ -373,14 +376,14 @@ var regionChooser = (function(){
if (checkedBoxes.length === 0){
console.log("You should select at least one citygml, though.");
} else{
document.getElementById("download").disabled = true;
document.getElementById("download_region_button").disabled = true;
publicScope.downloadRegionFromCityGMLs(checkedBoxes.map(c => c.id));
}
}
publicScope.checkCityGMLS = function(allOrNone) {
document.querySelectorAll("input.select_citygml").forEach(c => c.checked = allOrNone);
publicScope.canDownload();
publicScope.isDownloadPossible();
}
publicScope.selectRepository = function() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment