Use ol.object.assign() instead of goog.object.extend()

This commit is contained in:
Tim Schaub
2016-02-03 09:37:38 -07:00
parent a74af66d5f
commit 3c0ef430db
14 changed files with 49 additions and 51 deletions

View File

@@ -2,11 +2,11 @@ goog.provide('ol.source.ImageMapGuide');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('goog.object');
goog.require('goog.uri.utils');
goog.require('ol.Image');
goog.require('ol.ImageLoadFunctionType');
goog.require('ol.extent');
goog.require('ol.object');
goog.require('ol.source.Image');
@@ -43,9 +43,9 @@ ol.source.ImageMapGuide = function(options) {
/**
* @private
* @type {Object}
* @type {!Object}
*/
this.params_ = options.params !== undefined ? options.params : {};
this.params_ = options.params || {};
/**
* @private
@@ -192,7 +192,7 @@ ol.source.ImageMapGuide.getScale = function(extent, size, metersPerUnit, dpi) {
* @api stable
*/
ol.source.ImageMapGuide.prototype.updateParams = function(params) {
goog.object.extend(this.params_, params);
ol.object.assign(this.params_, params);
this.changed();
};
@@ -222,7 +222,7 @@ ol.source.ImageMapGuide.prototype.getUrl = function(baseUrl, params, extent, siz
'SETVIEWCENTERX': center[0],
'SETVIEWCENTERY': center[1]
};
goog.object.extend(baseParams, params);
ol.object.assign(baseParams, params);
return goog.uri.utils.appendParamsFromMap(baseUrl, baseParams);
};

View File

