Transformed
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
|
||||
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.format.EsriJSON');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.geom.LinearRing');
|
||||
goog.require('ol.geom.MultiLineString');
|
||||
goog.require('ol.geom.MultiPoint');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.proj');
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import _ol_format_EsriJSON_ from '../../../../src/ol/format/EsriJSON.js';
|
||||
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||
import _ol_geom_MultiLineString_ from '../../../../src/ol/geom/MultiLineString.js';
|
||||
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';
|
||||
|
||||
|
||||
describe('ol.format.EsriJSON', function() {
|
||||
|
||||
var format;
|
||||
beforeEach(function() {
|
||||
format = new ol.format.EsriJSON();
|
||||
format = new _ol_format_EsriJSON_();
|
||||
});
|
||||
|
||||
var pointEsriJSON = {
|
||||
@@ -163,27 +161,27 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a single point feature', function() {
|
||||
var feature = format.readFeature(pointEsriJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.Point);
|
||||
expect(geometry).to.be.an(_ol_geom_Point_);
|
||||
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
});
|
||||
|
||||
it('can read a single multipoint feature', function() {
|
||||
var feature = format.readFeature(multiPointEsriJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.MultiPoint);
|
||||
expect(geometry).to.be.an(_ol_geom_MultiPoint_);
|
||||
expect(geometry.getCoordinates()).to.eql([[102.0, 0.0], [103.0, 1.0]]);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
});
|
||||
|
||||
it('can read a single line string feature', function() {
|
||||
var feature = format.readFeature(lineStringEsriJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.LineString);
|
||||
expect(geometry).to.be.an(_ol_geom_LineString_);
|
||||
expect(geometry.getCoordinates()).to.eql(
|
||||
[[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
@@ -192,9 +190,9 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a multi line string feature', function() {
|
||||
var feature = format.readFeature(multiLineStringEsriJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.MultiLineString);
|
||||
expect(geometry).to.be.an(_ol_geom_MultiLineString_);
|
||||
expect(geometry.getCoordinates()).to.eql([
|
||||
[[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]],
|
||||
[[105.0, 3.0], [106.0, 4.0], [107.0, 3.0], [108.0, 4.0]]
|
||||
@@ -205,9 +203,9 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a single polygon feature', function() {
|
||||
var feature = format.readFeature(polygonEsriJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.Polygon);
|
||||
expect(geometry).to.be.an(_ol_geom_Polygon_);
|
||||
expect(geometry.getCoordinates()).to.eql([[
|
||||
[100.0, 0.0], [100.0, 1.0], [101.0, 1.0], [101.0, 0.0]
|
||||
]]);
|
||||
@@ -217,9 +215,9 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a multi polygon feature', function() {
|
||||
var feature = format.readFeature(multiPolygonEsriJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(geometry).to.be.an(_ol_geom_MultiPolygon_);
|
||||
expect(geometry.getCoordinates()).to.eql([
|
||||
[[[0, 1], [1, 4], [4, 3], [3, 0]], [[2, 2], [3, 2], [3, 3], [2, 3]]],
|
||||
[[[10, 1], [11, 5], [14, 3], [13, 0]]]
|
||||
@@ -229,9 +227,9 @@ describe('ol.format.EsriJSON', function() {
|
||||
it('can read a feature collection', function() {
|
||||
var features = format.readFeatures(featureCollectionEsriJSON);
|
||||
expect(features).to.have.length(3);
|
||||
expect(features[0].getGeometry()).to.be.an(ol.geom.Point);
|
||||
expect(features[1].getGeometry()).to.be.an(ol.geom.LineString);
|
||||
expect(features[2].getGeometry()).to.be.an(ol.geom.Polygon);
|
||||
expect(features[0].getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
expect(features[1].getGeometry()).to.be.an(_ol_geom_LineString_);
|
||||
expect(features[2].getGeometry()).to.be.an(_ol_geom_Polygon_);
|
||||
});
|
||||
|
||||
it('can read and transform a point', function() {
|
||||
@@ -239,9 +237,9 @@ describe('ol.format.EsriJSON', function() {
|
||||
featureProjection: 'EPSG:3857',
|
||||
dataProjection: 'EPSG:4326'
|
||||
});
|
||||
expect(feature[0].getGeometry()).to.be.an(ol.geom.Point);
|
||||
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'));
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('can read and transform a feature collection', function() {
|
||||
@@ -249,28 +247,28 @@ describe('ol.format.EsriJSON', function() {
|
||||
featureProjection: 'EPSG:3857',
|
||||
dataProjection: 'EPSG:4326'
|
||||
});
|
||||
expect(features[0].getGeometry()).to.be.an(ol.geom.Point);
|
||||
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'));
|
||||
_ol_proj_.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')
|
||||
_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')
|
||||
]);
|
||||
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')
|
||||
_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')
|
||||
]]);
|
||||
});
|
||||
|
||||
it('can create a feature with a specific geometryName', function() {
|
||||
var feature = new ol.format.EsriJSON({geometryName: 'the_geom'}).
|
||||
var feature = new _ol_format_EsriJSON_({geometryName: 'the_geom'}).
|
||||
readFeature(pointEsriJSON);
|
||||
expect(feature.getGeometryName()).to.be('the_geom');
|
||||
expect(feature.getGeometry()).to.be.an(ol.geom.Point);
|
||||
expect(feature.getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -284,16 +282,16 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(array.length).to.be(2);
|
||||
|
||||
var first = array[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first.get('LINK_ID')).to.be(573730499);
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(ol.geom.LineString);
|
||||
expect(firstGeom).to.be.a(_ol_geom_LineString_);
|
||||
|
||||
var second = array[1];
|
||||
expect(second).to.be.a(ol.Feature);
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second.get('ST_NAME')).to.be('BRUNNSGATAN');
|
||||
var secondGeom = second.getGeometry();
|
||||
expect(secondGeom).to.be.a(ol.geom.LineString);
|
||||
expect(secondGeom).to.be.a(_ol_geom_LineString_);
|
||||
});
|
||||
|
||||
it('parses ksfields.geojson', function(done) {
|
||||
@@ -302,23 +300,23 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(result.length).to.be(9);
|
||||
|
||||
var first = result[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first.get('field_name')).to.be('EUDORA');
|
||||
expect(first.getId()).to.be(6406);
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(ol.geom.Polygon);
|
||||
expect(ol.extent.equals(firstGeom.getExtent(), [
|
||||
expect(firstGeom).to.be.a(_ol_geom_Polygon_);
|
||||
expect(_ol_extent_.equals(firstGeom.getExtent(), [
|
||||
-10585772.743554419, 4712365.161160459,
|
||||
-10579560.16462974, 4716567.373073828
|
||||
])).to.be(true);
|
||||
|
||||
var last = result[8];
|
||||
expect(last).to.be.a(ol.Feature);
|
||||
expect(last).to.be.a(_ol_Feature_);
|
||||
expect(last.get('field_name')).to.be('FEAGINS');
|
||||
expect(last.getId()).to.be(6030);
|
||||
var lastGeom = last.getGeometry();
|
||||
expect(lastGeom).to.be.a(ol.geom.Polygon);
|
||||
expect(ol.extent.equals(lastGeom.getExtent(), [
|
||||
expect(lastGeom).to.be.a(_ol_geom_Polygon_);
|
||||
expect(_ol_extent_.equals(lastGeom.getExtent(), [
|
||||
-10555714.026858449, 4576511.565880965,
|
||||
-10553671.199322715, 4578554.9934867555
|
||||
])).to.be(true);
|
||||
@@ -338,7 +336,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Point);
|
||||
expect(obj).to.be.a(_ol_geom_Point_);
|
||||
expect(obj.getCoordinates()).to.eql([10, 20]);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
});
|
||||
@@ -351,7 +349,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Point);
|
||||
expect(obj).to.be.a(_ol_geom_Point_);
|
||||
expect(obj.getCoordinates()).to.eql([10, 20, 10]);
|
||||
expect(obj.getLayout()).to.eql('XYZ');
|
||||
});
|
||||
@@ -364,7 +362,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Point);
|
||||
expect(obj).to.be.a(_ol_geom_Point_);
|
||||
expect(obj.getCoordinates()).to.eql([10, 20, 10]);
|
||||
expect(obj.getLayout()).to.eql('XYM');
|
||||
});
|
||||
@@ -378,7 +376,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Point);
|
||||
expect(obj).to.be.a(_ol_geom_Point_);
|
||||
expect(obj.getCoordinates()).to.eql([10, 20, 0, 10]);
|
||||
expect(obj.getLayout()).to.eql('XYZM');
|
||||
});
|
||||
@@ -389,7 +387,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiPoint);
|
||||
expect(obj).to.be.a(_ol_geom_MultiPoint_);
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20], [20, 30]]);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
});
|
||||
@@ -401,7 +399,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiPoint);
|
||||
expect(obj).to.be.a(_ol_geom_MultiPoint_);
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20, 0], [20, 30, 0]]);
|
||||
expect(obj.getLayout()).to.eql('XYZ');
|
||||
});
|
||||
@@ -413,7 +411,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiPoint);
|
||||
expect(obj).to.be.a(_ol_geom_MultiPoint_);
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20, 0], [20, 30, 0]]);
|
||||
expect(obj.getLayout()).to.eql('XYM');
|
||||
});
|
||||
@@ -426,7 +424,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiPoint);
|
||||
expect(obj).to.be.a(_ol_geom_MultiPoint_);
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20, 0, 1], [20, 30, 0, 1]]);
|
||||
expect(obj.getLayout()).to.eql('XYZM');
|
||||
});
|
||||
@@ -437,7 +435,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.LineString);
|
||||
expect(obj).to.be.a(_ol_geom_LineString_);
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20], [30, 40]]);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
});
|
||||
@@ -449,7 +447,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.LineString);
|
||||
expect(obj).to.be.a(_ol_geom_LineString_);
|
||||
expect(obj.getLayout()).to.eql('XYZ');
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20, 1534], [30, 40, 1420]]);
|
||||
});
|
||||
@@ -461,7 +459,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.LineString);
|
||||
expect(obj).to.be.a(_ol_geom_LineString_);
|
||||
expect(obj.getLayout()).to.eql('XYM');
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20, 1534], [30, 40, 1420]]);
|
||||
});
|
||||
@@ -474,7 +472,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.LineString);
|
||||
expect(obj).to.be.a(_ol_geom_LineString_);
|
||||
expect(obj.getLayout()).to.eql('XYZM');
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20, 1534, 1],
|
||||
[30, 40, 1420, 2]]);
|
||||
@@ -489,7 +487,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
]]
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiLineString);
|
||||
expect(obj).to.be.a(_ol_geom_MultiLineString_);
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]],
|
||||
[[105.0, 3.0], [106.0, 4.0], [107.0, 3.0], [108.0, 4.0]]
|
||||
@@ -507,7 +505,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
]]
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiLineString);
|
||||
expect(obj).to.be.a(_ol_geom_MultiLineString_);
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[102.0, 0.0, 1], [103.0, 1.0, 1], [104.0, 0.0, 1], [105.0, 1.0, 1]],
|
||||
[[105.0, 3.0, 1], [106.0, 4.0, 1], [107.0, 3.0, 1], [108.0, 4.0, 1]]
|
||||
@@ -525,7 +523,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
]]
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiLineString);
|
||||
expect(obj).to.be.a(_ol_geom_MultiLineString_);
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[102.0, 0.0, 1], [103.0, 1.0, 1], [104.0, 0.0, 1], [105.0, 1.0, 1]],
|
||||
[[105.0, 3.0, 1], [106.0, 4.0, 1], [107.0, 3.0, 1], [108.0, 4.0, 1]]
|
||||
@@ -544,7 +542,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
]]
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiLineString);
|
||||
expect(obj).to.be.a(_ol_geom_MultiLineString_);
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[102, 0, 1, 2], [103, 1, 1, 2], [104, 0, 1, 2], [105, 1, 1, 2]],
|
||||
[[105, 3, 1, 2], [106, 4, 1, 2], [107, 3, 1, 2], [108, 4, 1, 2]]
|
||||
@@ -560,14 +558,14 @@ describe('ol.format.EsriJSON', function() {
|
||||
rings: [outer, inner1, inner2]
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Polygon);
|
||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0].getCoordinates()[0].length).to.equal(2);
|
||||
expect(rings[0]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[1]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[2]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
});
|
||||
|
||||
it('parses XYZ polygon', function() {
|
||||
@@ -579,14 +577,14 @@ describe('ol.format.EsriJSON', function() {
|
||||
hasZ: true
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Polygon);
|
||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
||||
expect(obj.getLayout()).to.eql('XYZ');
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0].getCoordinates()[0].length).to.equal(3);
|
||||
expect(rings[0]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[1]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[2]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
});
|
||||
|
||||
it('parses XYM polygon', function() {
|
||||
@@ -598,14 +596,14 @@ describe('ol.format.EsriJSON', function() {
|
||||
hasM: true
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Polygon);
|
||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
||||
expect(obj.getLayout()).to.eql('XYM');
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0].getCoordinates()[0].length).to.equal(3);
|
||||
expect(rings[0]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[1]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[2]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
});
|
||||
|
||||
it('parses XYZM polygon', function() {
|
||||
@@ -627,14 +625,14 @@ describe('ol.format.EsriJSON', function() {
|
||||
hasM: true
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Polygon);
|
||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
||||
expect(obj.getLayout()).to.eql('XYZM');
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0].getCoordinates()[0].length).to.equal(4);
|
||||
expect(rings[0]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[1]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[2]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
});
|
||||
|
||||
it('parses XY multipolygon', function() {
|
||||
@@ -646,7 +644,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
]
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiPolygon);
|
||||
expect(obj).to.be.a(_ol_geom_MultiPolygon_);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[[0, 1], [1, 4], [4, 3], [3, 0]], [[2, 2], [3, 2],
|
||||
@@ -665,7 +663,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
hasZ: true
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiPolygon);
|
||||
expect(obj).to.be.a(_ol_geom_MultiPolygon_);
|
||||
expect(obj.getLayout()).to.eql('XYZ');
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
|
||||
@@ -684,7 +682,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
hasM: true
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiPolygon);
|
||||
expect(obj).to.be.a(_ol_geom_MultiPolygon_);
|
||||
expect(obj.getLayout()).to.eql('XYM');
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
|
||||
@@ -704,7 +702,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
hasM: true
|
||||
});
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.MultiPolygon);
|
||||
expect(obj).to.be.a(_ol_geom_MultiPolygon_);
|
||||
expect(obj.getLayout()).to.eql('XYZM');
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[[0, 1, 0, 1], [1, 4, 0, 1], [4, 3, 0, 1], [3, 0, 0, 1]],
|
||||
@@ -746,16 +744,16 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(features.length).to.be(2);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first.get('foo')).to.be('bar');
|
||||
expect(first.getGeometry()).to.be.a(ol.geom.Point);
|
||||
expect(first.getGeometry()).to.be.a(_ol_geom_Point_);
|
||||
|
||||
var second = features[1];
|
||||
expect(second).to.be.a(ol.Feature);
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(ol.geom.LineString);
|
||||
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(_ol_proj_.get('EPSG:3857'));
|
||||
|
||||
});
|
||||
|
||||
@@ -764,28 +762,28 @@ describe('ol.format.EsriJSON', function() {
|
||||
describe('#writeGeometry', function() {
|
||||
|
||||
it('encodes point', function() {
|
||||
var point = new ol.geom.Point([10, 20]);
|
||||
var point = new _ol_geom_Point_([10, 20]);
|
||||
var esrijson = format.writeGeometry(point);
|
||||
expect(point.getCoordinates()).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
});
|
||||
|
||||
it('encodes XYZ point', function() {
|
||||
var point = new ol.geom.Point([10, 20, 0], 'XYZ');
|
||||
var point = new _ol_geom_Point_([10, 20, 0], 'XYZ');
|
||||
var esrijson = format.writeGeometry(point);
|
||||
expect(point.getCoordinates()).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
});
|
||||
|
||||
it('encodes XYM point', function() {
|
||||
var point = new ol.geom.Point([10, 20, 0], 'XYM');
|
||||
var point = new _ol_geom_Point_([10, 20, 0], 'XYM');
|
||||
var esrijson = format.writeGeometry(point);
|
||||
expect(point.getCoordinates()).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
});
|
||||
|
||||
it('encodes XYZM point', function() {
|
||||
var point = new ol.geom.Point([10, 20, 5, 0],
|
||||
var point = new _ol_geom_Point_([10, 20, 5, 0],
|
||||
'XYZM');
|
||||
var esrijson = format.writeGeometry(point);
|
||||
expect(point.getCoordinates()).to.eql(
|
||||
@@ -793,14 +791,14 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes linestring', function() {
|
||||
var linestring = new ol.geom.LineString([[10, 20], [30, 40]]);
|
||||
var linestring = new _ol_geom_LineString_([[10, 20], [30, 40]]);
|
||||
var esrijson = format.writeGeometry(linestring);
|
||||
expect(linestring.getCoordinates()).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
});
|
||||
|
||||
it('encodes XYZ linestring', function() {
|
||||
var linestring = new ol.geom.LineString([[10, 20, 1534], [30, 40, 1420]],
|
||||
var linestring = new _ol_geom_LineString_([[10, 20, 1534], [30, 40, 1420]],
|
||||
'XYZ');
|
||||
var esrijson = format.writeGeometry(linestring);
|
||||
expect(linestring.getCoordinates()).to.eql(
|
||||
@@ -808,7 +806,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYM linestring', function() {
|
||||
var linestring = new ol.geom.LineString([[10, 20, 1534], [30, 40, 1420]],
|
||||
var linestring = new _ol_geom_LineString_([[10, 20, 1534], [30, 40, 1420]],
|
||||
'XYM');
|
||||
var esrijson = format.writeGeometry(linestring);
|
||||
expect(linestring.getCoordinates()).to.eql(
|
||||
@@ -816,7 +814,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYZM linestring', function() {
|
||||
var linestring = new ol.geom.LineString([[10, 20, 1534, 1],
|
||||
var linestring = new _ol_geom_LineString_([[10, 20, 1534, 1],
|
||||
[30, 40, 1420, 1]],
|
||||
'XYZM');
|
||||
var esrijson = format.writeGeometry(linestring);
|
||||
@@ -828,7 +826,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
||||
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
||||
var polygon = new ol.geom.Polygon([outer, inner1, inner2]);
|
||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
||||
var esrijson = format.writeGeometry(polygon);
|
||||
expect(polygon.getCoordinates(false)).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
@@ -838,7 +836,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
|
||||
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
|
||||
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
|
||||
var polygon = new ol.geom.Polygon([outer, inner1, inner2],
|
||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2],
|
||||
'XYZ');
|
||||
var esrijson = format.writeGeometry(polygon);
|
||||
expect(polygon.getCoordinates(false)).to.eql(
|
||||
@@ -849,7 +847,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
|
||||
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
|
||||
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
|
||||
var polygon = new ol.geom.Polygon([outer, inner1, inner2],
|
||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2],
|
||||
'XYM');
|
||||
var esrijson = format.writeGeometry(polygon);
|
||||
expect(polygon.getCoordinates(false)).to.eql(
|
||||
@@ -866,7 +864,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
var inner2 = [
|
||||
[8, 8, 2, 1], [9, 8, 2, 2], [9, 9, 2, 1], [8, 9, 2, 1], [8, 8, 2, 1]
|
||||
];
|
||||
var polygon = new ol.geom.Polygon([outer, inner1, inner2],
|
||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2],
|
||||
'XYZM');
|
||||
var esrijson = format.writeGeometry(polygon);
|
||||
expect(polygon.getCoordinates(false)).to.eql(
|
||||
@@ -874,14 +872,14 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes multipoint', function() {
|
||||
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0], [103.0, 1.0]]);
|
||||
var multipoint = new _ol_geom_MultiPoint_([[102.0, 0.0], [103.0, 1.0]]);
|
||||
var esrijson = format.writeGeometry(multipoint);
|
||||
expect(multipoint.getCoordinates()).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
});
|
||||
|
||||
it('encodes XYZ multipoint', function() {
|
||||
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0, 3],
|
||||
var multipoint = new _ol_geom_MultiPoint_([[102.0, 0.0, 3],
|
||||
[103.0, 1.0, 4]], 'XYZ');
|
||||
var esrijson = format.writeGeometry(multipoint);
|
||||
expect(multipoint.getCoordinates()).to.eql(
|
||||
@@ -889,7 +887,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYM multipoint', function() {
|
||||
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0, 3],
|
||||
var multipoint = new _ol_geom_MultiPoint_([[102.0, 0.0, 3],
|
||||
[103.0, 1.0, 4]], 'XYM');
|
||||
var esrijson = format.writeGeometry(multipoint);
|
||||
expect(multipoint.getCoordinates()).to.eql(
|
||||
@@ -897,7 +895,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYZM multipoint', function() {
|
||||
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0, 3, 1],
|
||||
var multipoint = new _ol_geom_MultiPoint_([[102.0, 0.0, 3, 1],
|
||||
[103.0, 1.0, 4, 1]], 'XYZM');
|
||||
var esrijson = format.writeGeometry(multipoint);
|
||||
expect(multipoint.getCoordinates()).to.eql(
|
||||
@@ -905,7 +903,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes multilinestring', function() {
|
||||
var multilinestring = new ol.geom.MultiLineString([
|
||||
var multilinestring = new _ol_geom_MultiLineString_([
|
||||
[[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]],
|
||||
[[105.0, 3.0], [106.0, 4.0], [107.0, 3.0], [108.0, 4.0]]
|
||||
]);
|
||||
@@ -915,7 +913,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYZ multilinestring', function() {
|
||||
var multilinestring = new ol.geom.MultiLineString([
|
||||
var multilinestring = new _ol_geom_MultiLineString_([
|
||||
[[102.0, 0.0, 1], [103.0, 1.0, 2], [104.0, 0.0, 3], [105.0, 1.0, 4]],
|
||||
[[105.0, 3.0, 1], [106.0, 4.0, 2], [107.0, 3.0, 3], [108.0, 4.0, 4]]
|
||||
], 'XYZ');
|
||||
@@ -925,7 +923,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYM multilinestring', function() {
|
||||
var multilinestring = new ol.geom.MultiLineString([
|
||||
var multilinestring = new _ol_geom_MultiLineString_([
|
||||
[[102.0, 0.0, 1], [103.0, 1.0, 2], [104.0, 0.0, 3], [105.0, 1.0, 4]],
|
||||
[[105.0, 3.0, 1], [106.0, 4.0, 2], [107.0, 3.0, 3], [108.0, 4.0, 4]]
|
||||
], 'XYM');
|
||||
@@ -935,7 +933,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYZM multilinestring', function() {
|
||||
var multilinestring = new ol.geom.MultiLineString([
|
||||
var multilinestring = new _ol_geom_MultiLineString_([
|
||||
[[102.0, 0.0, 1, 0], [103.0, 1.0, 2, 2], [104.0, 0.0, 3, 1],
|
||||
[105.0, 1.0, 4, 2]],
|
||||
[[105.0, 3.0, 1, 0], [106.0, 4.0, 2, 1], [107.0, 3.0, 3, 1],
|
||||
@@ -947,7 +945,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes multipolygon', function() {
|
||||
var multipolygon = new ol.geom.MultiPolygon([
|
||||
var multipolygon = new _ol_geom_MultiPolygon_([
|
||||
[[[0, 1], [1, 4], [4, 3], [3, 0]], [[2, 2], [3, 2], [3, 3], [2, 3]]],
|
||||
[[[10, 1], [11, 5], [14, 3], [13, 0]]]
|
||||
]);
|
||||
@@ -957,7 +955,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYZ multipolygon', function() {
|
||||
var multipolygon = new ol.geom.MultiPolygon([
|
||||
var multipolygon = new _ol_geom_MultiPolygon_([
|
||||
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[[[10, 1, 0], [11, 5, 0], [14, 3, 0], [13, 0, 0]]]
|
||||
@@ -968,7 +966,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYM multipolygon', function() {
|
||||
var multipolygon = new ol.geom.MultiPolygon([
|
||||
var multipolygon = new _ol_geom_MultiPolygon_([
|
||||
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[[[10, 1, 0], [11, 5, 0], [14, 3, 0], [13, 0, 0]]]
|
||||
@@ -979,7 +977,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes XYZM multipolygon', function() {
|
||||
var multipolygon = new ol.geom.MultiPolygon([
|
||||
var multipolygon = new _ol_geom_MultiPolygon_([
|
||||
[[[0, 1, 0, 1], [1, 4, 0, 1], [4, 3, 0, 3], [3, 0, 0, 3]],
|
||||
[[2, 2, 0, 3], [3, 2, 0, 4],
|
||||
[3, 3, 0, 1], [2, 3, 0, 1]]],
|
||||
@@ -991,7 +989,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('transforms and encodes a point', function() {
|
||||
var point = new ol.geom.Point([2, 3]);
|
||||
var point = new _ol_geom_Point_([2, 3]);
|
||||
var esrijson = format.writeGeometry(point, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
@@ -1050,15 +1048,15 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('writes out a feature with a different geometryName correctly',
|
||||
function() {
|
||||
var feature = new ol.Feature({'foo': 'bar'});
|
||||
var feature = new _ol_Feature_({'foo': 'bar'});
|
||||
feature.setGeometryName('mygeom');
|
||||
feature.setGeometry(new ol.geom.Point([5, 10]));
|
||||
feature.setGeometry(new _ol_geom_Point_([5, 10]));
|
||||
var esrijson = format.writeFeaturesObject([feature]);
|
||||
expect(esrijson.features[0].attributes.mygeom).to.eql(undefined);
|
||||
});
|
||||
|
||||
it('writes out a feature without properties correctly', function() {
|
||||
var feature = new ol.Feature(new ol.geom.Point([5, 10]));
|
||||
var feature = new _ol_Feature_(new _ol_geom_Point_([5, 10]));
|
||||
var esrijson = format.writeFeatureObject(feature);
|
||||
expect(esrijson.attributes).to.eql({});
|
||||
});
|
||||
|
||||
+117
-117
@@ -1,21 +1,21 @@
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.format.GeoJSON');
|
||||
goog.require('ol.geom.Circle');
|
||||
goog.require('ol.geom.GeometryCollection');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.geom.LinearRing');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.proj');
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js';
|
||||
import _ol_geom_Circle_ from '../../../../src/ol/geom/Circle.js';
|
||||
import _ol_geom_GeometryCollection_ from '../../../../src/ol/geom/GeometryCollection.js';
|
||||
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
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';
|
||||
|
||||
|
||||
describe('ol.format.GeoJSON', function() {
|
||||
|
||||
var format;
|
||||
beforeEach(function() {
|
||||
format = new ol.format.GeoJSON();
|
||||
format = new _ol_format_GeoJSON_();
|
||||
});
|
||||
|
||||
var pointGeoJSON = {
|
||||
@@ -145,26 +145,26 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a single point feature', function() {
|
||||
var feature = format.readFeature(pointGeoJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.Point);
|
||||
expect(geometry).to.be.an(_ol_geom_Point_);
|
||||
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
});
|
||||
|
||||
it('can read a single point geometry as a feature', function() {
|
||||
var feature = format.readFeature(pointGeoJSON.geometry);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.Point);
|
||||
expect(geometry).to.be.an(_ol_geom_Point_);
|
||||
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
|
||||
});
|
||||
|
||||
it('can read a single line string feature', function() {
|
||||
var feature = format.readFeature(lineStringGeoJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.LineString);
|
||||
expect(geometry).to.be.an(_ol_geom_LineString_);
|
||||
expect(geometry.getCoordinates()).to.eql(
|
||||
[[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
@@ -173,9 +173,9 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a single polygon feature', function() {
|
||||
var feature = format.readFeature(polygonGeoJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.Polygon);
|
||||
expect(geometry).to.be.an(_ol_geom_Polygon_);
|
||||
expect(geometry.getCoordinates()).to.eql([[
|
||||
[100.0, 0.0], [100.0, 1.0], [101.0, 1.0], [101.0, 0.0]
|
||||
]]);
|
||||
@@ -185,7 +185,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a feature with null geometry', function() {
|
||||
var feature = format.readFeature(nullGeometryGeoJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.eql(null);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
@@ -193,71 +193,71 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a feature with id equal to 0', function() {
|
||||
var feature = format.readFeature(zeroIdGeoJSON);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature.getId()).to.be(0);
|
||||
});
|
||||
|
||||
it('can read a feature collection', function() {
|
||||
var features = format.readFeatures(featureCollectionGeoJSON);
|
||||
expect(features).to.have.length(3);
|
||||
expect(features[0].getGeometry()).to.be.an(ol.geom.Point);
|
||||
expect(features[1].getGeometry()).to.be.an(ol.geom.LineString);
|
||||
expect(features[2].getGeometry()).to.be.an(ol.geom.Polygon);
|
||||
expect(features[0].getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
expect(features[1].getGeometry()).to.be.an(_ol_geom_LineString_);
|
||||
expect(features[2].getGeometry()).to.be.an(_ol_geom_Polygon_);
|
||||
});
|
||||
|
||||
it('can read and transform a point', function() {
|
||||
var feature = format.readFeatures(pointGeoJSON, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature[0].getGeometry()).to.be.an(ol.geom.Point);
|
||||
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'));
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('uses featureProjection passed to the constructor', function() {
|
||||
var format = new ol.format.GeoJSON({featureProjection: 'EPSG:3857'});
|
||||
var format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:3857'});
|
||||
var feature = format.readFeatures(pointGeoJSON);
|
||||
expect(feature[0].getGeometry()).to.be.an(ol.geom.Point);
|
||||
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'));
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('gives precedence to options passed to the read method', function() {
|
||||
var format = new ol.format.GeoJSON({featureProjection: 'EPSG:1234'});
|
||||
var format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:1234'});
|
||||
var feature = format.readFeatures(pointGeoJSON, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature[0].getGeometry()).to.be.an(ol.geom.Point);
|
||||
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'));
|
||||
_ol_proj_.transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('can read and transform a feature collection', function() {
|
||||
var features = format.readFeatures(featureCollectionGeoJSON, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(features[0].getGeometry()).to.be.an(ol.geom.Point);
|
||||
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'));
|
||||
_ol_proj_.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')
|
||||
_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')
|
||||
]);
|
||||
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')
|
||||
_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')
|
||||
]]);
|
||||
});
|
||||
|
||||
it('can create a feature with a specific geometryName', function() {
|
||||
var feature = new ol.format.GeoJSON({geometryName: 'the_geom'}).
|
||||
var feature = new _ol_format_GeoJSON_({geometryName: 'the_geom'}).
|
||||
readFeature(pointGeoJSON);
|
||||
expect(feature.getGeometryName()).to.be('the_geom');
|
||||
expect(feature.getGeometry()).to.be.an(ol.geom.Point);
|
||||
expect(feature.getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -271,16 +271,16 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(array.length).to.be(2);
|
||||
|
||||
var first = array[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first.get('LINK_ID')).to.be(573730499);
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(ol.geom.LineString);
|
||||
expect(firstGeom).to.be.a(_ol_geom_LineString_);
|
||||
|
||||
var second = array[1];
|
||||
expect(second).to.be.a(ol.Feature);
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second.get('ST_NAME')).to.be('BRUNNSGATAN');
|
||||
var secondGeom = second.getGeometry();
|
||||
expect(secondGeom).to.be.a(ol.geom.LineString);
|
||||
expect(secondGeom).to.be.a(_ol_geom_LineString_);
|
||||
});
|
||||
|
||||
it('can parse a polygon geometry as an array of one feature', function() {
|
||||
@@ -288,7 +288,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features).to.have.length(1);
|
||||
var geometry = features[0].getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.Polygon);
|
||||
expect(geometry).to.be.an(_ol_geom_Polygon_);
|
||||
});
|
||||
|
||||
it('parses countries.geojson', function(done) {
|
||||
@@ -297,22 +297,22 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(result.length).to.be(179);
|
||||
|
||||
var first = result[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first.get('name')).to.be('Afghanistan');
|
||||
expect(first.getId()).to.be('AFG');
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(ol.geom.Polygon);
|
||||
expect(ol.extent.equals(firstGeom.getExtent(),
|
||||
expect(firstGeom).to.be.a(_ol_geom_Polygon_);
|
||||
expect(_ol_extent_.equals(firstGeom.getExtent(),
|
||||
[60.52843, 29.318572, 75.158028, 38.486282]))
|
||||
.to.be(true);
|
||||
|
||||
var last = result[178];
|
||||
expect(last).to.be.a(ol.Feature);
|
||||
expect(last).to.be.a(_ol_Feature_);
|
||||
expect(last.get('name')).to.be('Zimbabwe');
|
||||
expect(last.getId()).to.be('ZWE');
|
||||
var lastGeom = last.getGeometry();
|
||||
expect(lastGeom).to.be.a(ol.geom.Polygon);
|
||||
expect(ol.extent.equals(lastGeom.getExtent(),
|
||||
expect(lastGeom).to.be.a(_ol_geom_Polygon_);
|
||||
expect(_ol_extent_.equals(lastGeom.getExtent(),
|
||||
[25.264226, -22.271612, 32.849861, -15.507787]))
|
||||
.to.be(true);
|
||||
done();
|
||||
@@ -322,7 +322,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('generates an array of features for Feature', function() {
|
||||
|
||||
var format = new ol.format.GeoJSON();
|
||||
var format = new _ol_format_GeoJSON_();
|
||||
var json = {
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
@@ -338,11 +338,11 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(features.length).to.be(1);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first.get('bam')).to.be('baz');
|
||||
expect(first.getGeometry()).to.be.a(ol.geom.LineString);
|
||||
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(_ol_proj_.get('EPSG:4326'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -356,7 +356,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Point);
|
||||
expect(obj).to.be.a(_ol_geom_Point_);
|
||||
expect(obj.getCoordinates()).to.eql([10, 20]);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
});
|
||||
@@ -368,7 +368,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.LineString);
|
||||
expect(obj).to.be.a(_ol_geom_LineString_);
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20], [30, 40]]);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
});
|
||||
@@ -380,7 +380,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.LineString);
|
||||
expect(obj).to.be.a(_ol_geom_LineString_);
|
||||
expect(obj.getLayout()).to.eql('XYZ');
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20, 1534], [30, 40, 1420]]);
|
||||
});
|
||||
@@ -395,13 +395,13 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(ol.geom.Polygon);
|
||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[1]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[2]).to.be.a(ol.geom.LinearRing);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
});
|
||||
|
||||
it('parses geometry collection', function() {
|
||||
@@ -414,12 +414,12 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
var geometryCollection = format.readGeometry(str);
|
||||
expect(geometryCollection).to.be.an(ol.geom.GeometryCollection);
|
||||
expect(geometryCollection).to.be.an(_ol_geom_GeometryCollection_);
|
||||
var array = geometryCollection.getGeometries();
|
||||
expect(array.length).to.be(2);
|
||||
expect(array[0]).to.be.a(ol.geom.Point);
|
||||
expect(array[0]).to.be.a(_ol_geom_Point_);
|
||||
expect(array[0].getLayout()).to.eql('XY');
|
||||
expect(array[1]).to.be.a(ol.geom.LineString);
|
||||
expect(array[1]).to.be.a(_ol_geom_LineString_);
|
||||
expect(array[1].getLayout()).to.eql('XY');
|
||||
});
|
||||
|
||||
@@ -462,16 +462,16 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(features.length).to.be(2);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first.get('foo')).to.be('bar');
|
||||
expect(first.getGeometry()).to.be.a(ol.geom.Point);
|
||||
expect(first.getGeometry()).to.be.a(_ol_geom_Point_);
|
||||
|
||||
var second = features[1];
|
||||
expect(second).to.be.a(ol.Feature);
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(ol.geom.LineString);
|
||||
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(_ol_proj_.get('EPSG:3857'));
|
||||
|
||||
});
|
||||
|
||||
@@ -505,16 +505,16 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(features.length).to.be(2);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first.get('foo')).to.be('bar');
|
||||
expect(first.getGeometry()).to.be.a(ol.geom.Point);
|
||||
expect(first.getGeometry()).to.be.a(_ol_geom_Point_);
|
||||
|
||||
var second = features[1];
|
||||
expect(second).to.be.a(ol.Feature);
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(ol.geom.LineString);
|
||||
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(_ol_proj_.get('EPSG:4326'));
|
||||
|
||||
});
|
||||
|
||||
@@ -560,27 +560,27 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('writes out a feature with a different geometryName correctly',
|
||||
function() {
|
||||
var feature = new ol.Feature({'foo': 'bar'});
|
||||
var feature = new _ol_Feature_({'foo': 'bar'});
|
||||
feature.setGeometryName('mygeom');
|
||||
feature.setGeometry(new ol.geom.Point([5, 10]));
|
||||
feature.setGeometry(new _ol_geom_Point_([5, 10]));
|
||||
var geojson = format.writeFeaturesObject([feature]);
|
||||
expect(geojson.features[0].properties.mygeom).to.eql(undefined);
|
||||
});
|
||||
|
||||
it('writes out a feature without properties correctly', function() {
|
||||
var feature = new ol.Feature(new ol.geom.Point([5, 10]));
|
||||
var feature = new _ol_Feature_(new _ol_geom_Point_([5, 10]));
|
||||
var geojson = format.writeFeatureObject(feature);
|
||||
expect(geojson.properties).to.eql(null);
|
||||
});
|
||||
|
||||
it('writes out a feature without geometry correctly', function() {
|
||||
var feature = new ol.Feature();
|
||||
var feature = new _ol_Feature_();
|
||||
var geojson = format.writeFeatureObject(feature);
|
||||
expect(geojson.geometry).to.eql(null);
|
||||
});
|
||||
|
||||
it('writes out a feature with id equal to 0 correctly', function() {
|
||||
var feature = new ol.Feature();
|
||||
var feature = new _ol_Feature_();
|
||||
feature.setId(0);
|
||||
var geojson = format.writeFeatureObject(feature);
|
||||
expect(geojson.id).to.eql(0);
|
||||
@@ -590,29 +590,29 @@ describe('ol.format.GeoJSON', function() {
|
||||
describe('#writeGeometry', function() {
|
||||
|
||||
it('encodes point', function() {
|
||||
var point = new ol.geom.Point([10, 20]);
|
||||
var point = new _ol_geom_Point_([10, 20]);
|
||||
var geojson = format.writeGeometry(point);
|
||||
expect(point.getCoordinates()).to.eql(
|
||||
format.readGeometry(geojson).getCoordinates());
|
||||
});
|
||||
|
||||
it('accepts featureProjection', function() {
|
||||
var point = new ol.geom.Point(ol.proj.fromLonLat([10, 20]));
|
||||
var point = new _ol_geom_Point_(_ol_proj_.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(_ol_proj_.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 format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:3857'});
|
||||
var point = new _ol_geom_Point_(_ol_proj_.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(_ol_proj_.toLonLat(point.getCoordinates()));
|
||||
});
|
||||
|
||||
it('encodes linestring', function() {
|
||||
var linestring = new ol.geom.LineString([[10, 20], [30, 40]]);
|
||||
var linestring = new _ol_geom_LineString_([[10, 20], [30, 40]]);
|
||||
var geojson = format.writeGeometry(linestring);
|
||||
expect(linestring.getCoordinates()).to.eql(
|
||||
format.readGeometry(geojson).getCoordinates());
|
||||
@@ -622,7 +622,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
||||
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
||||
var polygon = new ol.geom.Polygon([outer, inner1, inner2]);
|
||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
||||
var geojson = format.writeGeometry(polygon);
|
||||
expect(polygon.getCoordinates()).to.eql(
|
||||
format.readGeometry(geojson).getCoordinates());
|
||||
@@ -633,10 +633,10 @@ describe('ol.format.GeoJSON', function() {
|
||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||
|
||||
var right = new ol.geom.Polygon([ccw, cw]);
|
||||
var rightMulti = new ol.geom.MultiPolygon([[ccw, cw]]);
|
||||
var left = new ol.geom.Polygon([cw, ccw]);
|
||||
var leftMulti = new ol.geom.MultiPolygon([[cw, ccw]]);
|
||||
var right = new _ol_geom_Polygon_([ccw, cw]);
|
||||
var rightMulti = new _ol_geom_MultiPolygon_([[ccw, cw]]);
|
||||
var left = new _ol_geom_Polygon_([cw, ccw]);
|
||||
var leftMulti = new _ol_geom_MultiPolygon_([[cw, ccw]]);
|
||||
|
||||
var rightObj = {
|
||||
type: 'Polygon',
|
||||
@@ -670,10 +670,10 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||
var right = new ol.geom.Polygon([ccw, cw]);
|
||||
var rightMulti = new ol.geom.MultiPolygon([[ccw, cw]]);
|
||||
var left = new ol.geom.Polygon([cw, ccw]);
|
||||
var leftMulti = new ol.geom.MultiPolygon([[cw, ccw]]);
|
||||
var right = new _ol_geom_Polygon_([ccw, cw]);
|
||||
var rightMulti = new _ol_geom_MultiPolygon_([[ccw, cw]]);
|
||||
var left = new _ol_geom_Polygon_([cw, ccw]);
|
||||
var leftMulti = new _ol_geom_MultiPolygon_([[cw, ccw]]);
|
||||
|
||||
var rightObj = {
|
||||
type: 'Polygon',
|
||||
@@ -701,10 +701,10 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||
var right = new ol.geom.Polygon([ccw, cw]);
|
||||
var rightMulti = new ol.geom.MultiPolygon([[ccw, cw]]);
|
||||
var left = new ol.geom.Polygon([cw, ccw]);
|
||||
var leftMulti = new ol.geom.MultiPolygon([[cw, ccw]]);
|
||||
var right = new _ol_geom_Polygon_([ccw, cw]);
|
||||
var rightMulti = new _ol_geom_MultiPolygon_([[ccw, cw]]);
|
||||
var left = new _ol_geom_Polygon_([cw, ccw]);
|
||||
var leftMulti = new _ol_geom_MultiPolygon_([[cw, ccw]]);
|
||||
|
||||
var leftObj = {
|
||||
type: 'Polygon',
|
||||
@@ -729,13 +729,13 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes geometry collection', function() {
|
||||
var collection = new ol.geom.GeometryCollection([
|
||||
new ol.geom.Point([10, 20]),
|
||||
new ol.geom.LineString([[30, 40], [50, 60]])
|
||||
var collection = new _ol_geom_GeometryCollection_([
|
||||
new _ol_geom_Point_([10, 20]),
|
||||
new _ol_geom_LineString_([[30, 40], [50, 60]])
|
||||
]);
|
||||
var geojson = format.writeGeometry(collection);
|
||||
var got = format.readGeometry(geojson);
|
||||
expect(got).to.be.an(ol.geom.GeometryCollection);
|
||||
expect(got).to.be.an(_ol_geom_GeometryCollection_);
|
||||
var gotGeometries = got.getGeometries();
|
||||
var geometries = collection.getGeometries();
|
||||
expect(geometries.length).to.equal(gotGeometries.length);
|
||||
@@ -747,7 +747,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes a circle as an empty geometry collection', function() {
|
||||
var circle = new ol.geom.Circle([0, 0], 1);
|
||||
var circle = new _ol_geom_Circle_([0, 0], 1);
|
||||
var geojson = format.writeGeometryObject(circle);
|
||||
expect(geojson).to.eql({
|
||||
'type': 'GeometryCollection',
|
||||
@@ -756,7 +756,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('transforms and encodes a point', function() {
|
||||
var point = new ol.geom.Point([2, 3]);
|
||||
var point = new _ol_geom_Point_([2, 3]);
|
||||
var geojson = format.writeGeometry(point, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
@@ -770,9 +770,9 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('transforms and encodes geometry collection', function() {
|
||||
var collection = new ol.geom.GeometryCollection([
|
||||
new ol.geom.Point([2, 3]),
|
||||
new ol.geom.LineString([[3, 2], [2, 1]])
|
||||
var collection = new _ol_geom_GeometryCollection_([
|
||||
new _ol_geom_Point_([2, 3]),
|
||||
new _ol_geom_LineString_([[3, 2], [2, 1]])
|
||||
]);
|
||||
var geojson = format.writeGeometry(collection, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
@@ -793,7 +793,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('truncates transformed point with decimals option', function() {
|
||||
var point = new ol.geom.Point([2, 3]).transform('EPSG:4326', 'EPSG:3857');
|
||||
var point = new _ol_geom_Point_([2, 3]).transform('EPSG:4326', 'EPSG:3857');
|
||||
var geojson = format.writeGeometry(point, {
|
||||
featureProjection: 'EPSG:3857',
|
||||
decimals: 2
|
||||
@@ -803,7 +803,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('truncates a linestring with decimals option', function() {
|
||||
var linestring = new ol.geom.LineString([[42.123456789, 38.987654321],
|
||||
var linestring = new _ol_geom_LineString_([[42.123456789, 38.987654321],
|
||||
[43, 39]]);
|
||||
var geojson = format.writeGeometry(linestring, {
|
||||
decimals: 6
|
||||
@@ -815,7 +815,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('rounds a linestring with decimals option = 0', function() {
|
||||
var linestring = new ol.geom.LineString([[42.123456789, 38.987654321],
|
||||
var linestring = new _ol_geom_LineString_([[42.123456789, 38.987654321],
|
||||
[43, 39]]);
|
||||
var geojson = format.writeGeometry(linestring, {
|
||||
decimals: 0
|
||||
|
||||
+117
-119
@@ -1,20 +1,18 @@
|
||||
|
||||
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.GML');
|
||||
goog.require('ol.format.GML2');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.geom.LinearRing');
|
||||
goog.require('ol.geom.MultiLineString');
|
||||
goog.require('ol.geom.MultiPoint');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_format_GML_ from '../../../../src/ol/format/GML.js';
|
||||
import _ol_format_GML2_ from '../../../../src/ol/format/GML2.js';
|
||||
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||
import _ol_geom_MultiLineString_ from '../../../../src/ol/geom/MultiLineString.js';
|
||||
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 _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
|
||||
var readGeometry = function(format, text, opt_options) {
|
||||
var doc = ol.xml.parse(text);
|
||||
var doc = _ol_xml_.parse(text);
|
||||
// we need an intermediate node for testing purposes
|
||||
var node = document.createElement('PRE');
|
||||
node.appendChild(doc.documentElement);
|
||||
@@ -25,7 +23,7 @@ describe('ol.format.GML2', function() {
|
||||
|
||||
var format;
|
||||
beforeEach(function() {
|
||||
format = new ol.format.GML2({srsName: 'CRS:84'});
|
||||
format = new _ol_format_GML2_({srsName: 'CRS:84'});
|
||||
});
|
||||
|
||||
describe('#readFeatures', function() {
|
||||
@@ -34,7 +32,7 @@ describe('ol.format.GML2', function() {
|
||||
var url = 'spec/ol/format/gml/osm-wfs-10.xml';
|
||||
afterLoadText(url, function(xml) {
|
||||
try {
|
||||
features = new ol.format.GML2().readFeatures(xml);
|
||||
features = new _ol_format_GML2_().readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -59,7 +57,7 @@ describe('ol.format.GML2', function() {
|
||||
'</gml:Point>';
|
||||
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([-180, -90, 0]);
|
||||
});
|
||||
|
||||
@@ -70,7 +68,7 @@ describe('ol.format.GML2', function() {
|
||||
'</gml:Point>';
|
||||
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([-180, -90, 42]);
|
||||
});
|
||||
|
||||
@@ -120,7 +118,7 @@ describe('ol.format.GML2', function() {
|
||||
'</gml:MultiPolygon>';
|
||||
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(g).to.be.an(_ol_geom_MultiPolygon_);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[
|
||||
[
|
||||
@@ -148,7 +146,7 @@ describe('ol.format.GML2', function() {
|
||||
var node;
|
||||
var featureNS = 'http://www.openlayers.org/';
|
||||
beforeEach(function() {
|
||||
node = ol.xml.createElementNS(featureNS, 'layer');
|
||||
node = _ol_xml_.createElementNS(featureNS, 'layer');
|
||||
});
|
||||
|
||||
it('can serialize a LineString', function() {
|
||||
@@ -165,8 +163,8 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new ol.Feature({
|
||||
geometry: new ol.geom.LineString([[1.1, 2], [3, 4.2]])
|
||||
var feature = new _ol_Feature_({
|
||||
geometry: new _ol_geom_LineString_([[1.1, 2], [3, 4.2]])
|
||||
});
|
||||
feature.setId(1);
|
||||
var objectStack = [{
|
||||
@@ -175,7 +173,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(ol.xml.parse(expected));
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Polygon', function() {
|
||||
@@ -196,8 +194,8 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new ol.Feature({
|
||||
geometry: new ol.geom.Polygon([[[1.1, 2], [3, 4.2], [5.2, 6]]])
|
||||
var feature = new _ol_Feature_({
|
||||
geometry: new _ol_geom_Polygon_([[[1.1, 2], [3, 4.2], [5.2, 6]]])
|
||||
});
|
||||
feature.setId(1);
|
||||
var objectStack = [{
|
||||
@@ -206,7 +204,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(ol.xml.parse(expected));
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Point', function() {
|
||||
@@ -223,8 +221,8 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new ol.Feature({
|
||||
geometry: new ol.geom.Point([1.1, 2])
|
||||
var feature = new _ol_Feature_({
|
||||
geometry: new _ol_geom_Point_([1.1, 2])
|
||||
});
|
||||
feature.setId(1);
|
||||
var objectStack = [{
|
||||
@@ -233,7 +231,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(ol.xml.parse(expected));
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Multi Point', function() {
|
||||
@@ -254,8 +252,8 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new ol.Feature({
|
||||
geometry: new ol.geom.MultiPoint([[1.1, 2]])
|
||||
var feature = new _ol_Feature_({
|
||||
geometry: new _ol_geom_MultiPoint_([[1.1, 2]])
|
||||
});
|
||||
feature.setId(1);
|
||||
var objectStack = [{
|
||||
@@ -264,7 +262,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(ol.xml.parse(expected));
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Multi Line String', function() {
|
||||
@@ -285,8 +283,8 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new ol.Feature({
|
||||
geometry: new ol.geom.MultiLineString([[[1.1, 2], [3, 4.2]]])
|
||||
var feature = new _ol_Feature_({
|
||||
geometry: new _ol_geom_MultiLineString_([[[1.1, 2], [3, 4.2]]])
|
||||
});
|
||||
feature.setId(1);
|
||||
var objectStack = [{
|
||||
@@ -295,7 +293,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(ol.xml.parse(expected));
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Multi Polygon', function() {
|
||||
@@ -320,8 +318,8 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new ol.Feature({
|
||||
geometry: new ol.geom.MultiPolygon([[[[1.1, 2], [3, 4.2], [5.2, 6]]]])
|
||||
var feature = new _ol_Feature_({
|
||||
geometry: new _ol_geom_MultiPolygon_([[[[1.1, 2], [3, 4.2], [5.2, 6]]]])
|
||||
});
|
||||
feature.setId(1);
|
||||
var objectStack = [{
|
||||
@@ -330,7 +328,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(ol.xml.parse(expected));
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -339,11 +337,11 @@ describe('ol.format.GML3', function() {
|
||||
|
||||
var format, formatWGS84, formatNoSrs;
|
||||
beforeEach(function() {
|
||||
format = new ol.format.GML({srsName: 'CRS:84'});
|
||||
formatWGS84 = new ol.format.GML({
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84'});
|
||||
formatWGS84 = new _ol_format_GML_({
|
||||
srsName: 'urn:x-ogc:def:crs:EPSG:4326'
|
||||
});
|
||||
formatNoSrs = new ol.format.GML();
|
||||
formatNoSrs = new _ol_format_GML_();
|
||||
});
|
||||
|
||||
describe('#readGeometry', function() {
|
||||
@@ -357,10 +355,10 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:pos srsDimension="2">1 2</gml:pos>' +
|
||||
'</gml:Point>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([1, 2, 0]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read a point geometry with scientific notation', function() {
|
||||
@@ -370,7 +368,7 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:pos>1E7 2</gml:pos>' +
|
||||
'</gml:Point>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([10000000, 2, 0]);
|
||||
text =
|
||||
'<gml:Point xmlns:gml="http://www.opengis.net/gml" ' +
|
||||
@@ -378,7 +376,7 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:pos>1e7 2</gml:pos>' +
|
||||
'</gml:Point>';
|
||||
g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([10000000, 2, 0]);
|
||||
});
|
||||
|
||||
@@ -392,10 +390,10 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:pos>1 2</gml:pos>' +
|
||||
'</gml:Point>';
|
||||
var g = readGeometry(format, text, config);
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
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'));
|
||||
_ol_proj_.transform([1, 2], 'CRS:84', 'EPSG:3857'));
|
||||
config.dataProjection = 'CRS:84';
|
||||
var serialized = format.writeGeometryNode(g, config);
|
||||
var pos = serialized.firstElementChild.firstElementChild.textContent;
|
||||
@@ -414,10 +412,10 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:pos>1 2</gml:pos>' +
|
||||
'</gml:Point>';
|
||||
var g = readGeometry(formatNoSrs, text, config);
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
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'));
|
||||
_ol_proj_.transform([1, 2], 'CRS:84', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('can read and write a point geometry in EPSG:4326', function() {
|
||||
@@ -427,10 +425,10 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:pos srsDimension="2">2 1</gml:pos>' +
|
||||
'</gml:Point>';
|
||||
var g = readGeometry(formatWGS84, text);
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([1, 2, 0]);
|
||||
var serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -444,10 +442,10 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:posList srsDimension="2">1 2 3 4</gml:posList>' +
|
||||
'</gml:LineString>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read, transform and write a linestring geometry', function() {
|
||||
@@ -461,12 +459,12 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:posList>1 2 3 4</gml:posList>' +
|
||||
'</gml:LineString>';
|
||||
var g = readGeometry(format, text, config);
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
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'));
|
||||
_ol_proj_.transform([1, 2], 'CRS:84', 'EPSG:3857'));
|
||||
expect(coordinates[1].slice(0, 2)).to.eql(
|
||||
ol.proj.transform([3, 4], 'CRS:84', 'EPSG:3857'));
|
||||
_ol_proj_.transform([3, 4], 'CRS:84', 'EPSG:3857'));
|
||||
var serialized = format.writeGeometryNode(g, config);
|
||||
var poss = serialized.firstElementChild.firstElementChild.textContent;
|
||||
var coordinate = poss.split(' ');
|
||||
@@ -483,10 +481,10 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:posList srsDimension="2">2 1 4 3</gml:posList>' +
|
||||
'</gml:LineString>';
|
||||
var g = readGeometry(formatWGS84, text);
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
|
||||
var serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -502,10 +500,10 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:posList srsDimension="2">-90 -180 90 180</gml:posList>' +
|
||||
'</gml:LineString>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
expect(g.getCoordinates()).to.eql([[-180, -90, 0], [180, 90, 0]]);
|
||||
var serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a point geometry with correct axis order',
|
||||
@@ -516,10 +514,10 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:pos srsDimension="2">-90 -180</gml:pos>' +
|
||||
'</gml:Point>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([-180, -90, 0]);
|
||||
var serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a surface geometry with right axis order',
|
||||
@@ -547,11 +545,11 @@ describe('ol.format.GML3', function() {
|
||||
var g = readGeometry(format, text);
|
||||
expect(g.getCoordinates()[0][0][0][0]).to.equal(-77.0081);
|
||||
expect(g.getCoordinates()[0][0][0][1]).to.equal(38.9661);
|
||||
format = new ol.format.GML({
|
||||
format = new _ol_format_GML_({
|
||||
srsName: 'urn:x-ogc:def:crs:EPSG:4326',
|
||||
surface: false});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -565,7 +563,7 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:posList>1 2 3 4 5 6</gml:posList>' +
|
||||
'</gml:LineString>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 3], [4, 5, 6]]);
|
||||
});
|
||||
|
||||
@@ -580,11 +578,11 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:posList srsDimension="2">1 2 3 4 5 6 1 2</gml:posList>' +
|
||||
'</gml:LinearRing>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.LinearRing);
|
||||
expect(g).to.be.an(_ol_geom_LinearRing_);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[1, 2, 0], [3, 4, 0], [5, 6, 0], [1, 2, 0]]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -612,12 +610,12 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:interior>' +
|
||||
'</gml:Polygon>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Polygon);
|
||||
expect(g).to.be.an(_ol_geom_Polygon_);
|
||||
expect(g.getCoordinates()).to.eql([[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -655,13 +653,13 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:patches>' +
|
||||
'</gml:Surface>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Polygon);
|
||||
expect(g).to.be.an(_ol_geom_Polygon_);
|
||||
expect(g.getCoordinates()).to.eql([[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||
format = new ol.format.GML({srsName: 'CRS:84', surface: true});
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', surface: true});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -679,11 +677,11 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:segments>' +
|
||||
'</gml:Curve>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
|
||||
format = new ol.format.GML({srsName: 'CRS:84', curve: true});
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', curve: true});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -726,10 +724,10 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:pointMember>' +
|
||||
'</gml:MultiPoint>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiPoint);
|
||||
expect(g).to.be.an(_ol_geom_MultiPoint_);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 0], [2, 3, 0], [3, 4, 0]]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read a plural multipoint geometry', function() {
|
||||
@@ -749,7 +747,7 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:pointMembers>' +
|
||||
'</gml:MultiPoint>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiPoint);
|
||||
expect(g).to.be.an(_ol_geom_MultiPoint_);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 0], [2, 3, 0], [3, 4, 0]]);
|
||||
});
|
||||
|
||||
@@ -773,12 +771,12 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:lineStringMember>' +
|
||||
'</gml:MultiLineString>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiLineString);
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
|
||||
format = new ol.format.GML({srsName: 'CRS:84', multiCurve: false});
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', multiCurve: false});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read a plural multilinestring geometry', function() {
|
||||
@@ -795,7 +793,7 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:lineStringMembers>' +
|
||||
'</gml:MultiLineString>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiLineString);
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
|
||||
});
|
||||
@@ -846,15 +844,15 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:polygonMember>' +
|
||||
'</gml:MultiPolygon>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(g).to.be.an(_ol_geom_MultiPolygon_);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
format = new ol.format.GML({srsName: 'CRS:84', multiSurface: false});
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', multiSurface: false});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read a plural multipolygon geometry', function() {
|
||||
@@ -889,7 +887,7 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:polygonMembers>' +
|
||||
'</gml:MultiPolygon>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(g).to.be.an(_ol_geom_MultiPolygon_);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
@@ -918,11 +916,11 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:curveMember>' +
|
||||
'</gml:MultiCurve>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiLineString);
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a singular multicurve-curve geometry', function() {
|
||||
@@ -949,12 +947,12 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:curveMember>' +
|
||||
'</gml:MultiCurve>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiLineString);
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
|
||||
format = new ol.format.GML({srsName: 'CRS:84', curve: true});
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', curve: true});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1003,14 +1001,14 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:surfaceMember>' +
|
||||
'</gml:MultiSurface>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(g).to.be.an(_ol_geom_MultiPolygon_);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read a plural multisurface geometry', function() {
|
||||
@@ -1047,7 +1045,7 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:surfaceMembers>' +
|
||||
'</gml:MultiSurface>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(g).to.be.an(_ol_geom_MultiPolygon_);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
@@ -1105,15 +1103,15 @@ describe('ol.format.GML3', function() {
|
||||
' </gml:surfaceMember>' +
|
||||
'</gml:MultiSurface>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(g).to.be.an(_ol_geom_MultiPolygon_);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
format = new ol.format.GML({srsName: 'CRS:84', surface: true});
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', surface: true});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1143,7 +1141,7 @@ describe('ol.format.GML3', function() {
|
||||
'featureNS': 'http://www.openplans.org/topp',
|
||||
'featureType': 'gnis_pop'
|
||||
};
|
||||
var features = new ol.format.GML(config).readFeatures(text);
|
||||
var features = new _ol_format_GML_(config).readFeatures(text);
|
||||
var feature = features[0];
|
||||
expect(feature.get('empty')).to.be(undefined);
|
||||
});
|
||||
@@ -1174,7 +1172,7 @@ describe('ol.format.GML3', function() {
|
||||
'featureNS': 'http://www.openplans.org/topp',
|
||||
'featureType': 'gnis_pop'
|
||||
};
|
||||
features = new ol.format.GML(config).readFeatures(text);
|
||||
features = new _ol_format_GML_(config).readFeatures(text);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1195,7 +1193,7 @@ describe('ol.format.GML3', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/topp-states-wfs.xml', function(xml) {
|
||||
try {
|
||||
gmlFormat = new ol.format.GML();
|
||||
gmlFormat = new _ol_format_GML_();
|
||||
features = gmlFormat.readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
@@ -1260,7 +1258,7 @@ describe('ol.format.GML3', function() {
|
||||
'schemaLocation': schemaLoc
|
||||
};
|
||||
text = xml;
|
||||
gmlFormat = new ol.format.GML(config);
|
||||
gmlFormat = new _ol_format_GML_(config);
|
||||
features = gmlFormat.readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
@@ -1279,7 +1277,7 @@ describe('ol.format.GML3', function() {
|
||||
|
||||
it('writes back features as GML', function() {
|
||||
var serialized = gmlFormat.writeFeaturesNode(features);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text), {ignoreElementOrder: true});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text), {ignoreElementOrder: true});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1294,7 +1292,7 @@ describe('ol.format.GML3', function() {
|
||||
'featureNS': 'http://www.openplans.org/topp',
|
||||
'featureType': 'states'
|
||||
};
|
||||
features = new ol.format.GML(config).readFeatures(xml);
|
||||
features = new _ol_format_GML_(config).readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1310,7 +1308,7 @@ describe('ol.format.GML3', function() {
|
||||
feature = features[0];
|
||||
expect(feature.getId()).to.equal('states.1');
|
||||
expect(feature.get('STATE_NAME')).to.equal('Illinois');
|
||||
expect(feature.getGeometry()).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(feature.getGeometry()).to.be.an(_ol_geom_MultiPolygon_);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1325,7 +1323,7 @@ describe('ol.format.GML3', function() {
|
||||
'featureNS': 'http://opengeo.org/#medford',
|
||||
'featureType': 'zoning'
|
||||
};
|
||||
features = new ol.format.GML(config).readFeatures(xml);
|
||||
features = new _ol_format_GML_(config).readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1335,8 +1333,8 @@ describe('ol.format.GML3', function() {
|
||||
|
||||
it('creates 2 geometries', function() {
|
||||
var feature = features[0];
|
||||
expect(feature.get('center')).to.be.a(ol.geom.Point);
|
||||
expect(feature.get('the_geom')).to.be.a(ol.geom.MultiPolygon);
|
||||
expect(feature.get('center')).to.be.a(_ol_geom_Point_);
|
||||
expect(feature.get('the_geom')).to.be.a(_ol_geom_MultiPolygon_);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1351,7 +1349,7 @@ describe('ol.format.GML3', function() {
|
||||
'featureNS': 'http://opengeo.org/#medford',
|
||||
'featureType': 'zoning'
|
||||
};
|
||||
features = new ol.format.GML(config).readFeatures(xml);
|
||||
features = new _ol_format_GML_(config).readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1372,7 +1370,7 @@ describe('ol.format.GML3', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/only-boundedby.xml', function(xml) {
|
||||
try {
|
||||
features = new ol.format.GML().readFeatures(xml);
|
||||
features = new _ol_format_GML_().readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1393,7 +1391,7 @@ describe('ol.format.GML3', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/ogr.xml', function(xml) {
|
||||
try {
|
||||
features = new ol.format.GML().readFeatures(xml);
|
||||
features = new _ol_format_GML_().readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1413,7 +1411,7 @@ describe('ol.format.GML3', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
|
||||
try {
|
||||
features = new ol.format.GML({
|
||||
features = new _ol_format_GML_({
|
||||
featureNS: 'http://localhost:8080/official',
|
||||
featureType: ['planet_osm_polygon', 'planet_osm_line']
|
||||
}).readFeatures(xml);
|
||||
@@ -1436,7 +1434,7 @@ describe('ol.format.GML3', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
|
||||
try {
|
||||
features = new ol.format.GML().readFeatures(xml);
|
||||
features = new _ol_format_GML_().readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1457,7 +1455,7 @@ describe('ol.format.GML3', function() {
|
||||
var url = 'spec/ol/format/gml/multiple-typenames-ns.xml';
|
||||
afterLoadText(url, function(xml) {
|
||||
try {
|
||||
features = new ol.format.GML({
|
||||
features = new _ol_format_GML_({
|
||||
featureNS: {
|
||||
'topp': 'http://www.openplans.org/topp',
|
||||
'sf': 'http://www.openplans.org/spearfish'
|
||||
@@ -1484,7 +1482,7 @@ describe('ol.format.GML3', function() {
|
||||
var url = 'spec/ol/format/gml/multiple-typenames-ns.xml';
|
||||
afterLoadText(url, function(xml) {
|
||||
try {
|
||||
features = new ol.format.GML().readFeatures(xml);
|
||||
features = new _ol_format_GML_().readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1509,7 +1507,7 @@ describe('ol.format.GML3', function() {
|
||||
'featureNS': 'http://www.opengeospatial.net/cite',
|
||||
'featureType': 'geoserver_layer'
|
||||
};
|
||||
features = new ol.format.GML(config).readFeatures(xml);
|
||||
features = new _ol_format_GML_(config).readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1524,19 +1522,19 @@ describe('ol.format.GML3', function() {
|
||||
it('creates a LineString', function() {
|
||||
feature = features[0];
|
||||
expect(feature.getId()).to.equal('geoserver_layer.1');
|
||||
expect(feature.getGeometry()).to.be.an(ol.geom.LineString);
|
||||
expect(feature.getGeometry()).to.be.an(_ol_geom_LineString_);
|
||||
});
|
||||
|
||||
it('creates a Polygon', function() {
|
||||
feature = features[1];
|
||||
expect(feature.getId()).to.equal('geoserver_layer.2');
|
||||
expect(feature.getGeometry()).to.be.an(ol.geom.Polygon);
|
||||
expect(feature.getGeometry()).to.be.an(_ol_geom_Polygon_);
|
||||
});
|
||||
|
||||
it('creates a Point', function() {
|
||||
feature = features[2];
|
||||
expect(feature.getId()).to.equal('geoserver_layer.3');
|
||||
expect(feature.getGeometry()).to.be.an(ol.geom.Point);
|
||||
expect(feature.getGeometry()).to.be.an(_ol_geom_Point_);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
|
||||
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.GPX');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.geom.MultiLineString');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_format_GPX_ from '../../../../src/ol/format/GPX.js';
|
||||
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 _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
|
||||
describe('ol.format.GPX', function() {
|
||||
|
||||
var format;
|
||||
beforeEach(function() {
|
||||
format = new ol.format.GPX();
|
||||
format = new _ol_format_GPX_();
|
||||
});
|
||||
|
||||
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(_ol_proj_.get('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(_ol_proj_.get('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,9 +36,9 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
expect(g.getCoordinates()).to.eql([]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
});
|
||||
@@ -67,7 +65,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f.get('name')).to.be('Name');
|
||||
expect(f.get('cmt')).to.be('Comment');
|
||||
expect(f.get('desc')).to.be('Description');
|
||||
@@ -78,7 +76,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(f.get('number')).to.be(1);
|
||||
expect(f.get('type')).to.be('Type');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a rte with multiple rtepts', function() {
|
||||
@@ -95,13 +93,13 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can transform, read and write a rte', function() {
|
||||
@@ -120,17 +118,17 @@ describe('ol.format.GPX', function() {
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
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');
|
||||
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');
|
||||
expect(g.getCoordinates()).to.eql([p1, p2]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('does not write rte attributes in rtepts', function() {
|
||||
@@ -147,7 +145,7 @@ describe('ol.format.GPX', function() {
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -162,9 +160,9 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.MultiLineString);
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
expect(g.getCoordinates()).to.eql([]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
});
|
||||
@@ -191,7 +189,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f.get('name')).to.be('Name');
|
||||
expect(f.get('cmt')).to.be('Comment');
|
||||
expect(f.get('desc')).to.be('Description');
|
||||
@@ -202,7 +200,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(f.get('number')).to.be(1);
|
||||
expect(f.get('type')).to.be('Type');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a trk with an empty trkseg', function() {
|
||||
@@ -218,13 +216,13 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.MultiLineString);
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
expect(g.getCoordinates()).to.eql([[]]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read/write a trk with a trkseg with multiple trkpts', function() {
|
||||
@@ -249,15 +247,15 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.MultiLineString);
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[2, 1, 3, 1263115752], [6, 5, 7, 1263115812]]
|
||||
]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can transform, read and write a trk with a trkseg', function() {
|
||||
@@ -284,19 +282,19 @@ describe('ol.format.GPX', function() {
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
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');
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
var p1 = _ol_proj_.transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
p1.push(3, 1263115752);
|
||||
var p2 = ol.proj.transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
var p2 = _ol_proj_.transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
p2.push(7, 1263115812);
|
||||
expect(g.getCoordinates()).to.eql([[p1, p2]]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
var serialized = format.writeFeaturesNode(fs, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a trk with multiple trksegs', function() {
|
||||
@@ -331,16 +329,16 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.MultiLineString);
|
||||
expect(g).to.be.an(_ol_geom_MultiLineString_);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[2, 1, 3, 1263115752], [6, 5, 7, 1263115812]],
|
||||
[[9, 8, 10, 1263115872], [12, 11, 13, 1263115932]]
|
||||
]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('does not write trk attributes in trkpts', function() {
|
||||
@@ -375,7 +373,7 @@ describe('ol.format.GPX', function() {
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -393,13 +391,13 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can transform, read and write a wpt', function() {
|
||||
@@ -415,16 +413,16 @@ describe('ol.format.GPX', function() {
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
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');
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
var expectedPoint = _ol_proj_.transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
expect(g.getCoordinates()).to.eql(expectedPoint);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a wpt with ele', function() {
|
||||
@@ -440,13 +438,13 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 3]);
|
||||
expect(g.getLayout()).to.be('XYZ');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a wpt with time', function() {
|
||||
@@ -462,13 +460,13 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 1263115752]);
|
||||
expect(g.getLayout()).to.be('XYM');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a wpt with ele and time', function() {
|
||||
@@ -485,13 +483,13 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 3, 1263115752]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write various wpt attributes', function() {
|
||||
@@ -525,7 +523,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f.get('magvar')).to.be(11);
|
||||
expect(f.get('geoidheight')).to.be(4);
|
||||
expect(f.get('name')).to.be('Name');
|
||||
@@ -544,7 +542,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(f.get('ageofdgpsdata')).to.be(9);
|
||||
expect(f.get('dgpsid')).to.be(10);
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -552,7 +550,7 @@ describe('ol.format.GPX', function() {
|
||||
describe('XML namespace support', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
format = new ol.format.GPX();
|
||||
format = new _ol_format_GPX_();
|
||||
});
|
||||
|
||||
it('can read features with a version 1.0 namespace', function() {
|
||||
@@ -593,7 +591,7 @@ describe('ol.format.GPX', function() {
|
||||
describe('extensions support', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
format = new ol.format.GPX({
|
||||
format = new _ol_format_GPX_({
|
||||
readExtensions: function(feature, extensionsNode) {
|
||||
var nodes = extensionsNode.getElementsByTagName('id');
|
||||
var id = nodes.item(0).textContent;
|
||||
@@ -659,13 +657,13 @@ describe('ol.format.GPX', function() {
|
||||
|
||||
describe('write unsupported geometries', function() {
|
||||
beforeEach(function() {
|
||||
format = new ol.format.GPX();
|
||||
format = new _ol_format_GPX_();
|
||||
});
|
||||
|
||||
it('does not fail', function() {
|
||||
var polygon = new ol.geom.Polygon(
|
||||
var polygon = new _ol_geom_Polygon_(
|
||||
[[[0, 0], [2, 2], [4, 0], [0, 0]]]);
|
||||
var feature = new ol.Feature(polygon);
|
||||
var feature = new _ol_Feature_(polygon);
|
||||
var features = [feature];
|
||||
var gpx = format.writeFeaturesNode(features);
|
||||
var expected =
|
||||
@@ -674,7 +672,7 @@ describe('ol.format.GPX', function() {
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
'http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" ' +
|
||||
'creator="OpenLayers"></gpx>';
|
||||
expect(gpx).to.xmleql(ol.xml.parse(expected));
|
||||
expect(gpx).to.xmleql(_ol_xml_.parse(expected));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
|
||||
|
||||
goog.require('ol.format.IGC');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.proj');
|
||||
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';
|
||||
|
||||
|
||||
describe('ol.format.IGC', function() {
|
||||
@@ -31,13 +29,13 @@ describe('ol.format.IGC', function() {
|
||||
'G60189641B00B00800019000000000000';
|
||||
|
||||
beforeEach(function() {
|
||||
format = new ol.format.IGC();
|
||||
format = new _ol_format_IGC_();
|
||||
});
|
||||
|
||||
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(_ol_proj_.get('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,7 +46,7 @@ describe('ol.format.IGC', function() {
|
||||
|
||||
it('does read a feature', function() {
|
||||
var feature = format.readFeature(igc);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([
|
||||
@@ -62,20 +60,20 @@ describe('ol.format.IGC', function() {
|
||||
var feature = format.readFeature(igc, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
|
||||
var expectedPoint1 = ol.proj.transform(
|
||||
var expectedPoint1 = _ol_proj_.transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint1.push(1303202928);
|
||||
var expectedPoint2 = ol.proj.transform(
|
||||
var expectedPoint2 = _ol_proj_.transform(
|
||||
[6.850183333333334, 45.93395], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint2.push(1303203353);
|
||||
var expectedPoint3 = ol.proj.transform(
|
||||
var expectedPoint3 = _ol_proj_.transform(
|
||||
[6.800816666666667, 45.916066666666666], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint3.push(1303203815);
|
||||
var expectedPoint4 = ol.proj.transform(
|
||||
var expectedPoint4 = _ol_proj_.transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint4.push(1303289328);
|
||||
|
||||
@@ -95,7 +93,7 @@ describe('ol.format.IGC', function() {
|
||||
var features = format.readFeatures(igc);
|
||||
expect(features.length).to.eql(1);
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([
|
||||
@@ -111,20 +109,20 @@ describe('ol.format.IGC', function() {
|
||||
});
|
||||
expect(features.length).to.eql(1);
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
|
||||
var expectedPoint1 = ol.proj.transform(
|
||||
var expectedPoint1 = _ol_proj_.transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint1.push(1303202928);
|
||||
var expectedPoint2 = ol.proj.transform(
|
||||
var expectedPoint2 = _ol_proj_.transform(
|
||||
[6.850183333333334, 45.93395], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint2.push(1303203353);
|
||||
var expectedPoint3 = ol.proj.transform(
|
||||
var expectedPoint3 = _ol_proj_.transform(
|
||||
[6.800816666666667, 45.916066666666666], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint3.push(1303203815);
|
||||
var expectedPoint4 = ol.proj.transform(
|
||||
var expectedPoint4 = _ol_proj_.transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint4.push(1303289328);
|
||||
|
||||
|
||||
+361
-363
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,10 @@
|
||||
|
||||
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.format.MVT');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.render.Feature');
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js';
|
||||
import _ol_geom_Point_ from '../../../../src/ol/geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import _ol_render_Feature_ from '../../../../src/ol/render/Feature.js';
|
||||
|
||||
where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
|
||||
@@ -25,20 +23,20 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
describe('#readFeatures', function() {
|
||||
|
||||
it('uses ol.render.Feature as feature class by default', function() {
|
||||
var format = new ol.format.MVT({layers: ['water']});
|
||||
var format = new _ol_format_MVT_({layers: ['water']});
|
||||
var features = format.readFeatures(data);
|
||||
expect(features[0]).to.be.a(ol.render.Feature);
|
||||
expect(features[0]).to.be.a(_ol_render_Feature_);
|
||||
});
|
||||
|
||||
it('parses only specified layers', function() {
|
||||
var format = new ol.format.MVT({layers: ['water']});
|
||||
var format = new _ol_format_MVT_({layers: ['water']});
|
||||
var features = format.readFeatures(data);
|
||||
expect(features.length).to.be(10);
|
||||
});
|
||||
|
||||
it('parses geometries correctly', function() {
|
||||
var format = new ol.format.MVT({
|
||||
featureClass: ol.Feature,
|
||||
var format = new _ol_format_MVT_({
|
||||
featureClass: _ol_Feature_,
|
||||
layers: ['poi_label']
|
||||
});
|
||||
var geometry;
|
||||
@@ -62,14 +60,14 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
|
||||
it('parses id property', function() {
|
||||
// ol.Feature
|
||||
var format = new ol.format.MVT({
|
||||
featureClass: ol.Feature,
|
||||
var format = new _ol_format_MVT_({
|
||||
featureClass: _ol_Feature_,
|
||||
layers: ['building']
|
||||
});
|
||||
var features = format.readFeatures(data);
|
||||
expect(features[0].getId()).to.be(2);
|
||||
// ol.render.Feature
|
||||
format = new ol.format.MVT({
|
||||
format = new _ol_format_MVT_({
|
||||
layers: ['building']
|
||||
});
|
||||
features = format.readFeatures(data);
|
||||
@@ -77,10 +75,10 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
});
|
||||
|
||||
it('sets the extent of the last readFeatures call', function() {
|
||||
var format = new ol.format.MVT();
|
||||
var format = new _ol_format_MVT_();
|
||||
format.readFeatures(data);
|
||||
var extent = format.getLastExtent();
|
||||
expect(ol.extent.getWidth(extent)).to.be(4096);
|
||||
expect(_ol_extent_.getWidth(extent)).to.be(4096);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -91,8 +89,8 @@ describe('ol.format.MVT', function() {
|
||||
|
||||
describe('#createFeature_', function() {
|
||||
it('accepts a geometryName', function() {
|
||||
var format = new ol.format.MVT({
|
||||
featureClass: ol.Feature,
|
||||
var format = new _ol_format_MVT_({
|
||||
featureClass: _ol_Feature_,
|
||||
geometryName: 'myGeom'
|
||||
});
|
||||
var rawFeature = {
|
||||
@@ -105,22 +103,22 @@ describe('ol.format.MVT', function() {
|
||||
name: 'layer1'
|
||||
}
|
||||
};
|
||||
var readRawGeometry_ = ol.format.MVT.readRawGeometry_;
|
||||
ol.format.MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_;
|
||||
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
flatCoordinates.push(0, 0);
|
||||
ends.push(2);
|
||||
};
|
||||
var feature = format.createFeature_({}, rawFeature);
|
||||
ol.format.MVT.readRawGeometry_ = readRawGeometry_;
|
||||
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_;
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.a(ol.geom.Point);
|
||||
expect(geometry).to.be.a(_ol_geom_Point_);
|
||||
expect(feature.get('myGeom')).to.equal(geometry);
|
||||
expect(feature.get('geometry')).to.be('foo');
|
||||
});
|
||||
|
||||
it('detects a Polygon', function() {
|
||||
var format = new ol.format.MVT({
|
||||
featureClass: ol.Feature
|
||||
var format = new _ol_format_MVT_({
|
||||
featureClass: _ol_Feature_
|
||||
});
|
||||
var rawFeature = {
|
||||
type: 3,
|
||||
@@ -129,21 +127,21 @@ describe('ol.format.MVT', function() {
|
||||
name: 'layer1'
|
||||
}
|
||||
};
|
||||
var readRawGeometry_ = ol.format.MVT.readRawGeometry_;
|
||||
ol.format.MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_;
|
||||
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
flatCoordinates.push(0, 0, 3, 0, 3, 3, 3, 0, 0, 0);
|
||||
flatCoordinates.push(1, 1, 1, 2, 2, 2, 2, 1, 1, 1);
|
||||
ends.push(10, 20);
|
||||
};
|
||||
var feature = format.createFeature_({}, rawFeature);
|
||||
ol.format.MVT.readRawGeometry_ = readRawGeometry_;
|
||||
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_;
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.a(ol.geom.Polygon);
|
||||
expect(geometry).to.be.a(_ol_geom_Polygon_);
|
||||
});
|
||||
|
||||
it('detects a MultiPolygon', function() {
|
||||
var format = new ol.format.MVT({
|
||||
featureClass: ol.Feature
|
||||
var format = new _ol_format_MVT_({
|
||||
featureClass: _ol_Feature_
|
||||
});
|
||||
var rawFeature = {
|
||||
type: 3,
|
||||
@@ -152,20 +150,20 @@ describe('ol.format.MVT', function() {
|
||||
name: 'layer1'
|
||||
}
|
||||
};
|
||||
var readRawGeometry_ = ol.format.MVT.readRawGeometry_;
|
||||
ol.format.MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_;
|
||||
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0);
|
||||
flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1);
|
||||
ends.push(10, 20);
|
||||
};
|
||||
var feature = format.createFeature_({}, rawFeature);
|
||||
ol.format.MVT.readRawGeometry_ = readRawGeometry_;
|
||||
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_;
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.a(ol.geom.MultiPolygon);
|
||||
expect(geometry).to.be.a(_ol_geom_MultiPolygon_);
|
||||
});
|
||||
|
||||
it('creates ol.render.Feature instances', function() {
|
||||
var format = new ol.format.MVT();
|
||||
var format = new _ol_format_MVT_();
|
||||
var rawFeature = {
|
||||
type: 3,
|
||||
properties: {
|
||||
@@ -175,10 +173,10 @@ describe('ol.format.MVT', function() {
|
||||
name: 'layer1'
|
||||
}
|
||||
};
|
||||
var readRawGeometry_ = ol.format.MVT.readRawGeometry_;
|
||||
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_;
|
||||
var createdFlatCoordinates;
|
||||
var createdEnds;
|
||||
ol.format.MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0);
|
||||
flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1);
|
||||
createdFlatCoordinates = flatCoordinates;
|
||||
@@ -186,8 +184,8 @@ describe('ol.format.MVT', function() {
|
||||
createdEnds = ends;
|
||||
};
|
||||
var feature = format.createFeature_({}, rawFeature);
|
||||
ol.format.MVT.readRawGeometry_ = readRawGeometry_;
|
||||
expect(feature).to.be.a(ol.render.Feature);
|
||||
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_;
|
||||
expect(feature).to.be.a(_ol_render_Feature_);
|
||||
expect(feature.getType()).to.be('Polygon');
|
||||
expect(feature.getFlatCoordinates()).to.equal(createdFlatCoordinates);
|
||||
expect(feature.getEnds()).to.equal(createdEnds);
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
|
||||
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.OSMXML');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.proj');
|
||||
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';
|
||||
|
||||
|
||||
describe('ol.format.OSMXML', function() {
|
||||
|
||||
var format;
|
||||
beforeEach(function() {
|
||||
format = new ol.format.OSMXML();
|
||||
format = new _ol_format_OSMXML_();
|
||||
});
|
||||
|
||||
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(_ol_proj_.get('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(_ol_proj_.get('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -51,9 +49,9 @@ describe('ol.format.OSMXML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(2);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
});
|
||||
|
||||
@@ -76,14 +74,14 @@ describe('ol.format.OSMXML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(3);
|
||||
var point = fs[0];
|
||||
expect(point).to.be.an(ol.Feature);
|
||||
expect(point).to.be.an(_ol_Feature_);
|
||||
var g = point.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
var line = fs[2];
|
||||
expect(line).to.be.an(ol.Feature);
|
||||
expect(line).to.be.an(_ol_Feature_);
|
||||
g = line.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
|
||||
});
|
||||
|
||||
@@ -107,9 +105,9 @@ describe('ol.format.OSMXML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(3);
|
||||
var line = fs[2];
|
||||
expect(line).to.be.an(ol.Feature);
|
||||
expect(line).to.be.an(_ol_Feature_);
|
||||
var g = line.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g).to.be.an(_ol_geom_LineString_);
|
||||
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
|
||||
});
|
||||
|
||||
@@ -130,11 +128,11 @@ describe('ol.format.OSMXML', function() {
|
||||
});
|
||||
expect(fs).to.have.length(2);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.Point);
|
||||
expect(g).to.be.an(_ol_geom_Point_);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
ol.proj.transform([2, 1], 'EPSG:4326', 'EPSG:3857'));
|
||||
_ol_proj_.transform([2, 1], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
|
||||
|
||||
goog.require('ol.format.OWS');
|
||||
goog.require('ol.xml');
|
||||
import _ol_format_OWS_ from '../../../../src/ol/format/OWS.js';
|
||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
|
||||
|
||||
describe('ol.format.OWS 1.1', function() {
|
||||
|
||||
var parser = new ol.format.OWS();
|
||||
var parser = new _ol_format_OWS_();
|
||||
|
||||
it('should read ServiceProvider tag properly', function() {
|
||||
var doc = ol.xml.parse(
|
||||
var doc = _ol_xml_.parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
|
||||
'<ows:ServiceProvider>' +
|
||||
@@ -58,7 +56,7 @@ describe('ol.format.OWS 1.1', function() {
|
||||
});
|
||||
|
||||
it('should read ServiceIdentification tag properly', function() {
|
||||
var doc = ol.xml.parse(
|
||||
var doc = _ol_xml_.parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
|
||||
'<ows:ServiceIdentification>' +
|
||||
@@ -93,7 +91,7 @@ describe('ol.format.OWS 1.1', function() {
|
||||
});
|
||||
|
||||
it('should read OperationsMetadata tag properly', function() {
|
||||
var doc = ol.xml.parse(
|
||||
var doc = _ol_xml_.parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
|
||||
'<ows:OperationsMetadata>' +
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
|
||||
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.Polyline');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.proj');
|
||||
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';
|
||||
|
||||
describe('ol.format.Polyline', function() {
|
||||
|
||||
@@ -16,7 +14,7 @@ describe('ol.format.Polyline', function() {
|
||||
var points3857;
|
||||
|
||||
function resetTestingData() {
|
||||
format = new ol.format.Polyline();
|
||||
format = new _ol_format_Polyline_();
|
||||
points = [
|
||||
[-120.20000, 38.50000],
|
||||
[-120.95000, 40.70000],
|
||||
@@ -34,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')
|
||||
_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')
|
||||
];
|
||||
|
||||
floats = [0.00, 0.15, -0.01, -0.16, 0.16, 0.01];
|
||||
@@ -56,13 +54,13 @@ 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(_ol_proj_.get('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('encodeDeltas', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeDeltas = ol.format.Polyline.encodeDeltas;
|
||||
var encodeDeltas = _ol_format_Polyline_.encodeDeltas;
|
||||
|
||||
expect(encodeDeltas(flippedFlatPoints, 2)).to.eql(encodedFlatPoints);
|
||||
});
|
||||
@@ -70,7 +68,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeDeltas', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeDeltas = ol.format.Polyline.decodeDeltas;
|
||||
var decodeDeltas = _ol_format_Polyline_.decodeDeltas;
|
||||
|
||||
expect(decodeDeltas(encodedFlatPoints, 2)).to.eql(flippedFlatPoints);
|
||||
});
|
||||
@@ -79,7 +77,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeFloats', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeFloats = ol.format.Polyline.encodeFloats;
|
||||
var encodeFloats = _ol_format_Polyline_.encodeFloats;
|
||||
|
||||
expect(encodeFloats(smallFloats)).to.eql(encodedFloats);
|
||||
|
||||
@@ -92,7 +90,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeFloats', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeFloats = ol.format.Polyline.decodeFloats;
|
||||
var decodeFloats = _ol_format_Polyline_.decodeFloats;
|
||||
|
||||
expect(decodeFloats(encodedFloats)).to.eql(smallFloats);
|
||||
expect(decodeFloats(encodedFloats, 1e5)).to.eql(smallFloats);
|
||||
@@ -103,7 +101,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeSignedIntegers', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeSignedIntegers = ol.format.Polyline.encodeSignedIntegers;
|
||||
var encodeSignedIntegers = _ol_format_Polyline_.encodeSignedIntegers;
|
||||
|
||||
expect(encodeSignedIntegers(
|
||||
signedIntegers)).to.eql(encodedSignedIntegers);
|
||||
@@ -112,7 +110,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeSignedIntegers', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeSignedIntegers = ol.format.Polyline.decodeSignedIntegers;
|
||||
var decodeSignedIntegers = _ol_format_Polyline_.decodeSignedIntegers;
|
||||
|
||||
expect(decodeSignedIntegers(
|
||||
encodedSignedIntegers)).to.eql(signedIntegers);
|
||||
@@ -122,7 +120,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeUnsignedIntegers', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeUnsignedIntegers = ol.format.Polyline.encodeUnsignedIntegers;
|
||||
var encodeUnsignedIntegers = _ol_format_Polyline_.encodeUnsignedIntegers;
|
||||
|
||||
expect(encodeUnsignedIntegers(
|
||||
unsignedIntegers)).to.eql(encodedUnsignedIntegers);
|
||||
@@ -131,7 +129,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeUnsignedIntegers', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeUnsignedIntegers = ol.format.Polyline.decodeUnsignedIntegers;
|
||||
var decodeUnsignedIntegers = _ol_format_Polyline_.decodeUnsignedIntegers;
|
||||
|
||||
expect(decodeUnsignedIntegers(
|
||||
encodedUnsignedIntegers)).to.eql(unsignedIntegers);
|
||||
@@ -141,7 +139,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeFloat', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeFloats = ol.format.Polyline.encodeFloats;
|
||||
var encodeFloats = _ol_format_Polyline_.encodeFloats;
|
||||
|
||||
expect(encodeFloats([0.00000])).to.eql('?');
|
||||
expect(encodeFloats([-0.00001])).to.eql('@');
|
||||
@@ -164,7 +162,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeFloat', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeFloats = ol.format.Polyline.decodeFloats;
|
||||
var decodeFloats = _ol_format_Polyline_.decodeFloats;
|
||||
|
||||
expect(decodeFloats('?')).to.eql([0.00000]);
|
||||
expect(decodeFloats('@')).to.eql([-0.00001]);
|
||||
@@ -188,7 +186,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeSignedInteger', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeSignedIntegers = ol.format.Polyline.encodeSignedIntegers;
|
||||
var encodeSignedIntegers = _ol_format_Polyline_.encodeSignedIntegers;
|
||||
|
||||
expect(encodeSignedIntegers([0])).to.eql('?');
|
||||
expect(encodeSignedIntegers([-1])).to.eql('@');
|
||||
@@ -206,7 +204,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeSignedInteger', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeSignedIntegers = ol.format.Polyline.decodeSignedIntegers;
|
||||
var decodeSignedIntegers = _ol_format_Polyline_.decodeSignedIntegers;
|
||||
|
||||
expect(decodeSignedIntegers('?')).to.eql([0]);
|
||||
expect(decodeSignedIntegers('@')).to.eql([-1]);
|
||||
@@ -225,7 +223,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeUnsignedInteger', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeUnsignedInteger = ol.format.Polyline.encodeUnsignedInteger;
|
||||
var encodeUnsignedInteger = _ol_format_Polyline_.encodeUnsignedInteger;
|
||||
|
||||
expect(encodeUnsignedInteger(0)).to.eql('?');
|
||||
expect(encodeUnsignedInteger(1)).to.eql('@');
|
||||
@@ -245,7 +243,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeUnsignedInteger', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeUnsignedIntegers = ol.format.Polyline.decodeUnsignedIntegers;
|
||||
var decodeUnsignedIntegers = _ol_format_Polyline_.decodeUnsignedIntegers;
|
||||
|
||||
expect(decodeUnsignedIntegers('?')).to.eql([0]);
|
||||
expect(decodeUnsignedIntegers('@')).to.eql([1]);
|
||||
@@ -267,9 +265,9 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
it('returns the expected feature', function() {
|
||||
var feature = format.readFeature(encodedFlatPoints);
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.LineString);
|
||||
expect(geometry).to.be.an(_ol_geom_LineString_);
|
||||
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
|
||||
});
|
||||
|
||||
@@ -277,9 +275,9 @@ describe('ol.format.Polyline', function() {
|
||||
var feature = format.readFeature(encodedFlatPoints, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.LineString);
|
||||
expect(geometry).to.be.an(_ol_geom_LineString_);
|
||||
expect(geometry.getCoordinates()).to.eql(points3857);
|
||||
});
|
||||
|
||||
@@ -292,9 +290,9 @@ describe('ol.format.Polyline', function() {
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features).to.have.length(1);
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.LineString);
|
||||
expect(geometry).to.be.an(_ol_geom_LineString_);
|
||||
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
|
||||
});
|
||||
|
||||
@@ -305,9 +303,9 @@ describe('ol.format.Polyline', function() {
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features).to.have.length(1);
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.an(ol.Feature);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(ol.geom.LineString);
|
||||
expect(geometry).to.be.an(_ol_geom_LineString_);
|
||||
expect(geometry.getCoordinates()).to.eql(points3857);
|
||||
});
|
||||
|
||||
@@ -317,17 +315,17 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
it('returns the expected geometry', function() {
|
||||
var geometry = format.readGeometry(encodedFlatPoints);
|
||||
expect(geometry).to.be.an(ol.geom.LineString);
|
||||
expect(geometry).to.be.an(_ol_geom_LineString_);
|
||||
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
|
||||
});
|
||||
|
||||
it('parses XYZ linestring', function() {
|
||||
var xyz = ol.format.Polyline.encodeDeltas([
|
||||
var xyz = _ol_format_Polyline_.encodeDeltas([
|
||||
38.500, -120.200, 100,
|
||||
40.700, -120.950, 200,
|
||||
43.252, -126.453, 20
|
||||
], 3);
|
||||
var format = new ol.format.Polyline({
|
||||
var format = new _ol_format_Polyline_({
|
||||
geometryLayout: 'XYZ'
|
||||
});
|
||||
|
||||
@@ -344,7 +342,7 @@ describe('ol.format.Polyline', function() {
|
||||
var geometry = format.readGeometry(encodedFlatPoints, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(geometry).to.be.an(ol.geom.LineString);
|
||||
expect(geometry).to.be.an(_ol_geom_LineString_);
|
||||
expect(geometry.getCoordinates()).to.eql(points3857);
|
||||
});
|
||||
|
||||
@@ -354,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(_ol_proj_.get('EPSG:4326'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -362,12 +360,12 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#writeFeature', function() {
|
||||
|
||||
it('returns the expected text', function() {
|
||||
var feature = new ol.Feature(new ol.geom.LineString(points));
|
||||
var feature = new _ol_Feature_(new _ol_geom_LineString_(points));
|
||||
expect(format.writeFeature(feature)).to.be(encodedFlatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected text', function() {
|
||||
var feature = new ol.Feature(new ol.geom.LineString(points3857));
|
||||
var feature = new _ol_Feature_(new _ol_geom_LineString_(points3857));
|
||||
expect(format.writeFeature(feature, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
})).to.be(encodedFlatPoints);
|
||||
@@ -378,12 +376,12 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#writeFeature', function() {
|
||||
|
||||
it('returns the expected text', function() {
|
||||
var features = [new ol.Feature(new ol.geom.LineString(points))];
|
||||
var features = [new _ol_Feature_(new _ol_geom_LineString_(points))];
|
||||
expect(format.writeFeatures(features)).to.be(encodedFlatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected text', function() {
|
||||
var features = [new ol.Feature(new ol.geom.LineString(points3857))];
|
||||
var features = [new _ol_Feature_(new _ol_geom_LineString_(points3857))];
|
||||
expect(format.writeFeatures(features, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
})).to.be(encodedFlatPoints);
|
||||
@@ -394,12 +392,12 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#writeGeometry', function() {
|
||||
|
||||
it('returns the expected text', function() {
|
||||
var geometry = new ol.geom.LineString(points);
|
||||
var geometry = new _ol_geom_LineString_(points);
|
||||
expect(format.writeGeometry(geometry)).to.be(encodedFlatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected text', function() {
|
||||
var geometry = new ol.geom.LineString(points3857);
|
||||
var geometry = new _ol_geom_LineString_(points3857);
|
||||
expect(format.writeGeometry(geometry, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
})).to.be(encodedFlatPoints);
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
|
||||
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.format.Feature');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.format.TopoJSON');
|
||||
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 _ol_format_TopoJSON_ from '../../../../src/ol/format/TopoJSON.js';
|
||||
|
||||
var aruba = {
|
||||
type: 'Topology',
|
||||
@@ -44,13 +42,13 @@ describe('ol.format.TopoJSON', function() {
|
||||
|
||||
var format;
|
||||
before(function() {
|
||||
format = new ol.format.TopoJSON();
|
||||
format = new _ol_format_TopoJSON_();
|
||||
});
|
||||
|
||||
describe('constructor', function() {
|
||||
it('creates a new format', function() {
|
||||
expect(format).to.be.a(ol.format.Feature);
|
||||
expect(format).to.be.a(ol.format.TopoJSON);
|
||||
expect(format).to.be.a(_ol_format_Feature_);
|
||||
expect(format).to.be.a(_ol_format_TopoJSON_);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -61,10 +59,10 @@ describe('ol.format.TopoJSON', function() {
|
||||
expect(features).to.have.length(1);
|
||||
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.a(ol.Feature);
|
||||
expect(feature).to.be.a(_ol_Feature_);
|
||||
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.a(ol.geom.Polygon);
|
||||
expect(geometry).to.be.a(_ol_geom_Polygon_);
|
||||
|
||||
// Parses identifier
|
||||
expect(feature.getId()).to.be(533);
|
||||
@@ -82,7 +80,7 @@ describe('ol.format.TopoJSON', function() {
|
||||
expect(features).to.have.length(1);
|
||||
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.a(ol.Feature);
|
||||
expect(feature).to.be.a(_ol_Feature_);
|
||||
expect(feature.getId()).to.be(0);
|
||||
});
|
||||
|
||||
@@ -125,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'));
|
||||
_ol_proj_.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')
|
||||
_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')
|
||||
]);
|
||||
|
||||
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')
|
||||
_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')
|
||||
]]);
|
||||
|
||||
done();
|
||||
@@ -157,16 +155,16 @@ describe('ol.format.TopoJSON', function() {
|
||||
expect(features.length).to.be(178);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(ol.geom.MultiPolygon);
|
||||
expect(firstGeom).to.be.a(_ol_geom_MultiPolygon_);
|
||||
expect(firstGeom.getExtent()).to.eql(
|
||||
[-180, -85.60903777459777, 180, 83.64513000000002]);
|
||||
|
||||
var last = features[177];
|
||||
expect(last).to.be.a(ol.Feature);
|
||||
expect(last).to.be.a(_ol_Feature_);
|
||||
var lastGeom = last.getGeometry();
|
||||
expect(lastGeom).to.be.a(ol.geom.Polygon);
|
||||
expect(lastGeom).to.be.a(_ol_geom_Polygon_);
|
||||
expect(lastGeom.getExtent()).to.eql([
|
||||
25.26325263252633, -22.271802279310577,
|
||||
32.848528485284874, -15.50833810039586
|
||||
@@ -178,7 +176,7 @@ describe('ol.format.TopoJSON', function() {
|
||||
|
||||
it('sets the topology\'s child names as feature property', function(done) {
|
||||
afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) {
|
||||
var format = new ol.format.TopoJSON({
|
||||
var format = new _ol_format_TopoJSON_({
|
||||
layerName: 'layer'
|
||||
});
|
||||
var features = format.readFeatures(text);
|
||||
@@ -190,7 +188,7 @@ describe('ol.format.TopoJSON', function() {
|
||||
|
||||
it('only parses features from specified topology\'s children', function(done) {
|
||||
afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) {
|
||||
var format = new ol.format.TopoJSON({
|
||||
var format = new _ol_format_TopoJSON_({
|
||||
layers: ['land']
|
||||
});
|
||||
var features = format.readFeatures(text);
|
||||
|
||||
+159
-159
@@ -1,21 +1,21 @@
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.GML2');
|
||||
goog.require('ol.format.WFS');
|
||||
goog.require('ol.format.filter');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.geom.MultiLineString');
|
||||
goog.require('ol.geom.MultiPoint');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_format_GML2_ from '../../../../src/ol/format/GML2.js';
|
||||
import _ol_format_WFS_ from '../../../../src/ol/format/WFS.js';
|
||||
import _ol_format_filter_ from '../../../../src/ol/format/filter.js';
|
||||
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_geom_MultiLineString_ from '../../../../src/ol/geom/MultiLineString.js';
|
||||
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 _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
|
||||
describe('ol.format.WFS', function() {
|
||||
|
||||
describe('featureType', function() {
|
||||
|
||||
it('#getFeatureType #setFeatureType', function() {
|
||||
var format = new ol.format.WFS({
|
||||
var format = new _ol_format_WFS_({
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featureType: ['foo', 'bar']
|
||||
});
|
||||
@@ -39,7 +39,7 @@ describe('ol.format.WFS', function() {
|
||||
afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(data) {
|
||||
try {
|
||||
xml = data;
|
||||
features = new ol.format.WFS(config).readFeatures(xml);
|
||||
features = new _ol_format_WFS_(config).readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -55,19 +55,19 @@ describe('ol.format.WFS', function() {
|
||||
feature = features[0];
|
||||
expect(feature.getId()).to.equal('states.1');
|
||||
expect(feature.get('STATE_NAME')).to.equal('Illinois');
|
||||
expect(feature.getGeometry()).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(feature.getGeometry()).to.be.an(_ol_geom_MultiPolygon_);
|
||||
});
|
||||
|
||||
it('transforms and creates a polygon for Illinois', function() {
|
||||
features = new ol.format.WFS(config).readFeatures(xml, {
|
||||
features = new _ol_format_WFS_(config).readFeatures(xml, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
feature = features[0];
|
||||
expect(feature.getId()).to.equal('states.1');
|
||||
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');
|
||||
expect(geom).to.be.an(_ol_geom_MultiPolygon_);
|
||||
var p = _ol_proj_.transform([-88.071, 37.511], 'EPSG:4326', 'EPSG:3857');
|
||||
p.push(0);
|
||||
expect(geom.getFirstCoordinate()).to.eql(p);
|
||||
});
|
||||
@@ -80,7 +80,7 @@ describe('ol.format.WFS', function() {
|
||||
var config = {
|
||||
'featureNS': 'http://mapserver.gis.umn.edu/mapserver',
|
||||
'featureType': 'polygon',
|
||||
'gmlFormat': new ol.format.GML2()
|
||||
'gmlFormat': new _ol_format_GML2_()
|
||||
};
|
||||
|
||||
before(function(done) {
|
||||
@@ -88,7 +88,7 @@ describe('ol.format.WFS', function() {
|
||||
afterLoadText('spec/ol/format/wfs/polygonv2.xml', function(data) {
|
||||
try {
|
||||
xml = data;
|
||||
features = new ol.format.WFS(config).readFeatures(xml);
|
||||
features = new _ol_format_WFS_(config).readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ describe('ol.format.WFS', function() {
|
||||
expect(feature.get('name')).to.equal('My Polygon with hole');
|
||||
expect(feature.get('boundedBy')).to.eql(
|
||||
[47.003018, -0.768746, 47.925567, 0.532597]);
|
||||
expect(feature.getGeometry()).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(feature.getGeometry()).to.be.an(_ol_geom_MultiPolygon_);
|
||||
expect(feature.getGeometry().getFlatCoordinates()).
|
||||
to.have.length(60);
|
||||
});
|
||||
@@ -123,7 +123,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
});
|
||||
it('returns an empty array of features when none exist', function() {
|
||||
var result = new ol.format.WFS().readFeatures(xml);
|
||||
var result = new _ol_format_WFS_().readFeatures(xml);
|
||||
expect(result).to.have.length(0);
|
||||
});
|
||||
});
|
||||
@@ -134,7 +134,7 @@ describe('ol.format.WFS', function() {
|
||||
afterLoadText('spec/ol/format/wfs/NumberOfFeatures.xml',
|
||||
function(xml) {
|
||||
try {
|
||||
response = new ol.format.WFS().readFeatureCollectionMetadata(xml);
|
||||
response = new _ol_format_WFS_().readFeatureCollectionMetadata(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ describe('ol.format.WFS', function() {
|
||||
afterLoadText('spec/ol/format/wfs/boundedBy.xml',
|
||||
function(xml) {
|
||||
try {
|
||||
response = new ol.format.WFS().readFeatureCollectionMetadata(xml);
|
||||
response = new _ol_format_WFS_().readFeatureCollectionMetadata(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ describe('ol.format.WFS', function() {
|
||||
afterLoadText('spec/ol/format/wfs/TransactionResponse.xml',
|
||||
function(xml) {
|
||||
try {
|
||||
response = new ol.format.WFS().readTransactionResponse(xml);
|
||||
response = new _ol_format_WFS_().readTransactionResponse(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ describe('ol.format.WFS', function() {
|
||||
' <wfs:PropertyName>STATE_ABBR</wfs:PropertyName>' +
|
||||
' </wfs:Query>' +
|
||||
'</wfs:GetFeature>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
resultType: 'hits',
|
||||
featureTypes: ['states'],
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
@@ -218,7 +218,7 @@ describe('ol.format.WFS', function() {
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
propertyNames: ['STATE_NAME', 'STATE_FIPS', 'STATE_ABBR']
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates paging headers', function() {
|
||||
@@ -235,7 +235,7 @@ describe('ol.format.WFS', function() {
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
' </wfs:Query>' +
|
||||
'</wfs:GetFeature>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
count: 10,
|
||||
startIndex: 20,
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
@@ -243,7 +243,7 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states']
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates a BBOX filter', function() {
|
||||
@@ -262,7 +262,7 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:BBOX>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
@@ -270,7 +270,7 @@ describe('ol.format.WFS', function() {
|
||||
geometryName: 'the_geom',
|
||||
bbox: [1, 2, 3, 4]
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates a property filter', function() {
|
||||
@@ -285,14 +285,14 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsEqualTo>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.equalTo('name', 'New York', false)
|
||||
filter: _ol_format_filter_.equalTo('name', 'New York', false)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates two property filters', function() {
|
||||
@@ -313,16 +313,16 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Or>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.or(
|
||||
ol.format.filter.equalTo('name', 'New York'),
|
||||
ol.format.filter.equalTo('area', 1234))
|
||||
filter: _ol_format_filter_.or(
|
||||
_ol_format_filter_.equalTo('name', 'New York'),
|
||||
_ol_format_filter_.equalTo('area', 1234))
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates greater/less than property filters', function() {
|
||||
@@ -355,23 +355,23 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Or>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.or(
|
||||
ol.format.filter.and(
|
||||
ol.format.filter.greaterThan('area', 100),
|
||||
ol.format.filter.greaterThanOrEqualTo('pop', 20000)
|
||||
filter: _ol_format_filter_.or(
|
||||
_ol_format_filter_.and(
|
||||
_ol_format_filter_.greaterThan('area', 100),
|
||||
_ol_format_filter_.greaterThanOrEqualTo('pop', 20000)
|
||||
),
|
||||
ol.format.filter.and(
|
||||
ol.format.filter.lessThan('area', 100),
|
||||
ol.format.filter.lessThanOrEqualTo('pop', 20000)
|
||||
_ol_format_filter_.and(
|
||||
_ol_format_filter_.lessThan('area', 100),
|
||||
_ol_format_filter_.lessThanOrEqualTo('pop', 20000)
|
||||
)
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates isBetween property filter', function() {
|
||||
@@ -387,14 +387,14 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsBetween>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.between('area', 100, 1000)
|
||||
filter: _ol_format_filter_.between('area', 100, 1000)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates isNull property filter', function() {
|
||||
@@ -408,14 +408,14 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsNull>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.isNull('area')
|
||||
filter: _ol_format_filter_.isNull('area')
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates isLike property filter', function() {
|
||||
@@ -430,14 +430,14 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsLike>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.like('name', 'New*')
|
||||
filter: _ol_format_filter_.like('name', 'New*')
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates isLike property filter with arguments', function() {
|
||||
@@ -452,14 +452,14 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsLike>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.like('name', 'New*', '*', '.', '!', false)
|
||||
filter: _ol_format_filter_.like('name', 'New*', '*', '.', '!', false)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates a Not filter', function() {
|
||||
@@ -476,14 +476,14 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Not>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.not(ol.format.filter.equalTo('name', 'New York'))
|
||||
filter: _ol_format_filter_.not(_ol_format_filter_.equalTo('name', 'New York'))
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates an AND filter', function() {
|
||||
@@ -512,18 +512,18 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:And>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.and(
|
||||
ol.format.filter.equalTo('name', 'New York'),
|
||||
ol.format.filter.bbox('the_geom', [1, 2, 3, 4], 'urn:ogc:def:crs:EPSG::4326'),
|
||||
ol.format.filter.greaterThan('population', 2000000)
|
||||
filter: _ol_format_filter_.and(
|
||||
_ol_format_filter_.equalTo('name', 'New York'),
|
||||
_ol_format_filter_.bbox('the_geom', [1, 2, 3, 4], 'urn:ogc:def:crs:EPSG::4326'),
|
||||
_ol_format_filter_.greaterThan('population', 2000000)
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates a contains filter', function() {
|
||||
@@ -546,12 +546,12 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Contains>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'EPSG:4326',
|
||||
featureTypes: ['area'],
|
||||
filter: ol.format.filter.contains(
|
||||
filter: _ol_format_filter_.contains(
|
||||
'the_geom',
|
||||
new ol.geom.Polygon([[
|
||||
new _ol_geom_Polygon_([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
@@ -560,7 +560,7 @@ describe('ol.format.WFS', function() {
|
||||
]])
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates a intersects filter', function() {
|
||||
@@ -583,12 +583,12 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Intersects>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'EPSG:4326',
|
||||
featureTypes: ['area'],
|
||||
filter: ol.format.filter.intersects(
|
||||
filter: _ol_format_filter_.intersects(
|
||||
'the_geom',
|
||||
new ol.geom.Polygon([[
|
||||
new _ol_geom_Polygon_([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
@@ -597,7 +597,7 @@ describe('ol.format.WFS', function() {
|
||||
]])
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates a within filter', function() {
|
||||
@@ -620,12 +620,12 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Within>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'EPSG:4326',
|
||||
featureTypes: ['area'],
|
||||
filter: ol.format.filter.within(
|
||||
filter: _ol_format_filter_.within(
|
||||
'the_geom',
|
||||
new ol.geom.Polygon([[
|
||||
new _ol_geom_Polygon_([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
@@ -634,7 +634,7 @@ describe('ol.format.WFS', function() {
|
||||
]])
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates During property filter', function() {
|
||||
@@ -660,12 +660,12 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
|
||||
var serialized = new ol.format.WFS().writeGetFeature({
|
||||
var serialized = new _ol_format_WFS_().writeGetFeature({
|
||||
srsName: 'EPSG:4326',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.during('date_prop', '2010-01-20T00:00:00Z', '2012-12-31T00:00:00Z')
|
||||
filter: _ol_format_filter_.during('date_prop', '2010-01-20T00:00:00Z', '2012-12-31T00:00:00Z')
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -679,9 +679,9 @@ describe('ol.format.WFS', function() {
|
||||
'service="WFS" version="1.1.0" handle="handle_t" ' +
|
||||
'xsi:schemaLocation="http://www.opengis.net/wfs ' +
|
||||
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>';
|
||||
var serialized = new ol.format.WFS().writeTransaction(null, null, null,
|
||||
var serialized = new _ol_format_WFS_().writeTransaction(null, null, null,
|
||||
{handle: 'handle_t'});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -695,9 +695,9 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
});
|
||||
it('creates the correct srsName', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var insertFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.MultiLineString([[
|
||||
var format = new _ol_format_WFS_();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_MultiLineString_([[
|
||||
[-5178372.1885436, 1992365.7775042],
|
||||
[-4434792.7774889, 1601008.1927386],
|
||||
[-4043435.1927233, 2148908.8114105]
|
||||
@@ -712,7 +712,7 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'feature',
|
||||
gmlOptions: {multiCurve: true, srsName: 'EPSG:900913'}
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -726,10 +726,10 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates the correct update', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var updateFeature = new ol.Feature();
|
||||
var format = new _ol_format_WFS_();
|
||||
var updateFeature = new _ol_Feature_();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new ol.geom.MultiLineString([[
|
||||
updateFeature.setGeometry(new _ol_geom_MultiLineString_([[
|
||||
[-12279454, 6741885],
|
||||
[-12064207, 6732101],
|
||||
[-11941908, 6595126],
|
||||
@@ -743,12 +743,12 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'foo',
|
||||
gmlOptions: {srsName: 'EPSG:900913'}
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates the correct update if geometry name is alias', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var updateFeature = new ol.Feature(new ol.geom.MultiLineString([[
|
||||
var format = new _ol_format_WFS_();
|
||||
var updateFeature = new _ol_Feature_(new _ol_geom_MultiLineString_([[
|
||||
[-12279454, 6741885],
|
||||
[-12064207, 6732101],
|
||||
[-11941908, 6595126],
|
||||
@@ -763,7 +763,7 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'foo',
|
||||
gmlOptions: {srsName: 'EPSG:900913'}
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -771,10 +771,10 @@ describe('ol.format.WFS', function() {
|
||||
describe('when writing out a Transaction request', function() {
|
||||
|
||||
it('creates the correct update with default featurePrefix', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var updateFeature = new ol.Feature();
|
||||
var format = new _ol_format_WFS_();
|
||||
var updateFeature = new _ol_Feature_();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new ol.geom.MultiLineString([[
|
||||
updateFeature.setGeometry(new _ol_geom_MultiLineString_([[
|
||||
[-12279454, 6741885],
|
||||
[-12064207, 6732101],
|
||||
[-11941908, 6595126],
|
||||
@@ -794,10 +794,10 @@ describe('ol.format.WFS', function() {
|
||||
describe('when writing out a Transaction request', function() {
|
||||
|
||||
it('does not create an update if no fid', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var updateFeature = new ol.Feature();
|
||||
var format = new _ol_format_WFS_();
|
||||
var updateFeature = new _ol_Feature_();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new ol.geom.MultiLineString([[
|
||||
updateFeature.setGeometry(new _ol_geom_MultiLineString_([[
|
||||
[-12279454, 6741885],
|
||||
[-12064207, 6732101],
|
||||
[-11941908, 6595126],
|
||||
@@ -827,17 +827,17 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles multiple geometries', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var updateFeature = new ol.Feature();
|
||||
var format = new _ol_format_WFS_();
|
||||
var updateFeature = new _ol_Feature_();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new ol.geom.MultiLineString([[
|
||||
updateFeature.setGeometry(new _ol_geom_MultiLineString_([[
|
||||
[-12279454, 6741885],
|
||||
[-12064207, 6732101],
|
||||
[-11941908, 6595126],
|
||||
[-12240318, 6507071],
|
||||
[-12416429, 6604910]
|
||||
]]));
|
||||
updateFeature.set('geom2', new ol.geom.MultiLineString([[
|
||||
updateFeature.set('geom2', new _ol_geom_MultiLineString_([[
|
||||
[-12000000, 6700000],
|
||||
[-12000001, 6700001],
|
||||
[-12000002, 6700002]
|
||||
@@ -848,7 +848,7 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'foo',
|
||||
gmlOptions: {srsName: 'EPSG:900913'}
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -862,16 +862,16 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates the correct transaction body', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var insertFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.MultiPoint([[1, 2]]),
|
||||
var format = new _ol_format_WFS_();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_MultiPoint_([[1, 2]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.MultiPoint([[1, 2]]),
|
||||
var updateFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_MultiPoint_([[1, 2]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
nul: null,
|
||||
@@ -882,7 +882,7 @@ describe('ol.format.WFS', function() {
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
var updates = [updateFeature];
|
||||
|
||||
var deleteFeature = new ol.Feature();
|
||||
var deleteFeature = new _ol_Feature_();
|
||||
deleteFeature.setId('fid.37');
|
||||
var deletes = [deleteFeature];
|
||||
var serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
@@ -890,7 +890,7 @@ describe('ol.format.WFS', function() {
|
||||
featureType: 'states',
|
||||
featurePrefix: 'topp'
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -905,7 +905,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles writing out Native', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var format = new _ol_format_WFS_();
|
||||
var serialized = format.writeTransaction(null, null, null, {
|
||||
nativeElements: [{
|
||||
vendorId: 'ORACLE',
|
||||
@@ -917,7 +917,7 @@ describe('ol.format.WFS', function() {
|
||||
value: 'Another native line goes here'
|
||||
}]
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -932,16 +932,16 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles the WFS version', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var insertFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.LineString([[1.1, 2], [3, 4.2]]),
|
||||
var format = new _ol_format_WFS_();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_LineString_([[1.1, 2], [3, 4.2]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.LineString([[1.1, 2], [3, 4.2]]),
|
||||
var updateFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_LineString_([[1.1, 2], [3, 4.2]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
nul: null,
|
||||
@@ -952,7 +952,7 @@ describe('ol.format.WFS', function() {
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
var updates = [updateFeature];
|
||||
|
||||
var deleteFeature = new ol.Feature();
|
||||
var deleteFeature = new _ol_Feature_();
|
||||
deleteFeature.setId('fid.37');
|
||||
var deletes = [deleteFeature];
|
||||
var serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
@@ -962,7 +962,7 @@ describe('ol.format.WFS', function() {
|
||||
version: '1.0.0'
|
||||
});
|
||||
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -976,16 +976,16 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('do not add feature prefix twice', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var insertFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.MultiPoint([[1, 2]]),
|
||||
var format = new _ol_format_WFS_();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_MultiPoint_([[1, 2]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.MultiPoint([[1, 2]]),
|
||||
var updateFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_MultiPoint_([[1, 2]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
nul: null,
|
||||
@@ -996,7 +996,7 @@ describe('ol.format.WFS', function() {
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
var updates = [updateFeature];
|
||||
|
||||
var deleteFeature = new ol.Feature();
|
||||
var deleteFeature = new _ol_Feature_();
|
||||
deleteFeature.setId('fid.37');
|
||||
var deletes = [deleteFeature];
|
||||
var serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
@@ -1004,7 +1004,7 @@ describe('ol.format.WFS', function() {
|
||||
featureType: 'topp:states',
|
||||
featurePrefix: 'topp'
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1019,16 +1019,16 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles 3D in WFS 1.0.0', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var insertFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.LineString([[1.1, 2, 4], [3, 4.2, 5]]),
|
||||
var format = new _ol_format_WFS_();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_LineString_([[1.1, 2, 4], [3, 4.2, 5]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.LineString([[1.1, 2, 6], [3, 4.2, 7]]),
|
||||
var updateFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_LineString_([[1.1, 2, 6], [3, 4.2, 7]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
nul: null,
|
||||
@@ -1047,7 +1047,7 @@ describe('ol.format.WFS', function() {
|
||||
version: '1.0.0'
|
||||
});
|
||||
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1061,16 +1061,16 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles 3D in WFS 1.1.0', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var insertFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.MultiPoint([[1, 2, 3]]),
|
||||
var format = new _ol_format_WFS_();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_MultiPoint_([[1, 2, 3]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new ol.Feature({
|
||||
the_geom: new ol.geom.MultiPoint([[1, 2, 3]]),
|
||||
var updateFeature = new _ol_Feature_({
|
||||
the_geom: new _ol_geom_MultiPoint_([[1, 2, 3]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
nul: null,
|
||||
@@ -1087,7 +1087,7 @@ describe('ol.format.WFS', function() {
|
||||
hasZ: true,
|
||||
featurePrefix: 'topp'
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1101,13 +1101,13 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles writing multiple Query elements', function() {
|
||||
var format = new ol.format.WFS();
|
||||
var format = new _ol_format_WFS_();
|
||||
var serialized = format.writeGetFeature({
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featureTypes: ['states', 'cities'],
|
||||
featurePrefix: 'topp'
|
||||
});
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1121,7 +1121,7 @@ describe('ol.format.WFS', function() {
|
||||
'featureNS': 'http://mapserver.gis.umn.edu/mapserver',
|
||||
'featureType': 'Historische_Messtischblaetter_WFS'
|
||||
};
|
||||
features = new ol.format.WFS(config).readFeatures(xml);
|
||||
features = new _ol_format_WFS_(config).readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1138,7 +1138,7 @@ describe('ol.format.WFS', function() {
|
||||
var fid = 'Historische_Messtischblaetter_WFS.71055885';
|
||||
expect(feature.getId()).to.equal(fid);
|
||||
expect(feature.get('titel')).to.equal('Arnstadt');
|
||||
expect(feature.getGeometry()).to.be.an(ol.geom.Polygon);
|
||||
expect(feature.getGeometry()).to.be.an(_ol_geom_Polygon_);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1149,7 +1149,7 @@ describe('ol.format.WFS', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
|
||||
try {
|
||||
features = new ol.format.WFS({
|
||||
features = new _ol_format_WFS_({
|
||||
featureNS: 'http://localhost:8080/official',
|
||||
featureType: ['planet_osm_polygon', 'planet_osm_line']
|
||||
}).readFeatures(xml);
|
||||
@@ -1172,11 +1172,11 @@ describe('ol.format.WFS', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
|
||||
try {
|
||||
lineFeatures = new ol.format.WFS({
|
||||
lineFeatures = new _ol_format_WFS_({
|
||||
featureNS: 'http://localhost:8080/official',
|
||||
featureType: ['planet_osm_line']
|
||||
}).readFeatures(xml);
|
||||
polygonFeatures = new ol.format.WFS({
|
||||
polygonFeatures = new _ol_format_WFS_({
|
||||
featureNS: 'http://localhost:8080/official',
|
||||
featureType: ['planet_osm_polygon']
|
||||
}).readFeatures(xml);
|
||||
@@ -1200,7 +1200,7 @@ describe('ol.format.WFS', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
|
||||
try {
|
||||
features = new ol.format.WFS().readFeatures(xml);
|
||||
features = new _ol_format_WFS_().readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1220,7 +1220,7 @@ describe('ol.format.WFS', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) {
|
||||
try {
|
||||
features = new ol.format.WFS().readFeatures(xml);
|
||||
features = new _ol_format_WFS_().readFeatures(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -1231,7 +1231,7 @@ describe('ol.format.WFS', function() {
|
||||
it('reads all features', function() {
|
||||
expect(features.length).to.be(5);
|
||||
features.forEach(function(feature) {
|
||||
expect(feature instanceof ol.Feature).to.be(true);
|
||||
expect(feature instanceof _ol_Feature_).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1243,11 +1243,11 @@ describe('ol.format.WFS', function() {
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) {
|
||||
try {
|
||||
busFeatures = new ol.format.WFS({
|
||||
busFeatures = new _ol_format_WFS_({
|
||||
featureNS: 'http://mapserver.gis.umn.edu/mapserver',
|
||||
featureType: ['bus_stop']
|
||||
}).readFeatures(xml);
|
||||
infoFeatures = new ol.format.WFS({
|
||||
infoFeatures = new _ol_format_WFS_({
|
||||
featureNS: 'http://mapserver.gis.umn.edu/mapserver',
|
||||
featureType: ['information']
|
||||
}).readFeatures(xml);
|
||||
@@ -1280,13 +1280,13 @@ describe('ol.format.WFS', function() {
|
||||
' </PropertyIsEqualTo>' +
|
||||
' </And>' +
|
||||
'</Filter>';
|
||||
var serialized = ol.format.WFS.writeFilter(
|
||||
ol.format.filter.and(
|
||||
ol.format.filter.like('name', 'Mississippi*'),
|
||||
ol.format.filter.equalTo('waterway', 'riverbank')
|
||||
var serialized = _ol_format_WFS_.writeFilter(
|
||||
_ol_format_filter_.and(
|
||||
_ol_format_filter_.like('name', 'Mississippi*'),
|
||||
_ol_format_filter_.equalTo('waterway', 'riverbank')
|
||||
)
|
||||
);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
|
||||
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.format.WKT');
|
||||
goog.require('ol.proj');
|
||||
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';
|
||||
|
||||
|
||||
describe('ol.format.WKT', function() {
|
||||
|
||||
var format = new ol.format.WKT();
|
||||
var format = new _ol_format_WKT_();
|
||||
|
||||
describe('#readProjectionFromText', function() {
|
||||
it('returns the default projection', function() {
|
||||
@@ -26,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'));
|
||||
_ol_proj_.transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -34,7 +32,7 @@ describe('ol.format.WKT', function() {
|
||||
describe('#writeGeometry()', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var geom = new ol.geom.Point([1, 2]).transform('EPSG:4326', 'EPSG:3857');
|
||||
var geom = new _ol_geom_Point_([1, 2]).transform('EPSG:4326', 'EPSG:3857');
|
||||
var wkt = format.writeGeometry(geom, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
@@ -56,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'));
|
||||
_ol_proj_.transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -64,14 +62,14 @@ describe('ol.format.WKT', function() {
|
||||
describe('#writeFeature()', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var feature = new ol.Feature(
|
||||
new ol.geom.Point([1, 2]).transform('EPSG:4326', 'EPSG:3857'));
|
||||
var feature = new _ol_Feature_(
|
||||
new _ol_geom_Point_([1, 2]).transform('EPSG:4326', 'EPSG:3857'));
|
||||
var wkt = format.writeFeature(feature, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var gotFeature = format.readFeature(wkt);
|
||||
expect(gotFeature).to.be.a(ol.Feature);
|
||||
expect(gotFeature).to.be.a(_ol_Feature_);
|
||||
var got = gotFeature.getGeometry().getCoordinates();
|
||||
expect(got[0]).to.roughlyEqual(1, 1e-6);
|
||||
expect(got[1]).to.roughlyEqual(2, 1e-6);
|
||||
@@ -93,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'));
|
||||
_ol_proj_.transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
expect(point2.getCoordinates()).to.eql(
|
||||
ol.proj.transform([4, 5], 'EPSG:4326', 'EPSG:3857'));
|
||||
_ol_proj_.transform([4, 5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -103,10 +101,10 @@ describe('ol.format.WKT', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var features = [
|
||||
new ol.Feature(
|
||||
new ol.geom.Point([1, 2]).transform('EPSG:4326', 'EPSG:3857')),
|
||||
new ol.Feature(
|
||||
new ol.geom.Point([4, 5]).transform('EPSG:4326', 'EPSG:3857'))
|
||||
new _ol_Feature_(
|
||||
new _ol_geom_Point_([1, 2]).transform('EPSG:4326', 'EPSG:3857')),
|
||||
new _ol_Feature_(
|
||||
new _ol_geom_Point_([4, 5]).transform('EPSG:4326', 'EPSG:3857'))
|
||||
];
|
||||
var wkt = format.writeFeatures(features, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
@@ -781,7 +779,7 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('GeometryCollection split / merged correctly', function() {
|
||||
format = new ol.format.WKT({splitCollection: true});
|
||||
format = new _ol_format_WKT_({splitCollection: true});
|
||||
var wkt = 'GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))';
|
||||
var features = format.readFeatures(wkt);
|
||||
expect(features.length).to.eql(2);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
|
||||
|
||||
goog.require('ol.format.WMSCapabilities');
|
||||
import _ol_format_WMSCapabilities_ from '../../../../src/ol/format/WMSCapabilities.js';
|
||||
|
||||
describe('ol.format.WMSCapabilities', function() {
|
||||
|
||||
describe('when parsing ogcsample.xml', function() {
|
||||
|
||||
var parser = new ol.format.WMSCapabilities();
|
||||
var parser = new _ol_format_WMSCapabilities_();
|
||||
var capabilities;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wms/ogcsample.xml', function(xml) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
goog.require('ol.format.WMSGetFeatureInfo');
|
||||
import _ol_format_WMSGetFeatureInfo_ from '../../../../src/ol/format/WMSGetFeatureInfo.js';
|
||||
|
||||
|
||||
describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
@@ -6,12 +6,12 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
describe('#getLayers', function() {
|
||||
|
||||
it('returns null if layers is undefined', function() {
|
||||
var format = new ol.format.WMSGetFeatureInfo();
|
||||
var format = new _ol_format_WMSGetFeatureInfo_();
|
||||
expect(format.getLayers()).to.be(null);
|
||||
});
|
||||
|
||||
it('returns the value provided in the layers option', function() {
|
||||
var format = new ol.format.WMSGetFeatureInfo({
|
||||
var format = new _ol_format_WMSGetFeatureInfo_({
|
||||
layers: ['a', 'z']
|
||||
});
|
||||
expect(format.getLayers()).to.eql(['a', 'z']);
|
||||
@@ -29,7 +29,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'));
|
||||
afterLoadText('spec/ol/format/wms/getfeatureinfo.xml', function(data) {
|
||||
try {
|
||||
features = new ol.format.WMSGetFeatureInfo().readFeatures(data);
|
||||
features = new _ol_format_WMSGetFeatureInfo_().readFeatures(data);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
' <AAA64_layer>' +
|
||||
' </AAA64_layer>' +
|
||||
'</msGMLOutput>';
|
||||
var features = new ol.format.WMSGetFeatureInfo().readFeatures(text);
|
||||
var features = new _ol_format_WMSGetFeatureInfo_().readFeatures(text);
|
||||
expect(features.length).to.be(0);
|
||||
});
|
||||
|
||||
@@ -93,7 +93,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
' </AAA64_feature>' +
|
||||
' </AAA64_layer>' +
|
||||
'</msGMLOutput>';
|
||||
var features = new ol.format.WMSGetFeatureInfo().readFeatures(text);
|
||||
var features = new _ol_format_WMSGetFeatureInfo_().readFeatures(text);
|
||||
expect(features.length).to.be(1);
|
||||
expect(features[0].get('FOO')).to.be('bar');
|
||||
// FIXME is that really wanted ?
|
||||
@@ -153,7 +153,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
' </AAA62_feature>' +
|
||||
' </AAA62_layer>' +
|
||||
'</msGMLOutput>';
|
||||
var format = new ol.format.WMSGetFeatureInfo();
|
||||
var format = new _ol_format_WMSGetFeatureInfo_();
|
||||
var features = format.readFeatures(text);
|
||||
expect(features.length).to.be(2);
|
||||
expect(features[0].get('OBJECTID')).to.be('287');
|
||||
@@ -219,7 +219,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
' </opengeo:roads>' +
|
||||
' </gml:featureMember>' +
|
||||
'</wfs:FeatureCollection>';
|
||||
var features = new ol.format.WMSGetFeatureInfo().readFeatures(text);
|
||||
var features = new _ol_format_WMSGetFeatureInfo_().readFeatures(text);
|
||||
expect(features.length).to.be(1);
|
||||
expect(features[0].get('cat')).to.be('3');
|
||||
expect(features[0].getGeometry().getType()).to.be('MultiLineString');
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
|
||||
|
||||
goog.require('ol.format.WMTSCapabilities');
|
||||
import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabilities.js';
|
||||
|
||||
|
||||
describe('ol.format.WMTSCapabilities', function() {
|
||||
|
||||
describe('when parsing ogcsample.xml', function() {
|
||||
|
||||
var parser = new ol.format.WMTSCapabilities();
|
||||
var parser = new _ol_format_WMTSCapabilities_();
|
||||
var capabilities;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) {
|
||||
@@ -118,7 +116,7 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
|
||||
describe('when parsing ign.xml', function() {
|
||||
|
||||
var parser = new ol.format.WMTSCapabilities();
|
||||
var parser = new _ol_format_WMTSCapabilities_();
|
||||
var capabilities;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wmts/ign.xml', function(xml) {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
|
||||
goog.require('ol.format.XSD');
|
||||
import _ol_format_XSD_ from '../../../../src/ol/format/XSD.js';
|
||||
|
||||
|
||||
describe('ol.format.XSD', function() {
|
||||
@@ -9,7 +7,7 @@ describe('ol.format.XSD', function() {
|
||||
it('can handle non-Zulu time zones', function() {
|
||||
var node = document.createElement('time');
|
||||
node.textContent = '2016-07-12T15:00:00+03:00';
|
||||
expect(new Date(ol.format.XSD.readDateTime(node) * 1000).toISOString()).to.eql('2016-07-12T12:00:00.000Z');
|
||||
expect(new Date(_ol_format_XSD_.readDateTime(node) * 1000).toISOString()).to.eql('2016-07-12T12:00:00.000Z');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user