Commit dff7ef2a authored by Eric Duminil's avatar Eric Duminil
Browse files

Refactor.

parent 75ee91fc
......@@ -174,18 +174,21 @@ const regionChooser = (function(){
refreshStyle(feature);
}
refreshStyle = function(feature){
refreshStyle = function(feature, status){
if (status){
feature.status = status;
}
feature.setStyle(styles[feature.status]);
}
publicScope.isDownloadPossible = function(){
kml_source.getFeatures().forEach(f => {f.status = "original"; refreshStyle(f)});
kml_source.getFeatures().forEach(f => refreshStyle(f, "original"));
//TODO: Dry
var checkedBoxes = Array.from(document.querySelectorAll("input.select_citygml")).filter(c => c.checked);
var checkbox_ids = checkedBoxes.map(c => c.id);
var features = getCheckedPolygons(checkbox_ids);
features.forEach(f => {f.status = "selected"; refreshStyle(f)});
features.forEach(f => refreshStyle(f, "selected"));
document.getElementById("download_region_button").disabled = (checkedBoxes.length == 0);
}
......
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