Use Object.assign
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
import XYZ from './XYZ.js';
|
||||
import {assign} from '../obj.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
@@ -104,7 +103,7 @@ class CartoDB extends XYZ {
|
||||
* @api
|
||||
*/
|
||||
updateConfig(config) {
|
||||
assign(this.config_, config);
|
||||
Object.assign(this.config_, config);
|
||||
this.initializeMap_();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import EventType from '../events/EventType.js';
|
||||
import TileEventType from './TileEventType.js';
|
||||
import TileSource, {TileSourceEvent} from './Tile.js';
|
||||
import TileState from '../TileState.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
import {getKeyZXY} from '../tilecoord.js';
|
||||
import {getUid} from '../util.js';
|
||||
@@ -197,7 +196,7 @@ class DataTileSource extends TileSource {
|
||||
});
|
||||
}
|
||||
|
||||
const options = assign(
|
||||
const options = Object.assign(
|
||||
{
|
||||
tileCoord: [z, x, y],
|
||||
loader: loader,
|
||||
|
||||
@@ -7,7 +7,6 @@ import ImageSource, {defaultImageLoadFunction} from './Image.js';
|
||||
import ImageWrapper from '../Image.js';
|
||||
import {appendParams} from '../uri.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {containsExtent, getHeight, getWidth} from '../extent.js';
|
||||
|
||||
/**
|
||||
@@ -172,7 +171,7 @@ class ImageArcGISRest extends ImageSource {
|
||||
'FORMAT': 'PNG32',
|
||||
'TRANSPARENT': true,
|
||||
};
|
||||
assign(params, this.params_);
|
||||
Object.assign(params, this.params_);
|
||||
|
||||
extent = extent.slice();
|
||||
const centerX = (extent[0] + extent[2]) / 2;
|
||||
@@ -311,7 +310,7 @@ class ImageArcGISRest extends ImageSource {
|
||||
* @api
|
||||
*/
|
||||
updateParams(params) {
|
||||
assign(this.params_, params);
|
||||
Object.assign(this.params_, params);
|
||||
this.image_ = null;
|
||||
this.changed();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import EventType from '../events/EventType.js';
|
||||
import ImageSource, {defaultImageLoadFunction} from './Image.js';
|
||||
import ImageWrapper from '../Image.js';
|
||||
import {appendParams} from '../uri.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {
|
||||
containsExtent,
|
||||
getCenter,
|
||||
@@ -220,7 +219,7 @@ class ImageMapGuide extends ImageSource {
|
||||
* @api
|
||||
*/
|
||||
updateParams(params) {
|
||||
assign(this.params_, params);
|
||||
Object.assign(this.params_, params);
|
||||
this.changed();
|
||||
}
|
||||
|
||||
@@ -250,7 +249,7 @@ class ImageMapGuide extends ImageSource {
|
||||
'SETVIEWCENTERX': center[0],
|
||||
'SETVIEWCENTERY': center[1],
|
||||
};
|
||||
assign(baseParams, params);
|
||||
Object.assign(baseParams, params);
|
||||
return appendParams(baseUrl, baseParams);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import ImageSource, {defaultImageLoadFunction} from './Image.js';
|
||||
import ImageState from '../ImageState.js';
|
||||
import ImageWrapper from '../Image.js';
|
||||
import {IMAGE_SMOOTHING_DISABLED} from '../renderer/canvas/common.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import {getHeight, getWidth, intersects} from '../extent.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
@@ -158,7 +157,7 @@ class Static extends ImageSource {
|
||||
if (targetWidth !== imageWidth || targetHeight !== imageHeight) {
|
||||
const context = createCanvasContext2D(targetWidth, targetHeight);
|
||||
if (!this.getInterpolate()) {
|
||||
assign(context, IMAGE_SMOOTHING_DISABLED);
|
||||
Object.assign(context, IMAGE_SMOOTHING_DISABLED);
|
||||
}
|
||||
const canvas = context.canvas;
|
||||
context.drawImage(
|
||||
|
||||
@@ -8,7 +8,6 @@ import ImageWrapper from '../Image.js';
|
||||
import {DEFAULT_VERSION} from './wms.js';
|
||||
import {appendParams} from '../uri.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {calculateSourceResolution} from '../reproj.js';
|
||||
import {ceil, floor, round} from '../math.js';
|
||||
import {compareVersions} from '../string.js';
|
||||
@@ -206,7 +205,7 @@ class ImageWMS extends ImageSource {
|
||||
'TRANSPARENT': true,
|
||||
'QUERY_LAYERS': this.params_['LAYERS'],
|
||||
};
|
||||
assign(baseParams, this.params_, params);
|
||||
Object.assign(baseParams, this.params_, params);
|
||||
|
||||
const x = floor((coordinate[0] - extent[0]) / resolution, DECIMALS);
|
||||
const y = floor((extent[3] - coordinate[1]) / resolution, DECIMALS);
|
||||
@@ -265,7 +264,7 @@ class ImageWMS extends ImageSource {
|
||||
baseParams['SCALE'] = (resolution * mpu) / pixelSize;
|
||||
}
|
||||
|
||||
assign(baseParams, params);
|
||||
Object.assign(baseParams, params);
|
||||
|
||||
return appendParams(/** @type {string} */ (this.url_), baseParams);
|
||||
}
|
||||
@@ -338,7 +337,7 @@ class ImageWMS extends ImageSource {
|
||||
'FORMAT': 'image/png',
|
||||
'TRANSPARENT': true,
|
||||
};
|
||||
assign(params, this.params_);
|
||||
Object.assign(params, this.params_);
|
||||
|
||||
this.imageSize_[0] = round(
|
||||
getWidth(requestExtent) / imageResolution,
|
||||
@@ -480,7 +479,7 @@ class ImageWMS extends ImageSource {
|
||||
* @api
|
||||
*/
|
||||
updateParams(params) {
|
||||
assign(this.params_, params);
|
||||
Object.assign(this.params_, params);
|
||||
this.updateV13_();
|
||||
this.image_ = null;
|
||||
this.changed();
|
||||
|
||||
@@ -11,7 +11,6 @@ import Source from './Source.js';
|
||||
import TileLayer from '../layer/Tile.js';
|
||||
import TileQueue from '../TileQueue.js';
|
||||
import TileSource from './Tile.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import {create as createTransform} from '../transform.js';
|
||||
import {equals, getCenter, getHeight, getWidth} from '../extent.js';
|
||||
@@ -711,11 +710,11 @@ class RasterSource extends ImageSource {
|
||||
*/
|
||||
updateFrameState_(extent, resolution, projection) {
|
||||
const frameState = /** @type {import("../PluggableMap.js").FrameState} */ (
|
||||
assign({}, this.frameState_)
|
||||
Object.assign({}, this.frameState_)
|
||||
);
|
||||
|
||||
frameState.viewState = /** @type {import("../View.js").State} */ (
|
||||
assign({}, frameState.viewState)
|
||||
Object.assign({}, frameState.viewState)
|
||||
);
|
||||
|
||||
const center = getCenter(extent);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import TileImage from './TileImage.js';
|
||||
import {appendParams} from '../uri.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {createEmpty} from '../extent.js';
|
||||
import {modulo} from '../math.js';
|
||||
import {scale as scaleSize, toSize} from '../size.js';
|
||||
@@ -208,7 +207,7 @@ class TileArcGISRest extends TileImage {
|
||||
* @api
|
||||
*/
|
||||
updateParams(params) {
|
||||
assign(this.params_, params);
|
||||
Object.assign(this.params_, params);
|
||||
this.setKey(this.getKeyForParams_());
|
||||
}
|
||||
|
||||
@@ -246,7 +245,7 @@ class TileArcGISRest extends TileImage {
|
||||
'FORMAT': 'PNG32',
|
||||
'TRANSPARENT': true,
|
||||
};
|
||||
assign(baseParams, this.params_);
|
||||
Object.assign(baseParams, this.params_);
|
||||
|
||||
return this.getRequestUrl_(
|
||||
tileCoord,
|
||||
|
||||
@@ -6,7 +6,6 @@ import TileImage from './TileImage.js';
|
||||
import {DEFAULT_VERSION} from './wms.js';
|
||||
import {appendParams} from '../uri.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {buffer, createEmpty} from '../extent.js';
|
||||
import {buffer as bufferSize, scale as scaleSize, toSize} from '../size.js';
|
||||
import {calculateSourceResolution} from '../reproj.js';
|
||||
@@ -218,7 +217,7 @@ class TileWMS extends TileImage {
|
||||
'TRANSPARENT': true,
|
||||
'QUERY_LAYERS': this.params_['LAYERS'],
|
||||
};
|
||||
assign(baseParams, this.params_, params);
|
||||
Object.assign(baseParams, this.params_, params);
|
||||
|
||||
const x = Math.floor((coordinate[0] - tileExtent[0]) / tileResolution);
|
||||
const y = Math.floor((tileExtent[3] - coordinate[1]) / tileResolution);
|
||||
@@ -279,7 +278,7 @@ class TileWMS extends TileImage {
|
||||
baseParams['SCALE'] = (resolution * mpu) / pixelSize;
|
||||
}
|
||||
|
||||
assign(baseParams, params);
|
||||
Object.assign(baseParams, params);
|
||||
|
||||
return appendParams(/** @type {string} */ (this.urls[0]), baseParams);
|
||||
}
|
||||
@@ -407,7 +406,7 @@ class TileWMS extends TileImage {
|
||||
* @api
|
||||
*/
|
||||
updateParams(params) {
|
||||
assign(this.params_, params);
|
||||
Object.assign(this.params_, params);
|
||||
this.updateV13_();
|
||||
this.setKey(this.getKeyForParams_());
|
||||
}
|
||||
@@ -462,7 +461,7 @@ class TileWMS extends TileImage {
|
||||
'FORMAT': 'image/png',
|
||||
'TRANSPARENT': true,
|
||||
};
|
||||
assign(baseParams, this.params_);
|
||||
Object.assign(baseParams, this.params_);
|
||||
|
||||
return this.getRequestUrl_(
|
||||
tileCoord,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import TileImage from './TileImage.js';
|
||||
import {appendParams} from '../uri.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {containsExtent} from '../extent.js';
|
||||
import {createFromCapabilitiesMatrixSet} from '../tilegrid/WMTS.js';
|
||||
import {createFromTileUrlFunctions, expandUrl} from '../tileurlfunction.js';
|
||||
@@ -267,7 +266,7 @@ class WMTS extends TileImage {
|
||||
* @api
|
||||
*/
|
||||
updateDimensions(dimensions) {
|
||||
assign(this.dimensions_, dimensions);
|
||||
Object.assign(this.dimensions_, dimensions);
|
||||
this.setKey(this.getKeyForDimensions_());
|
||||
}
|
||||
|
||||
@@ -287,7 +286,7 @@ class WMTS extends TileImage {
|
||||
};
|
||||
|
||||
if (requestEncoding == 'KVP') {
|
||||
assign(context, {
|
||||
Object.assign(context, {
|
||||
'Service': 'WMTS',
|
||||
'Request': 'GetTile',
|
||||
'Version': this.version_,
|
||||
@@ -327,7 +326,7 @@ class WMTS extends TileImage {
|
||||
'TileCol': tileCoord[1],
|
||||
'TileRow': tileCoord[2],
|
||||
};
|
||||
assign(localContext, dimensions);
|
||||
Object.assign(localContext, dimensions);
|
||||
let url = template;
|
||||
if (requestEncoding == 'KVP') {
|
||||
url = appendParams(url, localContext);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
import TileGrid from '../tilegrid/TileGrid.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {getJSON, resolveUrl} from '../net.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import {getIntersection as intersectExtents} from '../extent.js';
|
||||
@@ -324,7 +323,7 @@ function parseTileMatrixSet(
|
||||
}
|
||||
}
|
||||
|
||||
assign(localContext, context);
|
||||
Object.assign(localContext, context);
|
||||
|
||||
const url = tileUrlTemplate.replace(/\{(\w+?)\}/g, function (m, p) {
|
||||
return localContext[p];
|
||||
|
||||
Reference in New Issue
Block a user