diff --git a/src/api/map.js b/src/api/map.js index 9bbaa411d5..173c1a703b 100644 --- a/src/api/map.js +++ b/src/api/map.js @@ -31,9 +31,9 @@ ol.map = function(opt_arg){ var userProjection; /** @type {ol.Bounds|undefined} */ var maxExtent; - /** @type {array|undefined} */ + /** @type {Array.|undefined} */ var resolutions; - /** @type {array|undefined} */ + /** @type {Array|undefined} */ var layers; if (arguments.length == 1) { @@ -90,7 +90,8 @@ ol.map = function(opt_arg){ */ ol.Map.prototype.center = function(opt_arg) { if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setCenter(ol.loc(opt_arg)); + this.setCenter(ol.loc(opt_arg)); + return this; } else { return this.getCenter(); } @@ -102,7 +103,8 @@ ol.Map.prototype.center = function(opt_arg) { */ ol.Map.prototype.projection = function(opt_arg) { if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setProjection(ol.projection(opt_arg)); + this.setProjection(ol.projection(opt_arg)); + return this; } else { return this.getProjection(); } @@ -114,7 +116,8 @@ ol.Map.prototype.projection = function(opt_arg) { */ ol.Map.prototype.userProjection = function(opt_arg) { if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setUserProjection(ol.projection(opt_arg)); + this.setUserProjection(ol.projection(opt_arg)); + return this; } else { return this.getUserProjection(); } @@ -126,7 +129,8 @@ ol.Map.prototype.userProjection = function(opt_arg) { */ ol.Map.prototype.zoom = function(opt_arg) { if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setZoom(opt_arg); + this.setZoom(opt_arg); + return this; } else { return this.getZoom(); } @@ -138,7 +142,8 @@ ol.Map.prototype.zoom = function(opt_arg) { */ ol.Map.prototype.numZoomLevels = function(opt_arg) { if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setNumZoomLevels(opt_arg); + this.setNumZoomLevels(opt_arg); + return this; } else { return this.getNumZoomLevels(); } @@ -150,7 +155,8 @@ ol.Map.prototype.numZoomLevels = function(opt_arg) { */ ol.Map.prototype.resolutions = function(opt_arg) { if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setResolutions(opt_arg); + this.setResolutions(opt_arg); + return this; } else { return this.getResolutions(); } @@ -162,7 +168,8 @@ ol.Map.prototype.resolutions = function(opt_arg) { */ ol.Map.prototype.layers = function(opt_arg) { if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setLayers(opt_arg); + this.setLayers(opt_arg); + return this; } else { return this.getLayers(); } @@ -170,11 +177,12 @@ ol.Map.prototype.layers = function(opt_arg) { /** * @param {Array=} opt_arg - * @returns {ol.Map|ol.Bounds|undefined} Map max extent. + * @returns {ol.Map|ol.UnreferencedBounds|undefined} Map max extent. */ ol.Map.prototype.maxExtent = function(opt_arg) { if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setMaxExtent(ol.bounds(opt_arg)); + this.setMaxExtent(ol.bounds(opt_arg)); + return this; } else { return this.getMaxExtent(); } diff --git a/src/ol/Map.js b/src/ol/Map.js index 77e0727a05..1a2462aaf2 100644 --- a/src/ol/Map.js +++ b/src/ol/Map.js @@ -30,7 +30,7 @@ ol.Map = function() { /** * @private - * @type {number} + * @type {number|undefined} */ this.zoom_ = undefined; @@ -97,7 +97,7 @@ ol.Map.prototype.getUserProjection = function() { /** - * @return {number} Zoom. + * @return {number|undefined} Zoom. */ ol.Map.prototype.getZoom = function() { return this.zoom_; @@ -129,7 +129,7 @@ ol.Map.prototype.getLayers = function() { /** - * @return {ol.Bounds} the maxExtent for the map + * @return {ol.UnreferencedBounds} the maxExtent for the map */ ol.Map.prototype.getMaxExtent = function() { if (goog.isDefAndNotNull(this.maxExtent_)) { @@ -147,78 +147,62 @@ ol.Map.prototype.getMaxExtent = function() { /** * @param {ol.Loc} center Center. - * @return {ol.Map} This. */ ol.Map.prototype.setCenter = function(center) { this.center_ = center; - return this; }; /** * @param {ol.Projection} projection Projection. - * @return {ol.Map} This. */ ol.Map.prototype.setProjection = function(projection) { this.projection_ = projection; - return this; }; /** * @param {ol.Projection} userProjection set the user projection. - * @return {ol.Map} This. */ ol.Map.prototype.setUserProjection = function(userProjection) { this.userProjection_ = userProjection; - return this; }; /** * @param {number} zoom Zoom. - * @return {ol.Map} This. */ ol.Map.prototype.setZoom = function(zoom) { this.zoom_ = zoom; - return this; }; /** * @param {number} nZoom Zoom. - * @return {ol.Map} This. */ ol.Map.prototype.setNumZoomLevels = function(nZoom) { this.numZoomLevels_ = nZoom; - return this; }; /** * @param {Array} resolutions the map resolutions if set on the map - * @return {ol.Map} This. */ ol.Map.prototype.setResolutions = function(resolutions) { this.resolutions_ = resolutions; - return this; }; /** * @param {Array} layers the layers set on the map - * @return {ol.Map} This. */ ol.Map.prototype.setLayers = function(layers) { this.layers_ = layers; - return this; }; /** * @param {ol.Bounds} extent the maxExtent for the map - * @return {ol.Map} This. */ ol.Map.prototype.setMaxExtent = function(extent) { this.maxExtent_ = extent; - return this; }; /**