Factor out ol.source.Vector#removeFeatureInternal_

This commit is contained in:
Tom Payne
2013-12-04 14:59:18 +01:00
parent 66457a7aaf
commit ae3ab95b56

View File

@@ -179,13 +179,22 @@ ol.source.Vector.prototype.isEmpty = function() {
*/
ol.source.Vector.prototype.removeFeature = function(feature) {
this.rBush_.remove(feature);
this.removeFeatureInternal_(feature);
this.dispatchChangeEvent();
};
/**
* @param {ol.Feature} feature Feature.
* @private
*/
ol.source.Vector.prototype.removeFeatureInternal_ = function(feature) {
var featureKey = goog.getUid(feature) + '';
goog.asserts.assert(featureKey in this.featureChangeKeys_);
goog.events.unlistenByKey(this.featureChangeKeys_[featureKey]);
delete this.featureChangeKeys_[featureKey];
this.dispatchEvent(new ol.source.VectorEvent(
ol.source.VectorEventType.REMOVEFEATURE, feature));
this.dispatchChangeEvent();
};