more "setters should not return this" changes + warning fixes
This commit is contained in:
+19
-11
@@ -31,9 +31,9 @@ ol.map = function(opt_arg){
|
|||||||
var userProjection;
|
var userProjection;
|
||||||
/** @type {ol.Bounds|undefined} */
|
/** @type {ol.Bounds|undefined} */
|
||||||
var maxExtent;
|
var maxExtent;
|
||||||
/** @type {array|undefined} */
|
/** @type {Array.<number>|undefined} */
|
||||||
var resolutions;
|
var resolutions;
|
||||||
/** @type {array|undefined} */
|
/** @type {Array|undefined} */
|
||||||
var layers;
|
var layers;
|
||||||
|
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
@@ -90,7 +90,8 @@ ol.map = function(opt_arg){
|
|||||||
*/
|
*/
|
||||||
ol.Map.prototype.center = function(opt_arg) {
|
ol.Map.prototype.center = function(opt_arg) {
|
||||||
if (arguments.length == 1 && goog.isDef(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 {
|
} else {
|
||||||
return this.getCenter();
|
return this.getCenter();
|
||||||
}
|
}
|
||||||
@@ -102,7 +103,8 @@ ol.Map.prototype.center = function(opt_arg) {
|
|||||||
*/
|
*/
|
||||||
ol.Map.prototype.projection = function(opt_arg) {
|
ol.Map.prototype.projection = function(opt_arg) {
|
||||||
if (arguments.length == 1 && goog.isDef(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 {
|
} else {
|
||||||
return this.getProjection();
|
return this.getProjection();
|
||||||
}
|
}
|
||||||
@@ -114,7 +116,8 @@ ol.Map.prototype.projection = function(opt_arg) {
|
|||||||
*/
|
*/
|
||||||
ol.Map.prototype.userProjection = function(opt_arg) {
|
ol.Map.prototype.userProjection = function(opt_arg) {
|
||||||
if (arguments.length == 1 && goog.isDef(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 {
|
} else {
|
||||||
return this.getUserProjection();
|
return this.getUserProjection();
|
||||||
}
|
}
|
||||||
@@ -126,7 +129,8 @@ ol.Map.prototype.userProjection = function(opt_arg) {
|
|||||||
*/
|
*/
|
||||||
ol.Map.prototype.zoom = function(opt_arg) {
|
ol.Map.prototype.zoom = function(opt_arg) {
|
||||||
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
return this.setZoom(opt_arg);
|
this.setZoom(opt_arg);
|
||||||
|
return this;
|
||||||
} else {
|
} else {
|
||||||
return this.getZoom();
|
return this.getZoom();
|
||||||
}
|
}
|
||||||
@@ -138,7 +142,8 @@ ol.Map.prototype.zoom = function(opt_arg) {
|
|||||||
*/
|
*/
|
||||||
ol.Map.prototype.numZoomLevels = function(opt_arg) {
|
ol.Map.prototype.numZoomLevels = function(opt_arg) {
|
||||||
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
return this.setNumZoomLevels(opt_arg);
|
this.setNumZoomLevels(opt_arg);
|
||||||
|
return this;
|
||||||
} else {
|
} else {
|
||||||
return this.getNumZoomLevels();
|
return this.getNumZoomLevels();
|
||||||
}
|
}
|
||||||
@@ -150,7 +155,8 @@ ol.Map.prototype.numZoomLevels = function(opt_arg) {
|
|||||||
*/
|
*/
|
||||||
ol.Map.prototype.resolutions = function(opt_arg) {
|
ol.Map.prototype.resolutions = function(opt_arg) {
|
||||||
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
return this.setResolutions(opt_arg);
|
this.setResolutions(opt_arg);
|
||||||
|
return this;
|
||||||
} else {
|
} else {
|
||||||
return this.getResolutions();
|
return this.getResolutions();
|
||||||
}
|
}
|
||||||
@@ -162,7 +168,8 @@ ol.Map.prototype.resolutions = function(opt_arg) {
|
|||||||
*/
|
*/
|
||||||
ol.Map.prototype.layers = function(opt_arg) {
|
ol.Map.prototype.layers = function(opt_arg) {
|
||||||
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
return this.setLayers(opt_arg);
|
this.setLayers(opt_arg);
|
||||||
|
return this;
|
||||||
} else {
|
} else {
|
||||||
return this.getLayers();
|
return this.getLayers();
|
||||||
}
|
}
|
||||||
@@ -170,11 +177,12 @@ ol.Map.prototype.layers = function(opt_arg) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array=} 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) {
|
ol.Map.prototype.maxExtent = function(opt_arg) {
|
||||||
if (arguments.length == 1 && goog.isDef(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 {
|
} else {
|
||||||
return this.getMaxExtent();
|
return this.getMaxExtent();
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-19
@@ -30,7 +30,7 @@ ol.Map = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number}
|
* @type {number|undefined}
|
||||||
*/
|
*/
|
||||||
this.zoom_ = 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() {
|
ol.Map.prototype.getZoom = function() {
|
||||||
return this.zoom_;
|
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() {
|
ol.Map.prototype.getMaxExtent = function() {
|
||||||
if (goog.isDefAndNotNull(this.maxExtent_)) {
|
if (goog.isDefAndNotNull(this.maxExtent_)) {
|
||||||
@@ -147,78 +147,62 @@ ol.Map.prototype.getMaxExtent = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Loc} center Center.
|
* @param {ol.Loc} center Center.
|
||||||
* @return {ol.Map} This.
|
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setCenter = function(center) {
|
ol.Map.prototype.setCenter = function(center) {
|
||||||
this.center_ = center;
|
this.center_ = center;
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Projection} projection Projection.
|
* @param {ol.Projection} projection Projection.
|
||||||
* @return {ol.Map} This.
|
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setProjection = function(projection) {
|
ol.Map.prototype.setProjection = function(projection) {
|
||||||
this.projection_ = projection;
|
this.projection_ = projection;
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Projection} userProjection set the user projection.
|
* @param {ol.Projection} userProjection set the user projection.
|
||||||
* @return {ol.Map} This.
|
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setUserProjection = function(userProjection) {
|
ol.Map.prototype.setUserProjection = function(userProjection) {
|
||||||
this.userProjection_ = userProjection;
|
this.userProjection_ = userProjection;
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} zoom Zoom.
|
* @param {number} zoom Zoom.
|
||||||
* @return {ol.Map} This.
|
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setZoom = function(zoom) {
|
ol.Map.prototype.setZoom = function(zoom) {
|
||||||
this.zoom_ = zoom;
|
this.zoom_ = zoom;
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} nZoom Zoom.
|
* @param {number} nZoom Zoom.
|
||||||
* @return {ol.Map} This.
|
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setNumZoomLevels = function(nZoom) {
|
ol.Map.prototype.setNumZoomLevels = function(nZoom) {
|
||||||
this.numZoomLevels_ = nZoom;
|
this.numZoomLevels_ = nZoom;
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array} resolutions the map resolutions if set on the map
|
* @param {Array} resolutions the map resolutions if set on the map
|
||||||
* @return {ol.Map} This.
|
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setResolutions = function(resolutions) {
|
ol.Map.prototype.setResolutions = function(resolutions) {
|
||||||
this.resolutions_ = resolutions;
|
this.resolutions_ = resolutions;
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array} layers the layers set on the map
|
* @param {Array} layers the layers set on the map
|
||||||
* @return {ol.Map} This.
|
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setLayers = function(layers) {
|
ol.Map.prototype.setLayers = function(layers) {
|
||||||
this.layers_ = layers;
|
this.layers_ = layers;
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Bounds} extent the maxExtent for the map
|
* @param {ol.Bounds} extent the maxExtent for the map
|
||||||
* @return {ol.Map} This.
|
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setMaxExtent = function(extent) {
|
ol.Map.prototype.setMaxExtent = function(extent) {
|
||||||
this.maxExtent_ = extent;
|
this.maxExtent_ = extent;
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user