Map stores skippedFeatures instead of layers
This commit is contained in:
@@ -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);
|
||||
// Don’t use dispatchChangeEvent here because we don’t 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 feature’s ids to be skipped.
|
||||
* @return {Array.<number>} Array of features Ids
|
||||
* @todo stability experimental
|
||||
*/
|
||||
ol.layer.Vector.prototype.getSkippedFeaturesIds = function() {
|
||||
return this.skippedFeaturesIds_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user