Transformed
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user