Map stores skippedFeatures instead of layers

This commit is contained in:
Antoine Abt
2014-03-19 14:53:41 +01:00
parent e91db0f9af
commit 0d87516135
5 changed files with 32 additions and 95 deletions

View File

@@ -1,11 +1,7 @@
goog.provide('ol.layer.Vector');
goog.require('goog.array');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('goog.object');
goog.require('ol.Collection');
goog.require('ol.CollectionEventType');
goog.require('ol.feature');
goog.require('ol.layer.Layer');
@@ -45,25 +41,6 @@ ol.layer.Vector = function(opt_options) {
this.setStyle(options.style);
}
/**
* Collection of Features to skip drawing.
* @type {ol.Collection}
* @private
*/
this.skippedFeatures_ = new ol.Collection();
/**
* Array of Feature ids to skip drawing.
* @type {Array.<number>}
* @private
*/
this.skippedFeaturesIds_ = [];
goog.events.listen(this.skippedFeatures_, [
ol.CollectionEventType.REMOVE,
ol.CollectionEventType.ADD
], this.updateSkippedFeaturesArray_, false, this);
};
goog.inherits(ol.layer.Vector, ol.layer.Layer);
@@ -102,36 +79,3 @@ ol.layer.Vector.prototype.setStyle = function(style) {
this.styleFunction_ = ol.feature.createStyleFunction(style);
this.dispatchChangeEvent();
};
/**
* Update Features Ids internal array.
* @private
*/
ol.layer.Vector.prototype.updateSkippedFeaturesArray_ = function() {
this.skippedFeaturesIds_ = goog.array.map(
this.skippedFeatures_.getArray(), goog.getUid);
// Dont use dispatchChangeEvent here because we dont want the batch
// to be re-created, just replayed.
this.dispatchEvent(goog.events.EventType.CHANGE);
};
/**
* Get the collection of features to be skipped.
* @return {ol.Collection} Features collection.
* @todo stability experimental
*/
ol.layer.Vector.prototype.getSkippedFeatures = function() {
return this.skippedFeatures_;
};
/**
* Get the features ids to be skipped.
* @return {Array.<number>} Array of features Ids
* @todo stability experimental
*/
ol.layer.Vector.prototype.getSkippedFeaturesIds = function() {
return this.skippedFeaturesIds_;
};