Commit 2978d76c authored by duminil's avatar duminil
Browse files

Fixed Javascript race condition.

parent c104f778
......@@ -117,8 +117,11 @@ var map = new ol.Map({
var geoJSONformat = new ol.format.GeoJSON();
kml_layer.addEventListener("change", function(event) {
var fromJavaFX = (typeof fxapp !== 'undefined');
map.getView().fitExtent(kml_source.getExtent(), (map.getSize()));
});
function updateGMLPolygons(){
var fromJavaFX = (typeof fxapp !== 'undefined');
kml_source.forEachFeature(function(feature) {
feature["geoJSON"] = geoJSONformat.writeFeatureObject(feature);
feature["area"] = feature.getGeometry().getArea();
......@@ -131,7 +134,7 @@ kml_layer.addEventListener("change", function(event) {
}
feature["available"] = citygmlHere;
});
});
}
// The features are not added to a regular vector layer/source,
// but to a feature overlay which holds a collection of features.
......@@ -185,6 +188,7 @@ var sketch;
draw.on('drawstart', function(evt) {
sketch = evt.feature;
reset_btn.disabled = false;
updateGMLPolygons();
});
var sourceProj = map.getView().getProjection();
......
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