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

rename

parent 2f951dcb
...@@ -89,7 +89,7 @@ var regionChooser = (function(){ ...@@ -89,7 +89,7 @@ var regionChooser = (function(){
// but to a feature overlay which holds a collection of features. // but to a feature overlay which holds a collection of features.
// This collection is passed to the modify and also the draw // This collection is passed to the modify and also the draw
// interaction, so that both can add or modify features. // interaction, so that both can add or modify features.
var featureOverlay = new ol.FeatureOverlay({ var drawnLayer = new ol.FeatureOverlay({
style : new ol.style.Style({ style : new ol.style.Style({
fill : new ol.style.Fill({ fill : new ol.style.Fill({
color : 'rgba(255, 155, 51, 0.5)' color : 'rgba(255, 155, 51, 0.5)'
...@@ -106,11 +106,9 @@ var regionChooser = (function(){ ...@@ -106,11 +106,9 @@ var regionChooser = (function(){
}) })
}) })
}); });
featureOverlay.setMap(map); drawnLayer.setMap(map);
//TODO: Rename to Javascript naming convention (CamelCase). drawnLayer.getFeatures().on('add', function(event) {
var selected_features = featureOverlay.getFeatures();
selected_features.on('add', function(event) {
var feature = event.element; var feature = event.element;
feature.on("change", function() { feature.on("change", function() {
displayInfo(); displayInfo();
...@@ -118,7 +116,7 @@ var regionChooser = (function(){ ...@@ -118,7 +116,7 @@ var regionChooser = (function(){
}); });
var modify = new ol.interaction.Modify({ var modify = new ol.interaction.Modify({
features : featureOverlay.getFeatures(), features : drawnLayer.getFeatures(),
// the SHIFT key must be pressed to delete vertices, so // the SHIFT key must be pressed to delete vertices, so
// that new vertices can be drawn at the same position // that new vertices can be drawn at the same position
// of existing vertices // of existing vertices
...@@ -129,7 +127,7 @@ var regionChooser = (function(){ ...@@ -129,7 +127,7 @@ var regionChooser = (function(){
map.addInteraction(modify); map.addInteraction(modify);
var draw = new ol.interaction.Draw({ var draw = new ol.interaction.Draw({
features : featureOverlay.getFeatures(), features : drawnLayer.getFeatures(),
type : 'Polygon' type : 'Polygon'
}); });
map.addInteraction(draw); map.addInteraction(draw);
...@@ -317,7 +315,7 @@ var regionChooser = (function(){ ...@@ -317,7 +315,7 @@ var regionChooser = (function(){
displayHelp(); displayHelp();
document.documentElement.className = ''; // Stop waiting document.documentElement.className = ''; // Stop waiting
draw.setActive(true); draw.setActive(true);
featureOverlay.getFeatures().clear(); drawnLayer.getFeatures().clear();
intersections.clear(); intersections.clear();
focusOnMap(); focusOnMap();
} }
......
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