Merge pull request #1480 from elemoine/vector-api-features-overlay
[vector-api] Add ol.FeaturesOverlay#addFeature and #removeFeature
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
@exportSymbol ol.render.FeaturesOverlay
|
||||
@exportProperty ol.render.FeaturesOverlay.prototype.addFeature
|
||||
@exportProperty ol.render.FeaturesOverlay.prototype.getFeatures
|
||||
@exportProperty ol.render.FeaturesOverlay.prototype.setFeatures
|
||||
@exportProperty ol.render.FeaturesOverlay.prototype.setMap
|
||||
@exportProperty ol.render.FeaturesOverlay.prototype.setStyleFunction
|
||||
@exportProperty ol.render.FeaturesOverlay.prototype.removeFeature
|
||||
|
||||
@@ -64,6 +64,8 @@ ol.render.FeaturesOverlay = function(opt_options) {
|
||||
goog.asserts.assertInstanceof(options.features, ol.Collection);
|
||||
this.setFeatures(options.features);
|
||||
}
|
||||
} else {
|
||||
this.setFeatures(new ol.Collection());
|
||||
}
|
||||
|
||||
if (goog.isDef(options.styleFunction)) {
|
||||
@@ -77,6 +79,14 @@ ol.render.FeaturesOverlay = function(opt_options) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Feature} feature Feature.
|
||||
*/
|
||||
ol.render.FeaturesOverlay.prototype.addFeature = function(feature) {
|
||||
this.features_.push(feature);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Collection} Features collection.
|
||||
*/
|
||||
@@ -144,6 +154,14 @@ ol.render.FeaturesOverlay.prototype.handleMapPostCompose_ = function(event) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Feature} feature Feature.
|
||||
*/
|
||||
ol.render.FeaturesOverlay.prototype.removeFeature = function(feature) {
|
||||
this.features_.remove(feature);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user