Rename goog.DEBUG to ol.DEBUG

This commit is contained in:
Andreas Hocevar
2016-08-28 17:02:49 +02:00
parent 92ab5a079c
commit d1e4b33760
115 changed files with 701 additions and 691 deletions

View File

@@ -91,7 +91,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = function(response)
}
//var copyright = response.copyright; // FIXME do we need to display this?
var resource = response.resourceSets[0].resources[0];
goog.DEBUG && console.assert(resource.imageWidth == resource.imageHeight,
ol.DEBUG && console.assert(resource.imageWidth == resource.imageHeight,
'resource has imageWidth equal to imageHeight, i.e. is square');
var maxZoom = this.maxZoom_ == -1 ? resource.zoomMax : this.maxZoom_;
@@ -122,7 +122,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = function(response)
* @return {string|undefined} Tile URL.
*/
function(tileCoord, pixelRatio, projection) {
goog.DEBUG && console.assert(ol.proj.equivalent(
ol.DEBUG && console.assert(ol.proj.equivalent(
projection, sourceProjection),
'projections are equivalent');
if (!tileCoord) {

View File

@@ -149,7 +149,7 @@ ol.source.Cluster.prototype.cluster_ = function() {
ol.extent.buffer(extent, mapDistance, extent);
var neighbors = this.source_.getFeaturesInExtent(extent);
goog.DEBUG && console.assert(neighbors.length >= 1, 'at least one neighbor found');
ol.DEBUG && console.assert(neighbors.length >= 1, 'at least one neighbor found');
neighbors = neighbors.filter(function(neighbor) {
var uid = ol.getUid(neighbor).toString();
if (!(uid in clustered)) {
@@ -163,7 +163,7 @@ ol.source.Cluster.prototype.cluster_ = function() {
}
}
}
goog.DEBUG && console.assert(
ol.DEBUG && console.assert(
Object.keys(clustered).length == this.source_.getFeatures().length,
'number of clustered equals number of features in the source');
};

View File

@@ -38,7 +38,7 @@ ol.source.Image = function(options) {
*/
this.resolutions_ = options.resolutions !== undefined ?
options.resolutions : null;
goog.DEBUG && console.assert(!this.resolutions_ ||
ol.DEBUG && console.assert(!this.resolutions_ ||
ol.array.isSorted(this.resolutions_,
function(a, b) {
return b - a;

View File

@@ -195,7 +195,7 @@ ol.source.ImageArcGISRest.prototype.getImageLoadFunction = function() {
*/
ol.source.ImageArcGISRest.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) {
goog.DEBUG && console.assert(this.url_ !== undefined, 'url is defined');
ol.DEBUG && console.assert(this.url_ !== undefined, 'url is defined');
// ArcGIS Server only wants the numeric portion of the projection ID.
var srid = projection.getCode().split(':').pop();

View File

@@ -135,7 +135,7 @@ ol.source.ImageWMS.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101];
*/
ol.source.ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) {
goog.DEBUG && console.assert(!('VERSION' in params),
ol.DEBUG && console.assert(!('VERSION' in params),
'key VERSION is not allowed in params');
if (this.url_ === undefined) {

View File

@@ -425,7 +425,7 @@ ol.source.Raster.createRenderer_ = function(source) {
} else if (source instanceof ol.source.Image) {
renderer = ol.source.Raster.createImageRenderer_(source);
} else {
goog.DEBUG && console.assert(false, 'Unsupported source type: ' + source);
ol.DEBUG && console.assert(false, 'Unsupported source type: ' + source);
}
return renderer;
};

View File

@@ -89,11 +89,11 @@ ol.source.Stamen = function(options) {
var i = options.layer.indexOf('-');
var provider = i == -1 ? options.layer : options.layer.slice(0, i);
goog.DEBUG && console.assert(provider in ol.source.StamenProviderConfig,
ol.DEBUG && console.assert(provider in ol.source.StamenProviderConfig,
'known provider configured');
var providerConfig = ol.source.StamenProviderConfig[provider];
goog.DEBUG && console.assert(options.layer in ol.source.StamenLayerConfig,
ol.DEBUG && console.assert(options.layer in ol.source.StamenLayerConfig,
'known layer configured');
var layerConfig = ol.source.StamenLayerConfig[options.layer];

View File

@@ -303,8 +303,8 @@ ol.source.TileImage.prototype.getTileInternal = function(z, x, y, pixelRatio, pr
// cases we attempt to assign an interim tile to the new tile.
var /** @type {ol.Tile} */ interimTile = tile;
if (tile.interimTile && tile.interimTile.key == key) {
goog.DEBUG && console.assert(tile.interimTile.getState() == ol.Tile.State.LOADED);
goog.DEBUG && console.assert(tile.interimTile.interimTile === null);
ol.DEBUG && console.assert(tile.interimTile.getState() == ol.Tile.State.LOADED);
ol.DEBUG && console.assert(tile.interimTile.interimTile === null);
tile = tile.interimTile;
if (interimTile.getState() == ol.Tile.State.LOADED) {
tile.interimTile = interimTile;

View File

@@ -118,7 +118,7 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
}
if (tileJSON.scheme !== undefined) {
goog.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
ol.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
}
var minZoom = tileJSON.minzoom || 0;
var maxZoom = tileJSON.maxzoom || 22;

View File

@@ -175,7 +175,7 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
}
if (tileJSON.scheme !== undefined) {
goog.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
ol.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
}
var minZoom = tileJSON.minzoom || 0;
var maxZoom = tileJSON.maxzoom || 22;
@@ -229,7 +229,7 @@ ol.source.TileUTFGrid.prototype.getTile = function(z, x, y, pixelRatio, projecti
if (this.tileCache.containsKey(tileCoordKey)) {
return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey));
} else {
goog.DEBUG && console.assert(projection, 'argument projection is truthy');
ol.DEBUG && console.assert(projection, 'argument projection is truthy');
var tileCoord = [z, x, y];
var urlTileCoord =
this.getTileCoordForTileUrlFunction(tileCoord, projection);

View File

@@ -116,7 +116,7 @@ ol.inherits(ol.source.TileWMS, ol.source.TileImage);
*/
ol.source.TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) {
goog.DEBUG && console.assert(!('VERSION' in params),
ol.DEBUG && console.assert(!('VERSION' in params),
'key VERSION is not allowed in params');
var projectionObj = ol.proj.get(projection);

View File

@@ -237,7 +237,7 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) {
* @private
*/
ol.source.Vector.prototype.setupChangeEvents_ = function(featureKey, feature) {
goog.DEBUG && console.assert(!(featureKey in this.featureChangeKeys_),
ol.DEBUG && console.assert(!(featureKey in this.featureChangeKeys_),
'key (%s) not yet registered in featureChangeKey', featureKey);
this.featureChangeKeys_[featureKey] = [
ol.events.listen(feature, ol.events.EventType.CHANGE,
@@ -334,7 +334,7 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) {
* @private
*/
ol.source.Vector.prototype.bindFeaturesCollection_ = function(collection) {
goog.DEBUG && console.assert(!this.featuresCollection_,
ol.DEBUG && console.assert(!this.featuresCollection_,
'bindFeaturesCollection can only be called once');
var modifyingCollection = false;
ol.events.listen(this, ol.source.VectorEventType.ADDFEATURE,
@@ -400,11 +400,11 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
if (this.featuresCollection_) {
this.featuresCollection_.clear();
}
goog.DEBUG && console.assert(ol.obj.isEmpty(this.featureChangeKeys_),
ol.DEBUG && console.assert(ol.obj.isEmpty(this.featureChangeKeys_),
'featureChangeKeys is an empty object now');
goog.DEBUG && console.assert(ol.obj.isEmpty(this.idIndex_),
ol.DEBUG && console.assert(ol.obj.isEmpty(this.idIndex_),
'idIndex is an empty object now');
goog.DEBUG && console.assert(ol.obj.isEmpty(this.undefIdIndex_),
ol.DEBUG && console.assert(ol.obj.isEmpty(this.undefIdIndex_),
'undefIdIndex is an empty object now');
if (this.featuresRtree_) {
@@ -457,7 +457,7 @@ ol.source.Vector.prototype.forEachFeatureAtCoordinateDirect = function(coordinat
var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]];
return this.forEachFeatureInExtent(extent, function(feature) {
var geometry = feature.getGeometry();
goog.DEBUG && console.assert(geometry, 'feature geometry is defined and not null');
ol.DEBUG && console.assert(geometry, 'feature geometry is defined and not null');
if (geometry.intersectsCoordinate(coordinate)) {
return callback.call(opt_this, feature);
} else {
@@ -523,7 +523,7 @@ ol.source.Vector.prototype.forEachFeatureIntersectingExtent = function(extent, c
*/
function(feature) {
var geometry = feature.getGeometry();
goog.DEBUG && console.assert(geometry,
ol.DEBUG && console.assert(geometry,
'feature geometry is defined and not null');
if (geometry.intersectsExtent(extent)) {
var result = callback.call(opt_this, feature);
@@ -594,7 +594,7 @@ ol.source.Vector.prototype.getFeaturesAtCoordinate = function(coordinate) {
* @api
*/
ol.source.Vector.prototype.getFeaturesInExtent = function(extent) {
goog.DEBUG && console.assert(this.featuresRtree_,
ol.DEBUG && console.assert(this.featuresRtree_,
'getFeaturesInExtent does not work when useSpatialIndex is set to false');
return this.featuresRtree_.getInExtent(extent);
};
@@ -626,7 +626,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate,
var closestPoint = [NaN, NaN];
var minSquaredDistance = Infinity;
var extent = [-Infinity, -Infinity, Infinity, Infinity];
goog.DEBUG && console.assert(this.featuresRtree_,
ol.DEBUG && console.assert(this.featuresRtree_,
'getClosestFeatureToCoordinate does not work with useSpatialIndex set ' +
'to false');
var filter = opt_filter ? opt_filter : ol.functions.TRUE;
@@ -637,7 +637,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate,
function(feature) {
if (filter(feature)) {
var geometry = feature.getGeometry();
goog.DEBUG && console.assert(geometry,
ol.DEBUG && console.assert(geometry,
'feature geometry is defined and not null');
var previousMinSquaredDistance = minSquaredDistance;
minSquaredDistance = geometry.closestPointXY(
@@ -669,7 +669,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate,
* @api stable
*/
ol.source.Vector.prototype.getExtent = function() {
goog.DEBUG && console.assert(this.featuresRtree_,
ol.DEBUG && console.assert(this.featuresRtree_,
'getExtent does not work when useSpatialIndex is set to false');
return this.featuresRtree_.getExtent();
};
@@ -758,7 +758,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
} else {
if (this.idIndex_[sid] !== feature) {
removed = this.removeFromIdIndex_(feature);
goog.DEBUG && console.assert(removed,
ol.DEBUG && console.assert(removed,
'Expected feature to be removed from index');
this.idIndex_[sid] = feature;
}
@@ -766,11 +766,11 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
} else {
if (!(featureKey in this.undefIdIndex_)) {
removed = this.removeFromIdIndex_(feature);
goog.DEBUG && console.assert(removed,
ol.DEBUG && console.assert(removed,
'Expected feature to be removed from index');
this.undefIdIndex_[featureKey] = feature;
} else {
goog.DEBUG && console.assert(this.undefIdIndex_[featureKey] === feature,
ol.DEBUG && console.assert(this.undefIdIndex_[featureKey] === feature,
'feature keyed under %s in undefIdKeys', featureKey);
}
}
@@ -845,7 +845,7 @@ ol.source.Vector.prototype.removeFeature = function(feature) {
*/
ol.source.Vector.prototype.removeFeatureInternal = function(feature) {
var featureKey = ol.getUid(feature).toString();
goog.DEBUG && console.assert(featureKey in this.featureChangeKeys_,
ol.DEBUG && console.assert(featureKey in this.featureChangeKeys_,
'featureKey exists in featureChangeKeys');
this.featureChangeKeys_[featureKey].forEach(ol.events.unlistenByKey);
delete this.featureChangeKeys_[featureKey];

View File

@@ -308,16 +308,16 @@ ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
// TODO: add support for TileMatrixLimits
goog.DEBUG && console.assert(config['layer'],
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'];
});
goog.DEBUG && console.assert(l, 'found a matching layer in Contents/Layer');
ol.DEBUG && console.assert(l, 'found a matching layer in Contents/Layer');
goog.DEBUG && console.assert(l['TileMatrixSetLink'].length > 0,
ol.DEBUG && console.assert(l['TileMatrixSetLink'].length > 0,
'layer has TileMatrixSetLink');
var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet'];
var idx, matrixSet;
@@ -347,7 +347,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
matrixSet = /** @type {string} */
(l['TileMatrixSetLink'][idx]['TileMatrixSet']);
goog.DEBUG && console.assert(matrixSet, 'TileMatrixSet must not be null');
ol.DEBUG && console.assert(matrixSet, 'TileMatrixSet must not be null');
var format = /** @type {string} */ (l['Format'][0]);
if ('format' in config) {
@@ -371,12 +371,12 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var key = elt['Identifier'];
var value = elt['Default'];
if (value !== undefined) {
goog.DEBUG && console.assert(ol.array.includes(elt['Value'], value),
ol.DEBUG && console.assert(ol.array.includes(elt['Value'], value),
'default value contained in values');
} else {
value = elt['Value'][0];
}
goog.DEBUG && console.assert(value !== undefined, 'value could be found');
ol.DEBUG && console.assert(value !== undefined, 'value could be found');
dimensions[key] = value;
});
}
@@ -385,7 +385,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var matrixSetObj = ol.array.find(matrixSets, function(elt, index, array) {
return elt['Identifier'] == matrixSet;
});
goog.DEBUG && console.assert(matrixSetObj,
ol.DEBUG && console.assert(matrixSetObj,
'found matrixSet in Contents/TileMatrixSet');
var projection;
@@ -422,21 +422,21 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var requestEncoding = config['requestEncoding'];
requestEncoding = requestEncoding !== undefined ? requestEncoding : '';
goog.DEBUG && console.assert(
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'];
goog.DEBUG && console.assert(gets.length >= 1);
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'];
goog.DEBUG && console.assert(encodings.length >= 1);
ol.DEBUG && console.assert(encodings.length >= 1);
if (requestEncoding === '') {
// requestEncoding not provided, use the first encoding from the list
@@ -460,7 +460,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
}
});
}
goog.DEBUG && console.assert(urls.length > 0, 'At least one URL found');
ol.DEBUG && console.assert(urls.length > 0, 'At least one URL found');
return {
urls: urls,