Rename _ol_source_WMTS_ to WMTS

This commit is contained in:
Tim Schaub
2018-01-08 16:06:42 -07:00
parent ecd1343d75
commit 2440d52ebe
8 changed files with 51 additions and 51 deletions

View File

@@ -8,7 +8,7 @@ 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 TileWMS from '../src/ol/source/TileWMS.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
import WMTS from '../src/ol/source/WMTS.js';
import XYZ from '../src/ol/source/XYZ.js';
import TileGrid from '../src/ol/tilegrid/TileGrid.js';
import proj4 from 'proj4';
@@ -104,7 +104,7 @@ fetch(url).then(function(response) {
return response.text();
}).then(function(text) {
var result = parser.read(text);
var options = _ol_source_WMTS_.optionsFromCapabilities(result, {
var options = WMTS.optionsFromCapabilities(result, {
layer: 'OSM_Land_Mask',
matrixSet: 'EPSG3413_250m'
});
@@ -112,7 +112,7 @@ fetch(url).then(function(response) {
options.projection = 'EPSG:3413';
options.wrapX = false;
layers['wmts3413'] = new TileLayer({
source: new _ol_source_WMTS_(/** @type {!olx.source.WMTSOptions} */ (options))
source: new WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
});
});

View File

@@ -4,7 +4,7 @@ import * as _ol_extent_ from '../src/ol/extent.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js';
import OSM from '../src/ol/source/OSM.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
import WMTS from '../src/ol/source/WMTS.js';
import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js';
@@ -26,7 +26,7 @@ var tileGrid = new WMTSTileGrid({
var scalgoToken = 'CC5BF28A7D96B320C7DFBFD1236B5BEB';
var wmtsSource = new _ol_source_WMTS_({
var wmtsSource = new WMTS({
url: 'http://ts2.scalgo.com/olpatch/wmts?token=' + scalgoToken,
layer: 'SRTM_4_1:SRTM_4_1_flooded_sealevels',
format: 'image/png',

View File

@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
import _ol_format_WMTSCapabilities_ from '../src/ol/format/WMTSCapabilities.js';
import _ol_has_ from '../src/ol/has.js';
import TileLayer from '../src/ol/layer/Tile.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
import WMTS from '../src/ol/source/WMTS.js';
var capabilitiesUrl = 'https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml';
@@ -27,13 +27,13 @@ fetch(capabilitiesUrl).then(function(response) {
return response.text();
}).then(function(text) {
var result = new _ol_format_WMTSCapabilities_().read(text);
var options = _ol_source_WMTS_.optionsFromCapabilities(result, {
var options = WMTS.optionsFromCapabilities(result, {
layer: layer,
matrixSet: 'google3857',
style: 'normal'
});
options.tilePixelRatio = tilePixelRatio;
map.addLayer(new TileLayer({
source: new _ol_source_WMTS_(/** @type {!olx.source.WMTSOptions} */ (options))
source: new WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
}));
});

View File

@@ -4,7 +4,7 @@ import {defaults as defaultControls} from '../src/ol/control.js';
import * as _ol_extent_ from '../src/ol/extent.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat, get as getProjection} from '../src/ol/proj.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
import WMTS from '../src/ol/source/WMTS.js';
import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js';
@@ -41,7 +41,7 @@ var tileGrid = new WMTSTileGrid({
// Expiration date is 06/29/2018.
var key = '2mqbg0z6cx7ube8gsou10nrt';
var ign_source = new _ol_source_WMTS_({
var ign_source = new WMTS({
url: 'https://wxs.ign.fr/' + key + '/wmts',
layer: 'GEOGRAPHICALGRIDSYSTEMS.MAPS',
matrixSet: 'PM',

View File

@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
import _ol_format_WMTSCapabilities_ from '../src/ol/format/WMTSCapabilities.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
import WMTS from '../src/ol/source/WMTS.js';
var parser = new _ol_format_WMTSCapabilities_();
var map;
@@ -12,7 +12,7 @@ fetch('data/WMTSCapabilities.xml').then(function(response) {
return response.text();
}).then(function(text) {
var result = parser.read(text);
var options = _ol_source_WMTS_.optionsFromCapabilities(result, {
var options = WMTS.optionsFromCapabilities(result, {
layer: 'layer-7328',
matrixSet: 'EPSG:3857'
});
@@ -25,7 +25,7 @@ fetch('data/WMTSCapabilities.xml').then(function(response) {
}),
new TileLayer({
opacity: 1,
source: new _ol_source_WMTS_(/** @type {!olx.source.WMTSOptions} */ (options))
source: new WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
})
],
target: 'map',

View File

@@ -5,7 +5,7 @@ import * as _ol_extent_ from '../src/ol/extent.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js';
import OSM from '../src/ol/source/OSM.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
import WMTS from '../src/ol/source/WMTS.js';
import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js';
@@ -28,7 +28,7 @@ var map = new Map({
}),
new TileLayer({
opacity: 0.7,
source: new _ol_source_WMTS_({
source: new WMTS({
attributions: 'Tiles © <a href="https://services.arcgisonline.com/arcgis/rest/' +
'services/Demographics/USA_Population_Density/MapServer/">ArcGIS</a>',
url: 'https://services.arcgisonline.com/arcgis/rest/' +

View File

@@ -21,7 +21,7 @@ import _ol_uri_ from '../uri.js';
* @param {olx.source.WMTSOptions} options WMTS options.
* @api
*/
var _ol_source_WMTS_ = function(options) {
var WMTS = function(options) {
// TODO: add support for TileMatrixLimits
@@ -173,14 +173,14 @@ var _ol_source_WMTS_ = function(options) {
};
inherits(_ol_source_WMTS_, TileImage);
inherits(WMTS, TileImage);
/**
* Set the URLs to use for requests.
* URLs may contain OCG conform URL Template Variables: {TileMatrix}, {TileRow}, {TileCol}.
* @override
*/
_ol_source_WMTS_.prototype.setUrls = function(urls) {
WMTS.prototype.setUrls = function(urls) {
this.urls = urls;
var key = urls.join('\n');
this.setTileUrlFunction(this.fixedTileUrlFunction ?
@@ -195,7 +195,7 @@ _ol_source_WMTS_.prototype.setUrls = function(urls) {
* @return {!Object} Dimensions.
* @api
*/
_ol_source_WMTS_.prototype.getDimensions = function() {
WMTS.prototype.getDimensions = function() {
return this.dimensions_;
};
@@ -205,7 +205,7 @@ _ol_source_WMTS_.prototype.getDimensions = function() {
* @return {string} Format.
* @api
*/
_ol_source_WMTS_.prototype.getFormat = function() {
WMTS.prototype.getFormat = function() {
return this.format_;
};
@@ -215,7 +215,7 @@ _ol_source_WMTS_.prototype.getFormat = function() {
* @return {string} Layer.
* @api
*/
_ol_source_WMTS_.prototype.getLayer = function() {
WMTS.prototype.getLayer = function() {
return this.layer_;
};
@@ -225,7 +225,7 @@ _ol_source_WMTS_.prototype.getLayer = function() {
* @return {string} MatrixSet.
* @api
*/
_ol_source_WMTS_.prototype.getMatrixSet = function() {
WMTS.prototype.getMatrixSet = function() {
return this.matrixSet_;
};
@@ -235,7 +235,7 @@ _ol_source_WMTS_.prototype.getMatrixSet = function() {
* @return {ol.source.WMTSRequestEncoding} Request encoding.
* @api
*/
_ol_source_WMTS_.prototype.getRequestEncoding = function() {
WMTS.prototype.getRequestEncoding = function() {
return this.requestEncoding_;
};
@@ -245,7 +245,7 @@ _ol_source_WMTS_.prototype.getRequestEncoding = function() {
* @return {string} Style.
* @api
*/
_ol_source_WMTS_.prototype.getStyle = function() {
WMTS.prototype.getStyle = function() {
return this.style_;
};
@@ -255,7 +255,7 @@ _ol_source_WMTS_.prototype.getStyle = function() {
* @return {string} Version.
* @api
*/
_ol_source_WMTS_.prototype.getVersion = function() {
WMTS.prototype.getVersion = function() {
return this.version_;
};
@@ -264,7 +264,7 @@ _ol_source_WMTS_.prototype.getVersion = function() {
* @private
* @return {string} The key for the current dimensions.
*/
_ol_source_WMTS_.prototype.getKeyForDimensions_ = function() {
WMTS.prototype.getKeyForDimensions_ = function() {
var i = 0;
var res = [];
for (var key in this.dimensions_) {
@@ -279,7 +279,7 @@ _ol_source_WMTS_.prototype.getKeyForDimensions_ = function() {
* @param {Object} dimensions Dimensions.
* @api
*/
_ol_source_WMTS_.prototype.updateDimensions = function(dimensions) {
WMTS.prototype.updateDimensions = function(dimensions) {
_ol_obj_.assign(this.dimensions_, dimensions);
this.setKey(this.getKeyForDimensions_());
};
@@ -309,7 +309,7 @@ _ol_source_WMTS_.prototype.updateDimensions = function(dimensions) {
* @return {?olx.source.WMTSOptions} WMTS source options object or `null` if the layer was not found.
* @api
*/
_ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var layers = wmtsCap['Contents']['Layer'];
var l = find(layers, function(elt, index, array) {
return elt['Identifier'] == config['layer'];
@@ -477,4 +477,4 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
crossOrigin: config['crossOrigin']
};
};
export default _ol_source_WMTS_;
export default WMTS;

View File

@@ -2,7 +2,7 @@ import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabili
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import WMTSTileGrid from '../../../../src/ol/tilegrid/WMTS.js';
import _ol_source_WMTS_ from '../../../../src/ol/source/WMTS.js';
import WMTS from '../../../../src/ol/source/WMTS.js';
describe('ol.source.WMTS', function() {
@@ -23,7 +23,7 @@ describe('ol.source.WMTS', function() {
});
it('returns null if the layer was not found in the capabilities', function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, {
var options = WMTS.optionsFromCapabilities(capabilities, {
layer: 'invalid'
});
@@ -31,7 +31,7 @@ describe('ol.source.WMTS', function() {
});
it('passes the crossOrigin option', function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, {
var options = WMTS.optionsFromCapabilities(capabilities, {
layer: 'BlueMarbleNextGeneration',
matrixSet: 'google3857',
crossOrigin: ''
@@ -42,7 +42,7 @@ describe('ol.source.WMTS', function() {
it('can create KVP options from spec/ol/format/wmts/ogcsample.xml',
function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(
var options = WMTS.optionsFromCapabilities(
capabilities,
{layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857'});
@@ -74,7 +74,7 @@ describe('ol.source.WMTS', function() {
it('can create REST options from spec/ol/format/wmts/ogcsample.xml',
function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, {
var options = WMTS.optionsFromCapabilities(capabilities, {
layer: 'BlueMarbleNextGeneration',
matrixSet: 'google3857',
requestEncoding: 'REST'
@@ -105,7 +105,7 @@ describe('ol.source.WMTS', function() {
});
it('can find a MatrixSet by SRS identifier', function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, {
var options = WMTS.optionsFromCapabilities(capabilities, {
layer: 'BlueMarbleNextGeneration',
projection: 'EPSG:3857',
requestEncoding: 'REST'
@@ -116,7 +116,7 @@ describe('ol.source.WMTS', function() {
});
it('can find a MatrixSet by equivalent SRS identifier', function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, {
var options = WMTS.optionsFromCapabilities(capabilities, {
layer: 'BlueMarbleNextGeneration',
projection: 'EPSG:900913',
requestEncoding: 'REST'
@@ -127,7 +127,7 @@ describe('ol.source.WMTS', function() {
});
it('can find the default MatrixSet', function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, {
var options = WMTS.optionsFromCapabilities(capabilities, {
layer: 'BlueMarbleNextGeneration',
requestEncoding: 'REST'
});
@@ -137,7 +137,7 @@ describe('ol.source.WMTS', function() {
});
it('uses the projection of the default MatrixSet if the config\'s projection is not supported', function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, {
var options = WMTS.optionsFromCapabilities(capabilities, {
layer: 'BlueMarbleNextGeneration',
projection: new _ol_proj_Projection_({
code: 'EPSG:2056',
@@ -153,7 +153,7 @@ describe('ol.source.WMTS', function() {
var tmpXml = content.replace(/<ows:Constraint[\s\S]*?<\/ows:Constraint>/g, '');
var tmpCapabilities = parser.read(tmpXml);
expect(tmpCapabilities['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get'][0]['Constraint']).to.be(undefined);
var options = _ol_source_WMTS_.optionsFromCapabilities(tmpCapabilities,
var options = WMTS.optionsFromCapabilities(tmpCapabilities,
{layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857'});
expect(options.layer).to.be.eql('BlueMarbleNextGeneration');
expect(options.matrixSet).to.be.eql('google3857');
@@ -166,7 +166,7 @@ describe('ol.source.WMTS', function() {
var tmpCapabilities = parser.read(tmpXml);
expect(tmpCapabilities['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get'][0]['Constraint']).to.be(undefined);
expect(tmpCapabilities['Contents']['Layer'][0]['ResourceURL']).to.be(undefined);
var options = _ol_source_WMTS_.optionsFromCapabilities(tmpCapabilities,
var options = WMTS.optionsFromCapabilities(tmpCapabilities,
{layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857'});
expect(options.layer).to.be.eql('BlueMarbleNextGeneration');
expect(options.matrixSet).to.be.eql('google3857');
@@ -180,7 +180,7 @@ describe('ol.source.WMTS', function() {
it('can replace lowercase REST parameters',
function() {
var source = new _ol_source_WMTS_({
var source = new WMTS({
layer: 'layer',
style: 'default',
urls: ['http://www.example.com/wmts/coastlines/{layer}/{style}/' +
@@ -206,7 +206,7 @@ describe('ol.source.WMTS', function() {
it('can replace camelcase REST parameters',
function() {
var source = new _ol_source_WMTS_({
var source = new WMTS({
layer: 'layer',
style: 'default',
urls: ['http://www.example.com/wmts/coastlines/{Layer}/{Style}/' +
@@ -247,7 +247,7 @@ describe('ol.source.WMTS', function() {
it('can create KVP options from spec/ol/format/wmts/arcgis.xml',
function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(
var options = WMTS.optionsFromCapabilities(
capabilities, {
layer: 'Demographics_USA_Population_Density',
requestEncoding: 'KVP',
@@ -263,7 +263,7 @@ describe('ol.source.WMTS', function() {
it('can create REST options from spec/ol/format/wmts/arcgis.xml',
function() {
var options = _ol_source_WMTS_.optionsFromCapabilities(
var options = WMTS.optionsFromCapabilities(
capabilities, {
layer: 'Demographics_USA_Population_Density',
matrixSet: 'default028mm'
@@ -281,7 +281,7 @@ describe('ol.source.WMTS', function() {
describe('#setUrls()', function() {
it('sets the URL for the source', function() {
var source = new _ol_source_WMTS_({});
var source = new WMTS({});
var urls = [
'https://a.example.com/',
@@ -294,7 +294,7 @@ describe('ol.source.WMTS', function() {
});
it('updates the key for the source', function() {
var source = new _ol_source_WMTS_({});
var source = new WMTS({});
var urls = [
'https://a.example.com/',
@@ -308,7 +308,7 @@ describe('ol.source.WMTS', function() {
it('generates the correct tileUrlFunction during application of setUrl()', function() {
var projection = getProjection('EPSG:3857');
var source = new _ol_source_WMTS_({
var source = new WMTS({
projection: projection,
requestEncoding: 'REST',
urls: [
@@ -334,7 +334,7 @@ describe('ol.source.WMTS', function() {
describe('url option', function() {
it('expands url template', function() {
var tileSource = new _ol_source_WMTS_({
var tileSource = new WMTS({
url: '{1-3}'
});
@@ -365,7 +365,7 @@ describe('ol.source.WMTS', function() {
describe('using a "url" option', function() {
beforeEach(function() {
sourceOptions.url = 'some_wmts_url';
source = new _ol_source_WMTS_(sourceOptions);
source = new WMTS(sourceOptions);
});
it('returns the WMTS URLs', function() {
@@ -378,7 +378,7 @@ describe('ol.source.WMTS', function() {
describe('using a "urls" option', function() {
beforeEach(function() {
sourceOptions.urls = ['some_wmts_url1', 'some_wmts_url2'];
source = new _ol_source_WMTS_(sourceOptions);
source = new WMTS(sourceOptions);
});
it('returns the WMTS URLs', function() {
@@ -395,7 +395,7 @@ describe('ol.source.WMTS', function() {
var source;
beforeEach(function() {
source = new _ol_source_WMTS_({
source = new WMTS({
layer: 'layer',
style: 'default',
matrixSet: 'foo',