Merge pull request #7782 from tschaub/default-names
Named exports from specific proj modules
This commit is contained in:
@@ -12,8 +12,8 @@ import {
|
||||
getTransformFromProjections
|
||||
} from '../../../src/ol/proj.js';
|
||||
import {register} from '../../../src/ol/proj/proj4.js';
|
||||
import _ol_proj_EPSG3857_ from '../../../src/ol/proj/EPSG3857.js';
|
||||
import _ol_proj_EPSG4326_ from '../../../src/ol/proj/EPSG4326.js';
|
||||
import {HALF_SIZE} from '../../../src/ol/proj/epsg3857.js';
|
||||
import {METERS_PER_UNIT} from '../../../src/ol/proj/epsg4326.js';
|
||||
import Projection from '../../../src/ol/proj/Projection.js';
|
||||
|
||||
|
||||
@@ -32,10 +32,10 @@ describe('ol.proj', function() {
|
||||
from: [-12356463.478053365, 5700582.732404122],
|
||||
to: [-111, 45.5]
|
||||
}, {
|
||||
from: [2 * _ol_proj_EPSG3857_.HALF_SIZE - 12356463.478053365, 5700582.732404122],
|
||||
from: [2 * HALF_SIZE - 12356463.478053365, 5700582.732404122],
|
||||
to: [-111, 45.5]
|
||||
}, {
|
||||
from: [-4 * _ol_proj_EPSG3857_.HALF_SIZE - 12356463.478053365, 5700582.732404122],
|
||||
from: [-4 * HALF_SIZE - 12356463.478053365, 5700582.732404122],
|
||||
to: [-111, 45.5]
|
||||
}];
|
||||
|
||||
@@ -600,8 +600,7 @@ describe('ol.proj', function() {
|
||||
|
||||
it('returns value in meters', function() {
|
||||
const epsg4326 = getProjection('EPSG:4326');
|
||||
expect(epsg4326.getMetersPerUnit()).to.eql(
|
||||
_ol_proj_EPSG4326_.METERS_PER_UNIT);
|
||||
expect(epsg4326.getMetersPerUnit()).to.eql(METERS_PER_UNIT);
|
||||
});
|
||||
|
||||
it('works for proj4js projections without units', function() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {getPointResolution, transform, get as getProjection, clearAllProjections, addCommon} from '../../../../src/ol/proj.js';
|
||||
import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js';
|
||||
import {fromEPSG4326, HALF_SIZE} from '../../../../src/ol/proj/epsg3857.js';
|
||||
|
||||
describe('ol.proj.EPSG3857', function() {
|
||||
describe('ol/proj/epsg3857', function() {
|
||||
|
||||
afterEach(function() {
|
||||
clearAllProjections();
|
||||
@@ -11,9 +11,6 @@ describe('ol.proj.EPSG3857', function() {
|
||||
describe('fromEPSG4326()', function() {
|
||||
|
||||
it('transforms from geographic to Web Mercator', function() {
|
||||
const forward = _ol_proj_EPSG3857_.fromEPSG4326;
|
||||
const edge = _ol_proj_EPSG3857_.HALF_SIZE;
|
||||
|
||||
const tolerance = 1e-5;
|
||||
|
||||
const cases = [{
|
||||
@@ -21,10 +18,10 @@ describe('ol.proj.EPSG3857', function() {
|
||||
m: [0, 0]
|
||||
}, {
|
||||
g: [-180, -90],
|
||||
m: [-edge, -edge]
|
||||
m: [-HALF_SIZE, -HALF_SIZE]
|
||||
}, {
|
||||
g: [180, 90],
|
||||
m: [edge, edge]
|
||||
m: [HALF_SIZE, HALF_SIZE]
|
||||
}, {
|
||||
g: [-111.0429, 45.6770],
|
||||
m: [-12361239.084208, 5728738.469095]
|
||||
@@ -32,7 +29,7 @@ describe('ol.proj.EPSG3857', function() {
|
||||
|
||||
for (let i = 0, ii = cases.length; i < ii; ++i) {
|
||||
const point = cases[i].g;
|
||||
const transformed = forward(point);
|
||||
const transformed = fromEPSG4326(point);
|
||||
expect(transformed[0]).to.roughlyEqual(cases[i].m[0], tolerance);
|
||||
expect(transformed[1]).to.roughlyEqual(cases[i].m[1], tolerance);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import {createFromTemplate} from '../../../../src/ol/tileurlfunction.js';
|
||||
import {listen} from '../../../../src/ol/events.js';
|
||||
import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import {register} from '../../../../src/ol/proj/proj4.js';
|
||||
import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js';
|
||||
import {WORLD_EXTENT} from '../../../../src/ol/proj/epsg3857.js';
|
||||
import Projection from '../../../../src/ol/proj/Projection.js';
|
||||
import ReprojTile from '../../../../src/ol/reproj/Tile.js';
|
||||
import TileImage from '../../../../src/ol/source/TileImage.js';
|
||||
@@ -161,7 +161,7 @@ describe('ol.source.TileImage', function() {
|
||||
const source = createSource();
|
||||
source.setTileGridForProjection(proj,
|
||||
_ol_tilegrid_.createXYZ({
|
||||
extent: _ol_proj_EPSG3857_.WORLD_EXTENT,
|
||||
extent: WORLD_EXTENT,
|
||||
tileSize: [2, 2]
|
||||
}));
|
||||
const tile = source.getTile(0, 0, -1, 1, proj);
|
||||
|
||||
@@ -2,7 +2,7 @@ import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/c
|
||||
import TileRange from '../../../../src/ol/TileRange.js';
|
||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import {get as getProjection, METERS_PER_UNIT} from '../../../../src/ol/proj.js';
|
||||
import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js';
|
||||
import {HALF_SIZE} from '../../../../src/ol/proj/epsg3857.js';
|
||||
import Projection from '../../../../src/ol/proj/Projection.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
|
||||
@@ -348,7 +348,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(projection);
|
||||
const origin = grid.getOrigin();
|
||||
const half = _ol_proj_EPSG3857_.HALF_SIZE;
|
||||
const half = HALF_SIZE;
|
||||
expect(origin).to.eql([-half, half]);
|
||||
});
|
||||
|
||||
@@ -357,7 +357,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
projection, undefined, undefined, 'bottom-left');
|
||||
const origin = grid.getOrigin();
|
||||
const half = _ol_proj_EPSG3857_.HALF_SIZE;
|
||||
const half = HALF_SIZE;
|
||||
expect(origin).to.eql([-half, -half]);
|
||||
});
|
||||
|
||||
@@ -366,7 +366,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
projection, undefined, undefined, 'bottom-right');
|
||||
const origin = grid.getOrigin();
|
||||
const half = _ol_proj_EPSG3857_.HALF_SIZE;
|
||||
const half = HALF_SIZE;
|
||||
expect(origin).to.eql([half, -half]);
|
||||
});
|
||||
|
||||
@@ -375,7 +375,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
projection, undefined, undefined, 'top-left');
|
||||
const origin = grid.getOrigin();
|
||||
const half = _ol_proj_EPSG3857_.HALF_SIZE;
|
||||
const half = HALF_SIZE;
|
||||
expect(origin).to.eql([-half, half]);
|
||||
});
|
||||
|
||||
@@ -384,7 +384,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
projection, undefined, undefined, 'top-right');
|
||||
const origin = grid.getOrigin();
|
||||
const half = _ol_proj_EPSG3857_.HALF_SIZE;
|
||||
const half = HALF_SIZE;
|
||||
expect(origin).to.eql([half, half]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user