Merge pull request #3758 from ahocevar/remove-featureoverlay
Removal of ol.FeatureOverlay
This commit is contained in:
@@ -7,7 +7,6 @@ goog.require('goog.functions');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.CollectionEventType');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.FeatureOverlay');
|
||||
goog.require('ol.MapBrowserEvent.EventType');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.coordinate');
|
||||
@@ -21,6 +20,8 @@ goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.interaction.Pointer');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.structs.RBush');
|
||||
goog.require('ol.style.Style');
|
||||
|
||||
@@ -112,10 +113,14 @@ ol.interaction.Modify = function(options) {
|
||||
|
||||
/**
|
||||
* Draw overlay where are sketch features are drawn.
|
||||
* @type {ol.FeatureOverlay}
|
||||
* @type {ol.layer.Vector}
|
||||
* @private
|
||||
*/
|
||||
this.overlay_ = new ol.FeatureOverlay({
|
||||
this.overlay_ = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
useSpatialIndex: false,
|
||||
wrapX: goog.isDef(options.wrapX) ? options.wrapX : false
|
||||
}),
|
||||
style: goog.isDef(options.style) ? options.style :
|
||||
ol.interaction.Modify.getDefaultStyleFunction()
|
||||
});
|
||||
@@ -208,7 +213,7 @@ ol.interaction.Modify.prototype.handleFeatureRemove_ = function(evt) {
|
||||
// There remains only vertexFeature…
|
||||
if (!goog.isNull(this.vertexFeature_) &&
|
||||
this.features_.getLength() === 0) {
|
||||
this.overlay_.removeFeature(this.vertexFeature_);
|
||||
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
||||
this.vertexFeature_ = null;
|
||||
}
|
||||
};
|
||||
@@ -383,7 +388,7 @@ ol.interaction.Modify.prototype.createOrUpdateVertexFeature_ =
|
||||
if (goog.isNull(vertexFeature)) {
|
||||
vertexFeature = new ol.Feature(new ol.geom.Point(coordinates));
|
||||
this.vertexFeature_ = vertexFeature;
|
||||
this.overlay_.addFeature(vertexFeature);
|
||||
this.overlay_.getSource().addFeature(vertexFeature);
|
||||
} else {
|
||||
var geometry = /** @type {ol.geom.Point} */ (vertexFeature.getGeometry());
|
||||
geometry.setCoordinates(coordinates);
|
||||
@@ -630,7 +635,7 @@ ol.interaction.Modify.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
||||
}
|
||||
}
|
||||
if (!goog.isNull(this.vertexFeature_)) {
|
||||
this.overlay_.removeFeature(this.vertexFeature_);
|
||||
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
||||
this.vertexFeature_ = null;
|
||||
}
|
||||
};
|
||||
@@ -800,7 +805,7 @@ ol.interaction.Modify.prototype.removeVertex_ = function() {
|
||||
newSegmentData);
|
||||
this.updateSegmentIndices_(geometry, index, segmentData.depth, -1);
|
||||
|
||||
this.overlay_.removeFeature(this.vertexFeature_);
|
||||
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
||||
this.vertexFeature_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user