Correct types in ol.layer.Group

This commit is contained in:
Tom Payne
2013-12-13 19:16:31 +01:00
parent e96d56215b
commit ee2098743d
2 changed files with 10 additions and 5 deletions

View File

@@ -142,11 +142,11 @@ ol.layer.Group.prototype.handleLayersRemove_ = function(collectionEvent) {
/** /**
* @return {ol.Collection} Collection of layers. * @return {ol.Collection|undefined} Collection of layers.
* @todo stability experimental * @todo stability experimental
*/ */
ol.layer.Group.prototype.getLayers = function() { ol.layer.Group.prototype.getLayers = function() {
return /** @type {ol.Collection} */ (this.get( return /** @type {ol.Collection|undefined} */ (this.get(
ol.layer.GroupProperty.LAYERS)); ol.layer.GroupProperty.LAYERS));
}; };
goog.exportProperty( goog.exportProperty(
@@ -156,7 +156,7 @@ goog.exportProperty(
/** /**
* @param {ol.Collection} layers Collection of layers. * @param {ol.Collection|undefined} layers Collection of layers.
* @todo stability experimental * @todo stability experimental
*/ */
ol.layer.Group.prototype.setLayers = function(layers) { ol.layer.Group.prototype.setLayers = function(layers) {

View File

@@ -621,11 +621,16 @@ goog.exportProperty(
/** /**
* Get the collection of layers associated with this map. * Get the collection of layers associated with this map.
* @return {ol.Collection} Layers. * @return {ol.Collection|undefined} Layers.
* @todo stability experimental * @todo stability experimental
*/ */
ol.Map.prototype.getLayers = function() { ol.Map.prototype.getLayers = function() {
return this.getLayerGroup().getLayers(); var layerGroup = this.getLayerGroup();
if (goog.isDef(layerGroup)) {
return layerGroup.getLayers();
} else {
return undefined;
}
}; };