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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user