Remove uniqueness constraint check

This commit is contained in:
Frederic Junod
2014-06-26 17:55:38 +02:00
parent d1737228e9
commit a172eda242
2 changed files with 7 additions and 16 deletions

View File

@@ -135,10 +135,7 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) {
}
var id = feature.getId();
if (goog.isDef(id)) {
var sid = id.toString();
goog.asserts.assert(!(sid in this.idIndex_),
'Feature with same id already added to the source: ' + id);
this.idIndex_[sid] = feature;
this.idIndex_[id.toString()] = feature;
} else {
goog.asserts.assert(!(featureKey in this.undefIdIndex_),
'Feature already added to the source');
@@ -385,16 +382,12 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
var sid = id.toString();
if (featureKey in this.undefIdIndex_) {
delete this.undefIdIndex_[featureKey];
goog.asserts.assert(!goog.isDef(this.idIndex_[sid]),
'Duplicate feature id: ' + id);
this.idIndex_[sid] = feature;
} else {
if (this.idIndex_[sid] !== feature) {
removed = this.removeFromIdIndex_(feature);
goog.asserts.assert(removed,
'Expected feature to be removed from index');
goog.asserts.assert(!(sid in this.idIndex_),
'Duplicate feature id: ' + id);
this.idIndex_[sid] = feature;
}
}