Add ol.Map.removeLayer

This commit is contained in:
Tom Payne
2013-03-06 17:17:32 +01:00
parent fcbd758f48
commit c48e281c68
2 changed files with 13 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
@exportProperty ol.Map.prototype.addPreRenderFunctions
@exportProperty ol.Map.prototype.getInteractions
@exportProperty ol.Map.prototype.getRenderer
@exportProperty ol.Map.prototype.removeLayer
@exportSymbol ol.RendererHint
@exportProperty ol.RendererHint.CANVAS

View File

@@ -629,6 +629,18 @@ ol.Map.prototype.requestRenderFrame = function() {
};
/**
* @param {ol.layer.Layer} layer Layer.
* @return {ol.layer.Layer|undefined} The removed layer or undefined if the
* layer was not found.
*/
ol.Map.prototype.removeLayer = function(layer) {
var layers = this.getLayers();
goog.asserts.assert(goog.isDef(layers));
return /** @type {ol.layer.Layer|undefined} */ (layers.remove(layer));
};
/**
* @param {number} time Time.
* @private