Remove ol.DEBUG

This commit is contained in:
Tim Schaub
2016-12-29 09:09:24 -07:00
parent 7b9690a691
commit 137cdc04c8
128 changed files with 309 additions and 2027 deletions

View File

@@ -296,19 +296,10 @@ ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
* @api
*/
ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
// TODO: add support for TileMatrixLimits
ol.DEBUG && console.assert(config['layer'],
'config "layer" must not be null');
var layers = wmtsCap['Contents']['Layer'];
var l = ol.array.find(layers, function(elt, index, array) {
return elt['Identifier'] == config['layer'];
});
ol.DEBUG && console.assert(l, 'found a matching layer in Contents/Layer');
ol.DEBUG && console.assert(l['TileMatrixSetLink'].length > 0,
'layer has TileMatrixSetLink');
var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet'];
var idx, matrixSet, matrixLimits;
if (l['TileMatrixSetLink'].length > 1) {
@@ -344,8 +335,6 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
matrixLimits = /** @type {Array.<Object>} */
(l['TileMatrixSetLink'][idx]['TileMatrixSetLimits']);
ol.DEBUG && console.assert(matrixSet, 'TileMatrixSet must not be null');
var format = /** @type {string} */ (l['Format'][0]);
if ('format' in config) {
format = config['format'];
@@ -367,13 +356,9 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
l['Dimension'].forEach(function(elt, index, array) {
var key = elt['Identifier'];
var value = elt['Default'];
if (value !== undefined) {
ol.DEBUG && console.assert(ol.array.includes(elt['Value'], value),
'default value contained in values');
} else {
if (value === undefined) {
value = elt['Value'][0];
}
ol.DEBUG && console.assert(value !== undefined, 'value could be found');
dimensions[key] = value;
});
}
@@ -382,8 +367,6 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var matrixSetObj = ol.array.find(matrixSets, function(elt, index, array) {
return elt['Identifier'] == matrixSet;
});
ol.DEBUG && console.assert(matrixSetObj,
'found matrixSet in Contents/TileMatrixSet');
var projection;
if ('projection' in config) {
@@ -419,21 +402,14 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var requestEncoding = config['requestEncoding'];
requestEncoding = requestEncoding !== undefined ? requestEncoding : '';
ol.DEBUG && console.assert(
ol.array.includes(['REST', 'RESTful', 'KVP', ''], requestEncoding),
'requestEncoding (%s) is one of "REST", "RESTful", "KVP" or ""',
requestEncoding);
if ('OperationsMetadata' in wmtsCap && 'GetTile' in wmtsCap['OperationsMetadata']) {
var gets = wmtsCap['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get'];
ol.DEBUG && console.assert(gets.length >= 1);
for (var i = 0, ii = gets.length; i < ii; ++i) {
var constraint = ol.array.find(gets[i]['Constraint'], function(element) {
return element['name'] == 'GetEncoding';
});
var encodings = constraint['AllowedValues']['Value'];
ol.DEBUG && console.assert(encodings.length >= 1);
if (requestEncoding === '') {
// requestEncoding not provided, use the first encoding from the list
@@ -457,7 +433,6 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
}
});
}
ol.DEBUG && console.assert(urls.length > 0, 'At least one URL found');
return {
urls: urls,
@@ -471,5 +446,4 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
dimensions: dimensions,
wrapX: wrapX
};
};