diff --git a/examples/canvas-gradient-pattern.js b/examples/canvas-gradient-pattern.js index e38ee0e43e..d5a6cd25e3 100644 --- a/examples/canvas-gradient-pattern.js +++ b/examples/canvas-gradient-pattern.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getWidth} from '../src/ol/extent.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import {DEVICE_PIXEL_RATIO} from '../src/ol/has.js'; import VectorLayer from '../src/ol/layer/Vector.js'; @@ -25,7 +25,7 @@ function gradient(feature, resolution) { // we just divide the geometry's extent width by resolution and multiply with // pixelRatio to match the renderer's pixel coordinate system. const grad = context.createLinearGradient(0, 0, - _ol_extent_.getWidth(extent) / resolution * pixelRatio, 0); + getWidth(extent) / resolution * pixelRatio, 0); grad.addColorStop(0, 'red'); grad.addColorStop(1 / 6, 'orange'); grad.addColorStop(2 / 6, 'yellow'); diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 2530e0afe9..e9ff625c94 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {createEmpty, getWidth, getHeight, extend} from '../src/ol/extent.js'; import KML from '../src/ol/format/KML.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import Select from '../src/ol/interaction/Select.js'; @@ -65,13 +65,13 @@ const calculateClusterInfo = function(resolution) { for (let i = features.length - 1; i >= 0; --i) { feature = features[i]; const originalFeatures = feature.get('features'); - const extent = _ol_extent_.createEmpty(); + const extent = createEmpty(); let j, jj; for (j = 0, jj = originalFeatures.length; j < jj; ++j) { - _ol_extent_.extend(extent, originalFeatures[j].getGeometry().getExtent()); + extend(extent, originalFeatures[j].getGeometry().getExtent()); } maxFeatureCount = Math.max(maxFeatureCount, jj); - radius = 0.25 * (_ol_extent_.getWidth(extent) + _ol_extent_.getHeight(extent)) / + radius = 0.25 * (getWidth(extent) + getHeight(extent)) / resolution; feature.set('radius', radius); } diff --git a/examples/moveend.js b/examples/moveend.js index 1e304d2f62..73fa95b1b7 100644 --- a/examples/moveend.js +++ b/examples/moveend.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getBottomLeft, getTopRight} from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {toLonLat} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; @@ -37,8 +37,8 @@ function wrapLon(value) { function onMoveEnd(evt) { const map = evt.map; const extent = map.getView().calculateExtent(map.getSize()); - const bottomLeft = toLonLat(_ol_extent_.getBottomLeft(extent)); - const topRight = toLonLat(_ol_extent_.getTopRight(extent)); + const bottomLeft = toLonLat(getBottomLeft(extent)); + const topRight = toLonLat(getTopRight(extent)); display('left', wrapLon(bottomLeft[0])); display('bottom', bottomLeft[1]); display('right', wrapLon(topRight[0])); diff --git a/examples/reprojection-by-code.js b/examples/reprojection-by-code.js index 47a202febf..346cb3067a 100644 --- a/examples/reprojection-by-code.js +++ b/examples/reprojection-by-code.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {applyTransform} from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {get as getProjection, getTransform} from '../src/ol/proj.js'; import {register} from '../src/ol/proj/proj4.js'; @@ -49,7 +49,7 @@ function setProjection(code, name, proj4def, bbox) { const fromLonLat = getTransform('EPSG:4326', newProj); // very approximate calculation of projection extent - const extent = _ol_extent_.applyTransform( + const extent = applyTransform( [bbox[1], bbox[2], bbox[3], bbox[0]], fromLonLat); newProj.setExtent(extent); const newView = new View({ diff --git a/examples/reprojection.js b/examples/reprojection.js index b33873f8a1..ca57e6e115 100644 --- a/examples/reprojection.js +++ b/examples/reprojection.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getWidth, getCenter} from '../src/ol/extent.js'; import WMTSCapabilities from '../src/ol/format/WMTSCapabilities.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {get as getProjection} from '../src/ol/proj.js'; @@ -128,7 +128,7 @@ layers['grandcanyon'] = new TileLayer({ }); const startResolution = - _ol_extent_.getWidth(getProjection('EPSG:3857').getExtent()) / 256; + getWidth(getProjection('EPSG:3857').getExtent()) / 256; const resolutions = new Array(22); for (let i = 0, ii = resolutions.length; i < ii; ++i) { resolutions[i] = startResolution / Math.pow(2, i); @@ -175,7 +175,7 @@ function updateViewProjection() { const newProjExtent = newProj.getExtent(); const newView = new View({ projection: newProj, - center: _ol_extent_.getCenter(newProjExtent || [0, 0, 0, 0]), + center: getCenter(newProjExtent || [0, 0, 0, 0]), zoom: 0, extent: newProjExtent || undefined }); diff --git a/examples/static-image.js b/examples/static-image.js index 3566e6f416..5c937e7e97 100644 --- a/examples/static-image.js +++ b/examples/static-image.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getCenter} from '../src/ol/extent.js'; import ImageLayer from '../src/ol/layer/Image.js'; import Projection from '../src/ol/proj/Projection.js'; import Static from '../src/ol/source/ImageStatic.js'; @@ -30,7 +30,7 @@ const map = new Map({ target: 'map', view: new View({ projection: projection, - center: _ol_extent_.getCenter(extent), + center: getCenter(extent), zoom: 2, maxZoom: 8 }) diff --git a/examples/street-labels.js b/examples/street-labels.js index ab8f875176..8d21993ab1 100644 --- a/examples/street-labels.js +++ b/examples/street-labels.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getCenter} from '../src/ol/extent.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; @@ -41,7 +41,7 @@ const map = new Map({ target: 'map', view: new View({ extent: viewExtent, - center: _ol_extent_.getCenter(viewExtent), + center: getCenter(viewExtent), zoom: 17, minZoom: 14 }) diff --git a/examples/vector-label-decluttering.js b/examples/vector-label-decluttering.js index a7c7c6bb34..cb340acbdf 100644 --- a/examples/vector-label-decluttering.js +++ b/examples/vector-label-decluttering.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getWidth} from '../src/ol/extent.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; @@ -26,7 +26,7 @@ const labelStyle = new Style({ let widest = 0; for (let i = 0, ii = polygons.length; i < ii; ++i) { const polygon = polygons[i]; - const width = _ol_extent_.getWidth(polygon.getExtent()); + const width = getWidth(polygon.getExtent()); if (width > widest) { widest = width; geometry = polygon; diff --git a/examples/wms-custom-tilegrid-512x256.js b/examples/wms-custom-tilegrid-512x256.js index db334e5987..cdffd2d696 100644 --- a/examples/wms-custom-tilegrid-512x256.js +++ b/examples/wms-custom-tilegrid-512x256.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getWidth} from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {get as getProjection} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; @@ -9,7 +9,7 @@ import TileGrid from '../src/ol/tilegrid/TileGrid.js'; const projExtent = getProjection('EPSG:3857').getExtent(); -const startResolution = _ol_extent_.getWidth(projExtent) / 256; +const startResolution = getWidth(projExtent) / 256; const resolutions = new Array(22); for (let i = 0, ii = resolutions.length; i < ii; ++i) { resolutions[i] = startResolution / Math.pow(2, i); diff --git a/examples/wms-time.js b/examples/wms-time.js index c68aa1ba73..7f65044055 100644 --- a/examples/wms-time.js +++ b/examples/wms-time.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getCenter} from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {transformExtent} from '../src/ol/proj.js'; import Stamen from '../src/ol/source/Stamen.js'; @@ -34,7 +34,7 @@ const map = new Map({ layers: layers, target: 'map', view: new View({ - center: _ol_extent_.getCenter(extent), + center: getCenter(extent), zoom: 4 }) }); diff --git a/examples/wmts-dimensions.js b/examples/wmts-dimensions.js index df31a6a486..2c9504680d 100644 --- a/examples/wmts-dimensions.js +++ b/examples/wmts-dimensions.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getWidth, getTopLeft} from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {get as getProjection} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; @@ -11,7 +11,7 @@ import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js'; // create the WMTS tile grid in the google projection const projection = getProjection('EPSG:3857'); const tileSizePixels = 256; -const tileSizeMtrs = _ol_extent_.getWidth(projection.getExtent()) / tileSizePixels; +const tileSizeMtrs = getWidth(projection.getExtent()) / tileSizePixels; const matrixIds = []; const resolutions = []; for (let i = 0; i <= 14; i++) { @@ -19,7 +19,7 @@ for (let i = 0; i <= 14; i++) { resolutions[i] = tileSizeMtrs / Math.pow(2, i); } const tileGrid = new WMTSTileGrid({ - origin: _ol_extent_.getTopLeft(projection.getExtent()), + origin: getTopLeft(projection.getExtent()), resolutions: resolutions, matrixIds: matrixIds }); diff --git a/examples/wmts-ign.js b/examples/wmts-ign.js index 2967e7e27e..0b4562e866 100644 --- a/examples/wmts-ign.js +++ b/examples/wmts-ign.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getWidth} from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat, get as getProjection} from '../src/ol/proj.js'; import WMTS from '../src/ol/source/WMTS.js'; @@ -24,7 +24,7 @@ const map = new Map({ const resolutions = []; const matrixIds = []; const proj3857 = getProjection('EPSG:3857'); -const maxResolution = _ol_extent_.getWidth(proj3857.getExtent()) / 256; +const maxResolution = getWidth(proj3857.getExtent()) / 256; for (let i = 0; i < 18; i++) { matrixIds[i] = i.toString(); diff --git a/examples/wmts.js b/examples/wmts.js index 1c017ee50b..8eadd4555b 100644 --- a/examples/wmts.js +++ b/examples/wmts.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; -import * as _ol_extent_ from '../src/ol/extent.js'; +import {getWidth, getTopLeft} from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {get as getProjection} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; @@ -11,7 +11,7 @@ import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js'; const projection = getProjection('EPSG:3857'); const projectionExtent = projection.getExtent(); -const size = _ol_extent_.getWidth(projectionExtent) / 256; +const size = getWidth(projectionExtent) / 256; const resolutions = new Array(14); const matrixIds = new Array(14); for (let z = 0; z < 14; ++z) { @@ -38,7 +38,7 @@ const map = new Map({ format: 'image/png', projection: projection, tileGrid: new WMTSTileGrid({ - origin: _ol_extent_.getTopLeft(projectionExtent), + origin: getTopLeft(projectionExtent), resolutions: resolutions, matrixIds: matrixIds }), diff --git a/test/rendering/ol/layer/tile.test.js b/test/rendering/ol/layer/tile.test.js index 82b90c2375..9f93c67092 100644 --- a/test/rendering/ol/layer/tile.test.js +++ b/test/rendering/ol/layer/tile.test.js @@ -1,6 +1,6 @@ import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {getSize} from '../../../../src/ol/extent.js'; import Point from '../../../../src/ol/geom/Point.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; import {assign} from '../../../../src/ol/obj.js'; @@ -146,8 +146,8 @@ describe('ol.rendering.layer.Tile', function() { function centerExtent(map) { const c = map.getView().calculateExtent(map.getSize()); - const qw = _ol_extent_.getSize(c)[0] / 4; - const qh = _ol_extent_.getSize(c)[1] / 4; + const qw = getSize(c)[0] / 4; + const qh = getSize(c)[1] / 4; return [c[0] + qw, c[1] + qh, c[2] - qw, c[3] - qh]; } diff --git a/test/spec/ol/format/esrijson.test.js b/test/spec/ol/format/esrijson.test.js index f09ad847ef..4f92375755 100644 --- a/test/spec/ol/format/esrijson.test.js +++ b/test/spec/ol/format/esrijson.test.js @@ -1,5 +1,5 @@ import Feature from '../../../../src/ol/Feature.js'; -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {equals} from '../../../../src/ol/extent.js'; import EsriJSON from '../../../../src/ol/format/EsriJSON.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js'; @@ -305,7 +305,7 @@ describe('ol.format.EsriJSON', function() { expect(first.getId()).to.be(6406); const firstGeom = first.getGeometry(); expect(firstGeom).to.be.a(Polygon); - expect(_ol_extent_.equals(firstGeom.getExtent(), [ + expect(equals(firstGeom.getExtent(), [ -10585772.743554419, 4712365.161160459, -10579560.16462974, 4716567.373073828 ])).to.be(true); @@ -316,7 +316,7 @@ describe('ol.format.EsriJSON', function() { expect(last.getId()).to.be(6030); const lastGeom = last.getGeometry(); expect(lastGeom).to.be.a(Polygon); - expect(_ol_extent_.equals(lastGeom.getExtent(), [ + expect(equals(lastGeom.getExtent(), [ -10555714.026858449, 4576511.565880965, -10553671.199322715, 4578554.9934867555 ])).to.be(true); diff --git a/test/spec/ol/format/geojson.test.js b/test/spec/ol/format/geojson.test.js index 07b48e7546..1ebb8faf26 100644 --- a/test/spec/ol/format/geojson.test.js +++ b/test/spec/ol/format/geojson.test.js @@ -1,5 +1,5 @@ import Feature from '../../../../src/ol/Feature.js'; -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {equals} from '../../../../src/ol/extent.js'; import GeoJSON from '../../../../src/ol/format/GeoJSON.js'; import Circle from '../../../../src/ol/geom/Circle.js'; import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js'; @@ -302,7 +302,7 @@ describe('ol.format.GeoJSON', function() { expect(first.getId()).to.be('AFG'); const firstGeom = first.getGeometry(); expect(firstGeom).to.be.a(Polygon); - expect(_ol_extent_.equals(firstGeom.getExtent(), + expect(equals(firstGeom.getExtent(), [60.52843, 29.318572, 75.158028, 38.486282])) .to.be(true); @@ -312,7 +312,7 @@ describe('ol.format.GeoJSON', function() { expect(last.getId()).to.be('ZWE'); const lastGeom = last.getGeometry(); expect(lastGeom).to.be.a(Polygon); - expect(_ol_extent_.equals(lastGeom.getExtent(), + expect(equals(lastGeom.getExtent(), [25.264226, -22.271612, 32.849861, -15.507787])) .to.be(true); done(); diff --git a/test/spec/ol/format/mvt.test.js b/test/spec/ol/format/mvt.test.js index 34607ebde7..a1eefdd8ed 100644 --- a/test/spec/ol/format/mvt.test.js +++ b/test/spec/ol/format/mvt.test.js @@ -1,5 +1,5 @@ import Feature from '../../../../src/ol/Feature.js'; -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {getWidth} from '../../../../src/ol/extent.js'; import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; @@ -78,7 +78,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() { const format = new MVT(); format.readFeatures(data); const extent = format.getLastExtent(); - expect(_ol_extent_.getWidth(extent)).to.be(4096); + expect(getWidth(extent)).to.be(4096); }); }); diff --git a/test/spec/ol/geom/linestring.test.js b/test/spec/ol/geom/linestring.test.js index b8975822a0..1646df628e 100644 --- a/test/spec/ol/geom/linestring.test.js +++ b/test/spec/ol/geom/linestring.test.js @@ -1,4 +1,4 @@ -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {isEmpty} from '../../../../src/ol/extent.js'; import LineString from '../../../../src/ol/geom/LineString.js'; @@ -26,7 +26,7 @@ describe('ol.geom.LineString', function() { }); it('has an empty extent', function() { - expect(_ol_extent_.isEmpty(lineString.getExtent())).to.be(true); + expect(isEmpty(lineString.getExtent())).to.be(true); }); it('has empty flat coordinates', function() { diff --git a/test/spec/ol/geom/multilinestring.test.js b/test/spec/ol/geom/multilinestring.test.js index 461cab961b..ba6b7d67d9 100644 --- a/test/spec/ol/geom/multilinestring.test.js +++ b/test/spec/ol/geom/multilinestring.test.js @@ -1,4 +1,4 @@ -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {isEmpty} from '../../../../src/ol/extent.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; @@ -27,7 +27,7 @@ describe('ol.geom.MultiLineString', function() { }); it('has an empty extent', function() { - expect(_ol_extent_.isEmpty(multiLineString.getExtent())).to.be(true); + expect(isEmpty(multiLineString.getExtent())).to.be(true); }); it('has empty flat coordinates', function() { diff --git a/test/spec/ol/geom/multipoint.test.js b/test/spec/ol/geom/multipoint.test.js index d5a3b39ff0..308f7c3ac9 100644 --- a/test/spec/ol/geom/multipoint.test.js +++ b/test/spec/ol/geom/multipoint.test.js @@ -1,4 +1,4 @@ -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {isEmpty} from '../../../../src/ol/extent.js'; import MultiPoint from '../../../../src/ol/geom/MultiPoint.js'; import Point from '../../../../src/ol/geom/Point.js'; @@ -27,7 +27,7 @@ describe('ol.geom.MultiPoint', function() { }); it('has an empty extent', function() { - expect(_ol_extent_.isEmpty(multiPoint.getExtent())).to.be(true); + expect(isEmpty(multiPoint.getExtent())).to.be(true); }); it('has empty flat coordinates', function() { diff --git a/test/spec/ol/geom/polygon.test.js b/test/spec/ol/geom/polygon.test.js index 44018b0b85..03c1b24c96 100644 --- a/test/spec/ol/geom/polygon.test.js +++ b/test/spec/ol/geom/polygon.test.js @@ -1,4 +1,4 @@ -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {isEmpty, boundingExtent} from '../../../../src/ol/extent.js'; import Circle from '../../../../src/ol/geom/Circle.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js'; import Polygon, {fromCircle, fromExtent} from '../../../../src/ol/geom/Polygon.js'; @@ -28,7 +28,7 @@ describe('ol/geom/Polygon', function() { }); it('has an empty extent', function() { - expect(_ol_extent_.isEmpty(polygon.getExtent())).to.be(true); + expect(isEmpty(polygon.getExtent())).to.be(true); }); it('has empty flat coordinates', function() { @@ -221,25 +221,25 @@ describe('ol/geom/Polygon', function() { it('does not intersect outside extent', function() { expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([outsideOuter]))).to.be(false); + boundingExtent([outsideOuter]))).to.be(false); }); it('does intersect inside extent', function() { expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([inside]))).to.be(true); + boundingExtent([inside]))).to.be(true); }); it('does intersect boundary extent', function() { const firstMidX = (outerRing[0][0] + outerRing[1][0]) / 2; const firstMidY = (outerRing[0][1] + outerRing[1][1]) / 2; - expect(polygon.intersectsExtent(_ol_extent_.boundingExtent([[firstMidX, + expect(polygon.intersectsExtent(boundingExtent([[firstMidX, firstMidY]]))).to.be(true); }); it('does not intersect extent fully contained by inner ring', function() { expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([insideInner]))).to.be(false); + boundingExtent([insideInner]))).to.be(false); }); }); @@ -320,25 +320,25 @@ describe('ol/geom/Polygon', function() { it('does not intersect outside extent', function() { expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([outsideOuter]))).to.be(false); + boundingExtent([outsideOuter]))).to.be(false); }); it('does intersect inside extent', function() { expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([inside]))).to.be(true); + boundingExtent([inside]))).to.be(true); }); it('does intersect boundary extent', function() { const firstMidX = (outerRing[0][0] + outerRing[1][0]) / 2; const firstMidY = (outerRing[0][1] + outerRing[1][1]) / 2; - expect(polygon.intersectsExtent(_ol_extent_.boundingExtent([[firstMidX, + expect(polygon.intersectsExtent(boundingExtent([[firstMidX, firstMidY]]))).to.be(true); }); it('does not intersect extent fully contained by inner ring', function() { expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([insideInner]))).to.be(false); + boundingExtent([insideInner]))).to.be(false); }); }); @@ -427,27 +427,27 @@ describe('ol/geom/Polygon', function() { it('does not intersect outside extent', function() { expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([outsideOuter]))).to.be(false); + boundingExtent([outsideOuter]))).to.be(false); }); it('does intersect inside extent', function() { expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([inside]))).to.be(true); + boundingExtent([inside]))).to.be(true); }); it('does intersect boundary extent', function() { const firstMidX = (outerRing[0][0] + outerRing[1][0]) / 2; const firstMidY = (outerRing[0][1] + outerRing[1][1]) / 2; - expect(polygon.intersectsExtent(_ol_extent_.boundingExtent([[firstMidX, + expect(polygon.intersectsExtent(boundingExtent([[firstMidX, firstMidY]]))).to.be(true); }); it('does not intersect extent fully contained by inner ring', function() { expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([insideInner1]))).to.be(false); + boundingExtent([insideInner1]))).to.be(false); expect(polygon.intersectsExtent( - _ol_extent_.boundingExtent([insideInner2]))).to.be(false); + boundingExtent([insideInner2]))).to.be(false); }); }); diff --git a/test/spec/ol/interaction/dragzoom.test.js b/test/spec/ol/interaction/dragzoom.test.js index d8c35a9585..8a5c2447f5 100644 --- a/test/spec/ol/interaction/dragzoom.test.js +++ b/test/spec/ol/interaction/dragzoom.test.js @@ -1,6 +1,6 @@ import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {getCenter} from '../../../../src/ol/extent.js'; import {fromExtent as polygonFromExtent} from '../../../../src/ol/geom/Polygon.js'; import DragZoom from '../../../../src/ol/interaction/DragZoom.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; @@ -79,7 +79,7 @@ describe('ol.interaction.DragZoom', function() { setTimeout(function() { const view = map.getView(); const center = view.getCenter(); - expect(center).to.eql(_ol_extent_.getCenter(extent)); + expect(center).to.eql(getCenter(extent)); done(); }, 50); diff --git a/test/spec/ol/layer/group.test.js b/test/spec/ol/layer/group.test.js index fbe7c6a950..014faced67 100644 --- a/test/spec/ol/layer/group.test.js +++ b/test/spec/ol/layer/group.test.js @@ -1,7 +1,7 @@ import {getUid} from '../../../../src/ol/index.js'; import {stableSort} from '../../../../src/ol/array.js'; import Collection from '../../../../src/ol/Collection.js'; -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {getIntersection} from '../../../../src/ol/extent.js'; import LayerGroup from '../../../../src/ol/layer/Group.js'; import Layer from '../../../../src/ol/layer/Layer.js'; import {assign} from '../../../../src/ol/obj.js'; @@ -403,7 +403,7 @@ describe('ol.layer.Group', function() { }); const layerStatesArray = layerGroup.getLayerStatesArray(); expect(layerStatesArray[0].extent).to.eql( - _ol_extent_.getIntersection(layer3.getExtent(), groupExtent)); + getIntersection(layer3.getExtent(), groupExtent)); layerGroup.dispose(); }); diff --git a/test/spec/ol/renderer/canvas/vectorlayer.test.js b/test/spec/ol/renderer/canvas/vectorlayer.test.js index 5058a98254..b20d07e66f 100644 --- a/test/spec/ol/renderer/canvas/vectorlayer.test.js +++ b/test/spec/ol/renderer/canvas/vectorlayer.test.js @@ -2,7 +2,7 @@ import {getUid} from '../../../../../src/ol/index.js'; import Feature from '../../../../../src/ol/Feature.js'; import Map from '../../../../../src/ol/Map.js'; import View from '../../../../../src/ol/View.js'; -import * as _ol_extent_ from '../../../../../src/ol/extent.js'; +import {buffer as bufferExtent, getWidth} from '../../../../../src/ol/extent.js'; import Point from '../../../../../src/ol/geom/Point.js'; import VectorLayer from '../../../../../src/ol/layer/Vector.js'; import {clear} from '../../../../../src/ol/obj.js'; @@ -228,7 +228,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { renderer = new CanvasVectorLayerRenderer(layer); const projection = getProjection('EPSG:3857'); projExtent = projection.getExtent(); - worldWidth = _ol_extent_.getWidth(projExtent); + worldWidth = getWidth(projExtent); buffer = layer.getRenderBuffer(); frameState = { skippedFeatureUids: {}, @@ -246,7 +246,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { frameState.extent = [projExtent[0] - 10000, -10000, projExtent[0] + 10000, 10000]; renderer.prepareFrame(frameState, {}); - expect(renderer.replayGroup_.maxExtent_).to.eql(_ol_extent_.buffer([ + expect(renderer.replayGroup_.maxExtent_).to.eql(bufferExtent([ projExtent[0] - worldWidth + buffer, -10000, projExtent[2] + worldWidth - buffer, 10000 ], buffer)); @@ -258,7 +258,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { frameState.extent = [projExtent[0] - 10000, -10000, projExtent[1] - 10000, 10000]; renderer.prepareFrame(frameState, {}); - expect(renderer.replayGroup_.maxExtent_).to.eql(_ol_extent_.buffer([ + expect(renderer.replayGroup_.maxExtent_).to.eql(bufferExtent([ projExtent[0] - worldWidth + buffer, -10000, projExtent[2] + worldWidth - buffer, 10000 ], buffer)); @@ -269,7 +269,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { frameState.extent = [2 * projExtent[0] - 10000, -10000, 2 * projExtent[1] + 10000, 10000]; renderer.prepareFrame(frameState, {}); - expect(renderer.replayGroup_.maxExtent_).to.eql(_ol_extent_.buffer([ + expect(renderer.replayGroup_.maxExtent_).to.eql(bufferExtent([ projExtent[0] - worldWidth + buffer, -10000, projExtent[2] + worldWidth - buffer, 10000 ], buffer)); @@ -282,7 +282,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { -10000, projExtent[1] + 2 * worldWidth + 10000, 10000 ]; renderer.prepareFrame(frameState, {}); - expect(renderer.replayGroup_.maxExtent_).to.eql(_ol_extent_.buffer([ + expect(renderer.replayGroup_.maxExtent_).to.eql(bufferExtent([ projExtent[0] - 2 * worldWidth - 10000, -10000, projExtent[2] + 2 * worldWidth + 10000, 10000 ], buffer)); diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index 044507a17a..8780c063a7 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -6,7 +6,7 @@ import TileState from '../../../../../src/ol/TileState.js'; import VectorImageTile from '../../../../../src/ol/VectorImageTile.js'; import VectorTile from '../../../../../src/ol/VectorTile.js'; import View from '../../../../../src/ol/View.js'; -import * as _ol_extent_ from '../../../../../src/ol/extent.js'; +import {getCenter} from '../../../../../src/ol/extent.js'; import MVT from '../../../../../src/ol/format/MVT.js'; import Point from '../../../../../src/ol/geom/Point.js'; import VectorTileLayer from '../../../../../src/ol/layer/VectorTile.js'; @@ -364,7 +364,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }) ], view: new View({ - center: _ol_extent_.getCenter(extent), + center: getCenter(extent), zoom: 19 }) }); diff --git a/test/spec/ol/tilegrid/tilegrid.test.js b/test/spec/ol/tilegrid/tilegrid.test.js index 6e77f340ff..2db2c7fa21 100644 --- a/test/spec/ol/tilegrid/tilegrid.test.js +++ b/test/spec/ol/tilegrid/tilegrid.test.js @@ -1,6 +1,6 @@ import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/common.js'; import TileRange from '../../../../src/ol/TileRange.js'; -import * as _ol_extent_ from '../../../../src/ol/extent.js'; +import {createOrUpdate} from '../../../../src/ol/extent.js'; import {get as getProjection, METERS_PER_UNIT} from '../../../../src/ol/proj.js'; import {HALF_SIZE} from '../../../../src/ol/proj/epsg3857.js'; import Projection from '../../../../src/ol/proj/Projection.js'; @@ -275,7 +275,7 @@ describe('ol.tilegrid.TileGrid', function() { describe('createForExtent', function() { it('allows creation of tile grid from extent', function() { - const extent = _ol_extent_.createOrUpdate(-100, -100, 100, 100); + const extent = createOrUpdate(-100, -100, 100, 100); const grid = createForExtent(extent); expect(grid).to.be.a(TileGrid); diff --git a/test/spec/ol/view.test.js b/test/spec/ol/view.test.js index 678a374ec1..c024db66b0 100644 --- a/test/spec/ol/view.test.js +++ b/test/spec/ol/view.test.js @@ -1,7 +1,7 @@ import Map from '../../../src/ol/Map.js'; import View, {createCenterConstraint, createResolutionConstraint, createRotationConstraint} from '../../../src/ol/View.js'; import ViewHint from '../../../src/ol/ViewHint.js'; -import * as _ol_extent_ from '../../../src/ol/extent.js'; +import {createEmpty} from '../../../src/ol/extent.js'; import Circle from '../../../src/ol/geom/Circle.js'; import LineString from '../../../src/ol/geom/LineString.js'; import Point from '../../../src/ol/geom/Point.js'; @@ -1348,7 +1348,7 @@ describe('ol.View', function() { }); it('throws on empty extent', function() { expect(function() { - view.fit(_ol_extent_.createEmpty()); + view.fit(createEmpty()); }).to.throwException(); }); it('animates when duration is defined', function(done) {