Rename _ol_interaction_Modify_ to Modify
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import Draw from '../src/ol/interaction/Draw.js';
|
import Draw from '../src/ol/interaction/Draw.js';
|
||||||
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
|
import Modify from '../src/ol/interaction/Modify.js';
|
||||||
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
|
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
@@ -45,7 +45,7 @@ var map = new Map({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({source: source});
|
var modify = new Modify({source: source});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|
||||||
var draw, snap; // global so we can remove them later
|
var draw, snap; // global so we can remove them later
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
||||||
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
|
import Modify from '../src/ol/interaction/Modify.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
@@ -26,7 +26,7 @@ var select = new _ol_interaction_Select_({
|
|||||||
wrapX: false
|
wrapX: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: select.getFeatures()
|
features: select.getFeatures()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
||||||
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
|
import Modify from '../src/ol/interaction/Modify.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
@@ -220,7 +220,7 @@ var select = new _ol_interaction_Select_({
|
|||||||
style: overlayStyle
|
style: overlayStyle
|
||||||
});
|
});
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: select.getFeatures(),
|
features: select.getFeatures(),
|
||||||
style: overlayStyle,
|
style: overlayStyle,
|
||||||
insertVertexCondition: function() {
|
insertVertexCondition: function() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import Draw from '../src/ol/interaction/Draw.js';
|
import Draw from '../src/ol/interaction/Draw.js';
|
||||||
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
|
import Modify from '../src/ol/interaction/Modify.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
||||||
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
|
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
@@ -50,7 +50,7 @@ var ExampleModify = {
|
|||||||
this.select = new _ol_interaction_Select_();
|
this.select = new _ol_interaction_Select_();
|
||||||
map.addInteraction(this.select);
|
map.addInteraction(this.select);
|
||||||
|
|
||||||
this.modify = new _ol_interaction_Modify_({
|
this.modify = new Modify({
|
||||||
features: this.select.getFeatures()
|
features: this.select.getFeatures()
|
||||||
});
|
});
|
||||||
map.addInteraction(this.modify);
|
map.addInteraction(this.modify);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import EsriJSON from '../src/ol/format/EsriJSON.js';
|
import EsriJSON from '../src/ol/format/EsriJSON.js';
|
||||||
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
||||||
import Draw from '../src/ol/interaction/Draw.js';
|
import Draw from '../src/ol/interaction/Draw.js';
|
||||||
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
|
import Modify from '../src/ol/interaction/Modify.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
@@ -71,7 +71,7 @@ var select = new _ol_interaction_Select_();
|
|||||||
select.setActive(false);
|
select.setActive(false);
|
||||||
var selected = select.getFeatures();
|
var selected = select.getFeatures();
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: selected
|
features: selected
|
||||||
});
|
});
|
||||||
modify.setActive(false);
|
modify.setActive(false);
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ import _ol_style_Style_ from '../style/Style.js';
|
|||||||
* @fires ol.interaction.Modify.Event
|
* @fires ol.interaction.Modify.Event
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_interaction_Modify_ = function(options) {
|
var Modify = function(options) {
|
||||||
|
|
||||||
PointerInteraction.call(this, {
|
PointerInteraction.call(this, {
|
||||||
handleDownEvent: _ol_interaction_Modify_.handleDownEvent_,
|
handleDownEvent: Modify.handleDownEvent_,
|
||||||
handleDragEvent: _ol_interaction_Modify_.handleDragEvent_,
|
handleDragEvent: Modify.handleDragEvent_,
|
||||||
handleEvent: _ol_interaction_Modify_.handleEvent,
|
handleEvent: Modify.handleEvent,
|
||||||
handleUpEvent: _ol_interaction_Modify_.handleUpEvent_
|
handleUpEvent: Modify.handleUpEvent_
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,7 +163,7 @@ var _ol_interaction_Modify_ = function(options) {
|
|||||||
wrapX: !!options.wrapX
|
wrapX: !!options.wrapX
|
||||||
}),
|
}),
|
||||||
style: options.style ? options.style :
|
style: options.style ? options.style :
|
||||||
_ol_interaction_Modify_.getDefaultStyleFunction(),
|
Modify.getDefaultStyleFunction(),
|
||||||
updateWhileAnimating: true,
|
updateWhileAnimating: true,
|
||||||
updateWhileInteracting: true
|
updateWhileInteracting: true
|
||||||
});
|
});
|
||||||
@@ -227,27 +227,27 @@ var _ol_interaction_Modify_ = function(options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_interaction_Modify_, PointerInteraction);
|
inherits(Modify, PointerInteraction);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @define {number} The segment index assigned to a circle's center when
|
* @define {number} The segment index assigned to a circle's center when
|
||||||
* breaking up a cicrle into ModifySegmentDataType segments.
|
* breaking up a cicrle into ModifySegmentDataType segments.
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX = 0;
|
Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @define {number} The segment index assigned to a circle's circumference when
|
* @define {number} The segment index assigned to a circle's circumference when
|
||||||
* breaking up a circle into ModifySegmentDataType segments.
|
* breaking up a circle into ModifySegmentDataType segments.
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX = 1;
|
Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX = 1;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Feature} feature Feature.
|
* @param {ol.Feature} feature Feature.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.addFeature_ = function(feature) {
|
Modify.prototype.addFeature_ = function(feature) {
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (geometry && geometry.getType() in this.SEGMENT_WRITERS_) {
|
if (geometry && geometry.getType() in this.SEGMENT_WRITERS_) {
|
||||||
this.SEGMENT_WRITERS_[geometry.getType()].call(this, feature, geometry);
|
this.SEGMENT_WRITERS_[geometry.getType()].call(this, feature, geometry);
|
||||||
@@ -265,10 +265,10 @@ _ol_interaction_Modify_.prototype.addFeature_ = function(feature) {
|
|||||||
* @param {ol.MapBrowserPointerEvent} evt Map browser event
|
* @param {ol.MapBrowserPointerEvent} evt Map browser event
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.willModifyFeatures_ = function(evt) {
|
Modify.prototype.willModifyFeatures_ = function(evt) {
|
||||||
if (!this.modified_) {
|
if (!this.modified_) {
|
||||||
this.modified_ = true;
|
this.modified_ = true;
|
||||||
this.dispatchEvent(new _ol_interaction_Modify_.Event(
|
this.dispatchEvent(new Modify.Event(
|
||||||
_ol_interaction_ModifyEventType_.MODIFYSTART, this.features_, evt));
|
_ol_interaction_ModifyEventType_.MODIFYSTART, this.features_, evt));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -278,7 +278,7 @@ _ol_interaction_Modify_.prototype.willModifyFeatures_ = function(evt) {
|
|||||||
* @param {ol.Feature} feature Feature.
|
* @param {ol.Feature} feature Feature.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.removeFeature_ = function(feature) {
|
Modify.prototype.removeFeature_ = function(feature) {
|
||||||
this.removeFeatureSegmentData_(feature);
|
this.removeFeatureSegmentData_(feature);
|
||||||
// Remove the vertex feature if the collection of canditate features
|
// Remove the vertex feature if the collection of canditate features
|
||||||
// is empty.
|
// is empty.
|
||||||
@@ -295,7 +295,7 @@ _ol_interaction_Modify_.prototype.removeFeature_ = function(feature) {
|
|||||||
* @param {ol.Feature} feature Feature.
|
* @param {ol.Feature} feature Feature.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.removeFeatureSegmentData_ = function(feature) {
|
Modify.prototype.removeFeatureSegmentData_ = function(feature) {
|
||||||
var rBush = this.rBush_;
|
var rBush = this.rBush_;
|
||||||
var /** @type {Array.<ol.ModifySegmentDataType>} */ nodesToRemove = [];
|
var /** @type {Array.<ol.ModifySegmentDataType>} */ nodesToRemove = [];
|
||||||
rBush.forEach(
|
rBush.forEach(
|
||||||
@@ -316,7 +316,7 @@ _ol_interaction_Modify_.prototype.removeFeatureSegmentData_ = function(feature)
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.setActive = function(active) {
|
Modify.prototype.setActive = function(active) {
|
||||||
if (this.vertexFeature_ && !active) {
|
if (this.vertexFeature_ && !active) {
|
||||||
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
||||||
this.vertexFeature_ = null;
|
this.vertexFeature_ = null;
|
||||||
@@ -328,7 +328,7 @@ _ol_interaction_Modify_.prototype.setActive = function(active) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.setMap = function(map) {
|
Modify.prototype.setMap = function(map) {
|
||||||
this.overlay_.setMap(map);
|
this.overlay_.setMap(map);
|
||||||
PointerInteraction.prototype.setMap.call(this, map);
|
PointerInteraction.prototype.setMap.call(this, map);
|
||||||
};
|
};
|
||||||
@@ -338,7 +338,7 @@ _ol_interaction_Modify_.prototype.setMap = function(map) {
|
|||||||
* @param {ol.source.Vector.Event} event Event.
|
* @param {ol.source.Vector.Event} event Event.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.handleSourceAdd_ = function(event) {
|
Modify.prototype.handleSourceAdd_ = function(event) {
|
||||||
if (event.feature) {
|
if (event.feature) {
|
||||||
this.features_.push(event.feature);
|
this.features_.push(event.feature);
|
||||||
}
|
}
|
||||||
@@ -349,7 +349,7 @@ _ol_interaction_Modify_.prototype.handleSourceAdd_ = function(event) {
|
|||||||
* @param {ol.source.Vector.Event} event Event.
|
* @param {ol.source.Vector.Event} event Event.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.handleSourceRemove_ = function(event) {
|
Modify.prototype.handleSourceRemove_ = function(event) {
|
||||||
if (event.feature) {
|
if (event.feature) {
|
||||||
this.features_.remove(event.feature);
|
this.features_.remove(event.feature);
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ _ol_interaction_Modify_.prototype.handleSourceRemove_ = function(event) {
|
|||||||
* @param {ol.Collection.Event} evt Event.
|
* @param {ol.Collection.Event} evt Event.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.handleFeatureAdd_ = function(evt) {
|
Modify.prototype.handleFeatureAdd_ = function(evt) {
|
||||||
this.addFeature_(/** @type {ol.Feature} */ (evt.element));
|
this.addFeature_(/** @type {ol.Feature} */ (evt.element));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ _ol_interaction_Modify_.prototype.handleFeatureAdd_ = function(evt) {
|
|||||||
* @param {ol.events.Event} evt Event.
|
* @param {ol.events.Event} evt Event.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.handleFeatureChange_ = function(evt) {
|
Modify.prototype.handleFeatureChange_ = function(evt) {
|
||||||
if (!this.changingFeature_) {
|
if (!this.changingFeature_) {
|
||||||
var feature = /** @type {ol.Feature} */ (evt.target);
|
var feature = /** @type {ol.Feature} */ (evt.target);
|
||||||
this.removeFeature_(feature);
|
this.removeFeature_(feature);
|
||||||
@@ -382,7 +382,7 @@ _ol_interaction_Modify_.prototype.handleFeatureChange_ = function(evt) {
|
|||||||
* @param {ol.Collection.Event} evt Event.
|
* @param {ol.Collection.Event} evt Event.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.handleFeatureRemove_ = function(evt) {
|
Modify.prototype.handleFeatureRemove_ = function(evt) {
|
||||||
var feature = /** @type {ol.Feature} */ (evt.element);
|
var feature = /** @type {ol.Feature} */ (evt.element);
|
||||||
this.removeFeature_(feature);
|
this.removeFeature_(feature);
|
||||||
};
|
};
|
||||||
@@ -393,7 +393,7 @@ _ol_interaction_Modify_.prototype.handleFeatureRemove_ = function(evt) {
|
|||||||
* @param {ol.geom.Point} geometry Geometry.
|
* @param {ol.geom.Point} geometry Geometry.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.writePointGeometry_ = function(feature, geometry) {
|
Modify.prototype.writePointGeometry_ = function(feature, geometry) {
|
||||||
var coordinates = geometry.getCoordinates();
|
var coordinates = geometry.getCoordinates();
|
||||||
var segmentData = /** @type {ol.ModifySegmentDataType} */ ({
|
var segmentData = /** @type {ol.ModifySegmentDataType} */ ({
|
||||||
feature: feature,
|
feature: feature,
|
||||||
@@ -409,7 +409,7 @@ _ol_interaction_Modify_.prototype.writePointGeometry_ = function(feature, geomet
|
|||||||
* @param {ol.geom.MultiPoint} geometry Geometry.
|
* @param {ol.geom.MultiPoint} geometry Geometry.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.writeMultiPointGeometry_ = function(feature, geometry) {
|
Modify.prototype.writeMultiPointGeometry_ = function(feature, geometry) {
|
||||||
var points = geometry.getCoordinates();
|
var points = geometry.getCoordinates();
|
||||||
var coordinates, i, ii, segmentData;
|
var coordinates, i, ii, segmentData;
|
||||||
for (i = 0, ii = points.length; i < ii; ++i) {
|
for (i = 0, ii = points.length; i < ii; ++i) {
|
||||||
@@ -431,7 +431,7 @@ _ol_interaction_Modify_.prototype.writeMultiPointGeometry_ = function(feature, g
|
|||||||
* @param {ol.geom.LineString} geometry Geometry.
|
* @param {ol.geom.LineString} geometry Geometry.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.writeLineStringGeometry_ = function(feature, geometry) {
|
Modify.prototype.writeLineStringGeometry_ = function(feature, geometry) {
|
||||||
var coordinates = geometry.getCoordinates();
|
var coordinates = geometry.getCoordinates();
|
||||||
var i, ii, segment, segmentData;
|
var i, ii, segment, segmentData;
|
||||||
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||||
@@ -452,7 +452,7 @@ _ol_interaction_Modify_.prototype.writeLineStringGeometry_ = function(feature, g
|
|||||||
* @param {ol.geom.MultiLineString} geometry Geometry.
|
* @param {ol.geom.MultiLineString} geometry Geometry.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) {
|
Modify.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) {
|
||||||
var lines = geometry.getCoordinates();
|
var lines = geometry.getCoordinates();
|
||||||
var coordinates, i, ii, j, jj, segment, segmentData;
|
var coordinates, i, ii, j, jj, segment, segmentData;
|
||||||
for (j = 0, jj = lines.length; j < jj; ++j) {
|
for (j = 0, jj = lines.length; j < jj; ++j) {
|
||||||
@@ -477,7 +477,7 @@ _ol_interaction_Modify_.prototype.writeMultiLineStringGeometry_ = function(featu
|
|||||||
* @param {ol.geom.Polygon} geometry Geometry.
|
* @param {ol.geom.Polygon} geometry Geometry.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.writePolygonGeometry_ = function(feature, geometry) {
|
Modify.prototype.writePolygonGeometry_ = function(feature, geometry) {
|
||||||
var rings = geometry.getCoordinates();
|
var rings = geometry.getCoordinates();
|
||||||
var coordinates, i, ii, j, jj, segment, segmentData;
|
var coordinates, i, ii, j, jj, segment, segmentData;
|
||||||
for (j = 0, jj = rings.length; j < jj; ++j) {
|
for (j = 0, jj = rings.length; j < jj; ++j) {
|
||||||
@@ -502,7 +502,7 @@ _ol_interaction_Modify_.prototype.writePolygonGeometry_ = function(feature, geom
|
|||||||
* @param {ol.geom.MultiPolygon} geometry Geometry.
|
* @param {ol.geom.MultiPolygon} geometry Geometry.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) {
|
Modify.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) {
|
||||||
var polygons = geometry.getCoordinates();
|
var polygons = geometry.getCoordinates();
|
||||||
var coordinates, i, ii, j, jj, k, kk, rings, segment, segmentData;
|
var coordinates, i, ii, j, jj, k, kk, rings, segment, segmentData;
|
||||||
for (k = 0, kk = polygons.length; k < kk; ++k) {
|
for (k = 0, kk = polygons.length; k < kk; ++k) {
|
||||||
@@ -536,18 +536,18 @@ _ol_interaction_Modify_.prototype.writeMultiPolygonGeometry_ = function(feature,
|
|||||||
* @param {ol.geom.Circle} geometry Geometry.
|
* @param {ol.geom.Circle} geometry Geometry.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.writeCircleGeometry_ = function(feature, geometry) {
|
Modify.prototype.writeCircleGeometry_ = function(feature, geometry) {
|
||||||
var coordinates = geometry.getCenter();
|
var coordinates = geometry.getCenter();
|
||||||
var centerSegmentData = /** @type {ol.ModifySegmentDataType} */ ({
|
var centerSegmentData = /** @type {ol.ModifySegmentDataType} */ ({
|
||||||
feature: feature,
|
feature: feature,
|
||||||
geometry: geometry,
|
geometry: geometry,
|
||||||
index: _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX,
|
index: Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX,
|
||||||
segment: [coordinates, coordinates]
|
segment: [coordinates, coordinates]
|
||||||
});
|
});
|
||||||
var circumferenceSegmentData = /** @type {ol.ModifySegmentDataType} */ ({
|
var circumferenceSegmentData = /** @type {ol.ModifySegmentDataType} */ ({
|
||||||
feature: feature,
|
feature: feature,
|
||||||
geometry: geometry,
|
geometry: geometry,
|
||||||
index: _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX,
|
index: Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX,
|
||||||
segment: [coordinates, coordinates]
|
segment: [coordinates, coordinates]
|
||||||
});
|
});
|
||||||
var featureSegments = [centerSegmentData, circumferenceSegmentData];
|
var featureSegments = [centerSegmentData, circumferenceSegmentData];
|
||||||
@@ -562,7 +562,7 @@ _ol_interaction_Modify_.prototype.writeCircleGeometry_ = function(feature, geome
|
|||||||
* @param {ol.geom.GeometryCollection} geometry Geometry.
|
* @param {ol.geom.GeometryCollection} geometry Geometry.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) {
|
Modify.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) {
|
||||||
var i, geometries = geometry.getGeometriesArray();
|
var i, geometries = geometry.getGeometriesArray();
|
||||||
for (i = 0; i < geometries.length; ++i) {
|
for (i = 0; i < geometries.length; ++i) {
|
||||||
this.SEGMENT_WRITERS_[geometries[i].getType()].call(
|
this.SEGMENT_WRITERS_[geometries[i].getType()].call(
|
||||||
@@ -576,7 +576,7 @@ _ol_interaction_Modify_.prototype.writeGeometryCollectionGeometry_ = function(fe
|
|||||||
* @return {ol.Feature} Vertex feature.
|
* @return {ol.Feature} Vertex feature.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.createOrUpdateVertexFeature_ = function(coordinates) {
|
Modify.prototype.createOrUpdateVertexFeature_ = function(coordinates) {
|
||||||
var vertexFeature = this.vertexFeature_;
|
var vertexFeature = this.vertexFeature_;
|
||||||
if (!vertexFeature) {
|
if (!vertexFeature) {
|
||||||
vertexFeature = new Feature(new Point(coordinates));
|
vertexFeature = new Feature(new Point(coordinates));
|
||||||
@@ -596,7 +596,7 @@ _ol_interaction_Modify_.prototype.createOrUpdateVertexFeature_ = function(coordi
|
|||||||
* @return {number} The difference in indexes.
|
* @return {number} The difference in indexes.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.compareIndexes_ = function(a, b) {
|
Modify.compareIndexes_ = function(a, b) {
|
||||||
return a.index - b.index;
|
return a.index - b.index;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -607,7 +607,7 @@ _ol_interaction_Modify_.compareIndexes_ = function(a, b) {
|
|||||||
* @this {ol.interaction.Modify}
|
* @this {ol.interaction.Modify}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.handleDownEvent_ = function(evt) {
|
Modify.handleDownEvent_ = function(evt) {
|
||||||
if (!this.condition_(evt)) {
|
if (!this.condition_(evt)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -623,7 +623,7 @@ _ol_interaction_Modify_.handleDownEvent_ = function(evt) {
|
|||||||
var vertexExtent = boundingExtent([vertex]);
|
var vertexExtent = boundingExtent([vertex]);
|
||||||
var segmentDataMatches = this.rBush_.getInExtent(vertexExtent);
|
var segmentDataMatches = this.rBush_.getInExtent(vertexExtent);
|
||||||
var componentSegments = {};
|
var componentSegments = {};
|
||||||
segmentDataMatches.sort(_ol_interaction_Modify_.compareIndexes_);
|
segmentDataMatches.sort(Modify.compareIndexes_);
|
||||||
for (var i = 0, ii = segmentDataMatches.length; i < ii; ++i) {
|
for (var i = 0, ii = segmentDataMatches.length; i < ii; ++i) {
|
||||||
var segmentDataMatch = segmentDataMatches[i];
|
var segmentDataMatch = segmentDataMatches[i];
|
||||||
var segment = segmentDataMatch.segment;
|
var segment = segmentDataMatch.segment;
|
||||||
@@ -636,9 +636,9 @@ _ol_interaction_Modify_.handleDownEvent_ = function(evt) {
|
|||||||
componentSegments[uid] = new Array(2);
|
componentSegments[uid] = new Array(2);
|
||||||
}
|
}
|
||||||
if (segmentDataMatch.geometry.getType() === GeometryType.CIRCLE &&
|
if (segmentDataMatch.geometry.getType() === GeometryType.CIRCLE &&
|
||||||
segmentDataMatch.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
segmentDataMatch.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
||||||
|
|
||||||
var closestVertex = _ol_interaction_Modify_.closestOnSegmentData_(pixelCoordinate, segmentDataMatch);
|
var closestVertex = Modify.closestOnSegmentData_(pixelCoordinate, segmentDataMatch);
|
||||||
if (_ol_coordinate_.equals(closestVertex, vertex) && !componentSegments[uid][0]) {
|
if (_ol_coordinate_.equals(closestVertex, vertex) && !componentSegments[uid][0]) {
|
||||||
this.dragSegments_.push([segmentDataMatch, 0]);
|
this.dragSegments_.push([segmentDataMatch, 0]);
|
||||||
componentSegments[uid][0] = segmentDataMatch;
|
componentSegments[uid][0] = segmentDataMatch;
|
||||||
@@ -683,7 +683,7 @@ _ol_interaction_Modify_.handleDownEvent_ = function(evt) {
|
|||||||
* @this {ol.interaction.Modify}
|
* @this {ol.interaction.Modify}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.handleDragEvent_ = function(evt) {
|
Modify.handleDragEvent_ = function(evt) {
|
||||||
this.ignoreNextSingleClick_ = false;
|
this.ignoreNextSingleClick_ = false;
|
||||||
this.willModifyFeatures_(evt);
|
this.willModifyFeatures_(evt);
|
||||||
|
|
||||||
@@ -733,7 +733,7 @@ _ol_interaction_Modify_.handleDragEvent_ = function(evt) {
|
|||||||
break;
|
break;
|
||||||
case GeometryType.CIRCLE:
|
case GeometryType.CIRCLE:
|
||||||
segment[0] = segment[1] = vertex;
|
segment[0] = segment[1] = vertex;
|
||||||
if (segmentData.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX) {
|
if (segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX) {
|
||||||
this.changingFeature_ = true;
|
this.changingFeature_ = true;
|
||||||
geometry.setCenter(vertex);
|
geometry.setCenter(vertex);
|
||||||
this.changingFeature_ = false;
|
this.changingFeature_ = false;
|
||||||
@@ -761,7 +761,7 @@ _ol_interaction_Modify_.handleDragEvent_ = function(evt) {
|
|||||||
* @this {ol.interaction.Modify}
|
* @this {ol.interaction.Modify}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.handleUpEvent_ = function(evt) {
|
Modify.handleUpEvent_ = function(evt) {
|
||||||
var segmentData;
|
var segmentData;
|
||||||
var geometry;
|
var geometry;
|
||||||
for (var i = this.dragSegments_.length - 1; i >= 0; --i) {
|
for (var i = this.dragSegments_.length - 1; i >= 0; --i) {
|
||||||
@@ -782,7 +782,7 @@ _ol_interaction_Modify_.handleUpEvent_ = function(evt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.modified_) {
|
if (this.modified_) {
|
||||||
this.dispatchEvent(new _ol_interaction_Modify_.Event(
|
this.dispatchEvent(new Modify.Event(
|
||||||
_ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt));
|
_ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt));
|
||||||
this.modified_ = false;
|
this.modified_ = false;
|
||||||
}
|
}
|
||||||
@@ -798,7 +798,7 @@ _ol_interaction_Modify_.handleUpEvent_ = function(evt) {
|
|||||||
* @this {ol.interaction.Modify}
|
* @this {ol.interaction.Modify}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) {
|
Modify.handleEvent = function(mapBrowserEvent) {
|
||||||
if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) {
|
if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ _ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) {
|
|||||||
* @param {ol.MapBrowserEvent} evt Event.
|
* @param {ol.MapBrowserEvent} evt Event.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.handlePointerMove_ = function(evt) {
|
Modify.prototype.handlePointerMove_ = function(evt) {
|
||||||
this.lastPixel_ = evt.pixel;
|
this.lastPixel_ = evt.pixel;
|
||||||
this.handlePointerAtPixel_(evt.pixel, evt.map);
|
this.handlePointerAtPixel_(evt.pixel, evt.map);
|
||||||
};
|
};
|
||||||
@@ -843,11 +843,11 @@ _ol_interaction_Modify_.prototype.handlePointerMove_ = function(evt) {
|
|||||||
* @param {ol.PluggableMap} map Map.
|
* @param {ol.PluggableMap} map Map.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
Modify.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
||||||
var pixelCoordinate = map.getCoordinateFromPixel(pixel);
|
var pixelCoordinate = map.getCoordinateFromPixel(pixel);
|
||||||
var sortByDistance = function(a, b) {
|
var sortByDistance = function(a, b) {
|
||||||
return _ol_interaction_Modify_.pointDistanceToSegmentDataSquared_(pixelCoordinate, a) -
|
return Modify.pointDistanceToSegmentDataSquared_(pixelCoordinate, a) -
|
||||||
_ol_interaction_Modify_.pointDistanceToSegmentDataSquared_(pixelCoordinate, b);
|
Modify.pointDistanceToSegmentDataSquared_(pixelCoordinate, b);
|
||||||
};
|
};
|
||||||
|
|
||||||
var box = buffer(createOrUpdateFromCoordinate(pixelCoordinate),
|
var box = buffer(createOrUpdateFromCoordinate(pixelCoordinate),
|
||||||
@@ -859,14 +859,14 @@ _ol_interaction_Modify_.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
|||||||
nodes.sort(sortByDistance);
|
nodes.sort(sortByDistance);
|
||||||
var node = nodes[0];
|
var node = nodes[0];
|
||||||
var closestSegment = node.segment;
|
var closestSegment = node.segment;
|
||||||
var vertex = _ol_interaction_Modify_.closestOnSegmentData_(pixelCoordinate, node);
|
var vertex = Modify.closestOnSegmentData_(pixelCoordinate, node);
|
||||||
var vertexPixel = map.getPixelFromCoordinate(vertex);
|
var vertexPixel = map.getPixelFromCoordinate(vertex);
|
||||||
var dist = _ol_coordinate_.distance(pixel, vertexPixel);
|
var dist = _ol_coordinate_.distance(pixel, vertexPixel);
|
||||||
if (dist <= this.pixelTolerance_) {
|
if (dist <= this.pixelTolerance_) {
|
||||||
var vertexSegments = {};
|
var vertexSegments = {};
|
||||||
|
|
||||||
if (node.geometry.getType() === GeometryType.CIRCLE &&
|
if (node.geometry.getType() === GeometryType.CIRCLE &&
|
||||||
node.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
node.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
||||||
|
|
||||||
this.snappedToVertex_ = true;
|
this.snappedToVertex_ = true;
|
||||||
this.createOrUpdateVertexFeature_(vertex);
|
this.createOrUpdateVertexFeature_(vertex);
|
||||||
@@ -917,13 +917,13 @@ _ol_interaction_Modify_.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
|||||||
* segment we are calculating the distance to.
|
* segment we are calculating the distance to.
|
||||||
* @return {number} The square of the distance between a point and a line segment.
|
* @return {number} The square of the distance between a point and a line segment.
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.pointDistanceToSegmentDataSquared_ = function(pointCoordinates, segmentData) {
|
Modify.pointDistanceToSegmentDataSquared_ = function(pointCoordinates, segmentData) {
|
||||||
var geometry = segmentData.geometry;
|
var geometry = segmentData.geometry;
|
||||||
|
|
||||||
if (geometry.getType() === GeometryType.CIRCLE) {
|
if (geometry.getType() === GeometryType.CIRCLE) {
|
||||||
var circleGeometry = /** @type {ol.geom.Circle} */ (geometry);
|
var circleGeometry = /** @type {ol.geom.Circle} */ (geometry);
|
||||||
|
|
||||||
if (segmentData.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
if (segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
||||||
var distanceToCenterSquared =
|
var distanceToCenterSquared =
|
||||||
_ol_coordinate_.squaredDistance(circleGeometry.getCenter(), pointCoordinates);
|
_ol_coordinate_.squaredDistance(circleGeometry.getCenter(), pointCoordinates);
|
||||||
var distanceToCircumference =
|
var distanceToCircumference =
|
||||||
@@ -943,11 +943,11 @@ _ol_interaction_Modify_.pointDistanceToSegmentDataSquared_ = function(pointCoord
|
|||||||
* segment which should contain the closest point.
|
* segment which should contain the closest point.
|
||||||
* @return {ol.Coordinate} The point closest to the specified line segment.
|
* @return {ol.Coordinate} The point closest to the specified line segment.
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.closestOnSegmentData_ = function(pointCoordinates, segmentData) {
|
Modify.closestOnSegmentData_ = function(pointCoordinates, segmentData) {
|
||||||
var geometry = segmentData.geometry;
|
var geometry = segmentData.geometry;
|
||||||
|
|
||||||
if (geometry.getType() === GeometryType.CIRCLE &&
|
if (geometry.getType() === GeometryType.CIRCLE &&
|
||||||
segmentData.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
||||||
return geometry.getClosestPoint(pointCoordinates);
|
return geometry.getClosestPoint(pointCoordinates);
|
||||||
}
|
}
|
||||||
return _ol_coordinate_.closestOnSegment(pointCoordinates, segmentData.segment);
|
return _ol_coordinate_.closestOnSegment(pointCoordinates, segmentData.segment);
|
||||||
@@ -959,7 +959,7 @@ _ol_interaction_Modify_.closestOnSegmentData_ = function(pointCoordinates, segme
|
|||||||
* @param {ol.Coordinate} vertex Vertex.
|
* @param {ol.Coordinate} vertex Vertex.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.insertVertex_ = function(segmentData, vertex) {
|
Modify.prototype.insertVertex_ = function(segmentData, vertex) {
|
||||||
var segment = segmentData.segment;
|
var segment = segmentData.segment;
|
||||||
var feature = segmentData.feature;
|
var feature = segmentData.feature;
|
||||||
var geometry = segmentData.geometry;
|
var geometry = segmentData.geometry;
|
||||||
@@ -1025,12 +1025,12 @@ _ol_interaction_Modify_.prototype.insertVertex_ = function(segmentData, vertex)
|
|||||||
* @return {boolean} True when a vertex was removed.
|
* @return {boolean} True when a vertex was removed.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.removePoint = function() {
|
Modify.prototype.removePoint = function() {
|
||||||
if (this.lastPointerEvent_ && this.lastPointerEvent_.type != MapBrowserEventType.POINTERDRAG) {
|
if (this.lastPointerEvent_ && this.lastPointerEvent_.type != MapBrowserEventType.POINTERDRAG) {
|
||||||
var evt = this.lastPointerEvent_;
|
var evt = this.lastPointerEvent_;
|
||||||
this.willModifyFeatures_(evt);
|
this.willModifyFeatures_(evt);
|
||||||
this.removeVertex_();
|
this.removeVertex_();
|
||||||
this.dispatchEvent(new _ol_interaction_Modify_.Event(
|
this.dispatchEvent(new Modify.Event(
|
||||||
_ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt));
|
_ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt));
|
||||||
this.modified_ = false;
|
this.modified_ = false;
|
||||||
return true;
|
return true;
|
||||||
@@ -1043,7 +1043,7 @@ _ol_interaction_Modify_.prototype.removePoint = function() {
|
|||||||
* @return {boolean} True when a vertex was removed.
|
* @return {boolean} True when a vertex was removed.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.removeVertex_ = function() {
|
Modify.prototype.removeVertex_ = function() {
|
||||||
var dragSegments = this.dragSegments_;
|
var dragSegments = this.dragSegments_;
|
||||||
var segmentsByFeature = {};
|
var segmentsByFeature = {};
|
||||||
var deleted = false;
|
var deleted = false;
|
||||||
@@ -1162,7 +1162,7 @@ _ol_interaction_Modify_.prototype.removeVertex_ = function() {
|
|||||||
* @param {Array} coordinates Coordinates.
|
* @param {Array} coordinates Coordinates.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.setGeometryCoordinates_ = function(geometry, coordinates) {
|
Modify.prototype.setGeometryCoordinates_ = function(geometry, coordinates) {
|
||||||
this.changingFeature_ = true;
|
this.changingFeature_ = true;
|
||||||
geometry.setCoordinates(coordinates);
|
geometry.setCoordinates(coordinates);
|
||||||
this.changingFeature_ = false;
|
this.changingFeature_ = false;
|
||||||
@@ -1176,7 +1176,7 @@ _ol_interaction_Modify_.prototype.setGeometryCoordinates_ = function(geometry, c
|
|||||||
* @param {number} delta Delta (1 or -1).
|
* @param {number} delta Delta (1 or -1).
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.updateSegmentIndices_ = function(
|
Modify.prototype.updateSegmentIndices_ = function(
|
||||||
geometry, index, depth, delta) {
|
geometry, index, depth, delta) {
|
||||||
this.rBush_.forEachInExtent(geometry.getExtent(), function(segmentDataMatch) {
|
this.rBush_.forEachInExtent(geometry.getExtent(), function(segmentDataMatch) {
|
||||||
if (segmentDataMatch.geometry === geometry &&
|
if (segmentDataMatch.geometry === geometry &&
|
||||||
@@ -1192,7 +1192,7 @@ _ol_interaction_Modify_.prototype.updateSegmentIndices_ = function(
|
|||||||
/**
|
/**
|
||||||
* @return {ol.StyleFunction} Styles.
|
* @return {ol.StyleFunction} Styles.
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.getDefaultStyleFunction = function() {
|
Modify.getDefaultStyleFunction = function() {
|
||||||
var style = _ol_style_Style_.createDefaultEditing();
|
var style = _ol_style_Style_.createDefaultEditing();
|
||||||
return function(feature, resolution) {
|
return function(feature, resolution) {
|
||||||
return style[GeometryType.POINT];
|
return style[GeometryType.POINT];
|
||||||
@@ -1213,7 +1213,7 @@ _ol_interaction_Modify_.getDefaultStyleFunction = function() {
|
|||||||
* @param {ol.MapBrowserPointerEvent} mapBrowserPointerEvent Associated
|
* @param {ol.MapBrowserPointerEvent} mapBrowserPointerEvent Associated
|
||||||
* {@link ol.MapBrowserPointerEvent}.
|
* {@link ol.MapBrowserPointerEvent}.
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.Event = function(type, features, mapBrowserPointerEvent) {
|
Modify.Event = function(type, features, mapBrowserPointerEvent) {
|
||||||
|
|
||||||
Event.call(this, type);
|
Event.call(this, type);
|
||||||
|
|
||||||
@@ -1231,5 +1231,5 @@ _ol_interaction_Modify_.Event = function(type, features, mapBrowserPointerEvent)
|
|||||||
*/
|
*/
|
||||||
this.mapBrowserEvent = mapBrowserPointerEvent;
|
this.mapBrowserEvent = mapBrowserPointerEvent;
|
||||||
};
|
};
|
||||||
inherits(_ol_interaction_Modify_.Event, Event);
|
inherits(Modify.Event, Event);
|
||||||
export default _ol_interaction_Modify_;
|
export default Modify;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Circle from '../../../../src/ol/geom/Circle.js';
|
|||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_interaction_Modify_ from '../../../../src/ol/interaction/Modify.js';
|
import Modify from '../../../../src/ol/interaction/Modify.js';
|
||||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||||
@@ -130,11 +130,11 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var endevent = events[events.length - 1];
|
var endevent = events[events.length - 1];
|
||||||
|
|
||||||
// first event should be modifystary
|
// first event should be modifystary
|
||||||
expect(startevent).to.be.an(_ol_interaction_Modify_.Event);
|
expect(startevent).to.be.an(Modify.Event);
|
||||||
expect(startevent.type).to.eql('modifystart');
|
expect(startevent.type).to.eql('modifystart');
|
||||||
|
|
||||||
// last event should be modifyend
|
// last event should be modifyend
|
||||||
expect(endevent).to.be.an(_ol_interaction_Modify_.Event);
|
expect(endevent).to.be.an(Modify.Event);
|
||||||
expect(endevent.type).to.eql('modifyend');
|
expect(endevent.type).to.eql('modifyend');
|
||||||
|
|
||||||
// make sure we get change events to events array
|
// make sure we get change events to events array
|
||||||
@@ -154,7 +154,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var feature = new Feature(
|
var feature = new Feature(
|
||||||
new Point([0, 0]));
|
new Point([0, 0]));
|
||||||
var features = new Collection([feature]);
|
var features = new Collection([feature]);
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: features
|
features: features
|
||||||
});
|
});
|
||||||
var rbushEntries = modify.rBush_.getAll();
|
var rbushEntries = modify.rBush_.getAll();
|
||||||
@@ -165,7 +165,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
it('accepts feature without geometry', function() {
|
it('accepts feature without geometry', function() {
|
||||||
var feature = new Feature();
|
var feature = new Feature();
|
||||||
var features = new Collection([feature]);
|
var features = new Collection([feature]);
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: features
|
features: features
|
||||||
});
|
});
|
||||||
var rbushEntries = modify.rBush_.getAll();
|
var rbushEntries = modify.rBush_.getAll();
|
||||||
@@ -181,7 +181,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var feature = new Feature(
|
var feature = new Feature(
|
||||||
new Point([0, 0]));
|
new Point([0, 0]));
|
||||||
var source = new VectorSource({features: [feature]});
|
var source = new VectorSource({features: [feature]});
|
||||||
var modify = new _ol_interaction_Modify_({source: source});
|
var modify = new Modify({source: source});
|
||||||
var rbushEntries = modify.rBush_.getAll();
|
var rbushEntries = modify.rBush_.getAll();
|
||||||
expect(rbushEntries.length).to.be(1);
|
expect(rbushEntries.length).to.be(1);
|
||||||
expect(rbushEntries[0].feature).to.be(feature);
|
expect(rbushEntries[0].feature).to.be(feature);
|
||||||
@@ -199,7 +199,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var second = features[1];
|
var second = features[1];
|
||||||
var secondRevision = second.getGeometry().getRevision();
|
var secondRevision = second.getGeometry().getRevision();
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -237,7 +237,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var first = features[0];
|
var first = features[0];
|
||||||
var firstRevision = first.getGeometry().getRevision();
|
var firstRevision = first.getGeometry().getRevision();
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -273,7 +273,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var first = features[0];
|
var first = features[0];
|
||||||
var firstRevision = first.getGeometry().getRevision();
|
var firstRevision = first.getGeometry().getRevision();
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -309,7 +309,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var first = features[0];
|
var first = features[0];
|
||||||
var firstRevision = first.getGeometry().getRevision();
|
var firstRevision = first.getGeometry().getRevision();
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -347,7 +347,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
features.length = 0;
|
features.length = 0;
|
||||||
features.push(lineFeature);
|
features.push(lineFeature);
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -386,7 +386,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
features.length = 0;
|
features.length = 0;
|
||||||
features.push(circleFeature);
|
features.push(circleFeature);
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -417,7 +417,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var modify, feature, events;
|
var modify, feature, events;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
modify = new _ol_interaction_Modify_({
|
modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -522,7 +522,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var modify, feature, events;
|
var modify, feature, events;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
modify = new _ol_interaction_Modify_({
|
modify = new Modify({
|
||||||
features: new Collection(features),
|
features: new Collection(features),
|
||||||
deleteCondition: _ol_events_condition_.doubleClick
|
deleteCondition: _ol_events_condition_.doubleClick
|
||||||
});
|
});
|
||||||
@@ -575,7 +575,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features),
|
features: new Collection(features),
|
||||||
insertVertexCondition: listenerSpy
|
insertVertexCondition: listenerSpy
|
||||||
});
|
});
|
||||||
@@ -621,7 +621,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
features.length = 0;
|
features.length = 0;
|
||||||
features.push(feature);
|
features.push(feature);
|
||||||
|
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -657,7 +657,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('updates polygon segment data', function() {
|
it('updates polygon segment data', function() {
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
@@ -697,7 +697,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
|
|
||||||
describe('#setActive', function() {
|
describe('#setActive', function() {
|
||||||
it('removes the vertexFeature of deactivation', function() {
|
it('removes the vertexFeature of deactivation', function() {
|
||||||
var modify = new _ol_interaction_Modify_({
|
var modify = new Modify({
|
||||||
features: new Collection(features)
|
features: new Collection(features)
|
||||||
});
|
});
|
||||||
map.addInteraction(modify);
|
map.addInteraction(modify);
|
||||||
|
|||||||
Reference in New Issue
Block a user