From 7d00159bfff3408f00a94339f1c45cba256b6220 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 3 Sep 2013 17:46:47 -0600 Subject: [PATCH] WMS capabilities parsing with new extent structure --- src/ol/parser/ogc/wmscapabilitiesparser_v1.js | 7 ++++--- src/ol/parser/ogc/wmscapabilitiesparser_v1_1.js | 7 ++++--- .../ol/parser/ogc/wmscapabilities_v1_1_1.test.js | 12 +++++++----- .../parser/ogc/wmscapabilities_v1_1_1_WMSC.test.js | 6 ++++-- .../ol/parser/ogc/wmscapabilities_v1_3_0.test.js | 6 +++--- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/ol/parser/ogc/wmscapabilitiesparser_v1.js b/src/ol/parser/ogc/wmscapabilitiesparser_v1.js index 55ed0c5a07..4ef0188baf 100644 --- a/src/ol/parser/ogc/wmscapabilitiesparser_v1.js +++ b/src/ol/parser/ogc/wmscapabilitiesparser_v1.js @@ -31,12 +31,13 @@ ol.parser.ogc.WMSCapabilities_v1 = function() { }, 'BoundingBox': function(node, obj) { var bbox = {}; - bbox['bbox'] = [ + bbox['bbox'] = [[ parseFloat(node.getAttribute('minx')), - parseFloat(node.getAttribute('miny')), + parseFloat(node.getAttribute('miny')) + ], [ parseFloat(node.getAttribute('maxx')), parseFloat(node.getAttribute('maxy')) - ]; + ]]; var res = { x: parseFloat(node.getAttribute('resx')), y: parseFloat(node.getAttribute('resy')) diff --git a/src/ol/parser/ogc/wmscapabilitiesparser_v1_1.js b/src/ol/parser/ogc/wmscapabilitiesparser_v1_1.js index b367cfa339..478282b7f2 100644 --- a/src/ol/parser/ogc/wmscapabilitiesparser_v1_1.js +++ b/src/ol/parser/ogc/wmscapabilitiesparser_v1_1.js @@ -47,12 +47,13 @@ ol.parser.ogc.WMSCapabilities_v1_1 = function() { obj['userSymbols'] = userSymbols; }, 'LatLonBoundingBox': function(node, obj) { - obj['llbbox'] = [ + obj['llbbox'] = [[ parseFloat(node.getAttribute('minx')), - parseFloat(node.getAttribute('miny')), + parseFloat(node.getAttribute('miny')) + ], [ parseFloat(node.getAttribute('maxx')), parseFloat(node.getAttribute('maxy')) - ]; + ]]; }, 'BoundingBox': function(node, obj) { var bbox = bboxreader.apply(this, arguments); diff --git a/test/spec/ol/parser/ogc/wmscapabilities_v1_1_1.test.js b/test/spec/ol/parser/ogc/wmscapabilities_v1_1_1.test.js index 789fb41977..7629608191 100644 --- a/test/spec/ol/parser/ogc/wmscapabilities_v1_1_1.test.js +++ b/test/spec/ol/parser/ogc/wmscapabilities_v1_1_1.test.js @@ -49,8 +49,10 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1', function() { expect(layer.title).to.eql('Manhattan (NY) roads'); var abstr = 'Highly simplified road layout of Manhattan in New York..'; expect(layer['abstract']).to.eql(abstr); - var bbox = [-74.08769307536667, 40.660618924633326, - -73.84653192463333, 40.90178007536667]; + var bbox = [ + [-74.08769307536667, 40.660618924633326], + [-73.84653192463333, 40.90178007536667] + ]; expect(layer.llbbox).to.eql(bbox); expect(layer.styles.length).to.eql(1); expect(layer.styles[0].name).to.eql('tiger_roads'); @@ -87,13 +89,13 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1', function() { expect(layers['ROADS_RIVERS'].srs).to.eql(srs); expect(layers['Temperature'].srs).to.eql({'EPSG:4326': true}); var bbox = layers['ROADS_RIVERS'].bbox['EPSG:26986']; - expect(bbox.bbox).to.eql([189000, 834000, 285000, 962000]); + expect(bbox.bbox).to.eql([[189000, 834000], [285000, 962000]]); expect(bbox.res).to.eql({x: 1, y: 1}); bbox = layers['ROADS_RIVERS'].bbox['EPSG:4326']; - expect(bbox.bbox).to.eql([-71.63, 41.75, -70.78, 42.90]); + expect(bbox.bbox).to.eql([[-71.63, 41.75], [-70.78, 42.90]]); expect(bbox.res).to.eql({x: 0.01, y: 0.01}); bbox = layers['ROADS_1M'].bbox['EPSG:26986']; - expect(bbox.bbox).to.eql([189000, 834000, 285000, 962000]); + expect(bbox.bbox).to.eql([[189000, 834000], [285000, 962000]]); expect(bbox.res).to.eql({x: 1, y: 1}); expect(identifiers).to.be.ok(); expect('DIF_ID' in identifiers).to.be.ok(); diff --git a/test/spec/ol/parser/ogc/wmscapabilities_v1_1_1_WMSC.test.js b/test/spec/ol/parser/ogc/wmscapabilities_v1_1_1_WMSC.test.js index 47f3071ddd..18c3b00139 100644 --- a/test/spec/ol/parser/ogc/wmscapabilities_v1_1_1_WMSC.test.js +++ b/test/spec/ol/parser/ogc/wmscapabilities_v1_1_1_WMSC.test.js @@ -16,8 +16,10 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1_wmsc', function() { tilesets = obj.capability.vendorSpecific.tileSets; tileset = tilesets[0]; expect(tilesets.length).to.eql(2); - var bbox = [-13697515.466796875, 5165920.118906248, - -13619243.94984375, 5244191.635859374]; + var bbox = [ + [-13697515.466796875, 5165920.118906248], + [-13619243.94984375, 5244191.635859374] + ]; expect(tileset.bbox['EPSG:900913'].bbox).to.eql(bbox); expect(tileset.format).to.eql('image/png'); expect(tileset.height).to.eql(256); diff --git a/test/spec/ol/parser/ogc/wmscapabilities_v1_3_0.test.js b/test/spec/ol/parser/ogc/wmscapabilities_v1_3_0.test.js index b3e6050ffb..4c8fb4b3d7 100644 --- a/test/spec/ol/parser/ogc/wmscapabilities_v1_3_0.test.js +++ b/test/spec/ol/parser/ogc/wmscapabilities_v1_3_0.test.js @@ -53,13 +53,13 @@ describe('ol.parser.ogc.wmscapabilities_v1_3_0', function() { var infoFormats = ['text/xml', 'text/plain', 'text/html']; expect(layers['Temperature'].infoFormats).to.eql(infoFormats); var bbox = layers['ROADS_RIVERS'].bbox['EPSG:26986']; - expect(bbox.bbox).to.eql([189000, 834000, 285000, 962000]); + expect(bbox.bbox).to.eql([[189000, 834000], [285000, 962000]]); expect(bbox.res).to.eql({x: 1, y: 1}); bbox = layers['ROADS_RIVERS'].bbox['CRS:84']; - expect(bbox.bbox).to.eql([-71.63, 41.75, -70.78, 42.90]); + expect(bbox.bbox).to.eql([[-71.63, 41.75], [-70.78, 42.90]]); expect(bbox.res).to.eql({x: 0.01, y: 0.01}); bbox = layers['ROADS_1M'].bbox['EPSG:26986']; - expect(bbox.bbox).to.eql([189000, 834000, 285000, 962000]); + expect(bbox.bbox).to.eql([[189000, 834000], [285000, 962000]]); expect(bbox.res).to.eql({x: 1, y: 1}); expect(identifiers).to.be.ok(); expect('DIF_ID' in identifiers).to.be.ok();