Merge pull request #7852 from nicholas-l/renameExtent

Rename extent
This commit is contained in:
Frédéric Junod
2018-02-19 13:42:20 +01:00
committed by GitHub
27 changed files with 80 additions and 80 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 GeoJSON from '../src/ol/format/GeoJSON.js';
import {DEVICE_PIXEL_RATIO} from '../src/ol/has.js'; import {DEVICE_PIXEL_RATIO} from '../src/ol/has.js';
import VectorLayer from '../src/ol/layer/Vector.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 // we just divide the geometry's extent width by resolution and multiply with
// pixelRatio to match the renderer's pixel coordinate system. // pixelRatio to match the renderer's pixel coordinate system.
const grad = context.createLinearGradient(0, 0, const grad = context.createLinearGradient(0, 0,
_ol_extent_.getWidth(extent) / resolution * pixelRatio, 0); getWidth(extent) / resolution * pixelRatio, 0);
grad.addColorStop(0, 'red'); grad.addColorStop(0, 'red');
grad.addColorStop(1 / 6, 'orange'); grad.addColorStop(1 / 6, 'orange');
grad.addColorStop(2 / 6, 'yellow'); grad.addColorStop(2 / 6, 'yellow');
+4 -4
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 KML from '../src/ol/format/KML.js';
import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js';
import Select from '../src/ol/interaction/Select.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) { for (let i = features.length - 1; i >= 0; --i) {
feature = features[i]; feature = features[i];
const originalFeatures = feature.get('features'); const originalFeatures = feature.get('features');
const extent = _ol_extent_.createEmpty(); const extent = createEmpty();
let j, jj; let j, jj;
for (j = 0, jj = originalFeatures.length; j < jj; ++j) { 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); maxFeatureCount = Math.max(maxFeatureCount, jj);
radius = 0.25 * (_ol_extent_.getWidth(extent) + _ol_extent_.getHeight(extent)) / radius = 0.25 * (getWidth(extent) + getHeight(extent)) /
resolution; resolution;
feature.set('radius', radius); feature.set('radius', radius);
} }
+3 -3
View File
@@ -1,7 +1,7 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.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 TileLayer from '../src/ol/layer/Tile.js';
import {toLonLat} from '../src/ol/proj.js'; import {toLonLat} from '../src/ol/proj.js';
import OSM from '../src/ol/source/OSM.js'; import OSM from '../src/ol/source/OSM.js';
@@ -37,8 +37,8 @@ function wrapLon(value) {
function onMoveEnd(evt) { function onMoveEnd(evt) {
const map = evt.map; const map = evt.map;
const extent = map.getView().calculateExtent(map.getSize()); const extent = map.getView().calculateExtent(map.getSize());
const bottomLeft = toLonLat(_ol_extent_.getBottomLeft(extent)); const bottomLeft = toLonLat(getBottomLeft(extent));
const topRight = toLonLat(_ol_extent_.getTopRight(extent)); const topRight = toLonLat(getTopRight(extent));
display('left', wrapLon(bottomLeft[0])); display('left', wrapLon(bottomLeft[0]));
display('bottom', bottomLeft[1]); display('bottom', bottomLeft[1]);
display('right', wrapLon(topRight[0])); display('right', wrapLon(topRight[0]));
+2 -2
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection, getTransform} from '../src/ol/proj.js'; import {get as getProjection, getTransform} from '../src/ol/proj.js';
import {register} from '../src/ol/proj/proj4.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); const fromLonLat = getTransform('EPSG:4326', newProj);
// very approximate calculation of projection extent // very approximate calculation of projection extent
const extent = _ol_extent_.applyTransform( const extent = applyTransform(
[bbox[1], bbox[2], bbox[3], bbox[0]], fromLonLat); [bbox[1], bbox[2], bbox[3], bbox[0]], fromLonLat);
newProj.setExtent(extent); newProj.setExtent(extent);
const newView = new View({ const newView = new View({
+3 -3
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 WMTSCapabilities from '../src/ol/format/WMTSCapabilities.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js'; import {get as getProjection} from '../src/ol/proj.js';
@@ -128,7 +128,7 @@ layers['grandcanyon'] = new TileLayer({
}); });
const startResolution = const startResolution =
_ol_extent_.getWidth(getProjection('EPSG:3857').getExtent()) / 256; getWidth(getProjection('EPSG:3857').getExtent()) / 256;
const resolutions = new Array(22); const resolutions = new Array(22);
for (let i = 0, ii = resolutions.length; i < ii; ++i) { for (let i = 0, ii = resolutions.length; i < ii; ++i) {
resolutions[i] = startResolution / Math.pow(2, i); resolutions[i] = startResolution / Math.pow(2, i);
@@ -175,7 +175,7 @@ function updateViewProjection() {
const newProjExtent = newProj.getExtent(); const newProjExtent = newProj.getExtent();
const newView = new View({ const newView = new View({
projection: newProj, projection: newProj,
center: _ol_extent_.getCenter(newProjExtent || [0, 0, 0, 0]), center: getCenter(newProjExtent || [0, 0, 0, 0]),
zoom: 0, zoom: 0,
extent: newProjExtent || undefined extent: newProjExtent || undefined
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 ImageLayer from '../src/ol/layer/Image.js';
import Projection from '../src/ol/proj/Projection.js'; import Projection from '../src/ol/proj/Projection.js';
import Static from '../src/ol/source/ImageStatic.js'; import Static from '../src/ol/source/ImageStatic.js';
@@ -30,7 +30,7 @@ const map = new Map({
target: 'map', target: 'map',
view: new View({ view: new View({
projection: projection, projection: projection,
center: _ol_extent_.getCenter(extent), center: getCenter(extent),
zoom: 2, zoom: 2,
maxZoom: 8 maxZoom: 8
}) })
+2 -2
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 GeoJSON from '../src/ol/format/GeoJSON.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import VectorLayer from '../src/ol/layer/Vector.js'; import VectorLayer from '../src/ol/layer/Vector.js';
@@ -41,7 +41,7 @@ const map = new Map({
target: 'map', target: 'map',
view: new View({ view: new View({
extent: viewExtent, extent: viewExtent,
center: _ol_extent_.getCenter(viewExtent), center: getCenter(viewExtent),
zoom: 17, zoom: 17,
minZoom: 14 minZoom: 14
}) })
+2 -2
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 GeoJSON from '../src/ol/format/GeoJSON.js';
import VectorLayer from '../src/ol/layer/Vector.js'; import VectorLayer from '../src/ol/layer/Vector.js';
import VectorSource from '../src/ol/source/Vector.js'; import VectorSource from '../src/ol/source/Vector.js';
@@ -26,7 +26,7 @@ const labelStyle = new Style({
let widest = 0; let widest = 0;
for (let i = 0, ii = polygons.length; i < ii; ++i) { for (let i = 0, ii = polygons.length; i < ii; ++i) {
const polygon = polygons[i]; const polygon = polygons[i];
const width = _ol_extent_.getWidth(polygon.getExtent()); const width = getWidth(polygon.getExtent());
if (width > widest) { if (width > widest) {
widest = width; widest = width;
geometry = polygon; geometry = polygon;
+2 -2
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js'; import {get as getProjection} from '../src/ol/proj.js';
import OSM from '../src/ol/source/OSM.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 projExtent = getProjection('EPSG:3857').getExtent();
const startResolution = _ol_extent_.getWidth(projExtent) / 256; const startResolution = getWidth(projExtent) / 256;
const resolutions = new Array(22); const resolutions = new Array(22);
for (let i = 0, ii = resolutions.length; i < ii; ++i) { for (let i = 0, ii = resolutions.length; i < ii; ++i) {
resolutions[i] = startResolution / Math.pow(2, i); resolutions[i] = startResolution / Math.pow(2, i);
+2 -2
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 TileLayer from '../src/ol/layer/Tile.js';
import {transformExtent} from '../src/ol/proj.js'; import {transformExtent} from '../src/ol/proj.js';
import Stamen from '../src/ol/source/Stamen.js'; import Stamen from '../src/ol/source/Stamen.js';
@@ -34,7 +34,7 @@ const map = new Map({
layers: layers, layers: layers,
target: 'map', target: 'map',
view: new View({ view: new View({
center: _ol_extent_.getCenter(extent), center: getCenter(extent),
zoom: 4 zoom: 4
}) })
}); });
+3 -3
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.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 TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js'; import {get as getProjection} from '../src/ol/proj.js';
import OSM from '../src/ol/source/OSM.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 // create the WMTS tile grid in the google projection
const projection = getProjection('EPSG:3857'); const projection = getProjection('EPSG:3857');
const tileSizePixels = 256; const tileSizePixels = 256;
const tileSizeMtrs = _ol_extent_.getWidth(projection.getExtent()) / tileSizePixels; const tileSizeMtrs = getWidth(projection.getExtent()) / tileSizePixels;
const matrixIds = []; const matrixIds = [];
const resolutions = []; const resolutions = [];
for (let i = 0; i <= 14; i++) { 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); resolutions[i] = tileSizeMtrs / Math.pow(2, i);
} }
const tileGrid = new WMTSTileGrid({ const tileGrid = new WMTSTileGrid({
origin: _ol_extent_.getTopLeft(projection.getExtent()), origin: getTopLeft(projection.getExtent()),
resolutions: resolutions, resolutions: resolutions,
matrixIds: matrixIds matrixIds: matrixIds
}); });
+2 -2
View File
@@ -1,7 +1,7 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.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 TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat, get as getProjection} from '../src/ol/proj.js'; import {fromLonLat, get as getProjection} from '../src/ol/proj.js';
import WMTS from '../src/ol/source/WMTS.js'; import WMTS from '../src/ol/source/WMTS.js';
@@ -24,7 +24,7 @@ const map = new Map({
const resolutions = []; const resolutions = [];
const matrixIds = []; const matrixIds = [];
const proj3857 = getProjection('EPSG:3857'); 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++) { for (let i = 0; i < 18; i++) {
matrixIds[i] = i.toString(); matrixIds[i] = i.toString();
+3 -3
View File
@@ -1,7 +1,7 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.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 TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js'; import {get as getProjection} from '../src/ol/proj.js';
import OSM from '../src/ol/source/OSM.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 projection = getProjection('EPSG:3857');
const projectionExtent = projection.getExtent(); const projectionExtent = projection.getExtent();
const size = _ol_extent_.getWidth(projectionExtent) / 256; const size = getWidth(projectionExtent) / 256;
const resolutions = new Array(14); const resolutions = new Array(14);
const matrixIds = new Array(14); const matrixIds = new Array(14);
for (let z = 0; z < 14; ++z) { for (let z = 0; z < 14; ++z) {
@@ -38,7 +38,7 @@ const map = new Map({
format: 'image/png', format: 'image/png',
projection: projection, projection: projection,
tileGrid: new WMTSTileGrid({ tileGrid: new WMTSTileGrid({
origin: _ol_extent_.getTopLeft(projectionExtent), origin: getTopLeft(projectionExtent),
resolutions: resolutions, resolutions: resolutions,
matrixIds: matrixIds matrixIds: matrixIds
}), }),
+3 -3
View File
@@ -1,6 +1,6 @@
import Map from '../../../../src/ol/Map.js'; import Map from '../../../../src/ol/Map.js';
import View from '../../../../src/ol/View.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 Point from '../../../../src/ol/geom/Point.js';
import TileLayer from '../../../../src/ol/layer/Tile.js'; import TileLayer from '../../../../src/ol/layer/Tile.js';
import {assign} from '../../../../src/ol/obj.js'; import {assign} from '../../../../src/ol/obj.js';
@@ -146,8 +146,8 @@ describe('ol.rendering.layer.Tile', function() {
function centerExtent(map) { function centerExtent(map) {
const c = map.getView().calculateExtent(map.getSize()); const c = map.getView().calculateExtent(map.getSize());
const qw = _ol_extent_.getSize(c)[0] / 4; const qw = getSize(c)[0] / 4;
const qh = _ol_extent_.getSize(c)[1] / 4; const qh = getSize(c)[1] / 4;
return [c[0] + qw, c[1] + qh, c[2] - qw, c[3] - qh]; return [c[0] + qw, c[1] + qh, c[2] - qw, c[3] - qh];
} }
+3 -3
View File
@@ -1,5 +1,5 @@
import Feature from '../../../../src/ol/Feature.js'; 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 EsriJSON from '../../../../src/ol/format/EsriJSON.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import LinearRing from '../../../../src/ol/geom/LinearRing.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js';
@@ -305,7 +305,7 @@ describe('ol.format.EsriJSON', function() {
expect(first.getId()).to.be(6406); expect(first.getId()).to.be(6406);
const firstGeom = first.getGeometry(); const firstGeom = first.getGeometry();
expect(firstGeom).to.be.a(Polygon); expect(firstGeom).to.be.a(Polygon);
expect(_ol_extent_.equals(firstGeom.getExtent(), [ expect(equals(firstGeom.getExtent(), [
-10585772.743554419, 4712365.161160459, -10585772.743554419, 4712365.161160459,
-10579560.16462974, 4716567.373073828 -10579560.16462974, 4716567.373073828
])).to.be(true); ])).to.be(true);
@@ -316,7 +316,7 @@ describe('ol.format.EsriJSON', function() {
expect(last.getId()).to.be(6030); expect(last.getId()).to.be(6030);
const lastGeom = last.getGeometry(); const lastGeom = last.getGeometry();
expect(lastGeom).to.be.a(Polygon); expect(lastGeom).to.be.a(Polygon);
expect(_ol_extent_.equals(lastGeom.getExtent(), [ expect(equals(lastGeom.getExtent(), [
-10555714.026858449, 4576511.565880965, -10555714.026858449, 4576511.565880965,
-10553671.199322715, 4578554.9934867555 -10553671.199322715, 4578554.9934867555
])).to.be(true); ])).to.be(true);
+3 -3
View File
@@ -1,5 +1,5 @@
import Feature from '../../../../src/ol/Feature.js'; 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 GeoJSON from '../../../../src/ol/format/GeoJSON.js';
import Circle from '../../../../src/ol/geom/Circle.js'; import Circle from '../../../../src/ol/geom/Circle.js';
import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js';
@@ -302,7 +302,7 @@ describe('ol.format.GeoJSON', function() {
expect(first.getId()).to.be('AFG'); expect(first.getId()).to.be('AFG');
const firstGeom = first.getGeometry(); const firstGeom = first.getGeometry();
expect(firstGeom).to.be.a(Polygon); expect(firstGeom).to.be.a(Polygon);
expect(_ol_extent_.equals(firstGeom.getExtent(), expect(equals(firstGeom.getExtent(),
[60.52843, 29.318572, 75.158028, 38.486282])) [60.52843, 29.318572, 75.158028, 38.486282]))
.to.be(true); .to.be(true);
@@ -312,7 +312,7 @@ describe('ol.format.GeoJSON', function() {
expect(last.getId()).to.be('ZWE'); expect(last.getId()).to.be('ZWE');
const lastGeom = last.getGeometry(); const lastGeom = last.getGeometry();
expect(lastGeom).to.be.a(Polygon); expect(lastGeom).to.be.a(Polygon);
expect(_ol_extent_.equals(lastGeom.getExtent(), expect(equals(lastGeom.getExtent(),
[25.264226, -22.271612, 32.849861, -15.507787])) [25.264226, -22.271612, 32.849861, -15.507787]))
.to.be(true); .to.be(true);
done(); done();
+2 -2
View File
@@ -1,5 +1,5 @@
import Feature from '../../../../src/ol/Feature.js'; 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 MVT from '../../../../src/ol/format/MVT.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.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(); const format = new MVT();
format.readFeatures(data); format.readFeatures(data);
const extent = format.getLastExtent(); const extent = format.getLastExtent();
expect(_ol_extent_.getWidth(extent)).to.be(4096); expect(getWidth(extent)).to.be(4096);
}); });
}); });
+2 -2
View File
@@ -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 LineString from '../../../../src/ol/geom/LineString.js';
@@ -26,7 +26,7 @@ describe('ol.geom.LineString', function() {
}); });
it('has an empty extent', 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() { it('has empty flat coordinates', function() {
+2 -2
View File
@@ -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 LineString from '../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
@@ -27,7 +27,7 @@ describe('ol.geom.MultiLineString', function() {
}); });
it('has an empty extent', 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() { it('has empty flat coordinates', function() {
+2 -2
View File
@@ -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 MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
@@ -27,7 +27,7 @@ describe('ol.geom.MultiPoint', function() {
}); });
it('has an empty extent', 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() { it('has empty flat coordinates', function() {
+15 -15
View File
@@ -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 Circle from '../../../../src/ol/geom/Circle.js';
import LinearRing from '../../../../src/ol/geom/LinearRing.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js';
import Polygon, {fromCircle, fromExtent} from '../../../../src/ol/geom/Polygon.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() { 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() { it('has empty flat coordinates', function() {
@@ -221,25 +221,25 @@ describe('ol/geom/Polygon', function() {
it('does not intersect outside extent', function() { it('does not intersect outside extent', function() {
expect(polygon.intersectsExtent( expect(polygon.intersectsExtent(
_ol_extent_.boundingExtent([outsideOuter]))).to.be(false); boundingExtent([outsideOuter]))).to.be(false);
}); });
it('does intersect inside extent', function() { it('does intersect inside extent', function() {
expect(polygon.intersectsExtent( expect(polygon.intersectsExtent(
_ol_extent_.boundingExtent([inside]))).to.be(true); boundingExtent([inside]))).to.be(true);
}); });
it('does intersect boundary extent', function() { it('does intersect boundary extent', function() {
const firstMidX = (outerRing[0][0] + outerRing[1][0]) / 2; const firstMidX = (outerRing[0][0] + outerRing[1][0]) / 2;
const firstMidY = (outerRing[0][1] + outerRing[1][1]) / 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); firstMidY]]))).to.be(true);
}); });
it('does not intersect extent fully contained by inner ring', function() { it('does not intersect extent fully contained by inner ring', function() {
expect(polygon.intersectsExtent( 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() { it('does not intersect outside extent', function() {
expect(polygon.intersectsExtent( expect(polygon.intersectsExtent(
_ol_extent_.boundingExtent([outsideOuter]))).to.be(false); boundingExtent([outsideOuter]))).to.be(false);
}); });
it('does intersect inside extent', function() { it('does intersect inside extent', function() {
expect(polygon.intersectsExtent( expect(polygon.intersectsExtent(
_ol_extent_.boundingExtent([inside]))).to.be(true); boundingExtent([inside]))).to.be(true);
}); });
it('does intersect boundary extent', function() { it('does intersect boundary extent', function() {
const firstMidX = (outerRing[0][0] + outerRing[1][0]) / 2; const firstMidX = (outerRing[0][0] + outerRing[1][0]) / 2;
const firstMidY = (outerRing[0][1] + outerRing[1][1]) / 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); firstMidY]]))).to.be(true);
}); });
it('does not intersect extent fully contained by inner ring', function() { it('does not intersect extent fully contained by inner ring', function() {
expect(polygon.intersectsExtent( 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() { it('does not intersect outside extent', function() {
expect(polygon.intersectsExtent( expect(polygon.intersectsExtent(
_ol_extent_.boundingExtent([outsideOuter]))).to.be(false); boundingExtent([outsideOuter]))).to.be(false);
}); });
it('does intersect inside extent', function() { it('does intersect inside extent', function() {
expect(polygon.intersectsExtent( expect(polygon.intersectsExtent(
_ol_extent_.boundingExtent([inside]))).to.be(true); boundingExtent([inside]))).to.be(true);
}); });
it('does intersect boundary extent', function() { it('does intersect boundary extent', function() {
const firstMidX = (outerRing[0][0] + outerRing[1][0]) / 2; const firstMidX = (outerRing[0][0] + outerRing[1][0]) / 2;
const firstMidY = (outerRing[0][1] + outerRing[1][1]) / 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); firstMidY]]))).to.be(true);
}); });
it('does not intersect extent fully contained by inner ring', function() { it('does not intersect extent fully contained by inner ring', function() {
expect(polygon.intersectsExtent( expect(polygon.intersectsExtent(
_ol_extent_.boundingExtent([insideInner1]))).to.be(false); boundingExtent([insideInner1]))).to.be(false);
expect(polygon.intersectsExtent( expect(polygon.intersectsExtent(
_ol_extent_.boundingExtent([insideInner2]))).to.be(false); boundingExtent([insideInner2]))).to.be(false);
}); });
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import Map from '../../../../src/ol/Map.js'; import Map from '../../../../src/ol/Map.js';
import View from '../../../../src/ol/View.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 {fromExtent as polygonFromExtent} from '../../../../src/ol/geom/Polygon.js';
import DragZoom from '../../../../src/ol/interaction/DragZoom.js'; import DragZoom from '../../../../src/ol/interaction/DragZoom.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js';
@@ -79,7 +79,7 @@ describe('ol.interaction.DragZoom', function() {
setTimeout(function() { setTimeout(function() {
const view = map.getView(); const view = map.getView();
const center = view.getCenter(); const center = view.getCenter();
expect(center).to.eql(_ol_extent_.getCenter(extent)); expect(center).to.eql(getCenter(extent));
done(); done();
}, 50); }, 50);
+2 -2
View File
@@ -1,7 +1,7 @@
import {getUid} from '../../../../src/ol/index.js'; import {getUid} from '../../../../src/ol/index.js';
import {stableSort} from '../../../../src/ol/array.js'; import {stableSort} from '../../../../src/ol/array.js';
import Collection from '../../../../src/ol/Collection.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 LayerGroup from '../../../../src/ol/layer/Group.js';
import Layer from '../../../../src/ol/layer/Layer.js'; import Layer from '../../../../src/ol/layer/Layer.js';
import {assign} from '../../../../src/ol/obj.js'; import {assign} from '../../../../src/ol/obj.js';
@@ -403,7 +403,7 @@ describe('ol.layer.Group', function() {
}); });
const layerStatesArray = layerGroup.getLayerStatesArray(); const layerStatesArray = layerGroup.getLayerStatesArray();
expect(layerStatesArray[0].extent).to.eql( expect(layerStatesArray[0].extent).to.eql(
_ol_extent_.getIntersection(layer3.getExtent(), groupExtent)); getIntersection(layer3.getExtent(), groupExtent));
layerGroup.dispose(); layerGroup.dispose();
}); });
@@ -2,7 +2,7 @@ import {getUid} from '../../../../../src/ol/index.js';
import Feature from '../../../../../src/ol/Feature.js'; import Feature from '../../../../../src/ol/Feature.js';
import Map from '../../../../../src/ol/Map.js'; import Map from '../../../../../src/ol/Map.js';
import View from '../../../../../src/ol/View.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 Point from '../../../../../src/ol/geom/Point.js';
import VectorLayer from '../../../../../src/ol/layer/Vector.js'; import VectorLayer from '../../../../../src/ol/layer/Vector.js';
import {clear} from '../../../../../src/ol/obj.js'; import {clear} from '../../../../../src/ol/obj.js';
@@ -228,7 +228,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
renderer = new CanvasVectorLayerRenderer(layer); renderer = new CanvasVectorLayerRenderer(layer);
const projection = getProjection('EPSG:3857'); const projection = getProjection('EPSG:3857');
projExtent = projection.getExtent(); projExtent = projection.getExtent();
worldWidth = _ol_extent_.getWidth(projExtent); worldWidth = getWidth(projExtent);
buffer = layer.getRenderBuffer(); buffer = layer.getRenderBuffer();
frameState = { frameState = {
skippedFeatureUids: {}, skippedFeatureUids: {},
@@ -246,7 +246,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
frameState.extent = frameState.extent =
[projExtent[0] - 10000, -10000, projExtent[0] + 10000, 10000]; [projExtent[0] - 10000, -10000, projExtent[0] + 10000, 10000];
renderer.prepareFrame(frameState, {}); renderer.prepareFrame(frameState, {});
expect(renderer.replayGroup_.maxExtent_).to.eql(_ol_extent_.buffer([ expect(renderer.replayGroup_.maxExtent_).to.eql(bufferExtent([
projExtent[0] - worldWidth + buffer, projExtent[0] - worldWidth + buffer,
-10000, projExtent[2] + worldWidth - buffer, 10000 -10000, projExtent[2] + worldWidth - buffer, 10000
], buffer)); ], buffer));
@@ -258,7 +258,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
frameState.extent = frameState.extent =
[projExtent[0] - 10000, -10000, projExtent[1] - 10000, 10000]; [projExtent[0] - 10000, -10000, projExtent[1] - 10000, 10000];
renderer.prepareFrame(frameState, {}); renderer.prepareFrame(frameState, {});
expect(renderer.replayGroup_.maxExtent_).to.eql(_ol_extent_.buffer([ expect(renderer.replayGroup_.maxExtent_).to.eql(bufferExtent([
projExtent[0] - worldWidth + buffer, projExtent[0] - worldWidth + buffer,
-10000, projExtent[2] + worldWidth - buffer, 10000 -10000, projExtent[2] + worldWidth - buffer, 10000
], buffer)); ], buffer));
@@ -269,7 +269,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
frameState.extent = frameState.extent =
[2 * projExtent[0] - 10000, -10000, 2 * projExtent[1] + 10000, 10000]; [2 * projExtent[0] - 10000, -10000, 2 * projExtent[1] + 10000, 10000];
renderer.prepareFrame(frameState, {}); renderer.prepareFrame(frameState, {});
expect(renderer.replayGroup_.maxExtent_).to.eql(_ol_extent_.buffer([ expect(renderer.replayGroup_.maxExtent_).to.eql(bufferExtent([
projExtent[0] - worldWidth + buffer, projExtent[0] - worldWidth + buffer,
-10000, projExtent[2] + worldWidth - buffer, 10000 -10000, projExtent[2] + worldWidth - buffer, 10000
], buffer)); ], buffer));
@@ -282,7 +282,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
-10000, projExtent[1] + 2 * worldWidth + 10000, 10000 -10000, projExtent[1] + 2 * worldWidth + 10000, 10000
]; ];
renderer.prepareFrame(frameState, {}); renderer.prepareFrame(frameState, {});
expect(renderer.replayGroup_.maxExtent_).to.eql(_ol_extent_.buffer([ expect(renderer.replayGroup_.maxExtent_).to.eql(bufferExtent([
projExtent[0] - 2 * worldWidth - 10000, projExtent[0] - 2 * worldWidth - 10000,
-10000, projExtent[2] + 2 * worldWidth + 10000, 10000 -10000, projExtent[2] + 2 * worldWidth + 10000, 10000
], buffer)); ], buffer));
@@ -6,7 +6,7 @@ import TileState from '../../../../../src/ol/TileState.js';
import VectorImageTile from '../../../../../src/ol/VectorImageTile.js'; import VectorImageTile from '../../../../../src/ol/VectorImageTile.js';
import VectorTile from '../../../../../src/ol/VectorTile.js'; import VectorTile from '../../../../../src/ol/VectorTile.js';
import View from '../../../../../src/ol/View.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 MVT from '../../../../../src/ol/format/MVT.js';
import Point from '../../../../../src/ol/geom/Point.js'; import Point from '../../../../../src/ol/geom/Point.js';
import VectorTileLayer from '../../../../../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../../../../../src/ol/layer/VectorTile.js';
@@ -364,7 +364,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
}) })
], ],
view: new View({ view: new View({
center: _ol_extent_.getCenter(extent), center: getCenter(extent),
zoom: 19 zoom: 19
}) })
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/common.js'; import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/common.js';
import TileRange from '../../../../src/ol/TileRange.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 {get as getProjection, METERS_PER_UNIT} from '../../../../src/ol/proj.js';
import {HALF_SIZE} from '../../../../src/ol/proj/epsg3857.js'; import {HALF_SIZE} from '../../../../src/ol/proj/epsg3857.js';
import Projection from '../../../../src/ol/proj/Projection.js'; import Projection from '../../../../src/ol/proj/Projection.js';
@@ -275,7 +275,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('createForExtent', function() { describe('createForExtent', function() {
it('allows creation of tile grid from extent', 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); const grid = createForExtent(extent);
expect(grid).to.be.a(TileGrid); expect(grid).to.be.a(TileGrid);
+2 -2
View File
@@ -1,7 +1,7 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View, {createCenterConstraint, createResolutionConstraint, createRotationConstraint} from '../../../src/ol/View.js'; import View, {createCenterConstraint, createResolutionConstraint, createRotationConstraint} from '../../../src/ol/View.js';
import ViewHint from '../../../src/ol/ViewHint.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 Circle from '../../../src/ol/geom/Circle.js';
import LineString from '../../../src/ol/geom/LineString.js'; import LineString from '../../../src/ol/geom/LineString.js';
import Point from '../../../src/ol/geom/Point.js'; import Point from '../../../src/ol/geom/Point.js';
@@ -1348,7 +1348,7 @@ describe('ol.View', function() {
}); });
it('throws on empty extent', function() { it('throws on empty extent', function() {
expect(function() { expect(function() {
view.fit(_ol_extent_.createEmpty()); view.fit(createEmpty());
}).to.throwException(); }).to.throwException();
}); });
it('animates when duration is defined', function(done) { it('animates when duration is defined', function(done) {