Named exports from ol/TileRange
This commit is contained in:
@@ -45,7 +45,7 @@ const TileRange = function(minX, maxX, minY, maxY) {
|
|||||||
* @param {ol.TileRange|undefined} tileRange TileRange.
|
* @param {ol.TileRange|undefined} tileRange TileRange.
|
||||||
* @return {ol.TileRange} Tile range.
|
* @return {ol.TileRange} Tile range.
|
||||||
*/
|
*/
|
||||||
TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) {
|
export function createOrUpdate(minX, maxX, minY, maxY, tileRange) {
|
||||||
if (tileRange !== undefined) {
|
if (tileRange !== undefined) {
|
||||||
tileRange.minX = minX;
|
tileRange.minX = minX;
|
||||||
tileRange.maxX = maxX;
|
tileRange.maxX = maxX;
|
||||||
@@ -55,7 +55,7 @@ TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) {
|
|||||||
} else {
|
} else {
|
||||||
return new TileRange(minX, maxX, minY, maxY);
|
return new TileRange(minX, maxX, minY, maxY);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {DEFAULT_TILE_SIZE} from './common.js';
|
import {DEFAULT_TILE_SIZE} from './common.js';
|
||||||
import {assert} from '../asserts.js';
|
import {assert} from '../asserts.js';
|
||||||
import TileRange from '../TileRange.js';
|
import TileRange, {createOrUpdate as createOrUpdateTileRange} from '../TileRange.js';
|
||||||
import {isSorted, linearFindNearest} from '../array.js';
|
import {isSorted, linearFindNearest} from '../array.js';
|
||||||
import {createOrUpdate, getTopLeft} from '../extent.js';
|
import {createOrUpdate, getTopLeft} from '../extent.js';
|
||||||
import {clamp} from '../math.js';
|
import {clamp} from '../math.js';
|
||||||
@@ -199,7 +199,7 @@ TileGrid.prototype.forEachTileCoordParentTileRange = function(tileCoord, callbac
|
|||||||
if (this.zoomFactor_ === 2) {
|
if (this.zoomFactor_ === 2) {
|
||||||
x = Math.floor(x / 2);
|
x = Math.floor(x / 2);
|
||||||
y = Math.floor(y / 2);
|
y = Math.floor(y / 2);
|
||||||
tileRange = TileRange.createOrUpdate(x, x, y, y, opt_tileRange);
|
tileRange = createOrUpdateTileRange(x, x, y, y, opt_tileRange);
|
||||||
} else {
|
} else {
|
||||||
tileRange = this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange);
|
tileRange = this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange);
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,7 @@ TileGrid.prototype.getTileCoordChildTileRange = function(tileCoord, opt_tileRang
|
|||||||
if (this.zoomFactor_ === 2) {
|
if (this.zoomFactor_ === 2) {
|
||||||
const minX = tileCoord[1] * 2;
|
const minX = tileCoord[1] * 2;
|
||||||
const minY = tileCoord[2] * 2;
|
const minY = tileCoord[2] * 2;
|
||||||
return TileRange.createOrUpdate(minX, minX + 1, minY, minY + 1, opt_tileRange);
|
return createOrUpdateTileRange(minX, minX + 1, minY, minY + 1, opt_tileRange);
|
||||||
}
|
}
|
||||||
const tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent);
|
const tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent);
|
||||||
return this.getTileRangeForExtentAndZ(
|
return this.getTileRangeForExtentAndZ(
|
||||||
@@ -330,8 +330,7 @@ TileGrid.prototype.getTileRangeForExtentAndZ = function(extent, z, opt_tileRange
|
|||||||
const minX = tileCoord[1];
|
const minX = tileCoord[1];
|
||||||
const minY = tileCoord[2];
|
const minY = tileCoord[2];
|
||||||
this.getTileCoordForXYAndZ_(extent[2], extent[3], z, true, tileCoord);
|
this.getTileCoordForXYAndZ_(extent[2], extent[3], z, true, tileCoord);
|
||||||
return TileRange.createOrUpdate(
|
return createOrUpdateTileRange(minX, tileCoord[1], minY, tileCoord[2], opt_tileRange);
|
||||||
minX, tileCoord[1], minY, tileCoord[2], opt_tileRange);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user