diff --git a/examples/layers/JSONLayers/Ortho.json b/examples/layers/JSONLayers/Ortho.json index 412ebcf63d..adc86acda7 100644 --- a/examples/layers/JSONLayers/Ortho.json +++ b/examples/layers/JSONLayers/Ortho.json @@ -16,123 +16,111 @@ "tileMatrixSetLimits": { "2": { "minTileRow": 0, - "maxTileRow": 4, + "maxTileRow": 3, "minTileCol": 0, "maxTileCol": 4 }, "3": { "minTileRow": 0, - "maxTileRow": 8, + "maxTileRow": 7, "minTileCol": 0, "maxTileCol": 8 }, "4": { - "minTileRow": 0, - "maxTileRow": 16, + "minTileRow": 1, + "maxTileRow": 14, "minTileCol": 0, - "maxTileCol": 16 + "maxTileCol": 15 }, "5": { - "minTileRow": 0, - "maxTileRow": 32, + "minTileRow": 3, + "maxTileRow": 28, "minTileCol": 0, - "maxTileCol": 32 + "maxTileCol": 31 }, "6": { - "minTileRow": 1, - "maxTileRow": 64, + "minTileRow": 7, + "maxTileRow": 56, "minTileCol": 0, - "maxTileCol": 64 + "maxTileCol": 63 }, "7": { - "minTileRow": 3, - "maxTileRow": 128, + "minTileRow": 14, + "maxTileRow": 113, "minTileCol": 0, - "maxTileCol": 128 + "maxTileCol": 127 }, "8": { - "minTileRow": 7, - "maxTileRow": 256, + "minTileRow": 28, + "maxTileRow": 227, "minTileCol": 0, - "maxTileCol": 256 + "maxTileCol": 255 }, "9": { - "minTileRow": 15, - "maxTileRow": 512, + "minTileRow": 57, + "maxTileRow": 454, "minTileCol": 0, - "maxTileCol": 512 + "maxTileCol": 511 }, "10": { - "minTileRow": 31, - "maxTileRow": 1024, + "minTileRow": 114, + "maxTileRow": 909, "minTileCol": 0, - "maxTileCol": 1024 + "maxTileCol": 1023 }, "11": { - "minTileRow": 62, - "maxTileRow": 2048, + "minTileRow": 229, + "maxTileRow": 1818, "minTileCol": 0, - "maxTileCol": 2048 + "maxTileCol": 2047 }, "12": { - "minTileRow": 125, - "maxTileRow": 4096, + "minTileRow": 459, + "maxTileRow": 3636, "minTileCol": 0, - "maxTileCol": 4096 + "maxTileCol": 4095 }, "13": { - "minTileRow": 2739, - "maxTileRow": 4628, - "minTileCol": 41, - "maxTileCol": 7917 + "minTileRow": 919, + "maxTileRow": 7272, + "minTileCol": 0, + "maxTileCol": 8191 }, "14": { - "minTileRow": 5478, - "maxTileRow": 9256, - "minTileCol": 82, - "maxTileCol": 15835 + "minTileRow": 1839, + "maxTileRow": 14544, + "minTileCol": 0, + "maxTileCol": 16383 }, "15": { - "minTileRow": 10956, - "maxTileRow": 18513, - "minTileCol": 165, - "maxTileCol": 31670 + "minTileRow": 3678, + "maxTileRow": 29089, + "minTileCol": 0, + "maxTileCol": 32767 }, "16": { - "minTileRow": 21912, - "maxTileRow": 37026, - "minTileCol": 330, - "maxTileCol": 63341 + "minTileRow": 7357, + "maxTileRow": 58178, + "minTileCol": 0, + "maxTileCol": 65535 }, "17": { - "minTileRow": 43825, - "maxTileRow": 74052, - "minTileCol": 660, - "maxTileCol": 126683 + "minTileRow": 14714, + "maxTileRow": 116357, + "minTileCol": 0, + "maxTileCol": 131071 }, "18": { - "minTileRow": 87648, - "maxTileRow": 148111, - "minTileCol": 1312, - "maxTileCol": 253375 + "minTileRow": 29428, + "maxTileRow": 232715, + "minTileCol": 0, + "maxTileCol": 262143 }, "19": { - "minTileRow": 175296, - "maxTileRow": 294063, - "minTileCol": 170144, - "maxTileCol": 343487 - }, - "20": { - "minTileRow": 357008, - "maxTileRow": 384687, - "minTileCol": 524400, - "maxTileCol": 540927 - }, - "21": { - "minTileRow": 714032, - "maxTileRow": 768783, - "minTileCol": 1048816, - "maxTileCol": 1081775 + "minTileRow": 58856, + "maxTileRow": 465431, + "minTileCol": 0, + "maxTileCol": 524287 } } } diff --git a/packages/Geographic/src/Extent.ts b/packages/Geographic/src/Extent.ts index 612588f138..2690c5ffc5 100644 --- a/packages/Geographic/src/Extent.ts +++ b/packages/Geographic/src/Extent.ts @@ -299,8 +299,21 @@ class Extent { return Extent.intersectsExtent(this, extent); } + /** + * Tests whether two extents intersect. + * + * This method checks if the geographic extents `extentA` and `extentB` + * overlap. If their coordinate reference systems (CRS) differ, `extentB` + * is reprojected into the CRS of `extentA` before performing the test. + * + * Extents that touch at an edge or a corner aren't treated as intersecting. + * + * @param extentA - The reference extent. + * @param extentB - The extent to test against. + * + * @returns `true` if the extents intersect, `false` otherwise. + */ static intersectsExtent(extentA: Extent, extentB: Extent) { - // TODO don't work when is on limit const other = extentB.crs == extentA.crs ? extentB : extentB.as(extentA.crs, _extent); return !(extentA.west >= other.east || extentA.east <= other.west || @@ -310,16 +323,29 @@ class Extent { /** * Returns the intersection of this extent with another one. - * @param extent - extent to intersect + * + * This method computes the overlapping region between this extent and + * another extent. If their coordinate reference systems (CRS) differ, + * the other extent is reprojected into the CRS of this extent before + * performing the intersection. + * + * + * @param extent - The extent to intersect with this one. + * @param target - The target extent to store the result. If not provided, + * a new extent will be created. + * + * @returns The intersection extent + * (may be empty if extents do not intersect). */ - intersect(extent: Extent) { + intersect(extent: Extent, target = new Extent(this.crs)) { if (!this.intersectsExtent(extent)) { - return new Extent(this.crs); + return target; } if (extent.crs != this.crs) { extent = extent.as(this.crs, _extent); } - return new Extent(this.crs, + + return target.set( Math.max(this.west, extent.west), Math.min(this.east, extent.east), Math.max(this.south, extent.south), @@ -432,6 +458,8 @@ class Extent { this.north = north; } } + + return this; } /** diff --git a/packages/Geographic/test/unit/extent.js b/packages/Geographic/test/unit/extent.js index 332f40cc87..cf6377fa82 100644 --- a/packages/Geographic/test/unit/extent.js +++ b/packages/Geographic/test/unit/extent.js @@ -151,6 +151,20 @@ describe('Extent', function () { assert.ok(withValues.intersectsExtent(inter)); }); + it('intersectsExtent should return false when extents touch at edges -------', () => { + const a = new Extent('EPSG:4326', 0, 10, 0, 10); + const b = new Extent('EPSG:4326', 10, 20, 0, 10); + + assert.strictEqual(Extent.intersectsExtent(a, b), false); + }); + + it('intersectsExtent should return false when extents touch at corners', () => { + const a = new Extent('EPSG:4326', 0, 10, 0, 10); + const b = new Extent('EPSG:4326', 10, 20, 10, 20); + + assert.strictEqual(Extent.intersectsExtent(a, b), false); + }); + it('should intersect like expected', function () { const withValues = new Extent('EPSG:4326', minX, maxX, minY, maxY); const extent = new Extent('EPSG:4326', minX + 1, maxX - 1, maxY - 1, maxY + 2); diff --git a/packages/Main/src/Core/Picking.js b/packages/Main/src/Core/Picking.js index 0fbe5e528d..95a05e223a 100644 --- a/packages/Main/src/Core/Picking.js +++ b/packages/Main/src/Core/Picking.js @@ -210,7 +210,7 @@ export default { pickObjectsAt(view, viewCoords, radius, object, target = []) { // Raycaster use NDC coordinate view.viewToNormalizedCoords(viewCoords, normalized); - if (radius < 0) { + if (radius === 0) { raycaster.setFromCamera(normalized, view.camera3D); const intersects = raycaster.intersectObject(object, true); diff --git a/packages/Main/src/Core/Tile/Tile.ts b/packages/Main/src/Core/Tile/Tile.ts index dd92f563c8..73a2226112 100644 --- a/packages/Main/src/Core/Tile/Tile.ts +++ b/packages/Main/src/Core/Tile/Tile.ts @@ -60,7 +60,7 @@ class Tile { * @param target - The target to store the projected extent. If this not * provided a new extent will be created. */ - toExtent(crs: string, target = new Extent('EPSG:4326')) { + toExtent(crs = this.crs, target = new Extent('EPSG:4326')) { CRS.isValid(crs); const { epsg, globalExtent, globalDimension } = getInfoTms(this.crs); const countTiles = getCountTiles(this.crs, this.zoom); @@ -210,4 +210,164 @@ export function tiledCovering(e: Extent, tms: string) { } } +/** + * Represents a set of limits for a Tile Matrix Set (TMS). + */ +type TileLimit = { + /** Minimum tile (top-left in the matrix) */ + min: Tile; + + /** Maximum tile (bottom-right in the matrix) */ + max: Tile; + + /** Geographic extent covered by the tile range */ + extent: Extent; +}; + +type TileLimitJson = { + maxTileRow: number; + + minTileRow: number; + + minTileCol: number; + + maxTileCol: number; +}; + + +/** + * Represents a set of limits for a Tile Matrix Set (TMS). + * + * This class stores tile boundaries per zoom level, along with + * global extent information and intersection constraints. + */ +export class TileMatrixSetLimits { + /** + * Tile limits indexed by zoom level. + * Each entry defines the min/max tiles and their corresponding extent. + */ + limits: Record; + + /** Coordinate reference system (CRS) of the tile matrix set */ + crs: string; + + /** Global extent (union) of all tile limits */ + extent: Extent; + + /** Common intersection extent across all tile limits */ + intersect: Extent; + + /** Zoom level range covered by the limits */ + zoom: { + min: number; + + max: number; + }; + /** + * Creates a new TileMatrixSetLimits instance. + * + * @param crs - The coordinate reference system of the tile matrix set. + */ + constructor(crs: string) { + this.limits = {}; + + this.crs = crs; + + this.extent = new Extent(crs, -Infinity, Infinity, -Infinity, Infinity); + + this.intersect = new Extent(crs, -Infinity, Infinity, -Infinity, Infinity); + + this.zoom = { + min: 0, + + max: Infinity, + }; + } + + /** + * Builds a TileMatrixSetLimits instance from capabilities JSON. + * + * The input JSON is expected to contain tile limits per zoom level. + * Each zoom level entry must define min/max tile rows and columns. + * + * @param json - Capabilities object describing tile matrix limits. + * @param crs - The coordinate reference system. + * + * @returns A populated TileMatrixSetLimits instance. + */ + + static fromCapabilities(json: Record, crs: string) { + const tileMatrix = new TileMatrixSetLimits(crs); + + if (!json) { + return tileMatrix; + } + + tileMatrix.extent.set(Infinity, -Infinity, Infinity, -Infinity); + + const zooms = Object.keys(json).map(zoom => Number(zoom)); + + tileMatrix.zoom.min = Math.min(...zooms); + + tileMatrix.zoom.max = Math.max(...zooms); + + zooms.forEach((zoom) => { + const limit = json[zoom]; + + const min = new Tile(crs, zoom, limit.minTileRow, limit.minTileCol); + + const max = new Tile(crs, zoom, limit.maxTileRow, limit.maxTileCol); + + const extent = min.toExtent().union(max.toExtent()); + + const tileLimit : TileLimit = { min, max, extent }; + + tileMatrix.extent.union(tileLimit.extent); + + tileMatrix.intersect = tileMatrix.intersect.intersect(tileLimit.extent); + + tileMatrix.limits[zoom] = tileLimit; + }); + + return tileMatrix; + } + + + /** + * Tests whether a tile or extent is inside the defined limits. + * If there are no limits at this zoom level, + * the tile is always considered as inside + * + * - If a {@link Tile} is provided, checks whether it falls within the + * min/max bounds for its zoom level. + * - If an {@link Extent} is provided, checks whether it intersects + * the common intersection extent of all limits. + * + * @param extentOrTile - The tile or extent to test. + * + * @returns `true` if inside the limits, `false` otherwise. + */ + isInside(extentOrTile: Tile | Extent) { + if (extentOrTile instanceof Tile) { + if (extentOrTile.zoom < this.zoom.min || extentOrTile.zoom > this.zoom.max) { + return false; + } + const limit = this.limits[extentOrTile.zoom]; + + if (limit) { + return extentOrTile.row >= limit.min.row && + extentOrTile.col >= limit.min.col && + extentOrTile.row <= limit.max.row && + extentOrTile.col <= limit.max.col; + } else { + // if there are no limits at this zoom level, + // the tile is always considered as inside + return true; + } + } else { + return this.intersect.intersectsExtent(extentOrTile); + } + } +} + export default Tile; diff --git a/packages/Main/src/Layer/LabelLayer.js b/packages/Main/src/Layer/LabelLayer.js index c54742cc51..f32318b267 100644 --- a/packages/Main/src/Layer/LabelLayer.js +++ b/packages/Main/src/Layer/LabelLayer.js @@ -415,7 +415,7 @@ class LabelLayer extends GeometryLayer { node.layerUpdateState[this.id] = new LayerUpdateState(); } - if (!this.source.extentInsideLimit(node.extent, zoomDest)) { + if (!extentsDestination.some(e => this.source.hasData(e))) { node.layerUpdateState[this.id].noMoreUpdatePossible(); return; } else if (this.#hasLabelChildren(node.parent)) { diff --git a/packages/Main/src/Layer/TiledGeometryLayer.js b/packages/Main/src/Layer/TiledGeometryLayer.js index 353d4bf9d3..021c4fae83 100644 --- a/packages/Main/src/Layer/TiledGeometryLayer.js +++ b/packages/Main/src/Layer/TiledGeometryLayer.js @@ -396,12 +396,9 @@ class TiledGeometryLayer extends GeometryLayer { let nodeLayer = node.material.getElevationTile(); for (const e of context.elevationLayers) { - const extents = node.getExtentsByProjection(e.crs); - const zoom = extents[0].zoom; - if (zoom > e.zoom.max || zoom < e.zoom.min) { - continue; - } - if (!e.frozen && e.ready && e.source.extentInsideLimit(node.extent, zoom) && (!nodeLayer || nodeLayer.level < 0)) { + const tiles = node.getExtentsByProjection(e.crs); + + if (!e.frozen && e.ready && tiles.some(t => e.source.hasData(t)) && (!nodeLayer || nodeLayer.level < 0)) { // no stop subdivision in the case of a loading error if (layerUpdateState[e.id] && layerUpdateState[e.id].inError()) { continue; @@ -414,17 +411,14 @@ class TiledGeometryLayer extends GeometryLayer { if (c.frozen || !c.visible || !c.ready) { continue; } - const extents = node.getExtentsByProjection(c.crs); - const zoom = extents[0].zoom; - if (zoom > c.zoom.max || zoom < c.zoom.min) { - continue; - } + const tiles = node.getExtentsByProjection(c.crs); + // no stop subdivision in the case of a loading error if (layerUpdateState[c.id] && layerUpdateState[c.id].inError()) { continue; } nodeLayer = node.material.getColorTile(c.id); - if (c.source.extentInsideLimit(node.extent, zoom) && (!nodeLayer || nodeLayer.level < 0)) { + if (tiles.some(t => c.source.hasData(t)) && (!nodeLayer || nodeLayer.level < 0)) { return false; } } diff --git a/packages/Main/src/Process/FeatureProcessing.js b/packages/Main/src/Process/FeatureProcessing.js index 62967a56a4..511f250c1a 100644 --- a/packages/Main/src/Process/FeatureProcessing.js +++ b/packages/Main/src/Process/FeatureProcessing.js @@ -61,7 +61,7 @@ export default { // if ((zoomDest < layer.zoom.min && zoomDest > layer.zoom.max) || if (zoomDest != layer.zoom.min || // check if there's data in extent tile. - !this.source.extentInsideLimit(node.extent, zoomDest) || + !this.source.hasData(node.extent) || // In FileSource case, check if the feature center is in extent tile. (layer.source.isFileSource && !node.extent.isPointInside(layer.source.extent.center(coord)))) { // if not, there's not data to add at this tile. diff --git a/packages/Main/src/Process/LayeredMaterialNodeProcessing.js b/packages/Main/src/Process/LayeredMaterialNodeProcessing.js index b41ce18a8f..0b8a87c76f 100644 --- a/packages/Main/src/Process/LayeredMaterialNodeProcessing.js +++ b/packages/Main/src/Process/LayeredMaterialNodeProcessing.js @@ -67,7 +67,7 @@ export function updateLayeredMaterialNodeImagery(context, layer, node, parent) { if (node.layerUpdateState[layer.id] === undefined) { node.layerUpdateState[layer.id] = new LayerUpdateState(); - if (!layer.source.extentInsideLimit(node.extent, zoom)) { + if (!extentsDestination.some(t => layer.source.hasData(t))) { // we also need to check that tile's parent doesn't have a texture for this layer, // because even if this tile is outside of the layer, it could inherit it's // parent texture @@ -134,7 +134,7 @@ export function updateLayeredMaterialNodeImagery(context, layer, node, parent) { node.layerUpdateState[layer.id].noMoreUpdatePossible(); } return; - } else if (!layer.source.extentInsideLimit(node.extent, targetLevel)) { + } else if (!extentsDestination.some(t => layer.source.hasData(t))) { node.layerUpdateState[layer.id].noData({ targetLevel }); context.view.notifyChange(node, false); return; @@ -209,7 +209,7 @@ export function updateLayeredMaterialNodeElevation(context, layer, node, parent) if (targetLevel <= nodeLayer.level || targetLevel > extentsDestination[0].zoom) { node.layerUpdateState[layer.id].noMoreUpdatePossible(); return; - } else if (!layer.source.extentInsideLimit(node.extent, targetLevel)) { + } else if (!extentsDestination.some(t => layer.source.hasData(t))) { node.layerUpdateState[layer.id].noData({ targetLevel }); context.view.notifyChange(node, false); return; diff --git a/packages/Main/src/Source/FileSource.js b/packages/Main/src/Source/FileSource.js index c7af033b3b..a1f98c301a 100644 --- a/packages/Main/src/Source/FileSource.js +++ b/packages/Main/src/Source/FileSource.js @@ -183,10 +183,6 @@ class FileSource extends Source { loadData(extent, out) { return this._featuresCaches[out.crs].get(0); } - - extentInsideLimit(extent) { - return this.extent.intersectsExtent(extent); - } } export default FileSource; diff --git a/packages/Main/src/Source/Source.js b/packages/Main/src/Source/Source.js index 9f33ccb3d9..04f198ce09 100644 --- a/packages/Main/src/Source/Source.js +++ b/packages/Main/src/Source/Source.js @@ -8,7 +8,6 @@ import GTXParser from 'Parser/GTXParser'; import ISGParser from 'Parser/ISGParser'; import VectorTileParser from 'Parser/VectorTileParser'; import Fetcher from 'Provider/Fetcher'; -// import Cache from 'Core/Scheduler/Cache'; import { LRUCache } from 'lru-cache'; /** @private */ @@ -193,15 +192,19 @@ class Source { } /** - * Tests if an extent is inside the source limits. + * Determines whether this source has data intersecting the given extent. * - * @param {Extent} extent - Extent to test. - - * @return {boolean} True if the extent is inside the limit, false otherwise. + * If the source has no defined extent, it is assumed to cover all areas and + * this method always returns `true`. Otherwise, the source's extent is + * tested for intersection with the provided extent. + * + * @param {Extent|Tile} extentOrTile - The extent or tile to test against. + * + * @return {boolean} `true` if the source has data for the + * given extent, `false` otherwise. */ - // eslint-disable-next-line - extentInsideLimit(extent) { - throw new Error('In extented Source, you have to implement the method extentInsideLimit!'); + hasData(extentOrTile) { + return this.extent ? this.extent.intersectsExtent(extentOrTile.isExtent ? extentOrTile : extentOrTile.toExtent(this.crs)) : true; } } diff --git a/packages/Main/src/Source/TMSSource.js b/packages/Main/src/Source/TMSSource.js index 318089bfac..bb0cb7ba18 100644 --- a/packages/Main/src/Source/TMSSource.js +++ b/packages/Main/src/Source/TMSSource.js @@ -1,10 +1,7 @@ import Source from 'Source/Source'; import URLBuilder from 'Provider/URLBuilder'; -import { Extent } from '@itowns/geographic'; import { globalExtentTMS } from 'Core/Tile/TileGrid'; -import Tile from 'Core/Tile/Tile'; - -const _tile = new Tile('EPSG:4326', 0, 0, 0); +import { TileMatrixSetLimits } from 'Core/Tile/Tile'; /** * An object defining the source of resources to get from a @@ -91,59 +88,25 @@ class TMSSource extends Source { this.extent = globalExtentTMS.get(source.crs); } - this.zoom = source.zoom; - this.isInverted = source.isInverted || false; - this.crs = source.crs; - this.tileMatrixSetLimits = source.tileMatrixSetLimits; - this.extentSetlimits = {}; - this.tileMatrixCallback = source.tileMatrixCallback || (zoomLevel => zoomLevel); - if (!this.zoom) { - if (this.tileMatrixSetLimits) { - const arrayLimits = Object.keys(this.tileMatrixSetLimits); - const size = arrayLimits.length; - const maxZoom = Number(arrayLimits[size - 1]); - const minZoom = maxZoom - size + 1; + this.tileMatrixSetLimits = TileMatrixSetLimits.fromCapabilities(source.tileMatrixSetLimits, this.crs); - this.zoom = { - min: minZoom, - max: maxZoom, - }; - } else { - this.zoom = { min: 0, max: Infinity }; - } - } + this.tileMatrixCallback = source.tileMatrixCallback || (zoomLevel => zoomLevel); + + this.zoom = source.zoom || this.tileMatrixSetLimits.zoom; } urlFromExtent(tile) { return URLBuilder.xyz(tile, this); } - onLayerAdded(options) { - super.onLayerAdded(options); - // Build extents of the set of identical zoom tiles. - const parent = options.out.parent; - // The extents crs is chosen to facilitate in raster tile process. - const crs = parent ? parent.extent.crs : options.out.crs; - if (this.tileMatrixSetLimits && !this.extentSetlimits[crs]) { - this.extentSetlimits[crs] = {}; - _tile.crs = this.crs; - for (let i = this.zoom.max; i >= this.zoom.min; i--) { - const tmsl = this.tileMatrixSetLimits[i]; - const { west, north } = _tile.set(i, tmsl.minTileRow, tmsl.minTileCol).toExtent(crs); - const { east, south } = _tile.set(i, tmsl.maxTileRow, tmsl.maxTileCol).toExtent(crs); - this.extentSetlimits[crs][i] = new Extent(crs, west, east, south, north); - } - } - } + hasData(tile) { + return tile.zoom >= this.zoom.min && + + tile.zoom <= this.zoom.max && - extentInsideLimit(extent, zoom) { - // This layer provides data starting at level = layer.source.zoom.min - // (the zoom.max property is used when building the url to make - // sure we don't use invalid levels) - return zoom >= this.zoom.min && zoom <= this.zoom.max && - (this.extentSetlimits[extent.crs] == undefined || this.extentSetlimits[extent.crs][zoom].intersectsExtent(extent)); + this.tileMatrixSetLimits.isInside(tile); } } diff --git a/packages/Main/src/Source/WFSSource.js b/packages/Main/src/Source/WFSSource.js index 0d23a2d677..d2a440f3c1 100644 --- a/packages/Main/src/Source/WFSSource.js +++ b/packages/Main/src/Source/WFSSource.js @@ -173,10 +173,6 @@ class WFSSource extends Source { extentOrTile.toExtent(this.crs, _extent); return URLBuilder.bbox(extent, this); } - - extentInsideLimit(extent) { - return this.extent.intersectsExtent(extent); - } } export default WFSSource; diff --git a/packages/Main/src/Source/WMSSource.js b/packages/Main/src/Source/WMSSource.js index 745156af7c..ed201154d9 100644 --- a/packages/Main/src/Source/WMSSource.js +++ b/packages/Main/src/Source/WMSSource.js @@ -171,10 +171,6 @@ class WMSSource extends Source { extentOrTile.toExtent(this.crs, _extent); return URLBuilder.bbox(extent, this); } - - extentInsideLimit(extent) { - return this.extent.intersectsExtent(extent); - } } export default WMSSource; diff --git a/packages/Main/test/unit/layeredmaterialnodeprocessing.js b/packages/Main/test/unit/layeredmaterialnodeprocessing.js index b69576cad7..294f5fa769 100644 --- a/packages/Main/test/unit/layeredmaterialnodeprocessing.js +++ b/packages/Main/test/unit/layeredmaterialnodeprocessing.js @@ -67,9 +67,9 @@ describe('updateLayeredMaterialNodeImagery', function () { }; layer.visible = true; - source.extentInsideLimit = () => true; + source.hasData = () => true; source.zoom = { min: 0, max: 10 }; - source.extent = { crs: 'EPSG:4326' }; + source.extent = new Extent('EPSG:4326'); }); diff --git a/packages/Main/test/unit/source/filesource.js b/packages/Main/test/unit/source/filesource.js index 0f9597e356..db6e802e2f 100644 --- a/packages/Main/test/unit/source/filesource.js +++ b/packages/Main/test/unit/source/filesource.js @@ -35,7 +35,7 @@ describe('FileSource', function () { .then(() => { const extent = new Extent('EPSG:4326', 0, 10, 0, 10); assert.ok(source.urlFromExtent()); - assert.ok(source.extentInsideLimit(extent)); + assert.ok(source.hasData(extent)); assert.ok(source.fetchedData); assert.ok(!source.features); assert.ok(source.isFileSource); diff --git a/packages/Main/test/unit/source/source.js b/packages/Main/test/unit/source/source.js index 524ca807bb..39d2c260fe 100644 --- a/packages/Main/test/unit/source/source.js +++ b/packages/Main/test/unit/source/source.js @@ -23,7 +23,6 @@ describe('Abstract Source', function () { it('testing abstract methods', function () { assert.throws(source.urlFromExtent, Error); - assert.throws(source.extentInsideLimit, Error); }); it("method 'onLayerRemoved'", function () { diff --git a/packages/Main/test/unit/source/tmssource.js b/packages/Main/test/unit/source/tmssource.js index 8803c8a309..8dade9f666 100644 --- a/packages/Main/test/unit/source/tmssource.js +++ b/packages/Main/test/unit/source/tmssource.js @@ -17,7 +17,7 @@ describe('TMSSource', function () { const extent = new Tile('TMS:3857', 5, 0, 0); assert.ok(source.isTMSSource); assert.ok(source.urlFromExtent(extent)); - assert.ok(source.extentInsideLimit(extent, extent.zoom)); + assert.ok(source.hasData(extent, extent.zoom)); }); }); diff --git a/packages/Main/test/unit/source/wmssource.js b/packages/Main/test/unit/source/wmssource.js index 2b2b7d2bbe..a2a09199cd 100644 --- a/packages/Main/test/unit/source/wmssource.js +++ b/packages/Main/test/unit/source/wmssource.js @@ -20,7 +20,7 @@ describe('WMSSource', function () { const extent = new Extent('EPSG:4326', 0, 10, 0, 10); assert.ok(source.isWMSSource); assert.ok(source.urlFromExtent(extent)); - assert.ok(source.extentInsideLimit(extent)); + assert.ok(source.hasData(extent)); }); it('should set the correct axisOrder', function () { diff --git a/packages/Main/test/unit/source/wmtssource.js b/packages/Main/test/unit/source/wmtssource.js index 5839ce6078..d98dbbe14b 100644 --- a/packages/Main/test/unit/source/wmtssource.js +++ b/packages/Main/test/unit/source/wmtssource.js @@ -25,7 +25,7 @@ describe('WMTSSource', function () { const extent = new Tile('TMS:3857', 5, 0, 0); assert.ok(source.isWMTSSource); assert.ok(source.urlFromExtent(extent)); - assert.ok(source.extentInsideLimit(extent, 5)); + assert.ok(source.hasData(extent)); }); it('should instance with tileMatrixSet', function () { @@ -43,7 +43,7 @@ describe('WMTSSource', function () { source.onLayerAdded({ out: { crs: 'EPSG:4326' } }); assert.ok(source.isWMTSSource); assert.ok(source.urlFromExtent(extent)); - assert.ok(source.extentInsideLimit(extent, 5)); + assert.ok(source.hasData(extent)); }); it('should use vendor specific parameters for the creation of the WMTS url', function () { diff --git a/test/hooks_functional.js b/test/hooks_functional.js index a1eaf90c24..6dd5829bfe 100644 --- a/test/hooks_functional.js +++ b/test/hooks_functional.js @@ -242,6 +242,10 @@ const enableGLForTest = async () => { }; const disableGLForTest = () => { + if (browserWithGl) { + browserWithGl.close(); + browserWithGl = null; + } browser = browserWithoutGl; };