From d4253603fbca826614d99554251caf7065e7b84f Mon Sep 17 00:00:00 2001 From: euzuro Date: Mon, 5 Jun 2006 16:57:06 +0000 Subject: [PATCH] add a removeMarker() function git-svn-id: http://svn.openlayers.org/trunk/openlayers@519 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Markers.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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.