diff --git a/examples/epsg-4326.js b/examples/epsg-4326.js index c21c83acd9..7e0850ecfc 100644 --- a/examples/epsg-4326.js +++ b/examples/epsg-4326.js @@ -3,12 +3,12 @@ import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import ScaleLine from '../src/ol/control/ScaleLine.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; var layers = [ new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: { 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', diff --git a/examples/getfeatureinfo-tile.js b/examples/getfeatureinfo-tile.js index fd8692b0be..d1bc2480ed 100644 --- a/examples/getfeatureinfo-tile.js +++ b/examples/getfeatureinfo-tile.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; -var wmsSource = new _ol_source_TileWMS_({ +var wmsSource = new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: {'LAYERS': 'ne:ne', 'TILED': true}, serverType: 'geoserver', diff --git a/examples/reprojection.js b/examples/reprojection.js index ab22c630f5..470e774c42 100644 --- a/examples/reprojection.js +++ b/examples/reprojection.js @@ -7,7 +7,7 @@ import {get as getProjection} from '../src/ol/proj.js'; import {register} from '../src/ol/proj/proj4.js'; import OSM from '../src/ol/source/OSM.js'; import TileImage from '../src/ol/source/TileImage.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; import _ol_source_WMTS_ from '../src/ol/source/WMTS.js'; import XYZ from '../src/ol/source/XYZ.js'; import TileGrid from '../src/ol/tilegrid/TileGrid.js'; @@ -72,7 +72,7 @@ layers['osm'] = new TileLayer({ }); layers['wms4326'] = new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', crossOrigin: '', params: { @@ -84,7 +84,7 @@ layers['wms4326'] = new TileLayer({ }); layers['wms21781'] = new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ attributions: '© Pixelmap 1:1000000 / geo.admin.ch', crossOrigin: 'anonymous', @@ -135,7 +135,7 @@ for (var i = 0, ii = resolutions.length; i < ii; ++i) { } layers['states'] = new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', crossOrigin: '', params: {'LAYERS': 'topp:states'}, diff --git a/examples/tissot.js b/examples/tissot.js index 79d8138979..b8f2880a38 100644 --- a/examples/tissot.js +++ b/examples/tissot.js @@ -4,7 +4,7 @@ import View from '../src/ol/View.js'; import {circular as circularPolygon} from '../src/ol/geom/Polygon.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; import VectorSource from '../src/ol/source/Vector.js'; var vectorLayer4326 = new VectorLayer({ @@ -18,7 +18,7 @@ var vectorLayer3857 = new VectorLayer({ var map4326 = new Map({ layers: [ new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: { 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', @@ -39,7 +39,7 @@ var map4326 = new Map({ var map3857 = new Map({ layers: [ new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: { 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index f624f3241a..473997a764 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -5,7 +5,7 @@ import ScaleLine from '../src/ol/control/ScaleLine.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {addProjection, addCoordinateTransforms, transform} from '../src/ol/proj.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; // By default OpenLayers does not know about the EPSG:21781 (Swiss) projection. @@ -44,7 +44,7 @@ var extent = [420000, 30000, 900000, 350000]; var layers = [ new TileLayer({ extent: extent, - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://wms.geo.admin.ch/', crossOrigin: 'anonymous', attributions: '© Pixelmap 1:1000000 / geo.admin.ch', crossOrigin: 'anonymous', diff --git a/examples/wms-tiled-wrap-180.js b/examples/wms-tiled-wrap-180.js index 965d47dd6e..48c11720f8 100644 --- a/examples/wms-tiled-wrap-180.js +++ b/examples/wms-tiled-wrap-180.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import OSM from '../src/ol/source/OSM.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; var layers = [ @@ -10,7 +10,7 @@ var layers = [ source: new OSM() }), new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/ne/wms', params: {'LAYERS': 'ne:ne_10m_admin_0_countries', 'TILED': true}, serverType: 'geoserver' diff --git a/examples/wms-tiled.js b/examples/wms-tiled.js index fcd349a48b..885be0e331 100644 --- a/examples/wms-tiled.js +++ b/examples/wms-tiled.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import OSM from '../src/ol/source/OSM.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; var layers = [ @@ -11,7 +11,7 @@ var layers = [ }), new TileLayer({ extent: [-13884991, 2870341, -7455066, 6338219], - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: {'LAYERS': 'topp:states', 'TILED': true}, serverType: 'geoserver', diff --git a/examples/wms-time.js b/examples/wms-time.js index 543e8f93c8..751295e7f6 100644 --- a/examples/wms-time.js +++ b/examples/wms-time.js @@ -4,7 +4,7 @@ import * as _ol_extent_ from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {transformExtent} from '../src/ol/proj.js'; import Stamen from '../src/ol/source/Stamen.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; function threeHoursAgo() { return new Date(Math.round(Date.now() / 3600000) * 3600000 - 3600000 * 3); @@ -23,7 +23,7 @@ var layers = [ }), new TileLayer({ extent: extent, - source: new _ol_source_TileWMS_({ + source: new TileWMS({ attributions: ['Iowa State University'], url: 'https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi', params: {'LAYERS': 'nexrad-n0r-wmst'} diff --git a/src/ol/source/TileWMS.js b/src/ol/source/TileWMS.js index 7ae7812ab7..fb078c4a3d 100644 --- a/src/ol/source/TileWMS.js +++ b/src/ol/source/TileWMS.js @@ -26,7 +26,7 @@ import _ol_uri_ from '../uri.js'; * @param {olx.source.TileWMSOptions=} opt_options Tile WMS options. * @api */ -var _ol_source_TileWMS_ = function(opt_options) { +var TileWMS = function(opt_options) { var options = opt_options || {}; @@ -91,7 +91,7 @@ var _ol_source_TileWMS_ = function(opt_options) { }; -inherits(_ol_source_TileWMS_, TileImage); +inherits(TileWMS, TileImage); /** @@ -108,7 +108,7 @@ inherits(_ol_source_TileWMS_, TileImage); * @return {string|undefined} GetFeatureInfo URL. * @api */ -_ol_source_TileWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) { +TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) { var projectionObj = getProjection(projection); var sourceProjectionObj = this.getProjection(); @@ -164,7 +164,7 @@ _ol_source_TileWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resolu /** * @inheritDoc */ -_ol_source_TileWMS_.prototype.getGutterInternal = function() { +TileWMS.prototype.getGutterInternal = function() { return this.gutter_; }; @@ -175,7 +175,7 @@ _ol_source_TileWMS_.prototype.getGutterInternal = function() { * @return {Object} Params. * @api */ -_ol_source_TileWMS_.prototype.getParams = function() { +TileWMS.prototype.getParams = function() { return this.params_; }; @@ -190,7 +190,7 @@ _ol_source_TileWMS_.prototype.getParams = function() { * @return {string|undefined} Request URL. * @private */ -_ol_source_TileWMS_.prototype.getRequestUrl_ = function(tileCoord, tileSize, tileExtent, +TileWMS.prototype.getRequestUrl_ = function(tileCoord, tileSize, tileExtent, pixelRatio, projection, params) { var urls = this.urls; @@ -257,7 +257,7 @@ _ol_source_TileWMS_.prototype.getRequestUrl_ = function(tileCoord, tileSize, til /** * @inheritDoc */ -_ol_source_TileWMS_.prototype.getTilePixelRatio = function(pixelRatio) { +TileWMS.prototype.getTilePixelRatio = function(pixelRatio) { return (!this.hidpi_ || this.serverType_ === undefined) ? 1 : /** @type {number} */ (pixelRatio); }; @@ -267,7 +267,7 @@ _ol_source_TileWMS_.prototype.getTilePixelRatio = function(pixelRatio) { * @private * @return {string} The key for the current params. */ -_ol_source_TileWMS_.prototype.getKeyForParams_ = function() { +TileWMS.prototype.getKeyForParams_ = function() { var i = 0; var res = []; for (var key in this.params_) { @@ -280,7 +280,7 @@ _ol_source_TileWMS_.prototype.getKeyForParams_ = function() { /** * @inheritDoc */ -_ol_source_TileWMS_.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, projection) { +TileWMS.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, projection) { var tileGrid = this.getTileGrid(); if (!tileGrid) { @@ -328,7 +328,7 @@ _ol_source_TileWMS_.prototype.fixedTileUrlFunction = function(tileCoord, pixelRa * @param {Object} params Params. * @api */ -_ol_source_TileWMS_.prototype.updateParams = function(params) { +TileWMS.prototype.updateParams = function(params) { _ol_obj_.assign(this.params_, params); this.updateV13_(); this.setKey(this.getKeyForParams_()); @@ -338,8 +338,8 @@ _ol_source_TileWMS_.prototype.updateParams = function(params) { /** * @private */ -_ol_source_TileWMS_.prototype.updateV13_ = function() { +TileWMS.prototype.updateV13_ = function() { var version = this.params_['VERSION'] || DEFAULT_WMS_VERSION; this.v13_ = _ol_string_.compareVersions(version, '1.3') >= 0; }; -export default _ol_source_TileWMS_; +export default TileWMS; diff --git a/test/rendering/ol/source/tilewms.test.js b/test/rendering/ol/source/tilewms.test.js index ed655cea70..1e5fef4c80 100644 --- a/test/rendering/ol/source/tilewms.test.js +++ b/test/rendering/ol/source/tilewms.test.js @@ -1,7 +1,7 @@ import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; -import _ol_source_TileWMS_ from '../../../../src/ol/source/TileWMS.js'; +import TileWMS from '../../../../src/ol/source/TileWMS.js'; describe('ol.rendering.source.TileWMS', function() { @@ -44,7 +44,7 @@ describe('ol.rendering.source.TileWMS', function() { }); function createSource(gutter) { - return new _ol_source_TileWMS_({ + return new TileWMS({ params: { 'LAYERS': 'layer' }, diff --git a/test/spec/ol/renderer/canvas/tilelayer.test.js b/test/spec/ol/renderer/canvas/tilelayer.test.js index 1c652a9c52..7c1b5d3fc3 100644 --- a/test/spec/ol/renderer/canvas/tilelayer.test.js +++ b/test/spec/ol/renderer/canvas/tilelayer.test.js @@ -4,7 +4,7 @@ import TileLayer from '../../../../../src/ol/layer/Tile.js'; import {get as getProjection} from '../../../../../src/ol/proj.js'; import _ol_renderer_Map_ from '../../../../../src/ol/renderer/Map.js'; import CanvasTileLayerRenderer from '../../../../../src/ol/renderer/canvas/TileLayer.js'; -import _ol_source_TileWMS_ from '../../../../../src/ol/source/TileWMS.js'; +import TileWMS from '../../../../../src/ol/source/TileWMS.js'; import XYZ from '../../../../../src/ol/source/XYZ.js'; import _ol_transform_ from '../../../../../src/ol/transform.js'; @@ -19,7 +19,7 @@ describe('ol.renderer.canvas.TileLayer', function() { target.style.width = '100px'; target.style.height = '100px'; document.body.appendChild(target); - source = new _ol_source_TileWMS_({ + source = new TileWMS({ url: 'spec/ol/data/osm-0-0-0.png', params: {LAYERS: 'foo', TIME: '0'} }); diff --git a/test/spec/ol/source/tilewms.test.js b/test/spec/ol/source/tilewms.test.js index cff8072c08..ce02d31ab8 100644 --- a/test/spec/ol/source/tilewms.test.js +++ b/test/spec/ol/source/tilewms.test.js @@ -1,6 +1,6 @@ import ImageTile from '../../../../src/ol/ImageTile.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_source_TileWMS_ from '../../../../src/ol/source/TileWMS.js'; +import TileWMS from '../../../../src/ol/source/TileWMS.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; @@ -26,18 +26,18 @@ describe('ol.source.TileWMS', function() { describe('constructor', function() { it('can be constructed without url or urls params', function() { - var source = new _ol_source_TileWMS_({ + var source = new TileWMS({ projection: 'EPSG:3857', tileGrid: _ol_tilegrid_.createXYZ({maxZoom: 6}) }); - expect(source).to.be.an(_ol_source_TileWMS_); + expect(source).to.be.an(TileWMS); }); }); describe('#getTile', function() { it('returns a tile with the expected URL', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); var uri = new URL(tile.src_); @@ -66,7 +66,7 @@ describe('ol.source.TileWMS', function() { it('returns a larger tile when a gutter is specified', function() { options.gutter = 16; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); var uri = new URL(tile.src_); @@ -83,7 +83,7 @@ describe('ol.source.TileWMS', function() { it('sets the SRS query value instead of CRS if version < 1.3', function() { options.params.VERSION = '1.2'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -94,7 +94,7 @@ describe('ol.source.TileWMS', function() { it('allows various parameters to be overridden', function() { options.params.FORMAT = 'image/jpeg'; options.params.TRANSPARENT = false; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -104,7 +104,7 @@ describe('ol.source.TileWMS', function() { it('does not add a STYLES= option if one is specified', function() { options.params.STYLES = 'foo'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -112,7 +112,7 @@ describe('ol.source.TileWMS', function() { }); it('changes the BBOX order for EN axis orientations', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -121,7 +121,7 @@ describe('ol.source.TileWMS', function() { it('uses EN BBOX order if version < 1.3', function() { options.params.VERSION = '1.1.0'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('CRS:84')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -130,7 +130,7 @@ describe('ol.source.TileWMS', function() { it('sets FORMAT_OPTIONS when the server is GeoServer', function() { options.serverType = 'geoserver'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 2, getProjection('CRS:84')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -139,7 +139,7 @@ describe('ol.source.TileWMS', function() { it('extends FORMAT_OPTIONS if it is already present', function() { options.serverType = 'geoserver'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); options.params.FORMAT_OPTIONS = 'param1:value1'; var tile = source.getTile(3, 2, -3, 2, getProjection('CRS:84')); var uri = new URL(tile.src_); @@ -150,7 +150,7 @@ describe('ol.source.TileWMS', function() { it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer', function() { options.serverType = 'geoserver'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1.325, getProjection('CRS:84')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -163,7 +163,7 @@ describe('ol.source.TileWMS', function() { it('returns a tile if it is contained within layers extent', function() { options.extent = [-80, -40, -50, -10]; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tileCoord = [3, 2, -3]; var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326')); var uri = new URL(url); @@ -173,7 +173,7 @@ describe('ol.source.TileWMS', function() { it('returns a tile if it intersects layers extent', function() { options.extent = [-80, -40, -40, -10]; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tileCoord = [3, 3, -3]; var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326')); var uri = new URL(url); @@ -187,7 +187,7 @@ describe('ol.source.TileWMS', function() { resolutions: [1.40625, 0.703125, 0.3515625, 0.17578125], origin: [-180, -90] }); - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tileCoord = [3, 3, -3]; var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326')); var uri = new URL(url); @@ -201,7 +201,7 @@ describe('ol.source.TileWMS', function() { describe('#getGetFeatureInfoUrl', function() { it('returns the expected GetFeatureInfo URL', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); source.pixelRatio_ = 1; var url = source.getGetFeatureInfoUrl( [-7000000, -12000000], @@ -235,7 +235,7 @@ describe('ol.source.TileWMS', function() { }); it('returns the expected GetFeatureInfo URL when source\'s projection is different from the parameter', function() { - var source = new _ol_source_TileWMS_(optionsReproj); + var source = new TileWMS(optionsReproj); source.pixelRatio_ = 1; var url = source.getGetFeatureInfoUrl( [-7000000, -12000000], @@ -265,7 +265,7 @@ describe('ol.source.TileWMS', function() { }); it('sets the QUERY_LAYERS param as expected', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); source.pixelRatio_ = 1; var url = source.getGetFeatureInfoUrl( [-7000000, -12000000], @@ -301,7 +301,7 @@ describe('ol.source.TileWMS', function() { describe('#setUrl()', function() { it('sets the correct url', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var url = 'http://foo/'; source.setUrl(url); var tileUrl = source.tileUrlFunction([0, 0, 0], 1, getProjection('EPSG:4326')); @@ -311,7 +311,7 @@ describe('ol.source.TileWMS', function() { describe('#setUrls()', function() { it ('updates the source key', function() { - var source = new _ol_source_TileWMS_({ + var source = new TileWMS({ urls: ['u1', 'u2'] }); var originalKey = source.getKey();