Use a hash to store features uids
This commit is contained in:
@@ -366,10 +366,17 @@ ol.Map = function(options) {
|
||||
*/
|
||||
this.skippedFeatures_ = new ol.Collection();
|
||||
goog.events.listen(this.skippedFeatures_,
|
||||
[ol.CollectionEventType.ADD, ol.CollectionEventType.remove],
|
||||
this.render, false, this);
|
||||
[ol.CollectionEventType.ADD, ol.CollectionEventType.REMOVE],
|
||||
this.handleSkippedFeaturesChange_, false, this);
|
||||
this.registerDisposable(this.skippedFeatures_);
|
||||
|
||||
/**
|
||||
* Hash of features uid to skip drawing.
|
||||
* @type {Object}
|
||||
* @private
|
||||
*/
|
||||
this.skippedFeaturesHash_ = {};
|
||||
|
||||
goog.events.listen(
|
||||
this, ol.Object.getChangeEventType(ol.MapProperty.LAYERGROUP),
|
||||
this.handleLayerGroupChanged_, false, this);
|
||||
@@ -818,6 +825,16 @@ ol.Map.prototype.getSkippedFeatures = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the hash of features uids to be skipped.
|
||||
* @return {Object} Features uids hash
|
||||
* @todo stability experimental
|
||||
*/
|
||||
ol.Map.prototype.getSkippedFeaturesHash = function() {
|
||||
return this.skippedFeaturesHash_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
||||
* @param {string=} opt_type Type.
|
||||
@@ -917,6 +934,18 @@ ol.Map.prototype.handleSizeChanged_ = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.Map.prototype.handleSkippedFeaturesChange_ = function() {
|
||||
this.skippedFeaturesHash_ = {};
|
||||
this.skippedFeatures_.forEach(function(feature) {
|
||||
this.skippedFeaturesHash_[goog.getUid(feature).toString()] = true;
|
||||
}, this);
|
||||
this.render();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@@ -1202,8 +1231,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
pixelToCoordinateMatrix: this.pixelToCoordinateMatrix_,
|
||||
postRenderFunctions: [],
|
||||
size: size,
|
||||
skippedFeaturesIds: goog.array.map(
|
||||
this.skippedFeatures_.getArray(), goog.getUid),
|
||||
skippedFeaturesHash_: this.skippedFeaturesHash_,
|
||||
tileQueue: this.tileQueue_,
|
||||
time: time,
|
||||
usedTiles: {},
|
||||
|
||||
Reference in New Issue
Block a user