Named exports from ol/proj

This commit is contained in:
Tim Schaub
2017-12-13 22:14:27 -07:00
committed by Andreas Hocevar
parent fab77e8d37
commit 6f72ffe498
127 changed files with 853 additions and 882 deletions

View File

@@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_Cluster_ from '../../../../src/ol/source/Cluster.js';
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -12,7 +12,7 @@ describe('ol.source.Cluster', function() {
describe('constructor', function() {
it('returns a cluster source', function() {
var source = new _ol_source_Cluster_({
projection: _ol_proj_.get('EPSG:4326'),
projection: getProjection('EPSG:4326'),
source: new _ol_source_Vector_()
});
expect(source).to.be.a(_ol_source_Source_);
@@ -23,7 +23,7 @@ describe('ol.source.Cluster', function() {
describe('#loadFeatures', function() {
var extent = [-1, -1, 1, 1];
var projection = _ol_proj_.get('EPSG:3857');
var projection = getProjection('EPSG:3857');
it('clusters a source with point features', function() {
var source = new _ol_source_Cluster_({
source: new _ol_source_Vector_({

View File

@@ -1,5 +1,5 @@
import _ol_source_ImageArcGISRest_ from '../../../../src/ol/source/ImageArcGISRest.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
describe('ol.source.ImageArcGISRest', function() {
@@ -7,8 +7,8 @@ describe('ol.source.ImageArcGISRest', function() {
var pixelRatio, options, projection, proj3857, resolution;
beforeEach(function() {
pixelRatio = 1;
projection = _ol_proj_.get('EPSG:4326');
proj3857 = _ol_proj_.get('EPSG:3857');
projection = getProjection('EPSG:4326');
proj3857 = getProjection('EPSG:3857');
resolution = 0.1;
options = {
params: {},

View File

@@ -1,5 +1,5 @@
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
describe('ol.source.ImageStatic', function() {
@@ -10,7 +10,7 @@ describe('ol.source.ImageStatic', function() {
-13637278.73946974, 4543799.13271362,
-13617443.330629736, 4553927.038961405];
pixelRatio = 1;
projection = _ol_proj_.get('EPSG:3857');
projection = getProjection('EPSG:3857');
resolution = 38;
});

View File

@@ -1,5 +1,5 @@
import _ol_source_ImageWMS_ from '../../../../src/ol/source/ImageWMS.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
describe('ol.source.ImageWMS', function() {
@@ -8,7 +8,7 @@ describe('ol.source.ImageWMS', function() {
beforeEach(function() {
extent = [10, 20, 30, 40];
pixelRatio = 1;
projection = _ol_proj_.get('EPSG:4326');
projection = getProjection('EPSG:4326');
resolution = 0.1;
options = {
params: {
@@ -121,7 +121,7 @@ describe('ol.source.ImageWMS', function() {
it('changes the BBOX order for EN axis orientations', function() {
var source = new _ol_source_ImageWMS_(options);
projection = _ol_proj_.get('CRS:84');
projection = getProjection('CRS:84');
var image = source.getImage(extent, resolution, pixelRatio, projection);
var uri = new URL(image.src_);
var queryData = uri.searchParams;

View File

@@ -1,4 +1,4 @@
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
@@ -7,7 +7,7 @@ describe('ol.source.Source', function() {
describe('constructor', function() {
it('returns a source', function() {
var source = new _ol_source_Source_({
projection: _ol_proj_.get('EPSG:4326')
projection: getProjection('EPSG:4326')
});
expect(source).to.be.a(_ol_source_Source_);
});
@@ -68,7 +68,7 @@ describe('ol.source.Source', function() {
describe('#refresh()', function() {
it('dispatches the change event', function() {
var source = new _ol_source_Source_({
projection: _ol_proj_.get('EPSG:4326')
projection: getProjection('EPSG:4326')
});
var changedSpy = sinon.spy();
source.on('change', changedSpy);

View File

@@ -1,7 +1,7 @@
import {inherits} from '../../../../src/ol/index.js';
import _ol_Tile_ from '../../../../src/ol/Tile.js';
import _ol_TileRange_ from '../../../../src/ol/TileRange.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
@@ -26,7 +26,7 @@ var MockTile = function(tileStates) {
});
_ol_source_Tile_.call(this, {
projection: _ol_proj_.get('EPSG:4326'),
projection: getProjection('EPSG:4326'),
tileGrid: tileGrid
});
@@ -57,13 +57,13 @@ describe('ol.source.Tile', function() {
describe('constructor', function() {
it('returns a tile source', function() {
var source = new _ol_source_Tile_({
projection: _ol_proj_.get('EPSG:4326')
projection: getProjection('EPSG:4326')
});
expect(source).to.be.a(_ol_source_Source_);
expect(source).to.be.a(_ol_source_Tile_);
});
it('sets a custom cache size', function() {
var projection = _ol_proj_.get('EPSG:4326');
var projection = getProjection('EPSG:4326');
var source = new _ol_source_Tile_({
projection: projection,
cacheSize: 42

View File

@@ -1,6 +1,6 @@
import _ol_ImageTile_ from '../../../../src/ol/ImageTile.js';
import _ol_source_TileArcGISRest_ from '../../../../src/ol/source/TileArcGISRest.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
describe('ol.source.TileArcGISRest', function() {
@@ -17,7 +17,7 @@ describe('ol.source.TileArcGISRest', function() {
it('returns a tile with the expected URL', function() {
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -7, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(_ol_ImageTile_);
var uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
@@ -39,7 +39,7 @@ describe('ol.source.TileArcGISRest', function() {
it('returns a non floating point DPI value', function() {
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -7, 1.12, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1.12, getProjection('EPSG:3857'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('DPI')).to.be('101');
@@ -48,7 +48,7 @@ describe('ol.source.TileArcGISRest', function() {
it('takes DPI from params if specified', function() {
options.params.DPI = 96;
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -7, 1.12, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1.12, getProjection('EPSG:3857'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('DPI')).to.be('108');
@@ -60,7 +60,7 @@ describe('ol.source.TileArcGISRest', function() {
options.urls = ['http://test1.com/MapServer', 'http://test2.com/MapServer'];
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -7, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(_ol_ImageTile_);
var uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
@@ -83,7 +83,7 @@ describe('ol.source.TileArcGISRest', function() {
it('returns a tile with the expected URL for ImageServer', function() {
options.url = 'http://example.com/ImageServer';
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -7, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(_ol_ImageTile_);
var uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
@@ -106,7 +106,7 @@ describe('ol.source.TileArcGISRest', function() {
options.params.FORMAT = 'png';
options.params.TRANSPARENT = false;
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('FORMAT')).to.be('png');
@@ -116,7 +116,7 @@ describe('ol.source.TileArcGISRest', function() {
it('allows adding rest option', function() {
options.params.LAYERS = 'show:1,3,4';
var source = new _ol_source_TileArcGISRest_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('LAYERS')).to.be('show:1,3,4');
@@ -129,7 +129,7 @@ describe('ol.source.TileArcGISRest', function() {
var source = new _ol_source_TileArcGISRest_(options);
source.updateParams({'TEST': 'value'});
var tile = source.getTile(3, 2, -7, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('TEST')).to.be('value');
@@ -141,7 +141,7 @@ describe('ol.source.TileArcGISRest', function() {
var source = new _ol_source_TileArcGISRest_(options);
source.updateParams({'TEST': 'newValue'});
var tile = source.getTile(3, 2, -7, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('TEST')).to.be('newValue');
@@ -245,7 +245,7 @@ describe('ol.source.TileArcGISRest', function() {
expect(urls).to.eql(['http://test3.com/MapServer']);
var tileUrl = source.tileUrlFunction([0, 0, 0], 1, _ol_proj_.get('EPSG:4326'));
var tileUrl = source.tileUrlFunction([0, 0, 0], 1, getProjection('EPSG:4326'));
expect(tileUrl.indexOf(urls[0])).to.be(0);
});

View File

@@ -2,7 +2,7 @@ import _ol_ImageTile_ from '../../../../src/ol/ImageTile.js';
import _ol_TileState_ from '../../../../src/ol/TileState.js';
import _ol_TileUrlFunction_ from '../../../../src/ol/TileUrlFunction.js';
import _ol_events_ from '../../../../src/ol/events.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import _ol_reproj_Tile_ from '../../../../src/ol/reproj/Tile.js';
@@ -27,7 +27,7 @@ describe('ol.source.TileImage', function() {
describe('#getTileCacheForProjection', function() {
it('uses the cacheSize for reprojected tile caches', function() {
var source = createSource(undefined, undefined, 42);
var tileCache = source.getTileCacheForProjection(_ol_proj_.get('EPSG:4326'));
var tileCache = source.getTileCacheForProjection(getProjection('EPSG:4326'));
expect(tileCache.highWaterMark).to.be(42);
expect(tileCache).to.not.equal(source.getTileCacheForProjection(source.getProjection()));
});
@@ -38,7 +38,7 @@ describe('ol.source.TileImage', function() {
var source = createSource();
var tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 3, [10, 20]);
source.setTileGridForProjection('EPSG:4326', tileGrid);
var retrieved = source.getTileGridForProjection(_ol_proj_.get('EPSG:4326'));
var retrieved = source.getTileGridForProjection(getProjection('EPSG:4326'));
expect(retrieved).to.be(tileGrid);
});
});
@@ -49,14 +49,14 @@ describe('ol.source.TileImage', function() {
beforeEach(function() {
source = createSource();
expect(source.getKey()).to.be('');
source.getTileInternal(0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
source.getTileInternal(0, 0, -1, 1, getProjection('EPSG:3857'));
expect(source.tileCache.getCount()).to.be(1);
tile = source.tileCache.get(_ol_tilecoord_.getKeyZXY(0, 0, -1));
});
it('gets the tile from the cache', function() {
var returnedTile = source.getTileInternal(
0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
0, 0, -1, 1, getProjection('EPSG:3857'));
expect(returnedTile).to.be(tile);
});
@@ -68,7 +68,7 @@ describe('ol.source.TileImage', function() {
return 'key0';
};
var returnedTile = source.getTileInternal(
0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
0, 0, -1, 1, getProjection('EPSG:3857'));
expect(returnedTile).not.to.be(tile);
expect(returnedTile.key).to.be('key0');
expect(returnedTile.interimTile).to.be(null);
@@ -82,7 +82,7 @@ describe('ol.source.TileImage', function() {
};
tile.state = 2; // LOADED
var returnedTile = source.getTileInternal(
0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
0, 0, -1, 1, getProjection('EPSG:3857'));
expect(returnedTile).not.to.be(tile);
expect(returnedTile.key).to.be('key0');
expect(returnedTile.interimTile).to.be(tile);
@@ -98,10 +98,10 @@ describe('ol.source.TileImage', function() {
dynamicParamsKey = 'key0';
tile.state = 2; // LOADED
returnedTile = source.getTileInternal(
0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
0, 0, -1, 1, getProjection('EPSG:3857'));
dynamicParamsKey = 'key1';
returnedTile = source.getTileInternal(
0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
0, 0, -1, 1, getProjection('EPSG:3857'));
expect(returnedTile).not.to.be(tile);
expect(returnedTile.key).to.be('key1');
expect(returnedTile.interimTile).to.be(tile);
@@ -115,7 +115,7 @@ describe('ol.source.TileImage', function() {
describe('#getTile', function() {
it('does not do reprojection for identity', function() {
var source3857 = createSource('EPSG:3857');
var tile3857 = source3857.getTile(0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
var tile3857 = source3857.getTile(0, 0, -1, 1, getProjection('EPSG:3857'));
expect(tile3857).to.be.a(_ol_ImageTile_);
expect(tile3857).not.to.be.a(_ol_reproj_Tile_);
@@ -142,7 +142,7 @@ describe('ol.source.TileImage', function() {
extent: [-180, -90, 180, 90],
tileSize: [2, 2]
}));
var tile = source.getTile(0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(0, 0, -1, 1, getProjection('EPSG:3857'));
expect(tile).to.be.a(_ol_reproj_Tile_);
_ol_events_.listen(tile, 'change', function() {
@@ -154,7 +154,7 @@ describe('ol.source.TileImage', function() {
});
it('can handle target projection without extent and units', function(done) {
var proj = _ol_proj_.get('4326_noextentnounits');
var proj = getProjection('4326_noextentnounits');
var source = createSource();
source.setTileGridForProjection(proj,
_ol_tilegrid_.createXYZ({
@@ -191,7 +191,7 @@ describe('ol.source.TileImage', function() {
source.on('tileloadstart', startSpy);
var endSpy = sinon.spy();
source.on('tileloadend', endSpy);
var tile = source.getTile(0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(0, 0, -1, 1, getProjection('EPSG:3857'));
tile.load();
expect(startSpy.callCount).to.be(1);
expect(endSpy.callCount).to.be(1);
@@ -217,7 +217,7 @@ describe('ol.source.TileImage', function() {
expect(errorSpy.callCount).to.be(1);
done();
});
var tile = source.getTile(0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(0, 0, -1, 1, getProjection('EPSG:3857'));
tile.load();
});
@@ -227,7 +227,7 @@ describe('ol.source.TileImage', function() {
source.on('tileloadstart', startSpy);
var endSpy = sinon.spy();
source.on('tileloadend', endSpy);
var tile = source.getTile(0, 0, -1, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(0, 0, -1, 1, getProjection('EPSG:3857'));
tile.load();
tile.dispose();
expect(startSpy.callCount).to.be(1);

View File

@@ -1,4 +1,4 @@
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection, transformExtent, fromLonLat} from '../../../../src/ol/proj.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import _ol_source_TileUTFGrid_ from '../../../../src/ol/source/TileUTFGrid.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
@@ -113,10 +113,10 @@ describe('ol.source.TileUTFGrid', function() {
var tileGrid = source.getTileGrid();
var extent = tileGrid.getExtent();
var proj4326 = _ol_proj_.get('EPSG:4326');
var proj3857 = _ol_proj_.get('EPSG:3857');
var proj4326 = getProjection('EPSG:4326');
var proj3857 = getProjection('EPSG:3857');
var expectedExtent4326 = tileJson.bounds;
var expectedExtent3857 = _ol_proj_.transformExtent(
var expectedExtent3857 = transformExtent(
expectedExtent4326, proj4326, proj3857
);
expect(extent).to.eql(proj3857.getExtent());
@@ -189,7 +189,7 @@ describe('ol.source.TileUTFGrid', function() {
describe('#forDataAtCoordinateAndResolution', function() {
var source = null;
var bonn3857 = _ol_proj_.fromLonLat([7.099814, 50.733992]);
var bonn3857 = fromLonLat([7.099814, 50.733992]);
var noState3857 = [0, 0];
var resolutionZoom1 = 78271.51696402048;

View File

@@ -1,5 +1,5 @@
import _ol_ImageTile_ from '../../../../src/ol/ImageTile.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_TileWMS_ from '../../../../src/ol/source/TileWMS.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
@@ -38,7 +38,7 @@ describe('ol.source.TileWMS', function() {
it('returns a tile with the expected URL', function() {
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -7, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(_ol_ImageTile_);
var uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
@@ -67,7 +67,7 @@ describe('ol.source.TileWMS', function() {
it('returns a larger tile when a gutter is specified', function() {
options.gutter = 16;
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -7, 1, _ol_proj_.get('EPSG:3857'));
var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(_ol_ImageTile_);
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
@@ -84,7 +84,7 @@ describe('ol.source.TileWMS', function() {
it('sets the SRS query value instead of CRS if version < 1.3', function() {
options.params.VERSION = '1.2';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('CRS')).to.be(null);
@@ -95,7 +95,7 @@ describe('ol.source.TileWMS', function() {
options.params.FORMAT = 'image/jpeg';
options.params.TRANSPARENT = false;
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('FORMAT')).to.be('image/jpeg');
@@ -105,7 +105,7 @@ describe('ol.source.TileWMS', function() {
it('does not add a STYLES= option if one is specified', function() {
options.params.STYLES = 'foo';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('STYLES')).to.be('foo');
@@ -113,7 +113,7 @@ describe('ol.source.TileWMS', function() {
it('changes the BBOX order for EN axis orientations', function() {
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('EPSG:4326'));
var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('BBOX')).to.be('-45,-90,0,-45');
@@ -122,7 +122,7 @@ describe('ol.source.TileWMS', function() {
it('uses EN BBOX order if version < 1.3', function() {
options.params.VERSION = '1.1.0';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1, _ol_proj_.get('CRS:84'));
var tile = source.getTile(3, 2, -3, 1, getProjection('CRS:84'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('BBOX')).to.be('-90,-45,-45,0');
@@ -131,7 +131,7 @@ describe('ol.source.TileWMS', function() {
it('sets FORMAT_OPTIONS when the server is GeoServer', function() {
options.serverType = 'geoserver';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 2, _ol_proj_.get('CRS:84'));
var tile = source.getTile(3, 2, -3, 2, getProjection('CRS:84'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:180');
@@ -141,7 +141,7 @@ describe('ol.source.TileWMS', function() {
options.serverType = 'geoserver';
var source = new _ol_source_TileWMS_(options);
options.params.FORMAT_OPTIONS = 'param1:value1';
var tile = source.getTile(3, 2, -3, 2, _ol_proj_.get('CRS:84'));
var tile = source.getTile(3, 2, -3, 2, getProjection('CRS:84'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('FORMAT_OPTIONS')).to.be('param1:value1;dpi:180');
@@ -151,7 +151,7 @@ describe('ol.source.TileWMS', function() {
function() {
options.serverType = 'geoserver';
var source = new _ol_source_TileWMS_(options);
var tile = source.getTile(3, 2, -3, 1.325, _ol_proj_.get('CRS:84'));
var tile = source.getTile(3, 2, -3, 1.325, getProjection('CRS:84'));
var uri = new URL(tile.src_);
var queryData = uri.searchParams;
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:119');
@@ -165,7 +165,7 @@ describe('ol.source.TileWMS', function() {
options.extent = [-80, -40, -50, -10];
var source = new _ol_source_TileWMS_(options);
var tileCoord = [3, 2, -3];
var url = source.tileUrlFunction(tileCoord, 1, _ol_proj_.get('EPSG:4326'));
var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326'));
var uri = new URL(url);
var queryData = uri.searchParams;
expect(queryData.get('BBOX')).to.be('-45,-90,0,-45');
@@ -175,7 +175,7 @@ describe('ol.source.TileWMS', function() {
options.extent = [-80, -40, -40, -10];
var source = new _ol_source_TileWMS_(options);
var tileCoord = [3, 3, -3];
var url = source.tileUrlFunction(tileCoord, 1, _ol_proj_.get('EPSG:4326'));
var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326'));
var uri = new URL(url);
var queryData = uri.searchParams;
expect(queryData.get('BBOX')).to.be('-45,-45,0,0');
@@ -189,7 +189,7 @@ describe('ol.source.TileWMS', function() {
});
var source = new _ol_source_TileWMS_(options);
var tileCoord = [3, 3, -3];
var url = source.tileUrlFunction(tileCoord, 1, _ol_proj_.get('EPSG:4326'));
var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326'));
var uri = new URL(url);
var queryData = uri.searchParams;
expect(queryData.get('WIDTH')).to.be('640');
@@ -205,7 +205,7 @@ describe('ol.source.TileWMS', function() {
source.pixelRatio_ = 1;
var url = source.getGetFeatureInfoUrl(
[-7000000, -12000000],
19567.87924100512, _ol_proj_.get('EPSG:3857'),
19567.87924100512, getProjection('EPSG:3857'),
{INFO_FORMAT: 'text/plain'});
var uri = new URL(url);
expect(uri.protocol).to.be('http:');
@@ -239,7 +239,7 @@ describe('ol.source.TileWMS', function() {
source.pixelRatio_ = 1;
var url = source.getGetFeatureInfoUrl(
[-7000000, -12000000],
19567.87924100512, _ol_proj_.get('EPSG:3857'),
19567.87924100512, getProjection('EPSG:3857'),
{INFO_FORMAT: 'text/plain'});
var uri = new URL(url);
expect(uri.protocol).to.be('http:');
@@ -269,7 +269,7 @@ describe('ol.source.TileWMS', function() {
source.pixelRatio_ = 1;
var url = source.getGetFeatureInfoUrl(
[-7000000, -12000000],
19567.87924100512, _ol_proj_.get('EPSG:3857'),
19567.87924100512, getProjection('EPSG:3857'),
{INFO_FORMAT: 'text/plain', QUERY_LAYERS: 'foo,bar'});
var uri = new URL(url);
expect(uri.protocol).to.be('http:');
@@ -304,7 +304,7 @@ describe('ol.source.TileWMS', function() {
var source = new _ol_source_TileWMS_(options);
var url = 'http://foo/';
source.setUrl(url);
var tileUrl = source.tileUrlFunction([0, 0, 0], 1, _ol_proj_.get('EPSG:4326'));
var tileUrl = source.tileUrlFunction([0, 0, 0], 1, getProjection('EPSG:4326'));
expect(tileUrl.indexOf(url)).to.be(0);
});
});

View File

@@ -1,4 +1,4 @@
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_UrlTile_ from '../../../../src/ol/source/UrlTile.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
@@ -168,7 +168,7 @@ describe('ol.source.UrlTile', function() {
beforeEach(function() {
sourceOptions = {
tileGrid: _ol_tilegrid_.createXYZ({
extent: _ol_proj_.get('EPSG:4326').getExtent()
extent: getProjection('EPSG:4326').getExtent()
})
};
});

View File

@@ -7,7 +7,7 @@ import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_loadingstrategy_ from '../../../../src/ol/loadingstrategy.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection, transformExtent, fromLonLat} from '../../../../src/ol/proj.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
@@ -428,7 +428,7 @@ describe('ol.source.Vector', function() {
strategy: _ol_loadingstrategy_.bbox,
loader: function(extent) {
setTimeout(function() {
var lonLatExtent = _ol_proj_.transformExtent(extent, 'EPSG:3857', 'EPSG:4326');
var lonLatExtent = transformExtent(extent, 'EPSG:3857', 'EPSG:4326');
expect(lonLatExtent[0]).to.roughlyEqual(-99.261474609, 1e-9);
expect(lonLatExtent[2]).to.roughlyEqual(-95.965576171, 1e-9);
done();
@@ -446,7 +446,7 @@ describe('ol.source.Vector', function() {
})
],
view: new _ol_View_({
center: _ol_proj_.fromLonLat(center),
center: fromLonLat(center),
zoom: 7
})
});
@@ -462,7 +462,7 @@ describe('ol.source.Vector', function() {
it('stores the infinity extent in the Rtree', function() {
var source = new _ol_source_Vector_();
source.loadFeatures([-10000, -10000, 10000, 10000], 1,
_ol_proj_.get('EPSG:3857'));
getProjection('EPSG:3857'));
var loadedExtents = source.loadedExtentsRtree_.getAll();
expect(loadedExtents).to.have.length(1);
expect(loadedExtents[0].extent).to.eql(
@@ -483,11 +483,11 @@ describe('ol.source.Vector', function() {
};
var source = new _ol_source_Vector_({loader: loader1});
source.loadFeatures([-10000, -10000, 10000, 10000], 1,
_ol_proj_.get('EPSG:3857'));
getProjection('EPSG:3857'));
source.setLoader(loader2);
source.clear();
source.loadFeatures([-10000, -10000, 10000, 10000], 1,
_ol_proj_.get('EPSG:3857'));
getProjection('EPSG:3857'));
expect(count1).to.eql(1);
expect(count2).to.eql(1);
});
@@ -502,7 +502,7 @@ describe('ol.source.Vector', function() {
done();
}, 0);
});
source.loadFeatures([-10000, -10000, 10000, 10000], 1, _ol_proj_.get('EPSG:3857'));
source.loadFeatures([-10000, -10000, 10000, 10000], 1, getProjection('EPSG:3857'));
});
});

View File

@@ -4,7 +4,7 @@ import _ol_VectorImageTile_ from '../../../../src/ol/VectorImageTile.js';
import _ol_VectorTile_ from '../../../../src/ol/VectorTile.js';
import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
@@ -37,28 +37,28 @@ describe('ol.source.VectorTile', function() {
describe('#getTile()', function() {
it('creates a tile with the correct tile class', function() {
tile = source.getTile(0, 0, 0, 1, _ol_proj_.get('EPSG:3857'));
tile = source.getTile(0, 0, 0, 1, getProjection('EPSG:3857'));
expect(tile).to.be.a(_ol_VectorImageTile_);
});
it('sets the correct tileCoord on the created tile', function() {
expect(tile.getTileCoord()).to.eql([0, 0, 0]);
});
it('fetches tile from cache when requested again', function() {
expect(source.getTile(0, 0, 0, 1, _ol_proj_.get('EPSG:3857')))
expect(source.getTile(0, 0, 0, 1, getProjection('EPSG:3857')))
.to.equal(tile);
});
});
describe('#getTileGridForProjection', function() {
it('creates a tile grid with the source tile grid\'s tile size', function() {
var tileGrid = source.getTileGridForProjection(_ol_proj_.get('EPSG:3857'));
var tileGrid = source.getTileGridForProjection(getProjection('EPSG:3857'));
expect(tileGrid.getTileSize(0)).to.be(512);
});
});
describe('Tile load events', function() {
it('triggers tileloadstart and tileloadend with ol.VectorTile', function(done) {
tile = source.getTile(14, 8938, -5681, 1, _ol_proj_.get('EPSG:3857'));
tile = source.getTile(14, 8938, -5681, 1, getProjection('EPSG:3857'));
var started = false;
source.on('tileloadstart', function() {
started = true;

View File

@@ -1,5 +1,5 @@
import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabilities.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import _ol_tilegrid_WMTS_ from '../../../../src/ol/tilegrid/WMTS.js';
import _ol_source_WMTS_ from '../../../../src/ol/source/WMTS.js';
@@ -58,7 +58,7 @@ describe('ol.source.WMTS', function() {
expect(options.format).to.be.eql('image/jpeg');
expect(options.projection).to.be.a(_ol_proj_Projection_);
expect(options.projection).to.be.eql(_ol_proj_.get('EPSG:3857'));
expect(options.projection).to.be.eql(getProjection('EPSG:3857'));
expect(options.requestEncoding).to.be.eql('KVP');
@@ -92,7 +92,7 @@ describe('ol.source.WMTS', function() {
expect(options.format).to.be.eql('image/png');
expect(options.projection).to.be.a(_ol_proj_Projection_);
expect(options.projection).to.be.eql(_ol_proj_.get('EPSG:3857'));
expect(options.projection).to.be.eql(getProjection('EPSG:3857'));
expect(options.requestEncoding).to.be.eql('REST');
@@ -196,7 +196,7 @@ describe('ol.source.WMTS', function() {
})
});
var projection = _ol_proj_.get('EPSG:3857');
var projection = getProjection('EPSG:3857');
var url = source.tileUrlFunction(
source.getTileCoordForTileUrlFunction([1, 1, -2]), 1, projection);
expect(url).to.be.eql('http://www.example.com/wmts/coastlines/' +
@@ -222,7 +222,7 @@ describe('ol.source.WMTS', function() {
})
});
var projection = _ol_proj_.get('EPSG:3857');
var projection = getProjection('EPSG:3857');
var url = source.tileUrlFunction(
source.getTileCoordForTileUrlFunction([1, 1, -2]), 1, projection);
expect(url).to.be.eql('http://www.example.com/wmts/coastlines/' +
@@ -307,7 +307,7 @@ describe('ol.source.WMTS', function() {
});
it('generates the correct tileUrlFunction during application of setUrl()', function() {
var projection = _ol_proj_.get('EPSG:3857');
var projection = getProjection('EPSG:3857');
var source = new _ol_source_WMTS_({
projection: projection,
requestEncoding: 'REST',