From cee014ec9e21cb0e38e2f1ba3cd16c24b4712166 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Wed, 8 Jan 2014 23:28:36 +0100 Subject: [PATCH] Remove unused ol.source.wms.getUrl function --- src/ol/source/wmssource.js | 41 --------------------------- test/spec/ol/source/wmssource.test.js | 33 --------------------- 2 files changed, 74 deletions(-) delete mode 100644 test/spec/ol/source/wmssource.test.js diff --git a/src/ol/source/wmssource.js b/src/ol/source/wmssource.js index 52bc75600d..591cd2d951 100644 --- a/src/ol/source/wmssource.js +++ b/src/ol/source/wmssource.js @@ -1,10 +1,6 @@ goog.provide('ol.source.wms'); goog.provide('ol.source.wms.ServerType'); -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('goog.uri.utils'); - /** * @define {string} WMS default version. @@ -20,40 +16,3 @@ ol.source.wms.ServerType = { MAPSERVER: 'mapserver', QGIS: 'qgis' }; - - -/** - * @param {string} baseUrl WMS base URL. - * @param {Object.} params Request parameters. - * @param {ol.Extent} extent Extent. - * @param {ol.Size} size Size. - * @param {ol.proj.Projection} projection Projection. - * @return {string} WMS GetMap request URL. - */ -ol.source.wms.getUrl = function(baseUrl, params, extent, size, projection) { - var baseParams = { - 'SERVICE': 'WMS', - 'VERSION': ol.source.wms.DEFAULT_VERSION, - 'REQUEST': 'GetMap', - 'FORMAT': 'image/png', - 'TRANSPARENT': true, - 'WIDTH': Math.round(size[0]), - 'HEIGHT': Math.round(size[1]) - }; - goog.object.extend(baseParams, params); - - //TODO: Provide our own appendParams function to avoid this empty string hack - var stylesParam = 'STYLES'; - baseParams[stylesParam] = params[stylesParam] || new String(''); - - var wms13 = baseParams['VERSION'] > '1.3'; - baseParams[wms13 ? 'CRS' : 'SRS'] = projection.getCode(); - - var axisOrientation = projection.getAxisOrientation(); - var bboxValues = (wms13 && axisOrientation.substr(0, 2) == 'ne') ? - [extent[1], extent[0], extent[3], extent[2]] : - [extent[0], extent[1], extent[2], extent[3]]; - baseParams['BBOX'] = bboxValues.join(','); - - return goog.uri.utils.appendParamsFromMap(baseUrl, baseParams); -}; diff --git a/test/spec/ol/source/wmssource.test.js b/test/spec/ol/source/wmssource.test.js deleted file mode 100644 index 665c4baf2f..0000000000 --- a/test/spec/ol/source/wmssource.test.js +++ /dev/null @@ -1,33 +0,0 @@ -goog.provide('ol.test.source.wms'); - -describe('ol.source.wms', function() { - - describe('ol.source.wms.getUrl', function() { - it('creates expected URL', function() { - var epsg3857 = ol.proj.get('EPSG:3857'); - var extent = [-20037508.342789244, -20037508.342789244, 0, 0]; - var expected = 'http://wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=' + - 'GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&WIDTH=256&HEIGHT=256&' + - 'foo=bar&STYLES=&CRS=EPSG%3A3857&BBOX=' + - '-20037508.342789244%2C-20037508.342789244%2C0%2C0'; - var url = ol.source.wms.getUrl('http://wms', {'foo': 'bar'}, - extent, [256, 256], epsg3857); - expect(url).to.eql(expected); - }); - it('creates expected URL respecting axis orientation', function() { - var epsg4326 = ol.proj.get('EPSG:4326'); - var extent = [-180, -90, 0, 90]; - var expected = 'http://wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=' + - 'GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&WIDTH=256&HEIGHT=256&' + - 'foo=bar&STYLES=&CRS=EPSG%3A4326&BBOX=-90%2C-180%2C90%2C0'; - var url = ol.source.wms.getUrl('http://wms', {'foo': 'bar'}, - extent, [256, 256], epsg4326); - expect(url).to.eql(expected); - }); - }); - -}); - - -goog.require('ol.proj'); -goog.require('ol.source.wms');