Named exports from ol/proj
This commit is contained in:
committed by
Andreas Hocevar
parent
fab77e8d37
commit
6f72ffe498
@@ -8,7 +8,7 @@ import _ol_geom_MultiPoint_ from '../../../../src/ol/geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.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, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
|
||||
describe('ol.format.EsriJSON', function() {
|
||||
@@ -239,7 +239,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
expect(feature[0].getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
expect(feature[0].getGeometry().getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('can read and transform a feature collection', function() {
|
||||
@@ -249,18 +249,18 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
expect(features[0].getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
expect(features[0].getGeometry().getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
expect(features[1].getGeometry().getCoordinates()).to.eql([
|
||||
_ol_proj_.transform([102.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([103.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([104.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([105.0, 1.0], 'EPSG:4326', 'EPSG:3857')
|
||||
transform([102.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([103.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([104.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([105.0, 1.0], 'EPSG:4326', 'EPSG:3857')
|
||||
]);
|
||||
expect(features[2].getGeometry().getCoordinates()).to.eql([[
|
||||
_ol_proj_.transform([100.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([100.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([101.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([101.0, 0.0], 'EPSG:4326', 'EPSG:3857')
|
||||
transform([100.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([100.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([101.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([101.0, 0.0], 'EPSG:4326', 'EPSG:3857')
|
||||
]]);
|
||||
});
|
||||
|
||||
@@ -753,7 +753,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(_ol_geom_LineString_);
|
||||
|
||||
expect(format.readProjection(json)).to.be(_ol_proj_.get('EPSG:3857'));
|
||||
expect(format.readProjection(json)).to.be(getProjection('EPSG:3857'));
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.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 {fromLonLat, get as getProjection, toLonLat, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
|
||||
describe('ol.format.GeoJSON', function() {
|
||||
@@ -211,7 +211,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
expect(feature[0].getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
expect(feature[0].getGeometry().getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('uses featureProjection passed to the constructor', function() {
|
||||
@@ -219,7 +219,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
var feature = format.readFeatures(pointGeoJSON);
|
||||
expect(feature[0].getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
expect(feature[0].getGeometry().getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('gives precedence to options passed to the read method', function() {
|
||||
@@ -229,7 +229,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
expect(feature[0].getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
expect(feature[0].getGeometry().getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('can read and transform a feature collection', function() {
|
||||
@@ -238,18 +238,18 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
expect(features[0].getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
expect(features[0].getGeometry().getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
expect(features[1].getGeometry().getCoordinates()).to.eql([
|
||||
_ol_proj_.transform([102.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([103.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([104.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([105.0, 1.0], 'EPSG:4326', 'EPSG:3857')
|
||||
transform([102.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([103.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([104.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([105.0, 1.0], 'EPSG:4326', 'EPSG:3857')
|
||||
]);
|
||||
expect(features[2].getGeometry().getCoordinates()).to.eql([[
|
||||
_ol_proj_.transform([100.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([100.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([101.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([101.0, 0.0], 'EPSG:4326', 'EPSG:3857')
|
||||
transform([100.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([100.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([101.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([101.0, 0.0], 'EPSG:4326', 'EPSG:3857')
|
||||
]]);
|
||||
});
|
||||
|
||||
@@ -342,7 +342,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(first.get('bam')).to.be('baz');
|
||||
expect(first.getGeometry()).to.be.a(_ol_geom_LineString_);
|
||||
|
||||
expect(format.readProjection(json)).to.be(_ol_proj_.get('EPSG:4326'));
|
||||
expect(format.readProjection(json)).to.be(getProjection('EPSG:4326'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -471,7 +471,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(_ol_geom_LineString_);
|
||||
|
||||
expect(format.readProjection(json)).to.be(_ol_proj_.get('EPSG:3857'));
|
||||
expect(format.readProjection(json)).to.be(getProjection('EPSG:3857'));
|
||||
|
||||
});
|
||||
|
||||
@@ -514,7 +514,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(_ol_geom_LineString_);
|
||||
|
||||
expect(format.readProjection(json)).to.be(_ol_proj_.get('EPSG:4326'));
|
||||
expect(format.readProjection(json)).to.be(getProjection('EPSG:4326'));
|
||||
|
||||
});
|
||||
|
||||
@@ -597,18 +597,18 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('accepts featureProjection', function() {
|
||||
var point = new _ol_geom_Point_(_ol_proj_.fromLonLat([10, 20]));
|
||||
var point = new _ol_geom_Point_(fromLonLat([10, 20]));
|
||||
var geojson = format.writeGeometry(point, {featureProjection: 'EPSG:3857'});
|
||||
var obj = JSON.parse(geojson);
|
||||
expect(obj.coordinates).to.eql(_ol_proj_.toLonLat(point.getCoordinates()));
|
||||
expect(obj.coordinates).to.eql(toLonLat(point.getCoordinates()));
|
||||
});
|
||||
|
||||
it('respects featureProjection passed to constructor', function() {
|
||||
var format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:3857'});
|
||||
var point = new _ol_geom_Point_(_ol_proj_.fromLonLat([10, 20]));
|
||||
var point = new _ol_geom_Point_(fromLonLat([10, 20]));
|
||||
var geojson = format.writeGeometry(point);
|
||||
var obj = JSON.parse(geojson);
|
||||
expect(obj.coordinates).to.eql(_ol_proj_.toLonLat(point.getCoordinates()));
|
||||
expect(obj.coordinates).to.eql(toLonLat(point.getCoordinates()));
|
||||
});
|
||||
|
||||
it('encodes linestring', function() {
|
||||
|
||||
@@ -8,7 +8,7 @@ import _ol_geom_MultiPoint_ from '../../../../src/ol/geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.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 {transform} from '../../../../src/ol/proj.js';
|
||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
|
||||
var readGeometry = function(format, text, opt_options) {
|
||||
@@ -393,7 +393,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
var coordinates = g.getCoordinates();
|
||||
expect(coordinates.splice(0, 2)).to.eql(
|
||||
_ol_proj_.transform([1, 2], 'CRS:84', 'EPSG:3857'));
|
||||
transform([1, 2], 'CRS:84', 'EPSG:3857'));
|
||||
config.dataProjection = 'CRS:84';
|
||||
var serialized = format.writeGeometryNode(g, config);
|
||||
var pos = serialized.firstElementChild.firstElementChild.textContent;
|
||||
@@ -415,7 +415,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
var coordinates = g.getCoordinates();
|
||||
expect(coordinates.splice(0, 2)).to.eql(
|
||||
_ol_proj_.transform([1, 2], 'CRS:84', 'EPSG:3857'));
|
||||
transform([1, 2], 'CRS:84', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('can read and write a point geometry in EPSG:4326', function() {
|
||||
@@ -462,9 +462,9 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
var coordinates = g.getCoordinates();
|
||||
expect(coordinates[0].slice(0, 2)).to.eql(
|
||||
_ol_proj_.transform([1, 2], 'CRS:84', 'EPSG:3857'));
|
||||
transform([1, 2], 'CRS:84', 'EPSG:3857'));
|
||||
expect(coordinates[1].slice(0, 2)).to.eql(
|
||||
_ol_proj_.transform([3, 4], 'CRS:84', 'EPSG:3857'));
|
||||
transform([3, 4], 'CRS:84', 'EPSG:3857'));
|
||||
var serialized = format.writeGeometryNode(g, config);
|
||||
var poss = serialized.firstElementChild.firstElementChild.textContent;
|
||||
var coordinate = poss.split(' ');
|
||||
|
||||
@@ -4,7 +4,7 @@ import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_geom_MultiLineString_ from '../../../../src/ol/geom/MultiLineString.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, transform} from '../../../../src/ol/proj.js';
|
||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
|
||||
describe('ol.format.GPX', function() {
|
||||
@@ -17,12 +17,12 @@ describe('ol.format.GPX', function() {
|
||||
describe('#readProjection', function() {
|
||||
it('returns the default projection from document', function() {
|
||||
var projection = format.readProjectionFromDocument();
|
||||
expect(projection).to.eql(_ol_proj_.get('EPSG:4326'));
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
|
||||
it('returns the default projection from node', function() {
|
||||
var projection = format.readProjectionFromNode();
|
||||
expect(projection).to.eql(_ol_proj_.get('EPSG:4326'));
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -121,8 +121,8 @@ describe('ol.format.GPX', function() {
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
var p1 = _ol_proj_.transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
var p2 = _ol_proj_.transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
var p2 = transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
expect(g.getCoordinates()).to.eql([p1, p2]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs, {
|
||||
@@ -285,9 +285,9 @@ describe('ol.format.GPX', function() {
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
var p1 = _ol_proj_.transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
p1.push(3, 1263115752);
|
||||
var p2 = _ol_proj_.transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
var p2 = transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
p2.push(7, 1263115812);
|
||||
expect(g.getCoordinates()).to.eql([[p1, p2]]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
@@ -416,7 +416,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
var expectedPoint = _ol_proj_.transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
var expectedPoint = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
expect(g.getCoordinates()).to.eql(expectedPoint);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs, {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ol_format_IGC_ from '../../../../src/ol/format/IGC.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_proj_ from '../../../../src/ol/proj.js';
|
||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
|
||||
describe('ol.format.IGC', function() {
|
||||
@@ -35,7 +35,7 @@ describe('ol.format.IGC', function() {
|
||||
describe('#readProjectionFromText', function() {
|
||||
it('returns the default projection', function() {
|
||||
var projection = format.readProjectionFromText(igc);
|
||||
expect(projection).to.eql(_ol_proj_.get('EPSG:4326'));
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -64,16 +64,16 @@ describe('ol.format.IGC', function() {
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
|
||||
var expectedPoint1 = _ol_proj_.transform(
|
||||
var expectedPoint1 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint1.push(1303202928);
|
||||
var expectedPoint2 = _ol_proj_.transform(
|
||||
var expectedPoint2 = transform(
|
||||
[6.850183333333334, 45.93395], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint2.push(1303203353);
|
||||
var expectedPoint3 = _ol_proj_.transform(
|
||||
var expectedPoint3 = transform(
|
||||
[6.800816666666667, 45.916066666666666], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint3.push(1303203815);
|
||||
var expectedPoint4 = _ol_proj_.transform(
|
||||
var expectedPoint4 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint4.push(1303289328);
|
||||
|
||||
@@ -113,16 +113,16 @@ describe('ol.format.IGC', function() {
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
|
||||
var expectedPoint1 = _ol_proj_.transform(
|
||||
var expectedPoint1 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint1.push(1303202928);
|
||||
var expectedPoint2 = _ol_proj_.transform(
|
||||
var expectedPoint2 = transform(
|
||||
[6.850183333333334, 45.93395], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint2.push(1303203353);
|
||||
var expectedPoint3 = _ol_proj_.transform(
|
||||
var expectedPoint3 = transform(
|
||||
[6.800816666666667, 45.916066666666666], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint3.push(1303203815);
|
||||
var expectedPoint4 = _ol_proj_.transform(
|
||||
var expectedPoint4 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint4.push(1303289328);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import _ol_geom_MultiPoint_ from '../../../../src/ol/geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.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 {addProjection, addCoordinateTransforms, transform, get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
||||
import _ol_proj_transforms_ from '../../../../src/ol/proj/transforms.js';
|
||||
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
|
||||
@@ -80,12 +80,12 @@ describe('ol.format.KML', function() {
|
||||
describe('#readProjection', function() {
|
||||
it('returns the default projection from document', function() {
|
||||
var projection = format.readProjectionFromDocument();
|
||||
expect(projection).to.eql(_ol_proj_.get('EPSG:4326'));
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
|
||||
it('returns the default projection from node', function() {
|
||||
var projection = format.readProjectionFromNode();
|
||||
expect(projection).to.eql(_ol_proj_.get('EPSG:4326'));
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -266,7 +266,7 @@ describe('ol.format.KML', function() {
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
var expectedPoint = _ol_proj_.transform([1, 2], 'EPSG:4326', 'EPSG:3857');
|
||||
var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint.push(3);
|
||||
expect(g.getCoordinates()).to.eql(expectedPoint);
|
||||
});
|
||||
@@ -310,7 +310,7 @@ describe('ol.format.KML', function() {
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
var expectedPoint = _ol_proj_.transform([1, 2], 'EPSG:4326', 'EPSG:3857');
|
||||
var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint.push(3);
|
||||
expect(g.getCoordinates()).to.eql(expectedPoint);
|
||||
});
|
||||
@@ -356,8 +356,8 @@ describe('ol.format.KML', function() {
|
||||
});
|
||||
|
||||
it('can transform and write XYZ Point geometries', function() {
|
||||
_ol_proj_.addProjection(new _ol_proj_Projection_({code: 'double'}));
|
||||
_ol_proj_.addCoordinateTransforms('EPSG:4326', 'double',
|
||||
addProjection(new _ol_proj_Projection_({code: 'double'}));
|
||||
addCoordinateTransforms('EPSG:4326', 'double',
|
||||
function(coordinate) {
|
||||
return [2 * coordinate[0], 2 * coordinate[1]];
|
||||
},
|
||||
@@ -387,9 +387,9 @@ describe('ol.format.KML', function() {
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
|
||||
_ol_proj_transforms_.remove(
|
||||
_ol_proj_.get('EPSG:4326'), _ol_proj_.get('double'));
|
||||
getProjection('EPSG:4326'), getProjection('double'));
|
||||
_ol_proj_transforms_.remove(
|
||||
_ol_proj_.get('double'), _ol_proj_.get('EPSG:4326'));
|
||||
getProjection('double'), getProjection('EPSG:4326'));
|
||||
});
|
||||
|
||||
it('can write XYM Point geometries', function() {
|
||||
@@ -2849,7 +2849,7 @@ describe('ol.format.KML', function() {
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
var expectedPoint = _ol_proj_.transform([1, 2], 'EPSG:4326', 'EPSG:3857');
|
||||
var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint.push(3);
|
||||
expect(g.getCoordinates()).to.eql(expectedPoint);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_format_OSMXML_ from '../../../../src/ol/format/OSMXML.js';
|
||||
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
|
||||
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_proj_ from '../../../../src/ol/proj.js';
|
||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
|
||||
describe('ol.format.OSMXML', function() {
|
||||
@@ -15,12 +15,12 @@ describe('ol.format.OSMXML', function() {
|
||||
describe('#readProjection', function() {
|
||||
it('returns the default projection from document', function() {
|
||||
var projection = format.readProjectionFromDocument();
|
||||
expect(projection).to.eql(_ol_proj_.get('EPSG:4326'));
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
|
||||
it('returns the default projection from node', function() {
|
||||
var projection = format.readProjectionFromNode();
|
||||
expect(projection).to.eql(_ol_proj_.get('EPSG:4326'));
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -132,7 +132,7 @@ describe('ol.format.OSMXML', function() {
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([2, 1], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([2, 1], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_format_Polyline_ from '../../../../src/ol/format/Polyline.js';
|
||||
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_proj_ from '../../../../src/ol/proj.js';
|
||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
describe('ol.format.Polyline', function() {
|
||||
|
||||
@@ -32,9 +32,9 @@ describe('ol.format.Polyline', function() {
|
||||
];
|
||||
encodedFlatPoints = '_p~iF~ps|U_ulLnnqC_mqNvxq`@';
|
||||
points3857 = [
|
||||
_ol_proj_.transform([-120.20000, 38.50000], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([-120.95000, 40.70000], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([-126.45300, 43.25200], 'EPSG:4326', 'EPSG:3857')
|
||||
transform([-120.20000, 38.50000], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([-120.95000, 40.70000], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([-126.45300, 43.25200], 'EPSG:4326', 'EPSG:3857')
|
||||
];
|
||||
|
||||
floats = [0.00, 0.15, -0.01, -0.16, 0.16, 0.01];
|
||||
@@ -54,7 +54,7 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#readProjectionFromText', function() {
|
||||
it('returns the default projection', function() {
|
||||
var projection = format.readProjectionFromText(encodedFlatPoints);
|
||||
expect(projection).to.eql(_ol_proj_.get('EPSG:4326'));
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -352,7 +352,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
it('returns the expected projection', function() {
|
||||
var projection = format.readProjection(encodedFlatPoints);
|
||||
expect(projection).to.be(_ol_proj_.get('EPSG:4326'));
|
||||
expect(projection).to.be(getProjection('EPSG:4326'));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
||||
import _ol_format_Feature_ from '../../../../src/ol/format/Feature.js';
|
||||
import _ol_proj_ from '../../../../src/ol/proj.js';
|
||||
import {transform} from '../../../../src/ol/proj.js';
|
||||
import _ol_format_TopoJSON_ from '../../../../src/ol/format/TopoJSON.js';
|
||||
|
||||
var aruba = {
|
||||
@@ -123,25 +123,25 @@ describe('ol.format.TopoJSON', function() {
|
||||
var point = features[0].getGeometry();
|
||||
expect(point.getType()).to.be('Point');
|
||||
expect(features[0].getGeometry().getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
|
||||
var line = features[1].getGeometry();
|
||||
expect(line.getType()).to.be('LineString');
|
||||
expect(line.getCoordinates()).to.eql([
|
||||
_ol_proj_.transform([102.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([103.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([104.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([105.0, 1.0], 'EPSG:4326', 'EPSG:3857')
|
||||
transform([102.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([103.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([104.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([105.0, 1.0], 'EPSG:4326', 'EPSG:3857')
|
||||
]);
|
||||
|
||||
var polygon = features[2].getGeometry();
|
||||
expect(polygon.getType()).to.be('Polygon');
|
||||
expect(polygon.getCoordinates()).to.eql([[
|
||||
_ol_proj_.transform([100.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([100.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([101.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([101.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
_ol_proj_.transform([100.0, 0.0], 'EPSG:4326', 'EPSG:3857')
|
||||
transform([100.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([100.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([101.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([101.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([100.0, 0.0], 'EPSG:4326', 'EPSG:3857')
|
||||
]]);
|
||||
|
||||
done();
|
||||
|
||||
@@ -7,7 +7,7 @@ import _ol_geom_MultiLineString_ from '../../../../src/ol/geom/MultiLineString.j
|
||||
import _ol_geom_MultiPoint_ from '../../../../src/ol/geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
||||
import _ol_proj_ from '../../../../src/ol/proj.js';
|
||||
import {transform} from '../../../../src/ol/proj.js';
|
||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
|
||||
describe('ol.format.WFS', function() {
|
||||
@@ -67,7 +67,7 @@ describe('ol.format.WFS', function() {
|
||||
expect(feature.get('STATE_NAME')).to.equal('Illinois');
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom).to.be.an(_ol_geom_MultiPolygon_);
|
||||
var p = _ol_proj_.transform([-88.071, 37.511], 'EPSG:4326', 'EPSG:3857');
|
||||
var p = transform([-88.071, 37.511], 'EPSG:4326', 'EPSG:3857');
|
||||
p.push(0);
|
||||
expect(geom.getFirstCoordinate()).to.eql(p);
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
|
||||
import _ol_format_WKT_ from '../../../../src/ol/format/WKT.js';
|
||||
import _ol_proj_ from '../../../../src/ol/proj.js';
|
||||
import {transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
|
||||
describe('ol.format.WKT', function() {
|
||||
@@ -24,7 +24,7 @@ describe('ol.format.WKT', function() {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(geom.getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -54,7 +54,7 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -91,9 +91,9 @@ describe('ol.format.WKT', function() {
|
||||
expect(point1.getType()).to.eql('Point');
|
||||
expect(point2.getType()).to.eql('Point');
|
||||
expect(point1.getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
expect(point2.getCoordinates()).to.eql(
|
||||
_ol_proj_.transform([4, 5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([4, 5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user