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

@@ -202,8 +202,6 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) {
* @private
*/
ol.source.Vector.prototype.setupChangeEvents_ = function(featureKey, feature) {
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,
this.handleFeatureChange_, this),
@@ -299,8 +297,6 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) {
* @private
*/
ol.source.Vector.prototype.bindFeaturesCollection_ = function(collection) {
ol.DEBUG && console.assert(!this.featuresCollection_,
'bindFeaturesCollection can only be called once');
var modifyingCollection = false;
ol.events.listen(this, ol.source.VectorEventType.ADDFEATURE,
function(evt) {
@@ -365,12 +361,6 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
if (this.featuresCollection_) {
this.featuresCollection_.clear();
}
ol.DEBUG && console.assert(ol.obj.isEmpty(this.featureChangeKeys_),
'featureChangeKeys is an empty object now');
ol.DEBUG && console.assert(ol.obj.isEmpty(this.idIndex_),
'idIndex is an empty object now');
ol.DEBUG && console.assert(ol.obj.isEmpty(this.undefIdIndex_),
'undefIdIndex is an empty object now');
if (this.featuresRtree_) {
this.featuresRtree_.clear();
@@ -422,7 +412,6 @@ 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');
if (geometry.intersectsCoordinate(coordinate)) {
return callback.call(opt_this, feature);
} else {
@@ -488,8 +477,6 @@ ol.source.Vector.prototype.forEachFeatureIntersectingExtent = function(extent, c
*/
function(feature) {
var geometry = feature.getGeometry();
ol.DEBUG && console.assert(geometry,
'feature geometry is defined and not null');
if (geometry.intersectsExtent(extent)) {
var result = callback.call(opt_this, feature);
if (result) {
@@ -559,8 +546,6 @@ ol.source.Vector.prototype.getFeaturesAtCoordinate = function(coordinate) {
* @api
*/
ol.source.Vector.prototype.getFeaturesInExtent = function(extent) {
ol.DEBUG && console.assert(this.featuresRtree_,
'getFeaturesInExtent does not work when useSpatialIndex is set to false');
return this.featuresRtree_.getInExtent(extent);
};
@@ -591,9 +576,6 @@ 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_,
'getClosestFeatureToCoordinate does not work with useSpatialIndex set ' +
'to false');
var filter = opt_filter ? opt_filter : ol.functions.TRUE;
this.featuresRtree_.forEachInExtent(extent,
/**
@@ -602,8 +584,6 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate,
function(feature) {
if (filter(feature)) {
var geometry = feature.getGeometry();
ol.DEBUG && console.assert(geometry,
'feature geometry is defined and not null');
var previousMinSquaredDistance = minSquaredDistance;
minSquaredDistance = geometry.closestPointXY(
x, y, closestPoint, minSquaredDistance);
@@ -634,8 +614,6 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate,
* @api stable
*/
ol.source.Vector.prototype.getExtent = function() {
ol.DEBUG && console.assert(this.featuresRtree_,
'getExtent does not work when useSpatialIndex is set to false');
return this.featuresRtree_.getExtent();
};
@@ -714,7 +692,6 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
}
}
var id = feature.getId();
var removed;
if (id !== undefined) {
var sid = id.toString();
if (featureKey in this.undefIdIndex_) {
@@ -722,21 +699,14 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
this.idIndex_[sid] = feature;
} else {
if (this.idIndex_[sid] !== feature) {
removed = this.removeFromIdIndex_(feature);
ol.DEBUG && console.assert(removed,
'Expected feature to be removed from index');
this.removeFromIdIndex_(feature);
this.idIndex_[sid] = feature;
}
}
} else {
if (!(featureKey in this.undefIdIndex_)) {
removed = this.removeFromIdIndex_(feature);
ol.DEBUG && console.assert(removed,
'Expected feature to be removed from index');
this.removeFromIdIndex_(feature);
this.undefIdIndex_[featureKey] = feature;
} else {
ol.DEBUG && console.assert(this.undefIdIndex_[featureKey] === feature,
'feature keyed under %s in undefIdKeys', featureKey);
}
}
this.changed();
@@ -810,8 +780,6 @@ 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_,
'featureKey exists in featureChangeKeys');
this.featureChangeKeys_[featureKey].forEach(ol.events.unlistenByKey);
delete this.featureChangeKeys_[featureKey];
var id = feature.getId();