patch from #796 - warn users if they try to add a layer that has already been added

git-svn-id: http://svn.openlayers.org/trunk/openlayers@3574 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-07-03 21:45:26 +00:00
parent 59c038f6b0
commit 5c4ef6011d

View File

@@ -492,6 +492,9 @@ OpenLayers.Map.prototype = {
addLayer: function (layer) {
for(var i=0; i < this.layers.length; i++) {
if (this.layers[i] == layer) {
var msg = "You tried to add the layer: " + layer.name +
" to the map, but it has already been added";
OpenLayers.Console.warn(msg);
return false;
}
}