@@ -12,6 +12,7 @@ goog.require('ol');
goog.require('ol.Image');
goog.require('ol.ImageLoadFunctionType');
goog.require('ol.extent');
goog.require('ol.object');
goog.require('ol.proj');
goog.require('ol.source.Image');
goog.require('ol.source.wms');
@@ -61,9 +62,9 @@ ol.source.ImageWMS = function(opt_options) {
/**
* @private
* @type {Object}
* @type {!Object}
*/
this.params_ = options.params;
this.params_ = options.params || {};
/**
* @private
@@ -156,7 +157,7 @@ ol.source.ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolut
'TRANSPARENT': true,
'QUERY_LAYERS': this.params_['LAYERS']
};
goog.object.extend(baseParams, this.params_, params);
ol.object.assign(baseParams, this.params_, params);
var x = Math.floor((coordinate[0] - extent[0]) / resolution);
var y = Math.floor((extent[3] - coordinate[1]) / resolution);
@@ -228,7 +229,7 @@ ol.source.ImageWMS.prototype.getImageInternal = function(extent, resolution, pix
'FORMAT': 'image/png',
'TRANSPARENT': true
};
goog.object.extend(params, this.params_);
ol.object.assign(params, this.params_);
this.imageSize_[0] = Math.ceil(imageWidth * this.ratio_);
this.imageSize_[1] = Math.ceil(imageHeight * this.ratio_);
@@ -360,7 +361,7 @@ ol.source.ImageWMS.prototype.setUrl = function(url) {
* @api stable
*/
ol.source.ImageWMS.prototype.updateParams = function(params) {
goog.object.extend(this.params_, params);
ol.object.assign(this.params_, params);
this.updateV13_();
this.image_ = null;
this.changed();

View File

@@ -2,12 +2,12 @@ goog.provide('ol.source.TileArcGISRest');
goog.require('goog.asserts');
goog.require('goog.math');
goog.require('goog.object');
goog.require('goog.string');
goog.require('goog.uri.utils');
goog.require('ol');
goog.require('ol.TileCoord');
goog.require('ol.extent');
goog.require('ol.object');
goog.require('ol.proj');
goog.require('ol.size');
goog.require('ol.source.TileImage');
@@ -32,8 +32,6 @@ ol.source.TileArcGISRest = function(opt_options) {
var options = opt_options || {};
var params = options.params !== undefined ? options.params : {};
goog.base(this, {
attributions: options.attributions,
crossOrigin: options.crossOrigin,
@@ -49,9 +47,9 @@ ol.source.TileArcGISRest = function(opt_options) {
/**
* @private
* @type {Object}
* @type {!Object}
*/
this.params_ = params;
this.params_ = options.params || {};
/**
* @private
@@ -165,7 +163,7 @@ ol.source.TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pi
'FORMAT': 'PNG32',
'TRANSPARENT': true
};
goog.object.extend(baseParams, this.params_);
ol.object.assign(baseParams, this.params_);
return this.getRequestUrl_(tileCoord, tileSize, tileExtent,
pixelRatio, projection, baseParams);
@@ -178,6 +176,6 @@ ol.source.TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pi
* @api stable
*/
ol.source.TileArcGISRest.prototype.updateParams = function(params) {
goog.object.extend(this.params_, params);
ol.object.assign(this.params_, params);
this.changed();
};

View File

@@ -12,6 +12,7 @@ goog.require('goog.uri.utils');
goog.require('ol');
goog.require('ol.TileCoord');
goog.require('ol.extent');
goog.require('ol.object');
goog.require('ol.proj');
goog.require('ol.size');
goog.require('ol.source.TileImage');
@@ -33,7 +34,7 @@ ol.source.TileWMS = function(opt_options) {
var options = opt_options || {};
var params = options.params !== undefined ? options.params : {};
var params = options.params || {};
var transparent = goog.object.get(params, 'TRANSPARENT', true);
@@ -59,7 +60,7 @@ ol.source.TileWMS = function(opt_options) {
/**
* @private
* @type {Object}
* @type {!Object}
*/
this.params_ = params;
@@ -161,7 +162,7 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resoluti
'TRANSPARENT': true,
'QUERY_LAYERS': this.params_['LAYERS']
};
goog.object.extend(baseParams, this.params_, params);
ol.object.assign(baseParams, this.params_, params);
var x = Math.floor((coordinate[0] - tileExtent[0]) / tileResolution);
var y = Math.floor((tileExtent[3] - coordinate[1]) / tileResolution);
@@ -363,7 +364,7 @@ ol.source.TileWMS.prototype.fixedTileUrlFunction = function(tileCoord, pixelRati
'FORMAT': 'image/png',
'TRANSPARENT': true
};
goog.object.extend(baseParams, this.params_);
ol.object.assign(baseParams, this.params_);
return this.getRequestUrl_(tileCoord, tileSize, tileExtent,
pixelRatio, projection, baseParams);
@@ -376,7 +377,7 @@ ol.source.TileWMS.prototype.fixedTileUrlFunction = function(tileCoord, pixelRati
* @api stable
*/
ol.source.TileWMS.prototype.updateParams = function(params) {
goog.object.extend(this.params_, params);
ol.object.assign(this.params_, params);
this.resetCoordKeyPrefix_();
this.resetParamsKey_();
this.updateV13_();

View File

@@ -2,12 +2,12 @@ goog.provide('ol.source.WMTS');
goog.provide('ol.source.WMTSRequestEncoding');
goog.require('goog.asserts');
goog.require('goog.object');
goog.require('goog.uri.utils');
goog.require('ol.TileUrlFunction');
goog.require('ol.TileUrlFunctionType');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.object');
goog.require('ol.proj');
goog.require('ol.source.TileImage');
goog.require('ol.tilegrid.WMTS');
@@ -111,7 +111,7 @@ ol.source.WMTS = function(options) {
};
if (requestEncoding == ol.source.WMTSRequestEncoding.KVP) {
goog.object.extend(context, {
ol.object.assign(context, {
'Service': 'WMTS',
'Request': 'GetTile',
'Version': this.version_,
@@ -153,7 +153,7 @@ ol.source.WMTS = function(options) {
'TileCol': tileCoord[1],
'TileRow': -tileCoord[2] - 1
};
goog.object.extend(localContext, dimensions);
ol.object.assign(localContext, dimensions);
var url = template;
if (requestEncoding == ol.source.WMTSRequestEncoding.KVP) {
url = goog.uri.utils.appendParamsFromMap(url, localContext);
@@ -290,7 +290,7 @@ ol.source.WMTS.prototype.resetDimensionsKey_ = function() {
* @api
*/
ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
goog.object.extend(this.dimensions_, dimensions);
ol.object.assign(this.dimensions_, dimensions);
this.resetDimensionsKey_();
this.changed();
};