Make handling of skipped features faster
This commit is contained in:
+21
-13
@@ -368,9 +368,10 @@ ol.Map = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.skippedFeatures_ = new ol.Collection();
|
this.skippedFeatures_ = new ol.Collection();
|
||||||
goog.events.listen(this.skippedFeatures_,
|
goog.events.listen(this.skippedFeatures_, ol.CollectionEventType.ADD,
|
||||||
[ol.CollectionEventType.ADD, ol.CollectionEventType.REMOVE],
|
this.handleSkippedFeaturesAdd_, false, this);
|
||||||
this.handleSkippedFeaturesChange_, false, this);
|
goog.events.listen(this.skippedFeatures_, ol.CollectionEventType.REMOVE,
|
||||||
|
this.handleSkippedFeaturesRemove_, false, this);
|
||||||
this.registerDisposable(this.skippedFeatures_);
|
this.registerDisposable(this.skippedFeatures_);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -931,17 +932,24 @@ ol.Map.prototype.handleSizeChanged_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
* @param {ol.CollectionEvent} event Collection "add" event.
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.handleSkippedFeaturesChange_ = function() {
|
ol.Map.prototype.handleSkippedFeaturesAdd_ = function(event) {
|
||||||
this.skippedFeatureUids_ = {};
|
var feature = /** @type {ol.Feature} */ (event.element);
|
||||||
this.skippedFeatures_.forEach(
|
var featureUid = goog.getUid(feature).toString();
|
||||||
/**
|
this.skippedFeatureUids_[featureUid] = true;
|
||||||
* @param {ol.Feature} feature Feature.
|
this.render();
|
||||||
* @this {ol.Map}
|
};
|
||||||
*/
|
|
||||||
function(feature) {
|
|
||||||
this.skippedFeatureUids_[goog.getUid(feature).toString()] = true;
|
/**
|
||||||
}, this);
|
* @private
|
||||||
|
* @param {ol.CollectionEvent} event Collection "remove" event.
|
||||||
|
*/
|
||||||
|
ol.Map.prototype.handleSkippedFeaturesRemove_ = function(event) {
|
||||||
|
var feature = /** @type {ol.Feature} */ (event.element);
|
||||||
|
var featureUid = goog.getUid(feature).toString();
|
||||||
|
delete this.skippedFeatureUids_[featureUid];
|
||||||
this.render();
|
this.render();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user