diff --git a/lib/OpenLayers/Layer/Markers.js b/lib/OpenLayers/Layer/Markers.js index aee92a56d1..06bac54fe7 100644 --- a/lib/OpenLayers/Layer/Markers.js +++ b/lib/OpenLayers/Layer/Markers.js @@ -40,6 +40,24 @@ OpenLayers.Layer.Markers.prototype = } }, + /** + * @param {OpenLayers.Marker} marker + */ + removeMarker: function(marker) { + var index = null; + for(var i=0; i < this.markers.length; i++) { + if (this.markers[i] == marker) { + index = i; + } + } + if (index != null) { + this.markers.splice(index, 1); + } + if ((marker.icon != null) && (marker.icon.imageDiv != null) && + (marker.icon.imageDiv.parentNode == this.div) ) { + this.div.removeChild(marker.icon.imageDiv); + } + }, /** clear all the marker div's from the layer and then redraw all of them. * Use the map to recalculate new placement of markers.