I try a selection of object with OpenLayers 3.5.0 but she doesn't work correctly.
I make a code like this when I click on the map :
// Style 1 - The overlay of selection var overlay_selection = new ol.FeatureOverlay ({ map: map, name: 'Sélection', style: new ol.style.Style ({ image: new ol.style.Circle ({radius: 7,stroke: new ol.style.Stroke ({color: 'rgb(0, 255, 255)',width: 2}) }) }) }); // Gestion of the overlay with a global variable : selection if (recup_prop != selection) { if (typeof(selection) !== 'undefined') { overlay_selection.removeFeature(selection); } if (typeof(recup_prop) !== 'undefined') { overlay_selection.addFeature(recup_prop); } selection = recup_prop; }; So, when I click on an object, Style 1 appear on this object, but if I click on a second object, both objects become like style 1 and removeFeature doesn't work.
I tried too, the method :
overlay_selection.getFeatures(selection).clear(); but the result is the same.
أكثر...
I make a code like this when I click on the map :
// Style 1 - The overlay of selection var overlay_selection = new ol.FeatureOverlay ({ map: map, name: 'Sélection', style: new ol.style.Style ({ image: new ol.style.Circle ({radius: 7,stroke: new ol.style.Stroke ({color: 'rgb(0, 255, 255)',width: 2}) }) }) }); // Gestion of the overlay with a global variable : selection if (recup_prop != selection) { if (typeof(selection) !== 'undefined') { overlay_selection.removeFeature(selection); } if (typeof(recup_prop) !== 'undefined') { overlay_selection.addFeature(recup_prop); } selection = recup_prop; }; So, when I click on an object, Style 1 appear on this object, but if I click on a second object, both objects become like style 1 and removeFeature doesn't work.
I tried too, the method :
overlay_selection.getFeatures(selection).clear(); but the result is the same.
أكثر...