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

Sort citygmls inside project.

parent 942d3f94
...@@ -4,6 +4,7 @@ var regionChooser = (function(){ ...@@ -4,6 +4,7 @@ var regionChooser = (function(){
var fromJavaFX = navigator.userAgent.indexOf('JavaFX') !== -1; var fromJavaFX = navigator.userAgent.indexOf('JavaFX') !== -1;
var dataPanel = $('#dataPanel'); var dataPanel = $('#dataPanel');
var wgs84Sphere = new ol.Sphere(6378137); var wgs84Sphere = new ol.Sphere(6378137);
var features_by_project;
var gmlId; var gmlId;
publicScope.init = function(){ publicScope.init = function(){
...@@ -96,6 +97,11 @@ var regionChooser = (function(){ ...@@ -96,6 +97,11 @@ var regionChooser = (function(){
feature["name"] = feature.get("name"); feature["name"] = feature.get("name");
feature["source"] = "CityGML"; feature["source"] = "CityGML";
}); });
features_by_project = groupBy(kml_source.getFeatures(), "project");
// Sort CityGMLs inside each project
Object.values(features_by_project).forEach(features => features.sort((a, b) => a.name.localeCompare(b.name)));
} }
// The features are not added to a regular vector layer/source, // The features are not added to a regular vector layer/source,
...@@ -190,8 +196,6 @@ var regionChooser = (function(){ ...@@ -190,8 +196,6 @@ var regionChooser = (function(){
var polygonArea = sketch.getGeometry().getArea(); var polygonArea = sketch.getGeometry().getArea();
var intersection_found = false; var intersection_found = false;
intersections.clear(); intersections.clear();
//NOTE: getFeatures seems to not be sorted anymore. :-/
features_by_project = groupBy(kml_source.getFeatures(), "project");
Object.keys(features_by_project).forEach(function(project) { Object.keys(features_by_project).forEach(function(project) {
features = features_by_project[project]; features = features_by_project[project];
...@@ -368,7 +372,7 @@ var regionChooser = (function(){ ...@@ -368,7 +372,7 @@ var regionChooser = (function(){
updateGMLPolygons(); updateGMLPolygons();
displayHelp(); displayHelp();
document.documentElement.className = ''; // Stop waiting document.documentElement.className = ''; // Stop waiting
console.log("READY!"); console.log("Ready!");
} }
publicScope.downloadFromSelectedCityGMLs = function() { publicScope.downloadFromSelectedCityGMLs = function() {
......
Markdown is supported
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