Use goog.DEBUG instead of ol.DEBUG for now
This commit is contained in:
@@ -90,7 +90,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];
|
||||
ol.DEBUG && console.assert(resource.imageWidth == resource.imageHeight,
|
||||
goog.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_;
|
||||
|
||||
@@ -121,7 +121,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = function(response)
|
||||
* @return {string|undefined} Tile URL.
|
||||
*/
|
||||
function(tileCoord, pixelRatio, projection) {
|
||||
ol.DEBUG && console.assert(ol.proj.equivalent(
|
||||
goog.DEBUG && console.assert(ol.proj.equivalent(
|
||||
projection, sourceProjection),
|
||||
'projections are equivalent');
|
||||
if (!tileCoord) {
|
||||
|
||||
@@ -136,7 +136,7 @@ ol.source.Cluster.prototype.cluster_ = function() {
|
||||
ol.extent.buffer(extent, mapDistance, extent);
|
||||
|
||||
var neighbors = this.source_.getFeaturesInExtent(extent);
|
||||
ol.DEBUG && console.assert(neighbors.length >= 1, 'at least one neighbor found');
|
||||
goog.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)) {
|
||||
@@ -150,7 +150,7 @@ ol.source.Cluster.prototype.cluster_ = function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
ol.DEBUG && console.assert(
|
||||
goog.DEBUG && console.assert(
|
||||
Object.keys(clustered).length == this.source_.getFeatures().length,
|
||||
'number of clustered equals number of features in the source');
|
||||
};
|
||||
|
||||
@@ -195,7 +195,7 @@ ol.source.ImageArcGISRest.prototype.getImageLoadFunction = function() {
|
||||
*/
|
||||
ol.source.ImageArcGISRest.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) {
|
||||
|
||||
ol.DEBUG && console.assert(this.url_ !== undefined, 'url is defined');
|
||||
goog.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();
|
||||
|
||||
@@ -37,7 +37,7 @@ ol.source.Image = function(options) {
|
||||
*/
|
||||
this.resolutions_ = options.resolutions !== undefined ?
|
||||
options.resolutions : null;
|
||||
ol.DEBUG && console.assert(!this.resolutions_ ||
|
||||
goog.DEBUG && console.assert(!this.resolutions_ ||
|
||||
ol.array.isSorted(this.resolutions_,
|
||||
function(a, b) {
|
||||
return b - a;
|
||||
|
||||
@@ -168,7 +168,7 @@ ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function(
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
ol.DEBUG && console.assert(feature !== undefined, 'passed a feature');
|
||||
goog.DEBUG && console.assert(feature !== undefined, 'passed a feature');
|
||||
var key = ol.getUid(feature).toString();
|
||||
if (!(key in features)) {
|
||||
features[key] = true;
|
||||
|
||||
@@ -135,7 +135,7 @@ ol.source.ImageWMS.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101];
|
||||
*/
|
||||
ol.source.ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) {
|
||||
|
||||
ol.DEBUG && console.assert(!('VERSION' in params),
|
||||
goog.DEBUG && console.assert(!('VERSION' in params),
|
||||
'key VERSION is not allowed in params');
|
||||
|
||||
if (this.url_ === undefined) {
|
||||
|
||||
@@ -424,7 +424,7 @@ ol.source.Raster.createRenderer_ = function(source) {
|
||||
} else if (source instanceof ol.source.Image) {
|
||||
renderer = ol.source.Raster.createImageRenderer_(source);
|
||||
} else {
|
||||
ol.DEBUG && console.assert(false, 'Unsupported source type: ' + source);
|
||||
goog.DEBUG && console.assert(false, 'Unsupported source type: ' + source);
|
||||
}
|
||||
return renderer;
|
||||
};
|
||||
|
||||
@@ -88,11 +88,11 @@ ol.source.Stamen = function(options) {
|
||||
|
||||
var i = options.layer.indexOf('-');
|
||||
var provider = i == -1 ? options.layer : options.layer.slice(0, i);
|
||||
ol.DEBUG && console.assert(provider in ol.source.StamenProviderConfig,
|
||||
goog.DEBUG && console.assert(provider in ol.source.StamenProviderConfig,
|
||||
'known provider configured');
|
||||
var providerConfig = ol.source.StamenProviderConfig[provider];
|
||||
|
||||
ol.DEBUG && console.assert(options.layer in ol.source.StamenLayerConfig,
|
||||
goog.DEBUG && console.assert(options.layer in ol.source.StamenLayerConfig,
|
||||
'known layer configured');
|
||||
var layerConfig = ol.source.StamenLayerConfig[options.layer];
|
||||
|
||||
|
||||
@@ -301,8 +301,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) {
|
||||
ol.DEBUG && console.assert(tile.interimTile.getState() == ol.TileState.LOADED);
|
||||
ol.DEBUG && console.assert(tile.interimTile.interimTile === null);
|
||||
goog.DEBUG && console.assert(tile.interimTile.getState() == ol.TileState.LOADED);
|
||||
goog.DEBUG && console.assert(tile.interimTile.interimTile === null);
|
||||
tile = tile.interimTile;
|
||||
if (interimTile.getState() == ol.TileState.LOADED) {
|
||||
tile.interimTile = interimTile;
|
||||
|
||||
@@ -117,7 +117,7 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
}
|
||||
|
||||
if (tileJSON.scheme !== undefined) {
|
||||
ol.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
|
||||
goog.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
|
||||
}
|
||||
var minZoom = tileJSON.minzoom || 0;
|
||||
var maxZoom = tileJSON.maxzoom || 22;
|
||||
|
||||
@@ -282,7 +282,7 @@ ol.source.Tile.prototype.getTileCoordForTileUrlFunction = function(tileCoord, op
|
||||
var projection = opt_projection !== undefined ?
|
||||
opt_projection : this.getProjection();
|
||||
var tileGrid = this.getTileGridForProjection(projection);
|
||||
ol.DEBUG && console.assert(tileGrid, 'tile grid needed');
|
||||
goog.DEBUG && console.assert(tileGrid, 'tile grid needed');
|
||||
if (this.getWrapX() && projection.isGlobal()) {
|
||||
tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
}
|
||||
|
||||
if (tileJSON.scheme !== undefined) {
|
||||
ol.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
|
||||
goog.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
|
||||
}
|
||||
var minZoom = tileJSON.minzoom || 0;
|
||||
var maxZoom = tileJSON.maxzoom || 22;
|
||||
@@ -228,7 +228,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 {
|
||||
ol.DEBUG && console.assert(projection, 'argument projection is truthy');
|
||||
goog.DEBUG && console.assert(projection, 'argument projection is truthy');
|
||||
var tileCoord = [z, x, y];
|
||||
var urlTileCoord =
|
||||
this.getTileCoordForTileUrlFunction(tileCoord, projection);
|
||||
|
||||
@@ -116,7 +116,7 @@ ol.inherits(ol.source.TileWMS, ol.source.TileImage);
|
||||
*/
|
||||
ol.source.TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) {
|
||||
|
||||
ol.DEBUG && console.assert(!('VERSION' in params),
|
||||
goog.DEBUG && console.assert(!('VERSION' in params),
|
||||
'key VERSION is not allowed in params');
|
||||
|
||||
var projectionObj = ol.proj.get(projection);
|
||||
|
||||
@@ -232,7 +232,7 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) {
|
||||
* @private
|
||||
*/
|
||||
ol.source.Vector.prototype.setupChangeEvents_ = function(featureKey, feature) {
|
||||
ol.DEBUG && console.assert(!(featureKey in this.featureChangeKeys_),
|
||||
goog.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,
|
||||
@@ -329,7 +329,7 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) {
|
||||
* @private
|
||||
*/
|
||||
ol.source.Vector.prototype.bindFeaturesCollection_ = function(collection) {
|
||||
ol.DEBUG && console.assert(!this.featuresCollection_,
|
||||
goog.DEBUG && console.assert(!this.featuresCollection_,
|
||||
'bindFeaturesCollection can only be called once');
|
||||
var modifyingCollection = false;
|
||||
ol.events.listen(this, ol.source.VectorEventType.ADDFEATURE,
|
||||
@@ -395,11 +395,11 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
|
||||
if (this.featuresCollection_) {
|
||||
this.featuresCollection_.clear();
|
||||
}
|
||||
ol.DEBUG && console.assert(ol.object.isEmpty(this.featureChangeKeys_),
|
||||
goog.DEBUG && console.assert(ol.object.isEmpty(this.featureChangeKeys_),
|
||||
'featureChangeKeys is an empty object now');
|
||||
ol.DEBUG && console.assert(ol.object.isEmpty(this.idIndex_),
|
||||
goog.DEBUG && console.assert(ol.object.isEmpty(this.idIndex_),
|
||||
'idIndex is an empty object now');
|
||||
ol.DEBUG && console.assert(ol.object.isEmpty(this.undefIdIndex_),
|
||||
goog.DEBUG && console.assert(ol.object.isEmpty(this.undefIdIndex_),
|
||||
'undefIdIndex is an empty object now');
|
||||
|
||||
if (this.featuresRtree_) {
|
||||
@@ -452,7 +452,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();
|
||||
ol.DEBUG && console.assert(geometry, 'feature geometry is defined and not null');
|
||||
goog.DEBUG && console.assert(geometry, 'feature geometry is defined and not null');
|
||||
if (geometry.containsCoordinate(coordinate)) {
|
||||
return callback.call(opt_this, feature);
|
||||
} else {
|
||||
@@ -518,7 +518,7 @@ ol.source.Vector.prototype.forEachFeatureIntersectingExtent = function(extent, c
|
||||
*/
|
||||
function(feature) {
|
||||
var geometry = feature.getGeometry();
|
||||
ol.DEBUG && console.assert(geometry,
|
||||
goog.DEBUG && console.assert(geometry,
|
||||
'feature geometry is defined and not null');
|
||||
if (geometry.intersectsExtent(extent)) {
|
||||
var result = callback.call(opt_this, feature);
|
||||
@@ -589,7 +589,7 @@ ol.source.Vector.prototype.getFeaturesAtCoordinate = function(coordinate) {
|
||||
* @api
|
||||
*/
|
||||
ol.source.Vector.prototype.getFeaturesInExtent = function(extent) {
|
||||
ol.DEBUG && console.assert(this.featuresRtree_,
|
||||
goog.DEBUG && console.assert(this.featuresRtree_,
|
||||
'getFeaturesInExtent does not work when useSpatialIndex is set to false');
|
||||
return this.featuresRtree_.getInExtent(extent);
|
||||
};
|
||||
@@ -621,7 +621,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate,
|
||||
var closestPoint = [NaN, NaN];
|
||||
var minSquaredDistance = Infinity;
|
||||
var extent = [-Infinity, -Infinity, Infinity, Infinity];
|
||||
ol.DEBUG && console.assert(this.featuresRtree_,
|
||||
goog.DEBUG && console.assert(this.featuresRtree_,
|
||||
'getClosestFeatureToCoordinate does not work with useSpatialIndex set ' +
|
||||
'to false');
|
||||
var filter = opt_filter ? opt_filter : ol.functions.TRUE;
|
||||
@@ -632,7 +632,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate,
|
||||
function(feature) {
|
||||
if (filter(feature)) {
|
||||
var geometry = feature.getGeometry();
|
||||
ol.DEBUG && console.assert(geometry,
|
||||
goog.DEBUG && console.assert(geometry,
|
||||
'feature geometry is defined and not null');
|
||||
var previousMinSquaredDistance = minSquaredDistance;
|
||||
minSquaredDistance = geometry.closestPointXY(
|
||||
@@ -664,7 +664,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate,
|
||||
* @api stable
|
||||
*/
|
||||
ol.source.Vector.prototype.getExtent = function() {
|
||||
ol.DEBUG && console.assert(this.featuresRtree_,
|
||||
goog.DEBUG && console.assert(this.featuresRtree_,
|
||||
'getExtent does not work when useSpatialIndex is set to false');
|
||||
return this.featuresRtree_.getExtent();
|
||||
};
|
||||
@@ -745,7 +745,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
|
||||
} else {
|
||||
if (this.idIndex_[sid] !== feature) {
|
||||
removed = this.removeFromIdIndex_(feature);
|
||||
ol.DEBUG && console.assert(removed,
|
||||
goog.DEBUG && console.assert(removed,
|
||||
'Expected feature to be removed from index');
|
||||
this.idIndex_[sid] = feature;
|
||||
}
|
||||
@@ -753,11 +753,11 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
|
||||
} else {
|
||||
if (!(featureKey in this.undefIdIndex_)) {
|
||||
removed = this.removeFromIdIndex_(feature);
|
||||
ol.DEBUG && console.assert(removed,
|
||||
goog.DEBUG && console.assert(removed,
|
||||
'Expected feature to be removed from index');
|
||||
this.undefIdIndex_[featureKey] = feature;
|
||||
} else {
|
||||
ol.DEBUG && console.assert(this.undefIdIndex_[featureKey] === feature,
|
||||
goog.DEBUG && console.assert(this.undefIdIndex_[featureKey] === feature,
|
||||
'feature keyed under %s in undefIdKeys', featureKey);
|
||||
}
|
||||
}
|
||||
@@ -832,7 +832,7 @@ ol.source.Vector.prototype.removeFeature = function(feature) {
|
||||
*/
|
||||
ol.source.Vector.prototype.removeFeatureInternal = function(feature) {
|
||||
var featureKey = ol.getUid(feature).toString();
|
||||
ol.DEBUG && console.assert(featureKey in this.featureChangeKeys_,
|
||||
goog.DEBUG && console.assert(featureKey in this.featureChangeKeys_,
|
||||
'featureKey exists in featureChangeKeys');
|
||||
this.featureChangeKeys_[featureKey].forEach(ol.events.unlistenByKey);
|
||||
delete this.featureChangeKeys_[featureKey];
|
||||
|
||||
@@ -307,16 +307,16 @@ ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
|
||||
ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
|
||||
// TODO: add support for TileMatrixLimits
|
||||
ol.DEBUG && console.assert(config['layer'],
|
||||
goog.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');
|
||||
goog.DEBUG && console.assert(l, 'found a matching layer in Contents/Layer');
|
||||
|
||||
ol.DEBUG && console.assert(l['TileMatrixSetLink'].length > 0,
|
||||
goog.DEBUG && console.assert(l['TileMatrixSetLink'].length > 0,
|
||||
'layer has TileMatrixSetLink');
|
||||
var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet'];
|
||||
var idx, matrixSet;
|
||||
@@ -346,7 +346,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
matrixSet = /** @type {string} */
|
||||
(l['TileMatrixSetLink'][idx]['TileMatrixSet']);
|
||||
|
||||
ol.DEBUG && console.assert(matrixSet, 'TileMatrixSet must not be null');
|
||||
goog.DEBUG && console.assert(matrixSet, 'TileMatrixSet must not be null');
|
||||
|
||||
var format = /** @type {string} */ (l['Format'][0]);
|
||||
if ('format' in config) {
|
||||
@@ -370,12 +370,12 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
var key = elt['Identifier'];
|
||||
var value = elt['Default'];
|
||||
if (value !== undefined) {
|
||||
ol.DEBUG && console.assert(ol.array.includes(elt['Value'], value),
|
||||
goog.DEBUG && console.assert(ol.array.includes(elt['Value'], value),
|
||||
'default value contained in values');
|
||||
} else {
|
||||
value = elt['Value'][0];
|
||||
}
|
||||
ol.DEBUG && console.assert(value !== undefined, 'value could be found');
|
||||
goog.DEBUG && console.assert(value !== undefined, 'value could be found');
|
||||
dimensions[key] = value;
|
||||
});
|
||||
}
|
||||
@@ -384,7 +384,7 @@ 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,
|
||||
goog.DEBUG && console.assert(matrixSetObj,
|
||||
'found matrixSet in Contents/TileMatrixSet');
|
||||
|
||||
var projection;
|
||||
@@ -421,21 +421,21 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
var requestEncoding = config['requestEncoding'];
|
||||
requestEncoding = requestEncoding !== undefined ? requestEncoding : '';
|
||||
|
||||
ol.DEBUG && console.assert(
|
||||
goog.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);
|
||||
goog.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);
|
||||
goog.DEBUG && console.assert(encodings.length >= 1);
|
||||
|
||||
if (requestEncoding === '') {
|
||||
// requestEncoding not provided, use the first encoding from the list
|
||||
@@ -459,7 +459,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
}
|
||||
});
|
||||
}
|
||||
ol.DEBUG && console.assert(urls.length > 0, 'At least one URL found');
|
||||
goog.DEBUG && console.assert(urls.length > 0, 'At least one URL found');
|
||||
|
||||
return {
|
||||
urls: urls,
|
||||
|
||||
Reference in New Issue
Block a user