@vaadin/bundles 25.3.0-alpha13 → 25.3.0-alpha14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js +6 -6
- package/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js +10 -1
- package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js +5 -0
- package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js +9 -8
- package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js +1 -1
- package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js +172 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js +58 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js.map +1 -0
- package/{node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-node_modules_vaadin_map_node_-a1378d.js → node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-304640.js} +244 -5
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-304640.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js +383 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js +243 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js +18 -5
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js +8 -8
- package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js.map +1 -1
- package/{node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c0.js → node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js} +2 -2
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js +17 -7
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js +18 -15
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js +18 -15
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js +21 -1
- package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js +34 -3
- package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js.map +1 -1
- package/package.json +135 -135
- package/vaadin-bundle.json +1824 -1812
- package/vaadin.js +2725 -1726
- package/vaadin.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js +30 -16
- package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js +6 -6
- package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js +7 -7
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js +6 -6
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js +34 -25
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js +146 -943
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js +111 -34
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js +3 -3
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js +1055 -219
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js +129 -57
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js +74 -80
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js +11 -11
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js +54 -54
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js +801 -0
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js.map +1 -0
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js +36 -20
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js +17 -279
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js +16 -7
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js +53 -17
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js +336 -38
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js +75 -42
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js.map +1 -1
- package/{node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js → vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js} +77 -11
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js +210 -16
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js +88 -32
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js +62 -22
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js +2 -2
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js +135 -81
- package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c0.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js +0 -144
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-node_modules_vaadin_map_node_-a1378d.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_style_js.js +0 -48
- package/node_modules_vaadin_map_node_modules_ol_style_js.js.map +0 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js +0 -769
- package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js.map +0 -1
|
@@ -11,26 +11,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11
11
|
/* harmony export */ "ModifyEvent": () => (/* binding */ ModifyEvent),
|
|
12
12
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
13
13
|
/* harmony export */ });
|
|
14
|
-
/* harmony import */ var
|
|
15
|
-
/* harmony import */ var
|
|
16
|
-
/* harmony import */ var
|
|
17
|
-
/* harmony import */ var
|
|
18
|
-
/* harmony import */ var
|
|
19
|
-
/* harmony import */ var
|
|
14
|
+
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Collection.js */ "./node_modules/@vaadin/map/node_modules/ol/Collection.js");
|
|
15
|
+
/* harmony import */ var _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../CollectionEventType.js */ "./node_modules/@vaadin/map/node_modules/ol/CollectionEventType.js");
|
|
16
|
+
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/@vaadin/map/node_modules/ol/Feature.js");
|
|
17
|
+
/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/@vaadin/map/node_modules/ol/MapBrowserEventType.js");
|
|
18
|
+
/* harmony import */ var _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../ObjectEventType.js */ "./node_modules/@vaadin/map/node_modules/ol/ObjectEventType.js");
|
|
19
|
+
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../array.js */ "./node_modules/@vaadin/map/node_modules/ol/array.js");
|
|
20
|
+
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/@vaadin/map/node_modules/ol/coordinate.js");
|
|
20
21
|
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/@vaadin/map/node_modules/ol/events/Event.js");
|
|
21
22
|
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/@vaadin/map/node_modules/ol/events/EventType.js");
|
|
22
23
|
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/@vaadin/map/node_modules/ol/events/condition.js");
|
|
23
|
-
/* harmony import */ var
|
|
24
|
-
/* harmony import */ var
|
|
25
|
-
/* harmony import */ var
|
|
24
|
+
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../extent.js */ "./node_modules/@vaadin/map/node_modules/ol/extent.js");
|
|
25
|
+
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/Point.js");
|
|
26
|
+
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/Polygon.js");
|
|
26
27
|
/* harmony import */ var _layer_Vector_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../layer/Vector.js */ "./node_modules/@vaadin/map/node_modules/ol/layer/Vector.js");
|
|
27
28
|
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../proj.js */ "./node_modules/@vaadin/map/node_modules/ol/proj.js");
|
|
28
29
|
/* harmony import */ var _source_Vector_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../source/Vector.js */ "./node_modules/@vaadin/map/node_modules/ol/source/Vector.js");
|
|
29
|
-
/* harmony import */ var
|
|
30
|
+
/* harmony import */ var _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../source/VectorEventType.js */ "./node_modules/@vaadin/map/node_modules/ol/source/VectorEventType.js");
|
|
30
31
|
/* harmony import */ var _structs_RBush_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../structs/RBush.js */ "./node_modules/@vaadin/map/node_modules/ol/structs/RBush.js");
|
|
31
|
-
/* harmony import */ var
|
|
32
|
-
/* harmony import */ var
|
|
32
|
+
/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/@vaadin/map/node_modules/ol/style/Style.js");
|
|
33
|
+
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../util.js */ "./node_modules/@vaadin/map/node_modules/ol/util.js");
|
|
33
34
|
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/@vaadin/map/node_modules/ol/interaction/Pointer.js");
|
|
35
|
+
/* harmony import */ var _tracing_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./tracing.js */ "./node_modules/@vaadin/map/node_modules/ol/interaction/tracing.js");
|
|
34
36
|
/**
|
|
35
37
|
* @module ol/interaction/Modify
|
|
36
38
|
*/
|
|
@@ -52,6 +54,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
52
54
|
|
|
53
55
|
|
|
54
56
|
|
|
57
|
+
|
|
58
|
+
|
|
55
59
|
|
|
56
60
|
|
|
57
61
|
|
|
@@ -100,6 +104,12 @@ const ModifyEventType = {
|
|
|
100
104
|
* @property {Array<SegmentData>} [featureSegments] FeatureSegments.
|
|
101
105
|
*/
|
|
102
106
|
|
|
107
|
+
/**
|
|
108
|
+
* A function that takes a {@link module:ol/Feature~Feature} and returns `true` if
|
|
109
|
+
* the feature may be modified or `false` otherwise.
|
|
110
|
+
* @typedef {function(Feature):boolean} FilterFunction
|
|
111
|
+
*/
|
|
112
|
+
|
|
103
113
|
/**
|
|
104
114
|
* @typedef {[SegmentData, number]} DragSegment
|
|
105
115
|
*/
|
|
@@ -116,6 +126,14 @@ const ModifyEventType = {
|
|
|
116
126
|
* boolean to indicate whether that event should be handled. By default,
|
|
117
127
|
* {@link module:ol/events/condition.singleClick} with
|
|
118
128
|
* {@link module:ol/events/condition.altKeyOnly} results in a vertex deletion.
|
|
129
|
+
* This combination is handled by wrapping the two condition checks in a single function:
|
|
130
|
+
* ```js
|
|
131
|
+
* import { altKeyOnly, singleClick } from 'ol/events/condition.js';
|
|
132
|
+
*
|
|
133
|
+
* function (event) {
|
|
134
|
+
* return altKeyOnly(event) && singleClick(event)
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
119
137
|
* @property {import("../events/condition.js").Condition} [insertVertexCondition] A
|
|
120
138
|
* function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and
|
|
121
139
|
* returns a boolean to indicate whether a new vertex should be added to the sketch
|
|
@@ -135,19 +153,51 @@ const ModifyEventType = {
|
|
|
135
153
|
* @property {VectorSource} [source] The vector source with
|
|
136
154
|
* features to modify. If a vector source is not provided, a feature collection
|
|
137
155
|
* must be provided with the `features` option.
|
|
138
|
-
* @property {boolean|import("../layer/BaseVector").default} [hitDetection] When configured, point
|
|
156
|
+
* @property {boolean|import("../layer/BaseVector.js").default} [hitDetection] When configured, point
|
|
139
157
|
* features will be considered for modification based on their visual appearance, instead of being within
|
|
140
158
|
* the `pixelTolerance` from the pointer location. When a {@link module:ol/layer/BaseVector~BaseVectorLayer} is
|
|
141
159
|
* provided, only the rendered representation of the features on that layer will be considered.
|
|
142
160
|
* @property {Collection<Feature>} [features]
|
|
143
161
|
* The features the interaction works on. If a feature collection is not
|
|
144
162
|
* provided, a vector source must be provided with the `source` option.
|
|
163
|
+
* @property {FilterFunction} [filter] A function that takes a {@link module:ol/Feature~Feature}
|
|
164
|
+
* and returns `true` if the feature may be modified or `false` otherwise.
|
|
165
|
+
* @property {boolean|import("../events/condition.js").Condition} [trace=false] Trace a portion of another geometry.
|
|
166
|
+
* Tracing starts when two neighboring vertices are dragged onto a trace target, without any other modification in between..
|
|
167
|
+
* @property {VectorSource} [traceSource] Source for features to trace. If tracing is active and a `traceSource` is
|
|
168
|
+
* not provided, the interaction's `source` will be used. Tracing requires that the interaction is configured with
|
|
169
|
+
* either a `traceSource` or a `source`.
|
|
145
170
|
* @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch
|
|
146
171
|
* overlay.
|
|
147
172
|
* @property {boolean} [snapToPointer=!hitDetection] The vertex, point or segment being modified snaps to the
|
|
148
173
|
* pointer coordinate when clicked within the `pixelTolerance`.
|
|
174
|
+
* @property {function(import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): boolean} [sharedVerticesEqual]
|
|
175
|
+
* A function that takes two coordinates and returns whether they should be
|
|
176
|
+
* considered equal for vertex matching purposes. By default, all coordinate
|
|
177
|
+
* dimensions are compared. This is useful when features have mixed coordinate
|
|
178
|
+
* dimensions (e.g., XY and XYZ) but should still be treated as sharing vertices
|
|
179
|
+
* at the same 2D position.
|
|
149
180
|
*/
|
|
150
181
|
|
|
182
|
+
function getCoordinatesArray(coordinates, geometryType, depth) {
|
|
183
|
+
let coordinatesArray;
|
|
184
|
+
switch (geometryType) {
|
|
185
|
+
case 'LineString':
|
|
186
|
+
coordinatesArray = coordinates;
|
|
187
|
+
break;
|
|
188
|
+
case 'MultiLineString':
|
|
189
|
+
case 'Polygon':
|
|
190
|
+
coordinatesArray = coordinates[depth[0]];
|
|
191
|
+
break;
|
|
192
|
+
case 'MultiPolygon':
|
|
193
|
+
coordinatesArray = coordinates[depth[1]][depth[0]];
|
|
194
|
+
break;
|
|
195
|
+
default:
|
|
196
|
+
// pass
|
|
197
|
+
}
|
|
198
|
+
return coordinatesArray;
|
|
199
|
+
}
|
|
200
|
+
|
|
151
201
|
/**
|
|
152
202
|
* @classdesc
|
|
153
203
|
* Events emitted by {@link module:ol/interaction/Modify~Modify} instances are
|
|
@@ -182,11 +232,11 @@ class ModifyEvent extends _events_Event_js__WEBPACK_IMPORTED_MODULE_1__["default
|
|
|
182
232
|
|
|
183
233
|
/***
|
|
184
234
|
* @template Return
|
|
185
|
-
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
|
186
|
-
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
|
187
|
-
* 'change:active', import("../Object").ObjectEvent, Return> &
|
|
188
|
-
* import("../Observable").OnSignature<'modifyend'|'modifystart', ModifyEvent, Return> &
|
|
189
|
-
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
|
235
|
+
* @typedef {import("../Observable.js").OnSignature<import("../Observable.js").EventTypes, import("../events/Event.js").default, Return> &
|
|
236
|
+
* import("../Observable.js").OnSignature<import("../ObjectEventType.js").Types|
|
|
237
|
+
* 'change:active', import("../Object.js").ObjectEvent, Return> &
|
|
238
|
+
* import("../Observable.js").OnSignature<'modifyend'|'modifystart', ModifyEvent, Return> &
|
|
239
|
+
* import("../Observable.js").CombinedOnSignature<import("../Observable.js").EventTypes|import("../ObjectEventType.js").Types|
|
|
190
240
|
* 'change:active'|'modifyend'|'modifystart', Return>} ModifyOnSignature
|
|
191
241
|
*/
|
|
192
242
|
|
|
@@ -218,13 +268,31 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
218
268
|
constructor(options) {
|
|
219
269
|
super(/** @type {import("./Pointer.js").Options} */ (options));
|
|
220
270
|
|
|
271
|
+
//Maintain a ref to event handlers for later unregistering
|
|
272
|
+
/** @private */
|
|
273
|
+
this.handleSourceAdd_ = this.handleSourceAdd_.bind(this);
|
|
274
|
+
|
|
275
|
+
/** @private */
|
|
276
|
+
this.handleSourceRemove_ = this.handleSourceRemove_.bind(this);
|
|
277
|
+
|
|
278
|
+
/** @private */
|
|
279
|
+
this.handleExternalCollectionAdd_ =
|
|
280
|
+
this.handleExternalCollectionAdd_.bind(this);
|
|
281
|
+
|
|
282
|
+
/** @private */
|
|
283
|
+
this.handleExternalCollectionRemove_ =
|
|
284
|
+
this.handleExternalCollectionRemove_.bind(this);
|
|
285
|
+
|
|
286
|
+
/** @private */
|
|
287
|
+
this.handleFeatureChange_ = this.handleFeatureChange_.bind(this);
|
|
288
|
+
|
|
221
289
|
/***
|
|
222
|
-
* @type {ModifyOnSignature<import("../events").EventsKey>}
|
|
290
|
+
* @type {ModifyOnSignature<import("../events.js").EventsKey>}
|
|
223
291
|
*/
|
|
224
292
|
this.on;
|
|
225
293
|
|
|
226
294
|
/***
|
|
227
|
-
* @type {ModifyOnSignature<import("../events").EventsKey>}
|
|
295
|
+
* @type {ModifyOnSignature<import("../events.js").EventsKey>}
|
|
228
296
|
*/
|
|
229
297
|
this.once;
|
|
230
298
|
|
|
@@ -233,9 +301,6 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
233
301
|
*/
|
|
234
302
|
this.un;
|
|
235
303
|
|
|
236
|
-
/** @private */
|
|
237
|
-
this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this);
|
|
238
|
-
|
|
239
304
|
/**
|
|
240
305
|
* @private
|
|
241
306
|
* @type {import("../events/condition.js").Condition}
|
|
@@ -282,10 +347,10 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
282
347
|
this.vertexSegments_ = null;
|
|
283
348
|
|
|
284
349
|
/**
|
|
285
|
-
* @type {import("../
|
|
350
|
+
* @type {import("../coordinate.js").Coordinate}
|
|
286
351
|
* @private
|
|
287
352
|
*/
|
|
288
|
-
this.
|
|
353
|
+
this.lastCoordinate_ = [0, 0];
|
|
289
354
|
|
|
290
355
|
/**
|
|
291
356
|
* Tracks if the next `singleclick` event should be ignored to prevent
|
|
@@ -356,15 +421,15 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
356
421
|
* @type {!Object<string, function(Feature, import("../geom/Geometry.js").default): void>}
|
|
357
422
|
*/
|
|
358
423
|
this.SEGMENT_WRITERS_ = {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
424
|
+
Point: this.writePointGeometry_.bind(this),
|
|
425
|
+
LineString: this.writeLineStringGeometry_.bind(this),
|
|
426
|
+
LinearRing: this.writeLineStringGeometry_.bind(this),
|
|
427
|
+
Polygon: this.writePolygonGeometry_.bind(this),
|
|
428
|
+
MultiPoint: this.writeMultiPointGeometry_.bind(this),
|
|
429
|
+
MultiLineString: this.writeMultiLineStringGeometry_.bind(this),
|
|
430
|
+
MultiPolygon: this.writeMultiPolygonGeometry_.bind(this),
|
|
431
|
+
Circle: this.writeCircleGeometry_.bind(this),
|
|
432
|
+
GeometryCollection: this.writeGeometryCollectionGeometry_.bind(this),
|
|
368
433
|
};
|
|
369
434
|
|
|
370
435
|
/**
|
|
@@ -374,51 +439,118 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
374
439
|
this.source_ = null;
|
|
375
440
|
|
|
376
441
|
/**
|
|
377
|
-
* @type {
|
|
442
|
+
* @type {VectorSource|null}
|
|
443
|
+
* @private
|
|
444
|
+
*/
|
|
445
|
+
this.traceSource_ = options.traceSource || options.source || null;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* @type {import("../events/condition.js").Condition}
|
|
449
|
+
* @private
|
|
450
|
+
*/
|
|
451
|
+
this.traceCondition_;
|
|
452
|
+
this.setTrace(options.trace || false);
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* @type {import('./tracing.js').TraceState}
|
|
456
|
+
* @private
|
|
457
|
+
*/
|
|
458
|
+
this.traceState_ = {active: false};
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* @type {Array<DragSegment>|null}
|
|
462
|
+
* @private
|
|
463
|
+
*/
|
|
464
|
+
this.traceSegments_ = null;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* @type {boolean|import("../layer/BaseVector.js").default}
|
|
378
468
|
* @private
|
|
379
469
|
*/
|
|
380
470
|
this.hitDetection_ = null;
|
|
381
471
|
|
|
382
|
-
/**
|
|
472
|
+
/**
|
|
473
|
+
* Useful for performance optimization
|
|
474
|
+
* @private
|
|
475
|
+
* @type boolean
|
|
476
|
+
*/
|
|
477
|
+
this.filterFunctionWasSupplied_ =
|
|
478
|
+
options.filter != undefined ? true : false;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* @private
|
|
482
|
+
* @type {FilterFunction}
|
|
483
|
+
*/
|
|
484
|
+
this.filter_ = options.filter ? options.filter : () => true;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* @private
|
|
488
|
+
* @type {function(import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): boolean}
|
|
489
|
+
*/
|
|
490
|
+
this.coordinatesEqual_ = options.sharedVerticesEqual
|
|
491
|
+
? options.sharedVerticesEqual
|
|
492
|
+
: _coordinate_js__WEBPACK_IMPORTED_MODULE_7__.equals;
|
|
493
|
+
|
|
494
|
+
if (!(options.features || options.source)) {
|
|
495
|
+
throw new Error(
|
|
496
|
+
'The modify interaction requires features collection or a source',
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
/** @type {Array<Feature>} */
|
|
383
500
|
let features;
|
|
384
501
|
if (options.features) {
|
|
385
|
-
features = options.features;
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
_source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].ADDFEATURE,
|
|
391
|
-
this.handleSourceAdd_.bind(this),
|
|
502
|
+
features = options.features.getArray();
|
|
503
|
+
//setup listeners on external features collection and features
|
|
504
|
+
options.features.addEventListener(
|
|
505
|
+
_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].ADD,
|
|
506
|
+
this.handleExternalCollectionAdd_,
|
|
392
507
|
);
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
this.
|
|
508
|
+
options.features.addEventListener(
|
|
509
|
+
_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].REMOVE,
|
|
510
|
+
this.handleExternalCollectionRemove_,
|
|
396
511
|
);
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
512
|
+
//keep ref for unsubscribe on dispose
|
|
513
|
+
this.featuresCollection_ = options.features;
|
|
514
|
+
} else if (options.source) {
|
|
515
|
+
features = options.source.getFeatures();
|
|
516
|
+
//setup listeners on external source and features
|
|
517
|
+
options.source.addEventListener(
|
|
518
|
+
_source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_9__["default"].ADDFEATURE,
|
|
519
|
+
this.handleSourceAdd_,
|
|
520
|
+
);
|
|
521
|
+
options.source.addEventListener(
|
|
522
|
+
_source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_9__["default"].REMOVEFEATURE,
|
|
523
|
+
this.handleSourceRemove_,
|
|
401
524
|
);
|
|
525
|
+
//keep ref for unsubscribe on dispose
|
|
526
|
+
this.source_ = options.source;
|
|
402
527
|
}
|
|
528
|
+
features.forEach((feature) => {
|
|
529
|
+
//any modification to the feature requires filter to be re-run
|
|
530
|
+
feature.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].CHANGE, this.handleFeatureChange_);
|
|
531
|
+
//prop change handler is only to re-run the filter
|
|
532
|
+
if (this.filterFunctionWasSupplied_) {
|
|
533
|
+
feature.addEventListener(
|
|
534
|
+
_ObjectEventType_js__WEBPACK_IMPORTED_MODULE_11__["default"].PROPERTYCHANGE,
|
|
535
|
+
this.handleFeatureChange_,
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
|
|
403
540
|
if (options.hitDetection) {
|
|
404
541
|
this.hitDetection_ = options.hitDetection;
|
|
405
542
|
}
|
|
406
543
|
|
|
407
544
|
/**
|
|
408
|
-
*
|
|
545
|
+
* Internal features array. When adding or removing features, be sure to use
|
|
546
|
+
* addFeature_()/removeFeature_() so that the the segment index is adjusted.
|
|
547
|
+
* @type {Array<Feature>}
|
|
409
548
|
* @private
|
|
410
549
|
*/
|
|
411
|
-
this.features_ =
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_9__["default"].ADD,
|
|
416
|
-
this.handleFeatureAdd_.bind(this),
|
|
417
|
-
);
|
|
418
|
-
this.features_.addEventListener(
|
|
419
|
-
_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_9__["default"].REMOVE,
|
|
420
|
-
this.handleFeatureRemove_.bind(this),
|
|
421
|
-
);
|
|
550
|
+
this.features_ = [];
|
|
551
|
+
features
|
|
552
|
+
.filter(this.filter_)
|
|
553
|
+
.forEach((feature) => this.addFeature_(feature));
|
|
422
554
|
|
|
423
555
|
/**
|
|
424
556
|
* @type {import("../MapBrowserEvent.js").default}
|
|
@@ -443,10 +575,30 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
443
575
|
}
|
|
444
576
|
|
|
445
577
|
/**
|
|
578
|
+
* Toggle tracing mode or set a tracing condition.
|
|
579
|
+
*
|
|
580
|
+
* @param {boolean|import("../events/condition.js").Condition} trace A boolean to toggle tracing mode or an event
|
|
581
|
+
* condition that will be checked when a feature is clicked to determine if tracing should be active.
|
|
582
|
+
*/
|
|
583
|
+
setTrace(trace) {
|
|
584
|
+
let condition;
|
|
585
|
+
if (!trace) {
|
|
586
|
+
condition = _events_condition_js__WEBPACK_IMPORTED_MODULE_3__.never;
|
|
587
|
+
} else if (trace === true) {
|
|
588
|
+
condition = _events_condition_js__WEBPACK_IMPORTED_MODULE_3__.always;
|
|
589
|
+
} else {
|
|
590
|
+
condition = trace;
|
|
591
|
+
}
|
|
592
|
+
this.traceCondition_ = condition;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Called when a feature is added to the internal features collection
|
|
446
597
|
* @param {Feature} feature Feature.
|
|
447
598
|
* @private
|
|
448
599
|
*/
|
|
449
600
|
addFeature_(feature) {
|
|
601
|
+
this.features_.push(feature);
|
|
450
602
|
const geometry = feature.getGeometry();
|
|
451
603
|
if (geometry) {
|
|
452
604
|
const writer = this.SEGMENT_WRITERS_[geometry.getType()];
|
|
@@ -456,9 +608,8 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
456
608
|
}
|
|
457
609
|
const map = this.getMap();
|
|
458
610
|
if (map && map.isRendered() && this.getActive()) {
|
|
459
|
-
this.handlePointerAtPixel_(
|
|
611
|
+
this.handlePointerAtPixel_(this.lastCoordinate_);
|
|
460
612
|
}
|
|
461
|
-
feature.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].CHANGE, this.boundHandleFeatureChange_);
|
|
462
613
|
}
|
|
463
614
|
|
|
464
615
|
/**
|
|
@@ -468,7 +619,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
468
619
|
*/
|
|
469
620
|
willModifyFeatures_(evt, segments) {
|
|
470
621
|
if (!this.featuresBeingModified_) {
|
|
471
|
-
this.featuresBeingModified_ = new
|
|
622
|
+
this.featuresBeingModified_ = new _Collection_js__WEBPACK_IMPORTED_MODULE_12__["default"]();
|
|
472
623
|
const features = this.featuresBeingModified_.getArray();
|
|
473
624
|
for (let i = 0, ii = segments.length; i < ii; ++i) {
|
|
474
625
|
const feature = segments[i].feature;
|
|
@@ -491,20 +642,20 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
491
642
|
}
|
|
492
643
|
|
|
493
644
|
/**
|
|
645
|
+
* Removes a feature from the internal features collection and updates internal state
|
|
646
|
+
* accordingly.
|
|
494
647
|
* @param {Feature} feature Feature.
|
|
495
648
|
* @private
|
|
496
649
|
*/
|
|
497
650
|
removeFeature_(feature) {
|
|
651
|
+
const itemIndex = this.features_.indexOf(feature);
|
|
652
|
+
this.features_.splice(itemIndex, 1);
|
|
498
653
|
this.removeFeatureSegmentData_(feature);
|
|
499
654
|
// Remove the vertex feature if the collection of candidate features is empty.
|
|
500
|
-
if (this.vertexFeature_ && this.features_.
|
|
655
|
+
if (this.vertexFeature_ && this.features_.length === 0) {
|
|
501
656
|
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
|
502
657
|
this.vertexFeature_ = null;
|
|
503
658
|
}
|
|
504
|
-
feature.removeEventListener(
|
|
505
|
-
_events_EventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].CHANGE,
|
|
506
|
-
this.boundHandleFeatureChange_,
|
|
507
|
-
);
|
|
508
659
|
}
|
|
509
660
|
|
|
510
661
|
/**
|
|
@@ -577,8 +728,9 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
577
728
|
* @private
|
|
578
729
|
*/
|
|
579
730
|
handleSourceAdd_(event) {
|
|
580
|
-
|
|
581
|
-
|
|
731
|
+
const feature = event.feature;
|
|
732
|
+
if (feature) {
|
|
733
|
+
this.externalAddFeatureHandler_(feature);
|
|
582
734
|
}
|
|
583
735
|
}
|
|
584
736
|
|
|
@@ -587,37 +739,83 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
587
739
|
* @private
|
|
588
740
|
*/
|
|
589
741
|
handleSourceRemove_(event) {
|
|
590
|
-
|
|
591
|
-
|
|
742
|
+
const feature = event.feature;
|
|
743
|
+
if (feature) {
|
|
744
|
+
this.externalRemoveFeatureHandler_(feature);
|
|
592
745
|
}
|
|
593
746
|
}
|
|
594
747
|
|
|
595
748
|
/**
|
|
596
|
-
* @param {import("../Collection.js").CollectionEvent
|
|
749
|
+
* @param {import("../Collection.js").CollectionEvent} event Event.
|
|
597
750
|
* @private
|
|
598
751
|
*/
|
|
599
|
-
|
|
600
|
-
|
|
752
|
+
handleExternalCollectionAdd_(event) {
|
|
753
|
+
const feature = event.element;
|
|
754
|
+
if (feature) {
|
|
755
|
+
this.externalAddFeatureHandler_(feature);
|
|
756
|
+
}
|
|
601
757
|
}
|
|
602
758
|
|
|
603
759
|
/**
|
|
604
|
-
* @param {import("../
|
|
760
|
+
* @param {import("../Collection.js").CollectionEvent} event Event.
|
|
605
761
|
* @private
|
|
606
762
|
*/
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
this.
|
|
763
|
+
handleExternalCollectionRemove_(event) {
|
|
764
|
+
const feature = event.element;
|
|
765
|
+
if (feature) {
|
|
766
|
+
this.externalRemoveFeatureHandler_(feature);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Common handler for event signaling addition of feature to the supplied features source
|
|
772
|
+
* or collection.
|
|
773
|
+
* @param {Feature} feature Feature.
|
|
774
|
+
*/
|
|
775
|
+
externalAddFeatureHandler_(feature) {
|
|
776
|
+
feature.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].CHANGE, this.handleFeatureChange_);
|
|
777
|
+
//prop change handler is only for reapplying the filter
|
|
778
|
+
if (this.filterFunctionWasSupplied_) {
|
|
779
|
+
feature.addEventListener(
|
|
780
|
+
_ObjectEventType_js__WEBPACK_IMPORTED_MODULE_11__["default"].PROPERTYCHANGE,
|
|
781
|
+
this.handleFeatureChange_,
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
if (this.filter_(feature)) {
|
|
611
785
|
this.addFeature_(feature);
|
|
612
786
|
}
|
|
613
787
|
}
|
|
614
788
|
|
|
615
789
|
/**
|
|
616
|
-
*
|
|
790
|
+
* Common handler for event signaling removal of feature from the supplied features source
|
|
791
|
+
* or collection.
|
|
792
|
+
* @param {Feature} feature Feature.
|
|
793
|
+
*/
|
|
794
|
+
externalRemoveFeatureHandler_(feature) {
|
|
795
|
+
feature.removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].CHANGE, this.handleFeatureChange_);
|
|
796
|
+
if (this.filterFunctionWasSupplied_) {
|
|
797
|
+
feature.removeEventListener(
|
|
798
|
+
_ObjectEventType_js__WEBPACK_IMPORTED_MODULE_11__["default"].PROPERTYCHANGE,
|
|
799
|
+
this.handleFeatureChange_,
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
this.removeFeature_(feature);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Listener for features in external source or features collection. Ensures the feature filter
|
|
807
|
+
* is re-run and segment data is updated.
|
|
808
|
+
* @param {import("../events/Event.js").default | import("../Object.js").ObjectEvent} evt Event.
|
|
617
809
|
* @private
|
|
618
810
|
*/
|
|
619
|
-
|
|
620
|
-
this.
|
|
811
|
+
handleFeatureChange_(evt) {
|
|
812
|
+
if (!this.changingFeature_) {
|
|
813
|
+
const feature = /** @type {Feature} */ (evt.target);
|
|
814
|
+
this.removeFeature_(feature);
|
|
815
|
+
//safe to remove handler on a feature if there isn't one, but need to apply the filter
|
|
816
|
+
// before adding the feature.
|
|
817
|
+
this.filter_(feature) && this.addFeature_(feature);
|
|
818
|
+
}
|
|
621
819
|
}
|
|
622
820
|
|
|
623
821
|
/**
|
|
@@ -679,7 +877,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
679
877
|
segment: segment,
|
|
680
878
|
};
|
|
681
879
|
|
|
682
|
-
this.rBush_.insert((0,
|
|
880
|
+
this.rBush_.insert((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)(segment), segmentData);
|
|
683
881
|
}
|
|
684
882
|
}
|
|
685
883
|
|
|
@@ -704,7 +902,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
704
902
|
segment: segment,
|
|
705
903
|
};
|
|
706
904
|
|
|
707
|
-
this.rBush_.insert((0,
|
|
905
|
+
this.rBush_.insert((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)(segment), segmentData);
|
|
708
906
|
}
|
|
709
907
|
}
|
|
710
908
|
}
|
|
@@ -730,7 +928,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
730
928
|
segment: segment,
|
|
731
929
|
};
|
|
732
930
|
|
|
733
|
-
this.rBush_.insert((0,
|
|
931
|
+
this.rBush_.insert((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)(segment), segmentData);
|
|
734
932
|
}
|
|
735
933
|
}
|
|
736
934
|
}
|
|
@@ -758,7 +956,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
758
956
|
segment: segment,
|
|
759
957
|
};
|
|
760
958
|
|
|
761
|
-
this.rBush_.insert((0,
|
|
959
|
+
this.rBush_.insert((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)(segment), segmentData);
|
|
762
960
|
}
|
|
763
961
|
}
|
|
764
962
|
}
|
|
@@ -797,7 +995,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
797
995
|
const featureSegments = [centerSegmentData, circumferenceSegmentData];
|
|
798
996
|
centerSegmentData.featureSegments = featureSegments;
|
|
799
997
|
circumferenceSegmentData.featureSegments = featureSegments;
|
|
800
|
-
this.rBush_.insert((0,
|
|
998
|
+
this.rBush_.insert((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.createOrUpdateFromCoordinate)(coordinates), centerSegmentData);
|
|
801
999
|
let circleGeometry = /** @type {import("../geom/Geometry.js").default} */ (
|
|
802
1000
|
geometry
|
|
803
1001
|
);
|
|
@@ -807,7 +1005,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
807
1005
|
circleGeometry = circleGeometry
|
|
808
1006
|
.clone()
|
|
809
1007
|
.transform(userProjection, projection);
|
|
810
|
-
circleGeometry = (0,
|
|
1008
|
+
circleGeometry = (0,_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_14__.fromCircle)(
|
|
811
1009
|
/** @type {import("../geom/Circle.js").default} */ (circleGeometry),
|
|
812
1010
|
).transform(projection, userProjection);
|
|
813
1011
|
}
|
|
@@ -839,7 +1037,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
839
1037
|
createOrUpdateVertexFeature_(coordinates, features, geometries, existing) {
|
|
840
1038
|
let vertexFeature = this.vertexFeature_;
|
|
841
1039
|
if (!vertexFeature) {
|
|
842
|
-
vertexFeature = new
|
|
1040
|
+
vertexFeature = new _Feature_js__WEBPACK_IMPORTED_MODULE_15__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_16__["default"](coordinates));
|
|
843
1041
|
this.vertexFeature_ = vertexFeature;
|
|
844
1042
|
this.overlay_.getSource().addFeature(vertexFeature);
|
|
845
1043
|
} else {
|
|
@@ -867,14 +1065,14 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
867
1065
|
let handled;
|
|
868
1066
|
if (
|
|
869
1067
|
!mapBrowserEvent.map.getView().getInteracting() &&
|
|
870
|
-
mapBrowserEvent.type ==
|
|
1068
|
+
mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].POINTERMOVE &&
|
|
871
1069
|
!this.handlingDownUpSequence
|
|
872
1070
|
) {
|
|
873
1071
|
this.handlePointerMove_(mapBrowserEvent);
|
|
874
1072
|
}
|
|
875
1073
|
if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {
|
|
876
1074
|
if (
|
|
877
|
-
mapBrowserEvent.type !=
|
|
1075
|
+
mapBrowserEvent.type != _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].SINGLECLICK ||
|
|
878
1076
|
!this.ignoreNextSingleClick_
|
|
879
1077
|
) {
|
|
880
1078
|
handled = this.removePoint();
|
|
@@ -883,13 +1081,18 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
883
1081
|
}
|
|
884
1082
|
}
|
|
885
1083
|
|
|
886
|
-
if (mapBrowserEvent.type ==
|
|
1084
|
+
if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].SINGLECLICK) {
|
|
887
1085
|
this.ignoreNextSingleClick_ = false;
|
|
888
1086
|
}
|
|
889
1087
|
|
|
890
1088
|
return super.handleEvent(mapBrowserEvent) && !handled;
|
|
891
1089
|
}
|
|
892
1090
|
|
|
1091
|
+
/**
|
|
1092
|
+
* @param {import("../coordinate.js").Coordinate} pixelCoordinate Pixel coordinate.
|
|
1093
|
+
* @return {Array<SegmentData>|undefined} Insert vertices and update drag segments.
|
|
1094
|
+
* @private
|
|
1095
|
+
*/
|
|
893
1096
|
findInsertVerticesAndUpdateDragSegments_(pixelCoordinate) {
|
|
894
1097
|
this.handlePointerAtPixel_(pixelCoordinate);
|
|
895
1098
|
this.dragSegments_.length = 0;
|
|
@@ -900,16 +1103,17 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
900
1103
|
}
|
|
901
1104
|
|
|
902
1105
|
const projection = this.getMap().getView().getProjection();
|
|
1106
|
+
/** @type {Array<SegmentData>} */
|
|
903
1107
|
const insertVertices = [];
|
|
904
|
-
const vertex =
|
|
905
|
-
const vertexExtent = (0,
|
|
1108
|
+
const vertex = this.vertexFeature_.getGeometry().getCoordinates();
|
|
1109
|
+
const vertexExtent = (0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)([vertex]);
|
|
906
1110
|
const segmentDataMatches = this.rBush_.getInExtent(vertexExtent);
|
|
907
1111
|
const componentSegments = {};
|
|
908
1112
|
segmentDataMatches.sort(compareIndexes);
|
|
909
1113
|
for (let i = 0, ii = segmentDataMatches.length; i < ii; ++i) {
|
|
910
1114
|
const segmentDataMatch = segmentDataMatches[i];
|
|
911
1115
|
const segment = segmentDataMatch.segment;
|
|
912
|
-
let uid = (0,
|
|
1116
|
+
let uid = (0,_util_js__WEBPACK_IMPORTED_MODULE_18__.getUid)(segmentDataMatch.geometry);
|
|
913
1117
|
const depth = segmentDataMatch.depth;
|
|
914
1118
|
if (depth) {
|
|
915
1119
|
uid += '-' + depth.join('-'); // separate feature components
|
|
@@ -928,7 +1132,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
928
1132
|
projection,
|
|
929
1133
|
);
|
|
930
1134
|
if (
|
|
931
|
-
|
|
1135
|
+
this.coordinatesEqual_(closestVertex, vertex) &&
|
|
932
1136
|
!componentSegments[uid][0]
|
|
933
1137
|
) {
|
|
934
1138
|
this.dragSegments_.push([segmentDataMatch, 0]);
|
|
@@ -937,13 +1141,19 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
937
1141
|
continue;
|
|
938
1142
|
}
|
|
939
1143
|
|
|
940
|
-
if (
|
|
1144
|
+
if (
|
|
1145
|
+
this.coordinatesEqual_(segment[0], vertex) &&
|
|
1146
|
+
!componentSegments[uid][0]
|
|
1147
|
+
) {
|
|
941
1148
|
this.dragSegments_.push([segmentDataMatch, 0]);
|
|
942
1149
|
componentSegments[uid][0] = segmentDataMatch;
|
|
943
1150
|
continue;
|
|
944
1151
|
}
|
|
945
1152
|
|
|
946
|
-
if (
|
|
1153
|
+
if (
|
|
1154
|
+
this.coordinatesEqual_(segment[1], vertex) &&
|
|
1155
|
+
!componentSegments[uid][1]
|
|
1156
|
+
) {
|
|
947
1157
|
if (
|
|
948
1158
|
componentSegments[uid][0] &&
|
|
949
1159
|
componentSegments[uid][0].index === 0
|
|
@@ -975,7 +1185,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
975
1185
|
}
|
|
976
1186
|
|
|
977
1187
|
if (
|
|
978
|
-
(0,
|
|
1188
|
+
(0,_util_js__WEBPACK_IMPORTED_MODULE_18__.getUid)(segment) in this.vertexSegments_ &&
|
|
979
1189
|
!componentSegments[uid][0] &&
|
|
980
1190
|
!componentSegments[uid][1]
|
|
981
1191
|
) {
|
|
@@ -986,6 +1196,491 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
986
1196
|
return insertVertices;
|
|
987
1197
|
}
|
|
988
1198
|
|
|
1199
|
+
/**
|
|
1200
|
+
* @private
|
|
1201
|
+
*/
|
|
1202
|
+
deactivateTrace_() {
|
|
1203
|
+
this.traceState_ = {active: false};
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Determine whether a trace from `fromIndex` to `toIndex` passes at least one
|
|
1208
|
+
* vertex of the target (i.e. whether it would add any traced coordinates).
|
|
1209
|
+
* The index math mirrors {@link addTracedCoordinates_}.
|
|
1210
|
+
* @param {number} fromIndex The start index.
|
|
1211
|
+
* @param {number} toIndex The end index.
|
|
1212
|
+
* @return {boolean} At least one target vertex lies between the indices.
|
|
1213
|
+
* @private
|
|
1214
|
+
*/
|
|
1215
|
+
tracePassesVertex_(fromIndex, toIndex) {
|
|
1216
|
+
if (fromIndex === toIndex) {
|
|
1217
|
+
return false;
|
|
1218
|
+
}
|
|
1219
|
+
if (fromIndex < toIndex) {
|
|
1220
|
+
const start = Math.ceil(fromIndex);
|
|
1221
|
+
let end = Math.floor(toIndex);
|
|
1222
|
+
if (end === toIndex) {
|
|
1223
|
+
end -= 1;
|
|
1224
|
+
}
|
|
1225
|
+
return start <= end;
|
|
1226
|
+
}
|
|
1227
|
+
const start = Math.floor(fromIndex);
|
|
1228
|
+
let end = Math.ceil(toIndex);
|
|
1229
|
+
if (end === toIndex) {
|
|
1230
|
+
end += 1;
|
|
1231
|
+
}
|
|
1232
|
+
return start >= end;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* Update the trace.
|
|
1237
|
+
* @param {import("../MapBrowserEvent.js").default} event Event.
|
|
1238
|
+
* @return {import('../coordinate.js').Coordinate|undefined} The coordinate the
|
|
1239
|
+
* dragged vertex was snapped onto a target edge, if any.
|
|
1240
|
+
* @private
|
|
1241
|
+
*/
|
|
1242
|
+
updateTrace_(event) {
|
|
1243
|
+
const traceState = this.traceState_;
|
|
1244
|
+
if (!traceState.active) {
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
if (traceState.targetIndex === -1) {
|
|
1249
|
+
// check if we are ready to pick a target
|
|
1250
|
+
const startPx = event.map.getPixelFromCoordinate(traceState.startCoord);
|
|
1251
|
+
if ((0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.distance)(startPx, event.pixel) < this.pixelTolerance_) {
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
const updatedTraceTarget = (0,_tracing_js__WEBPACK_IMPORTED_MODULE_19__.getTraceTargetUpdate)(
|
|
1257
|
+
event.coordinate,
|
|
1258
|
+
traceState,
|
|
1259
|
+
event.map,
|
|
1260
|
+
this.pixelTolerance_,
|
|
1261
|
+
);
|
|
1262
|
+
|
|
1263
|
+
if (
|
|
1264
|
+
traceState.targetIndex === -1 &&
|
|
1265
|
+
Math.sqrt(updatedTraceTarget.closestTargetDistance) /
|
|
1266
|
+
event.map.getView().getResolution() >
|
|
1267
|
+
this.pixelTolerance_
|
|
1268
|
+
) {
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
// Only commit to tracing a target once the drag has passed one of its
|
|
1273
|
+
// vertices. Before that we still snap the dragged vertex onto the target
|
|
1274
|
+
// edge (below), but we keep `targetIndex` at -1 so that pulling the pointer
|
|
1275
|
+
// beyond the tolerance releases the vertex instead of getting stuck on the
|
|
1276
|
+
// target.
|
|
1277
|
+
let commit = true;
|
|
1278
|
+
if (traceState.targetIndex === -1) {
|
|
1279
|
+
const candidateTarget = traceState.targets[updatedTraceTarget.index];
|
|
1280
|
+
commit = this.tracePassesVertex_(
|
|
1281
|
+
candidateTarget.startIndex,
|
|
1282
|
+
updatedTraceTarget.endIndex,
|
|
1283
|
+
);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
if (commit) {
|
|
1287
|
+
if (traceState.targetIndex !== updatedTraceTarget.index) {
|
|
1288
|
+
// target changed
|
|
1289
|
+
if (traceState.targetIndex !== -1) {
|
|
1290
|
+
// remove points added during previous trace
|
|
1291
|
+
const oldTarget = traceState.targets[traceState.targetIndex];
|
|
1292
|
+
this.removeTracedCoordinates_(
|
|
1293
|
+
oldTarget.startIndex,
|
|
1294
|
+
oldTarget.endIndex,
|
|
1295
|
+
);
|
|
1296
|
+
}
|
|
1297
|
+
// add points for the new target
|
|
1298
|
+
const newTarget = traceState.targets[updatedTraceTarget.index];
|
|
1299
|
+
this.addTracedCoordinates_(
|
|
1300
|
+
newTarget,
|
|
1301
|
+
newTarget.startIndex,
|
|
1302
|
+
updatedTraceTarget.endIndex,
|
|
1303
|
+
);
|
|
1304
|
+
} else {
|
|
1305
|
+
// target stayed the same
|
|
1306
|
+
const target = traceState.targets[traceState.targetIndex];
|
|
1307
|
+
this.addOrRemoveTracedCoordinates_(target, updatedTraceTarget.endIndex);
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
// modify the state with updated info
|
|
1311
|
+
traceState.targetIndex = updatedTraceTarget.index;
|
|
1312
|
+
traceState.targets[traceState.targetIndex].endIndex =
|
|
1313
|
+
updatedTraceTarget.endIndex;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// Snap the dragged vertex (the moving end of the trace) onto the target
|
|
1317
|
+
// edge so that the trace follows edges, not only vertices, and the geometry
|
|
1318
|
+
// stays consistent with the vertex marker. Moving all of the dragged
|
|
1319
|
+
// vertex' segments keeps polygon rings closed.
|
|
1320
|
+
const snapTarget = traceState.targets[updatedTraceTarget.index];
|
|
1321
|
+
const snappedVertex = (0,_tracing_js__WEBPACK_IMPORTED_MODULE_19__.interpolateCoordinate)(
|
|
1322
|
+
snapTarget.coordinates,
|
|
1323
|
+
updatedTraceTarget.endIndex,
|
|
1324
|
+
);
|
|
1325
|
+
for (const dragSegment of this.dragSegments_) {
|
|
1326
|
+
this.updateGeometry_(snappedVertex.slice(), dragSegment);
|
|
1327
|
+
}
|
|
1328
|
+
return snappedVertex;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
getTraceCandidates_(event) {
|
|
1332
|
+
const map = this.getMap();
|
|
1333
|
+
const tolerance = this.pixelTolerance_;
|
|
1334
|
+
const lowerLeft = map.getCoordinateFromPixel([
|
|
1335
|
+
event.pixel[0] - tolerance,
|
|
1336
|
+
event.pixel[1] + tolerance,
|
|
1337
|
+
]);
|
|
1338
|
+
const upperRight = map.getCoordinateFromPixel([
|
|
1339
|
+
event.pixel[0] + tolerance,
|
|
1340
|
+
event.pixel[1] - tolerance,
|
|
1341
|
+
]);
|
|
1342
|
+
const extent = (0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)([lowerLeft, upperRight]);
|
|
1343
|
+
const features = this.traceSource_.getFeaturesInExtent(extent);
|
|
1344
|
+
return features;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* Activate or deactivate trace state based on a browser event.
|
|
1349
|
+
* @param {import("../MapBrowserEvent.js").default} event Event.
|
|
1350
|
+
* @private
|
|
1351
|
+
*/
|
|
1352
|
+
toggleTraceState_(event) {
|
|
1353
|
+
if (!this.traceSource_ || !this.traceCondition_(event)) {
|
|
1354
|
+
return;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
if (this.traceState_.active) {
|
|
1358
|
+
this.deactivateTrace_();
|
|
1359
|
+
this.traceSegments_ = null;
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
const features = this.getTraceCandidates_(event);
|
|
1364
|
+
if (features.length === 0) {
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
const targets = (0,_tracing_js__WEBPACK_IMPORTED_MODULE_19__.getTraceTargets)(event.coordinate, features);
|
|
1369
|
+
if (targets.length) {
|
|
1370
|
+
this.traceState_ = {
|
|
1371
|
+
active: true,
|
|
1372
|
+
startCoord: event.coordinate.slice(),
|
|
1373
|
+
targets: targets,
|
|
1374
|
+
targetIndex: -1,
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* @param {import('./tracing.js').TraceTarget} target The trace target.
|
|
1381
|
+
* @param {number} endIndex The new end index of the trace.
|
|
1382
|
+
* @private
|
|
1383
|
+
*/
|
|
1384
|
+
addOrRemoveTracedCoordinates_(target, endIndex) {
|
|
1385
|
+
// three cases to handle:
|
|
1386
|
+
// 1. traced in the same direction and points need adding
|
|
1387
|
+
// 2. traced in the same direction and points need removing
|
|
1388
|
+
// 3. traced in a new direction
|
|
1389
|
+
const previouslyForward = target.startIndex <= target.endIndex;
|
|
1390
|
+
const currentlyForward = target.startIndex <= endIndex;
|
|
1391
|
+
if (previouslyForward === currentlyForward) {
|
|
1392
|
+
// same direction
|
|
1393
|
+
if (
|
|
1394
|
+
(previouslyForward && endIndex > target.endIndex) ||
|
|
1395
|
+
(!previouslyForward && endIndex < target.endIndex)
|
|
1396
|
+
) {
|
|
1397
|
+
// case 1 - add new points
|
|
1398
|
+
this.addTracedCoordinates_(target, target.endIndex, endIndex);
|
|
1399
|
+
} else if (
|
|
1400
|
+
(previouslyForward && endIndex < target.endIndex) ||
|
|
1401
|
+
(!previouslyForward && endIndex > target.endIndex)
|
|
1402
|
+
) {
|
|
1403
|
+
// case 2 - remove old points
|
|
1404
|
+
this.removeTracedCoordinates_(endIndex, target.endIndex);
|
|
1405
|
+
}
|
|
1406
|
+
} else {
|
|
1407
|
+
// case 3 - remove old points, add new points
|
|
1408
|
+
this.removeTracedCoordinates_(target.startIndex, target.endIndex);
|
|
1409
|
+
this.addTracedCoordinates_(target, target.startIndex, endIndex);
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Tracing splices coordinates into a ring next to the dragged vertex, but only
|
|
1415
|
+
* adjusts the index of the trace segment itself. The dragged vertex' other
|
|
1416
|
+
* segments in `dragSegments_` reference the same ring, so their stored index
|
|
1417
|
+
* must be shifted too - otherwise the next {@link updateGeometry_} writes the
|
|
1418
|
+
* dragged vertex to the wrong coordinate and scrambles the ring.
|
|
1419
|
+
* @param {SegmentData} traceSegmentData The trace segment (adjusted by the
|
|
1420
|
+
* caller and skipped here).
|
|
1421
|
+
* @param {number} atIndex Segments at or after this coordinate index shift.
|
|
1422
|
+
* @param {number} delta Coordinates added (positive) or removed (negative).
|
|
1423
|
+
* @private
|
|
1424
|
+
*/
|
|
1425
|
+
shiftTracedSegmentIndices_(traceSegmentData, atIndex, delta) {
|
|
1426
|
+
for (const dragSegment of this.dragSegments_) {
|
|
1427
|
+
const segmentData = dragSegment[0];
|
|
1428
|
+
if (
|
|
1429
|
+
segmentData !== traceSegmentData &&
|
|
1430
|
+
segmentData.geometry === traceSegmentData.geometry &&
|
|
1431
|
+
(segmentData.depth === undefined ||
|
|
1432
|
+
traceSegmentData.depth === undefined ||
|
|
1433
|
+
(0,_array_js__WEBPACK_IMPORTED_MODULE_20__.equals)(segmentData.depth, traceSegmentData.depth)) &&
|
|
1434
|
+
segmentData.index >= atIndex
|
|
1435
|
+
) {
|
|
1436
|
+
segmentData.index += delta;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/**
|
|
1442
|
+
* @param {number} fromIndex The start index.
|
|
1443
|
+
* @param {number} toIndex The end index.
|
|
1444
|
+
* @private
|
|
1445
|
+
*/
|
|
1446
|
+
removeTracedCoordinates_(fromIndex, toIndex) {
|
|
1447
|
+
if (fromIndex === toIndex) {
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
let remove = 0;
|
|
1452
|
+
if (fromIndex < toIndex) {
|
|
1453
|
+
const start = Math.ceil(fromIndex);
|
|
1454
|
+
let end = Math.floor(toIndex);
|
|
1455
|
+
if (end === toIndex) {
|
|
1456
|
+
end -= 1;
|
|
1457
|
+
}
|
|
1458
|
+
remove = end - start + 1;
|
|
1459
|
+
} else {
|
|
1460
|
+
const start = Math.floor(fromIndex);
|
|
1461
|
+
let end = Math.ceil(toIndex);
|
|
1462
|
+
if (end === toIndex) {
|
|
1463
|
+
end += 1;
|
|
1464
|
+
}
|
|
1465
|
+
remove = start - end + 1;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
if (remove > 0) {
|
|
1469
|
+
for (const traceSegment of this.traceSegments_) {
|
|
1470
|
+
const segmentData = traceSegment[0];
|
|
1471
|
+
const geometry = segmentData.geometry;
|
|
1472
|
+
const index = traceSegment[1];
|
|
1473
|
+
let removeIndex = traceSegment[0].index + 1;
|
|
1474
|
+
if (index === 1) {
|
|
1475
|
+
removeIndex -= remove;
|
|
1476
|
+
}
|
|
1477
|
+
const coordinates = geometry.getCoordinates();
|
|
1478
|
+
const coordinatesArray = getCoordinatesArray(
|
|
1479
|
+
coordinates,
|
|
1480
|
+
geometry.getType(),
|
|
1481
|
+
segmentData.depth,
|
|
1482
|
+
);
|
|
1483
|
+
coordinatesArray.splice(removeIndex, remove);
|
|
1484
|
+
this.setGeometryCoordinates_(geometry, coordinates);
|
|
1485
|
+
this.shiftTracedSegmentIndices_(
|
|
1486
|
+
segmentData,
|
|
1487
|
+
removeIndex + remove,
|
|
1488
|
+
-remove,
|
|
1489
|
+
);
|
|
1490
|
+
if (index === 1) {
|
|
1491
|
+
segmentData.index -= remove;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* @param {import('./tracing.js').TraceTarget} target The trace target.
|
|
1499
|
+
* @param {number} fromIndex The start index.
|
|
1500
|
+
* @param {number} toIndex The end index.
|
|
1501
|
+
* @private
|
|
1502
|
+
*/
|
|
1503
|
+
addTracedCoordinates_(target, fromIndex, toIndex) {
|
|
1504
|
+
if (fromIndex === toIndex) {
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
const newCoordinates = [];
|
|
1509
|
+
if (fromIndex < toIndex) {
|
|
1510
|
+
// forward trace
|
|
1511
|
+
const start = Math.ceil(fromIndex);
|
|
1512
|
+
let end = Math.floor(toIndex);
|
|
1513
|
+
if (end === toIndex) {
|
|
1514
|
+
// if end is snapped to a vertex, it will be added later
|
|
1515
|
+
end -= 1;
|
|
1516
|
+
}
|
|
1517
|
+
for (let i = start; i <= end; ++i) {
|
|
1518
|
+
newCoordinates.push((0,_tracing_js__WEBPACK_IMPORTED_MODULE_19__.getCoordinate)(target.coordinates, i));
|
|
1519
|
+
}
|
|
1520
|
+
} else {
|
|
1521
|
+
// reverse trace
|
|
1522
|
+
const start = Math.floor(fromIndex);
|
|
1523
|
+
let end = Math.ceil(toIndex);
|
|
1524
|
+
if (end === toIndex) {
|
|
1525
|
+
end += 1;
|
|
1526
|
+
}
|
|
1527
|
+
for (let i = start; i >= end; --i) {
|
|
1528
|
+
newCoordinates.push((0,_tracing_js__WEBPACK_IMPORTED_MODULE_19__.getCoordinate)(target.coordinates, i));
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
if (newCoordinates.length) {
|
|
1533
|
+
for (const traceSegment of this.traceSegments_) {
|
|
1534
|
+
const segmentData = traceSegment[0];
|
|
1535
|
+
const geometry = segmentData.geometry;
|
|
1536
|
+
const index = traceSegment[1];
|
|
1537
|
+
const insertIndex = segmentData.index + 1;
|
|
1538
|
+
if (index === 0) {
|
|
1539
|
+
newCoordinates.reverse();
|
|
1540
|
+
}
|
|
1541
|
+
const coordinates = geometry.getCoordinates();
|
|
1542
|
+
const coordinatesArray = getCoordinatesArray(
|
|
1543
|
+
coordinates,
|
|
1544
|
+
geometry.getType(),
|
|
1545
|
+
segmentData.depth,
|
|
1546
|
+
);
|
|
1547
|
+
coordinatesArray.splice(insertIndex, 0, ...newCoordinates);
|
|
1548
|
+
this.setGeometryCoordinates_(geometry, coordinates);
|
|
1549
|
+
this.shiftTracedSegmentIndices_(
|
|
1550
|
+
segmentData,
|
|
1551
|
+
insertIndex,
|
|
1552
|
+
newCoordinates.length,
|
|
1553
|
+
);
|
|
1554
|
+
if (index === 1) {
|
|
1555
|
+
segmentData.index += newCoordinates.length;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* @param {import('../coordinate.js').Coordinate} vertex Vertex.
|
|
1563
|
+
* @param {DragSegment} dragSegment Drag segment.
|
|
1564
|
+
*/
|
|
1565
|
+
updateGeometry_(vertex, dragSegment) {
|
|
1566
|
+
const segmentData = dragSegment[0];
|
|
1567
|
+
const depth = segmentData.depth;
|
|
1568
|
+
let coordinates;
|
|
1569
|
+
const segment = segmentData.segment;
|
|
1570
|
+
const geometry = segmentData.geometry;
|
|
1571
|
+
const index = dragSegment[1];
|
|
1572
|
+
|
|
1573
|
+
const stride = geometry.getStride();
|
|
1574
|
+
for (let i = 2; i < stride; ++i) {
|
|
1575
|
+
vertex[i] = segment[index][i];
|
|
1576
|
+
}
|
|
1577
|
+
vertex.length = stride;
|
|
1578
|
+
switch (geometry.getType()) {
|
|
1579
|
+
case 'Point':
|
|
1580
|
+
coordinates = vertex;
|
|
1581
|
+
segment[0] = vertex;
|
|
1582
|
+
segment[1] = vertex;
|
|
1583
|
+
break;
|
|
1584
|
+
case 'MultiPoint':
|
|
1585
|
+
coordinates = geometry.getCoordinates();
|
|
1586
|
+
coordinates[segmentData.index] = vertex;
|
|
1587
|
+
segment[0] = vertex;
|
|
1588
|
+
segment[1] = vertex;
|
|
1589
|
+
break;
|
|
1590
|
+
case 'LineString':
|
|
1591
|
+
coordinates = geometry.getCoordinates();
|
|
1592
|
+
coordinates[segmentData.index + index] = vertex;
|
|
1593
|
+
segment[index] = vertex;
|
|
1594
|
+
break;
|
|
1595
|
+
case 'MultiLineString':
|
|
1596
|
+
coordinates = geometry.getCoordinates();
|
|
1597
|
+
coordinates[depth[0]][segmentData.index + index] = vertex;
|
|
1598
|
+
segment[index] = vertex;
|
|
1599
|
+
break;
|
|
1600
|
+
case 'Polygon': {
|
|
1601
|
+
coordinates = geometry.getCoordinates();
|
|
1602
|
+
const ring = coordinates[depth[0]];
|
|
1603
|
+
const targetIndex = segmentData.index + index;
|
|
1604
|
+
|
|
1605
|
+
// Prevent duplicate change events when vertex already at position
|
|
1606
|
+
if (
|
|
1607
|
+
ring[targetIndex][0] === vertex[0] &&
|
|
1608
|
+
ring[targetIndex][1] === vertex[1]
|
|
1609
|
+
) {
|
|
1610
|
+
coordinates = null;
|
|
1611
|
+
} else {
|
|
1612
|
+
ring[targetIndex] = vertex;
|
|
1613
|
+
if (targetIndex === 0) {
|
|
1614
|
+
ring[ring.length - 1] = vertex;
|
|
1615
|
+
} else if (targetIndex === ring.length - 1) {
|
|
1616
|
+
ring[0] = vertex;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
segment[index] = vertex;
|
|
1620
|
+
break;
|
|
1621
|
+
}
|
|
1622
|
+
case 'MultiPolygon': {
|
|
1623
|
+
coordinates = geometry.getCoordinates();
|
|
1624
|
+
const mRing = coordinates[depth[1]][depth[0]];
|
|
1625
|
+
const mTargetIndex = segmentData.index + index;
|
|
1626
|
+
|
|
1627
|
+
// Prevent duplicate change events when vertex already at position
|
|
1628
|
+
if (
|
|
1629
|
+
mRing[mTargetIndex][0] === vertex[0] &&
|
|
1630
|
+
mRing[mTargetIndex][1] === vertex[1]
|
|
1631
|
+
) {
|
|
1632
|
+
coordinates = null;
|
|
1633
|
+
} else {
|
|
1634
|
+
mRing[mTargetIndex] = vertex;
|
|
1635
|
+
if (mTargetIndex === 0) {
|
|
1636
|
+
mRing[mRing.length - 1] = vertex;
|
|
1637
|
+
} else if (mTargetIndex === mRing.length - 1) {
|
|
1638
|
+
mRing[0] = vertex;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
segment[index] = vertex;
|
|
1642
|
+
break;
|
|
1643
|
+
}
|
|
1644
|
+
case 'Circle':
|
|
1645
|
+
const circle = /** @type {import("../geom/Circle.js").default} */ (
|
|
1646
|
+
geometry
|
|
1647
|
+
);
|
|
1648
|
+
segment[0] = vertex;
|
|
1649
|
+
segment[1] = vertex;
|
|
1650
|
+
if (segmentData.index === CIRCLE_CENTER_INDEX) {
|
|
1651
|
+
this.changingFeature_ = true;
|
|
1652
|
+
circle.setCenter(vertex);
|
|
1653
|
+
this.changingFeature_ = false;
|
|
1654
|
+
} else {
|
|
1655
|
+
// We're dragging the circle's circumference:
|
|
1656
|
+
this.changingFeature_ = true;
|
|
1657
|
+
const projection = this.getMap().getView().getProjection();
|
|
1658
|
+
let radius = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.distance)(
|
|
1659
|
+
(0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(circle.getCenter(), projection),
|
|
1660
|
+
(0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(vertex, projection),
|
|
1661
|
+
);
|
|
1662
|
+
const userProjection = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.getUserProjection)();
|
|
1663
|
+
if (userProjection) {
|
|
1664
|
+
const circleGeometry = circle
|
|
1665
|
+
.clone()
|
|
1666
|
+
.transform(userProjection, projection);
|
|
1667
|
+
circleGeometry.setRadius(radius);
|
|
1668
|
+
radius = circleGeometry
|
|
1669
|
+
.transform(projection, userProjection)
|
|
1670
|
+
.getRadius();
|
|
1671
|
+
}
|
|
1672
|
+
circle.setRadius(radius);
|
|
1673
|
+
this.changingFeature_ = false;
|
|
1674
|
+
}
|
|
1675
|
+
break;
|
|
1676
|
+
default:
|
|
1677
|
+
// pass
|
|
1678
|
+
}
|
|
1679
|
+
if (coordinates) {
|
|
1680
|
+
this.setGeometryCoordinates_(geometry, coordinates);
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
|
|
989
1684
|
/**
|
|
990
1685
|
* Handle pointer drag events.
|
|
991
1686
|
* @param {import("../MapBrowserEvent.js").default} evt Event.
|
|
@@ -1004,6 +1699,34 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1004
1699
|
];
|
|
1005
1700
|
const features = [];
|
|
1006
1701
|
const geometries = [];
|
|
1702
|
+
const startTraceCoord =
|
|
1703
|
+
this.traceState_.active && !this.traceSegments_
|
|
1704
|
+
? this.traceState_.startCoord
|
|
1705
|
+
: null;
|
|
1706
|
+
if (startTraceCoord) {
|
|
1707
|
+
this.traceSegments_ = [];
|
|
1708
|
+
for (const dragSegment of this.dragSegments_) {
|
|
1709
|
+
const segmentData = dragSegment[0];
|
|
1710
|
+
const eligibleForTracing =
|
|
1711
|
+
(0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.distance)(
|
|
1712
|
+
(0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.closestOnSegment)(startTraceCoord, segmentData.segment),
|
|
1713
|
+
startTraceCoord,
|
|
1714
|
+
) /
|
|
1715
|
+
evt.map.getView().getResolution() <
|
|
1716
|
+
1;
|
|
1717
|
+
if (eligibleForTracing) {
|
|
1718
|
+
this.traceSegments_.push(dragSegment);
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
if (this.traceSegments_.length > 1) {
|
|
1722
|
+
// Both segments of the dragged vertex are anchored at the trace start,
|
|
1723
|
+
// i.e. the grabbed vertex is the anchor itself. Tracing needs a fixed
|
|
1724
|
+
// anchor distinct from the moving vertex, so cancel tracing and let this
|
|
1725
|
+
// drag move the vertex freely.
|
|
1726
|
+
this.deactivateTrace_();
|
|
1727
|
+
this.traceSegments_ = null;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1007
1730
|
for (let i = 0, ii = this.dragSegments_.length; i < ii; ++i) {
|
|
1008
1731
|
const dragSegment = this.dragSegments_[i];
|
|
1009
1732
|
const segmentData = dragSegment[0];
|
|
@@ -1015,88 +1738,18 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1015
1738
|
if (!geometries.includes(geometry)) {
|
|
1016
1739
|
geometries.push(geometry);
|
|
1017
1740
|
}
|
|
1018
|
-
const depth = segmentData.depth;
|
|
1019
|
-
let coordinates;
|
|
1020
|
-
const segment = segmentData.segment;
|
|
1021
|
-
const index = dragSegment[1];
|
|
1022
1741
|
|
|
1023
|
-
|
|
1024
|
-
vertex.push(segment[index][vertex.length]);
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
switch (geometry.getType()) {
|
|
1028
|
-
case 'Point':
|
|
1029
|
-
coordinates = vertex;
|
|
1030
|
-
segment[0] = vertex;
|
|
1031
|
-
segment[1] = vertex;
|
|
1032
|
-
break;
|
|
1033
|
-
case 'MultiPoint':
|
|
1034
|
-
coordinates = geometry.getCoordinates();
|
|
1035
|
-
coordinates[segmentData.index] = vertex;
|
|
1036
|
-
segment[0] = vertex;
|
|
1037
|
-
segment[1] = vertex;
|
|
1038
|
-
break;
|
|
1039
|
-
case 'LineString':
|
|
1040
|
-
coordinates = geometry.getCoordinates();
|
|
1041
|
-
coordinates[segmentData.index + index] = vertex;
|
|
1042
|
-
segment[index] = vertex;
|
|
1043
|
-
break;
|
|
1044
|
-
case 'MultiLineString':
|
|
1045
|
-
coordinates = geometry.getCoordinates();
|
|
1046
|
-
coordinates[depth[0]][segmentData.index + index] = vertex;
|
|
1047
|
-
segment[index] = vertex;
|
|
1048
|
-
break;
|
|
1049
|
-
case 'Polygon':
|
|
1050
|
-
coordinates = geometry.getCoordinates();
|
|
1051
|
-
coordinates[depth[0]][segmentData.index + index] = vertex;
|
|
1052
|
-
segment[index] = vertex;
|
|
1053
|
-
break;
|
|
1054
|
-
case 'MultiPolygon':
|
|
1055
|
-
coordinates = geometry.getCoordinates();
|
|
1056
|
-
coordinates[depth[1]][depth[0]][segmentData.index + index] = vertex;
|
|
1057
|
-
segment[index] = vertex;
|
|
1058
|
-
break;
|
|
1059
|
-
case 'Circle':
|
|
1060
|
-
const circle = /** @type {import("../geom/Circle.js").default} */ (
|
|
1061
|
-
geometry
|
|
1062
|
-
);
|
|
1063
|
-
segment[0] = vertex;
|
|
1064
|
-
segment[1] = vertex;
|
|
1065
|
-
if (segmentData.index === CIRCLE_CENTER_INDEX) {
|
|
1066
|
-
this.changingFeature_ = true;
|
|
1067
|
-
circle.setCenter(vertex);
|
|
1068
|
-
this.changingFeature_ = false;
|
|
1069
|
-
} else {
|
|
1070
|
-
// We're dragging the circle's circumference:
|
|
1071
|
-
this.changingFeature_ = true;
|
|
1072
|
-
const projection = evt.map.getView().getProjection();
|
|
1073
|
-
let radius = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_17__.distance)(
|
|
1074
|
-
(0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(circle.getCenter(), projection),
|
|
1075
|
-
(0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(vertex, projection),
|
|
1076
|
-
);
|
|
1077
|
-
const userProjection = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.getUserProjection)();
|
|
1078
|
-
if (userProjection) {
|
|
1079
|
-
const circleGeometry = circle
|
|
1080
|
-
.clone()
|
|
1081
|
-
.transform(userProjection, projection);
|
|
1082
|
-
circleGeometry.setRadius(radius);
|
|
1083
|
-
radius = circleGeometry
|
|
1084
|
-
.transform(projection, userProjection)
|
|
1085
|
-
.getRadius();
|
|
1086
|
-
}
|
|
1087
|
-
circle.setRadius(radius);
|
|
1088
|
-
this.changingFeature_ = false;
|
|
1089
|
-
}
|
|
1090
|
-
break;
|
|
1091
|
-
default:
|
|
1092
|
-
// pass
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
if (coordinates) {
|
|
1096
|
-
this.setGeometryCoordinates_(geometry, coordinates);
|
|
1097
|
-
}
|
|
1742
|
+
this.updateGeometry_(vertex, dragSegment);
|
|
1098
1743
|
}
|
|
1099
|
-
|
|
1744
|
+
// when tracing snaps the dragged vertex onto a target edge, show the vertex
|
|
1745
|
+
// marker at the snapped location rather than at the raw pointer
|
|
1746
|
+
const snappedVertex = this.updateTrace_(evt);
|
|
1747
|
+
this.createOrUpdateVertexFeature_(
|
|
1748
|
+
snappedVertex || vertex,
|
|
1749
|
+
features,
|
|
1750
|
+
geometries,
|
|
1751
|
+
true,
|
|
1752
|
+
);
|
|
1100
1753
|
}
|
|
1101
1754
|
|
|
1102
1755
|
/**
|
|
@@ -1135,8 +1788,17 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1135
1788
|
* @override
|
|
1136
1789
|
*/
|
|
1137
1790
|
handleUpEvent(evt) {
|
|
1791
|
+
// Tracing inserts and removes vertices with guarded geometry mutations (so
|
|
1792
|
+
// that dragSegments_ survive the drag). Those guarded mutations skip the
|
|
1793
|
+
// segment rBush rebuild that handleFeatureChange_ would normally do, so the
|
|
1794
|
+
// rBush no longer matches the traced geometry. Collect the affected features
|
|
1795
|
+
// here and rebuild their segment data once the drag is over.
|
|
1796
|
+
const tracedFeatures = this.traceState_.active ? new Set() : null;
|
|
1138
1797
|
for (let i = this.dragSegments_.length - 1; i >= 0; --i) {
|
|
1139
1798
|
const segmentData = this.dragSegments_[i][0];
|
|
1799
|
+
if (tracedFeatures) {
|
|
1800
|
+
tracedFeatures.add(segmentData.feature);
|
|
1801
|
+
}
|
|
1140
1802
|
const geometry = segmentData.geometry;
|
|
1141
1803
|
if (geometry.getType() === 'Circle') {
|
|
1142
1804
|
const circle = /** @type {import("../geom/Circle.js").default} */ (
|
|
@@ -1150,7 +1812,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1150
1812
|
centerSegmentData.segment[1] = coordinates;
|
|
1151
1813
|
circumferenceSegmentData.segment[0] = coordinates;
|
|
1152
1814
|
circumferenceSegmentData.segment[1] = coordinates;
|
|
1153
|
-
this.rBush_.update((0,
|
|
1815
|
+
this.rBush_.update((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.createOrUpdateFromCoordinate)(coordinates), centerSegmentData);
|
|
1154
1816
|
/** @type {import("../geom/Circle.js").default | import("../geom/Polygon.js").default} */
|
|
1155
1817
|
let circleGeometry = circle;
|
|
1156
1818
|
const userProjection = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.getUserProjection)();
|
|
@@ -1159,7 +1821,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1159
1821
|
circleGeometry = circleGeometry
|
|
1160
1822
|
.clone()
|
|
1161
1823
|
.transform(userProjection, projection);
|
|
1162
|
-
circleGeometry = (0,
|
|
1824
|
+
circleGeometry = (0,_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_14__.fromCircle)(circleGeometry).transform(
|
|
1163
1825
|
projection,
|
|
1164
1826
|
userProjection,
|
|
1165
1827
|
);
|
|
@@ -1169,10 +1831,19 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1169
1831
|
circumferenceSegmentData,
|
|
1170
1832
|
);
|
|
1171
1833
|
} else {
|
|
1172
|
-
this.rBush_.update((0,
|
|
1834
|
+
this.rBush_.update((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)(segmentData.segment), segmentData);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
if (tracedFeatures) {
|
|
1838
|
+
for (const feature of tracedFeatures) {
|
|
1839
|
+
this.removeFeature_(feature);
|
|
1840
|
+
if (this.filter_(feature)) {
|
|
1841
|
+
this.addFeature_(feature);
|
|
1842
|
+
}
|
|
1173
1843
|
}
|
|
1174
1844
|
}
|
|
1175
1845
|
if (this.featuresBeingModified_) {
|
|
1846
|
+
this.toggleTraceState_(evt);
|
|
1176
1847
|
this.dispatchEvent(
|
|
1177
1848
|
new ModifyEvent(
|
|
1178
1849
|
ModifyEventType.MODIFYEND,
|
|
@@ -1190,8 +1861,8 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1190
1861
|
* @private
|
|
1191
1862
|
*/
|
|
1192
1863
|
handlePointerMove_(evt) {
|
|
1193
|
-
this.
|
|
1194
|
-
this.handlePointerAtPixel_(
|
|
1864
|
+
this.lastCoordinate_ = evt.coordinate;
|
|
1865
|
+
this.handlePointerAtPixel_(this.lastCoordinate_);
|
|
1195
1866
|
}
|
|
1196
1867
|
|
|
1197
1868
|
/**
|
|
@@ -1222,7 +1893,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1222
1893
|
pixel,
|
|
1223
1894
|
(feature, layer, geometry) => {
|
|
1224
1895
|
if (geometry && geometry.getType() === 'Point') {
|
|
1225
|
-
geometry = new
|
|
1896
|
+
geometry = new _geom_Point_js__WEBPACK_IMPORTED_MODULE_16__["default"](
|
|
1226
1897
|
(0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.toUserCoordinate)(geometry.getCoordinates(), projection),
|
|
1227
1898
|
);
|
|
1228
1899
|
}
|
|
@@ -1231,8 +1902,8 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1231
1902
|
if (
|
|
1232
1903
|
geom &&
|
|
1233
1904
|
geom.getType() === 'Point' &&
|
|
1234
|
-
feature instanceof
|
|
1235
|
-
this.features_.
|
|
1905
|
+
feature instanceof _Feature_js__WEBPACK_IMPORTED_MODULE_15__["default"] &&
|
|
1906
|
+
this.features_.includes(feature)
|
|
1236
1907
|
) {
|
|
1237
1908
|
hitPointGeometry = /** @type {Point} */ (geom);
|
|
1238
1909
|
const coordinate = /** @type {Point} */ (feature.getGeometry())
|
|
@@ -1253,12 +1924,12 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1253
1924
|
}
|
|
1254
1925
|
if (!nodes) {
|
|
1255
1926
|
const viewExtent = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserExtent)(
|
|
1256
|
-
(0,
|
|
1927
|
+
(0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.createOrUpdateFromCoordinate)(pixelCoordinate, tempExtent),
|
|
1257
1928
|
projection,
|
|
1258
1929
|
);
|
|
1259
1930
|
const buffer = map.getView().getResolution() * this.pixelTolerance_;
|
|
1260
1931
|
const box = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.toUserExtent)(
|
|
1261
|
-
(0,
|
|
1932
|
+
(0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.buffer)(viewExtent, buffer, tempExtent),
|
|
1262
1933
|
projection,
|
|
1263
1934
|
);
|
|
1264
1935
|
nodes = this.rBush_.getInExtent(box);
|
|
@@ -1269,11 +1940,11 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1269
1940
|
const closestSegment = node.segment;
|
|
1270
1941
|
let vertex = closestOnSegmentData(pixelCoordinate, node, projection);
|
|
1271
1942
|
const vertexPixel = map.getPixelFromCoordinate(vertex);
|
|
1272
|
-
let dist = (0,
|
|
1943
|
+
let dist = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.distance)(pixel, vertexPixel);
|
|
1273
1944
|
if (hitPointGeometry || dist <= this.pixelTolerance_) {
|
|
1274
1945
|
/** @type {Object<string, boolean>} */
|
|
1275
1946
|
const vertexSegments = {};
|
|
1276
|
-
vertexSegments[(0,
|
|
1947
|
+
vertexSegments[(0,_util_js__WEBPACK_IMPORTED_MODULE_18__.getUid)(closestSegment)] = true;
|
|
1277
1948
|
|
|
1278
1949
|
if (!this.snapToPointer_) {
|
|
1279
1950
|
this.delta_[0] = vertex[0] - pixelCoordinate[0];
|
|
@@ -1293,8 +1964,8 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1293
1964
|
} else {
|
|
1294
1965
|
const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
|
|
1295
1966
|
const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);
|
|
1296
|
-
const squaredDist1 = (0,
|
|
1297
|
-
const squaredDist2 = (0,
|
|
1967
|
+
const squaredDist1 = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.squaredDistance)(vertexPixel, pixel1);
|
|
1968
|
+
const squaredDist2 = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.squaredDistance)(vertexPixel, pixel2);
|
|
1298
1969
|
dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
|
|
1299
1970
|
this.snappedToVertex_ = dist <= this.pixelTolerance_;
|
|
1300
1971
|
// Stop and cleanup overlay vertex feature if a segment was hit and new vertex creation is not allowed by the insertVertexCondition
|
|
@@ -1321,19 +1992,19 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1321
1992
|
this.snappedToVertex_,
|
|
1322
1993
|
);
|
|
1323
1994
|
const geometries = {};
|
|
1324
|
-
geometries[(0,
|
|
1995
|
+
geometries[(0,_util_js__WEBPACK_IMPORTED_MODULE_18__.getUid)(node.geometry)] = true;
|
|
1325
1996
|
for (let i = 1, ii = nodes.length; i < ii; ++i) {
|
|
1326
1997
|
const segment = nodes[i].segment;
|
|
1327
1998
|
if (
|
|
1328
|
-
(
|
|
1329
|
-
|
|
1330
|
-
(
|
|
1331
|
-
|
|
1999
|
+
(this.coordinatesEqual_(closestSegment[0], segment[0]) &&
|
|
2000
|
+
this.coordinatesEqual_(closestSegment[1], segment[1])) ||
|
|
2001
|
+
(this.coordinatesEqual_(closestSegment[0], segment[1]) &&
|
|
2002
|
+
this.coordinatesEqual_(closestSegment[1], segment[0]))
|
|
1332
2003
|
) {
|
|
1333
|
-
const geometryUid = (0,
|
|
2004
|
+
const geometryUid = (0,_util_js__WEBPACK_IMPORTED_MODULE_18__.getUid)(nodes[i].geometry);
|
|
1334
2005
|
if (!(geometryUid in geometries)) {
|
|
1335
2006
|
geometries[geometryUid] = true;
|
|
1336
|
-
vertexSegments[(0,
|
|
2007
|
+
vertexSegments[(0,_util_js__WEBPACK_IMPORTED_MODULE_18__.getUid)(segment)] = true;
|
|
1337
2008
|
}
|
|
1338
2009
|
} else {
|
|
1339
2010
|
break;
|
|
@@ -1404,7 +2075,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1404
2075
|
index: index,
|
|
1405
2076
|
};
|
|
1406
2077
|
|
|
1407
|
-
rTree.insert((0,
|
|
2078
|
+
rTree.insert((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)(newSegmentData.segment), newSegmentData);
|
|
1408
2079
|
this.dragSegments_.push([newSegmentData, 1]);
|
|
1409
2080
|
|
|
1410
2081
|
/** @type {SegmentData} */
|
|
@@ -1416,11 +2087,16 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1416
2087
|
index: index + 1,
|
|
1417
2088
|
};
|
|
1418
2089
|
|
|
1419
|
-
rTree.insert((0,
|
|
2090
|
+
rTree.insert((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)(newSegmentData2.segment), newSegmentData2);
|
|
1420
2091
|
this.dragSegments_.push([newSegmentData2, 0]);
|
|
1421
2092
|
return true;
|
|
1422
2093
|
}
|
|
1423
2094
|
|
|
2095
|
+
/**
|
|
2096
|
+
* @param {import("../coordinate.js").Coordinate} coordinate The coordinate.
|
|
2097
|
+
* @return {import("../coordinate.js").Coordinate} The updated pointer coordinate.
|
|
2098
|
+
* @private
|
|
2099
|
+
*/
|
|
1424
2100
|
updatePointer_(coordinate) {
|
|
1425
2101
|
if (coordinate) {
|
|
1426
2102
|
this.findInsertVerticesAndUpdateDragSegments_(coordinate);
|
|
@@ -1465,11 +2141,11 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1465
2141
|
return false;
|
|
1466
2142
|
}
|
|
1467
2143
|
const coordinate = this.vertexFeature_.getGeometry().getCoordinates();
|
|
1468
|
-
const segments = this.rBush_.getInExtent((0,
|
|
2144
|
+
const segments = this.rBush_.getInExtent((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)([coordinate]));
|
|
1469
2145
|
return segments.some(
|
|
1470
2146
|
({segment}) =>
|
|
1471
|
-
|
|
1472
|
-
|
|
2147
|
+
this.coordinatesEqual_(segment[0], coordinate) ||
|
|
2148
|
+
this.coordinatesEqual_(segment[1], coordinate),
|
|
1473
2149
|
);
|
|
1474
2150
|
}
|
|
1475
2151
|
|
|
@@ -1491,7 +2167,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1491
2167
|
if (
|
|
1492
2168
|
!this.lastPointerEvent_ ||
|
|
1493
2169
|
(this.lastPointerEvent_ &&
|
|
1494
|
-
this.lastPointerEvent_.type !=
|
|
2170
|
+
this.lastPointerEvent_.type != _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].POINTERDRAG)
|
|
1495
2171
|
) {
|
|
1496
2172
|
const evt = this.lastPointerEvent_;
|
|
1497
2173
|
this.willModifyFeatures_(
|
|
@@ -1529,7 +2205,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1529
2205
|
for (i = dragSegments.length - 1; i >= 0; --i) {
|
|
1530
2206
|
dragSegment = dragSegments[i];
|
|
1531
2207
|
segmentData = dragSegment[0];
|
|
1532
|
-
uid = (0,
|
|
2208
|
+
uid = (0,_util_js__WEBPACK_IMPORTED_MODULE_18__.getUid)(segmentData.feature);
|
|
1533
2209
|
if (segmentData.depth) {
|
|
1534
2210
|
// separate feature components
|
|
1535
2211
|
uid += '-' + segmentData.depth.join('-');
|
|
@@ -1620,7 +2296,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1620
2296
|
};
|
|
1621
2297
|
|
|
1622
2298
|
this.rBush_.insert(
|
|
1623
|
-
(0,
|
|
2299
|
+
(0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)(newSegmentData.segment),
|
|
1624
2300
|
newSegmentData,
|
|
1625
2301
|
);
|
|
1626
2302
|
}
|
|
@@ -1657,12 +2333,12 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1657
2333
|
return false;
|
|
1658
2334
|
}
|
|
1659
2335
|
const coordinate = this.vertexFeature_.getGeometry().getCoordinates();
|
|
1660
|
-
const segments = this.rBush_.getInExtent((0,
|
|
2336
|
+
const segments = this.rBush_.getInExtent((0,_extent_js__WEBPACK_IMPORTED_MODULE_13__.boundingExtent)([coordinate]));
|
|
1661
2337
|
return segments.some(
|
|
1662
2338
|
({segment}) =>
|
|
1663
2339
|
!(
|
|
1664
|
-
|
|
1665
|
-
|
|
2340
|
+
this.coordinatesEqual_(segment[0], coordinate) ||
|
|
2341
|
+
this.coordinatesEqual_(segment[1], coordinate)
|
|
1666
2342
|
),
|
|
1667
2343
|
);
|
|
1668
2344
|
}
|
|
@@ -1716,7 +2392,7 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1716
2392
|
segmentDataMatch.geometry === geometry &&
|
|
1717
2393
|
(depth === undefined ||
|
|
1718
2394
|
segmentDataMatch.depth === undefined ||
|
|
1719
|
-
(0,
|
|
2395
|
+
(0,_array_js__WEBPACK_IMPORTED_MODULE_20__.equals)(segmentDataMatch.depth, depth)) &&
|
|
1720
2396
|
segmentDataMatch.index > index
|
|
1721
2397
|
) {
|
|
1722
2398
|
segmentDataMatch.index += delta;
|
|
@@ -1724,6 +2400,60 @@ class Modify extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
1724
2400
|
},
|
|
1725
2401
|
);
|
|
1726
2402
|
}
|
|
2403
|
+
|
|
2404
|
+
/**
|
|
2405
|
+
* @override
|
|
2406
|
+
*/
|
|
2407
|
+
disposeInternal() {
|
|
2408
|
+
super.disposeInternal();
|
|
2409
|
+
if (this.featuresCollection_) {
|
|
2410
|
+
this.featuresCollection_.removeEventListener(
|
|
2411
|
+
_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].ADD,
|
|
2412
|
+
this.handleExternalCollectionAdd_,
|
|
2413
|
+
);
|
|
2414
|
+
this.featuresCollection_.removeEventListener(
|
|
2415
|
+
_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].REMOVE,
|
|
2416
|
+
this.handleExternalCollectionRemove_,
|
|
2417
|
+
);
|
|
2418
|
+
//change and propertychange event handlers were placed on all features in the external
|
|
2419
|
+
// collection, not just the ones that passed the filter. Remove these too.
|
|
2420
|
+
for (const feature of this.featuresCollection_.getArray()) {
|
|
2421
|
+
feature.removeEventListener(
|
|
2422
|
+
_events_EventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].CHANGE,
|
|
2423
|
+
this.handleFeatureChange_,
|
|
2424
|
+
);
|
|
2425
|
+
if (this.filterFunctionWasSupplied_) {
|
|
2426
|
+
feature.removeEventListener(
|
|
2427
|
+
_ObjectEventType_js__WEBPACK_IMPORTED_MODULE_11__["default"].PROPERTYCHANGE,
|
|
2428
|
+
this.handleFeatureChange_,
|
|
2429
|
+
);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
} else if (this.source_) {
|
|
2433
|
+
this.source_.removeEventListener(
|
|
2434
|
+
_source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_9__["default"].ADDFEATURE,
|
|
2435
|
+
this.handleSourceAdd_,
|
|
2436
|
+
);
|
|
2437
|
+
this.source_.removeEventListener(
|
|
2438
|
+
_source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_9__["default"].REMOVEFEATURE,
|
|
2439
|
+
this.handleSourceRemove_,
|
|
2440
|
+
);
|
|
2441
|
+
//change and propertychange event handlers were placed on all features in the source, not
|
|
2442
|
+
// just the ones that passed the filter. Remove these too.
|
|
2443
|
+
for (const feature of this.source_.getFeatures()) {
|
|
2444
|
+
feature.removeEventListener(
|
|
2445
|
+
_events_EventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].CHANGE,
|
|
2446
|
+
this.handleFeatureChange_,
|
|
2447
|
+
);
|
|
2448
|
+
if (this.filterFunctionWasSupplied_) {
|
|
2449
|
+
feature.removeEventListener(
|
|
2450
|
+
_ObjectEventType_js__WEBPACK_IMPORTED_MODULE_11__["default"].PROPERTYCHANGE,
|
|
2451
|
+
this.handleFeatureChange_,
|
|
2452
|
+
);
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
1727
2457
|
}
|
|
1728
2458
|
|
|
1729
2459
|
/**
|
|
@@ -1764,7 +2494,7 @@ function projectedDistanceToSegmentDataSquared(
|
|
|
1764
2494
|
.clone()
|
|
1765
2495
|
.transform(userProjection, projection);
|
|
1766
2496
|
}
|
|
1767
|
-
const distanceToCenterSquared = (0,
|
|
2497
|
+
const distanceToCenterSquared = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.squaredDistance)(
|
|
1768
2498
|
circleGeometry.getCenter(),
|
|
1769
2499
|
(0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(pointCoordinates, projection),
|
|
1770
2500
|
);
|
|
@@ -1777,7 +2507,7 @@ function projectedDistanceToSegmentDataSquared(
|
|
|
1777
2507
|
const coordinate = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(pointCoordinates, projection);
|
|
1778
2508
|
tempSegment[0] = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(segmentData.segment[0], projection);
|
|
1779
2509
|
tempSegment[1] = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(segmentData.segment[1], projection);
|
|
1780
|
-
return (0,
|
|
2510
|
+
return (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.squaredDistanceToSegment)(coordinate, tempSegment);
|
|
1781
2511
|
}
|
|
1782
2512
|
|
|
1783
2513
|
/**
|
|
@@ -1817,7 +2547,7 @@ function closestOnSegmentData(pointCoordinates, segmentData, projection) {
|
|
|
1817
2547
|
tempSegment[0] = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(segmentData.segment[0], projection);
|
|
1818
2548
|
tempSegment[1] = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(segmentData.segment[1], projection);
|
|
1819
2549
|
return (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.toUserCoordinate)(
|
|
1820
|
-
(0,
|
|
2550
|
+
(0,_coordinate_js__WEBPACK_IMPORTED_MODULE_7__.closestOnSegment)(coordinate, tempSegment),
|
|
1821
2551
|
projection,
|
|
1822
2552
|
);
|
|
1823
2553
|
}
|
|
@@ -1826,7 +2556,7 @@ function closestOnSegmentData(pointCoordinates, segmentData, projection) {
|
|
|
1826
2556
|
* @return {import("../style/Style.js").StyleFunction} Styles.
|
|
1827
2557
|
*/
|
|
1828
2558
|
function getDefaultStyleFunction() {
|
|
1829
|
-
const style = (0,
|
|
2559
|
+
const style = (0,_style_Style_js__WEBPACK_IMPORTED_MODULE_21__.createEditingStyle)();
|
|
1830
2560
|
return function (feature, resolution) {
|
|
1831
2561
|
return style['Point'];
|
|
1832
2562
|
};
|
|
@@ -1835,6 +2565,112 @@ function getDefaultStyleFunction() {
|
|
|
1835
2565
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Modify);
|
|
1836
2566
|
|
|
1837
2567
|
|
|
2568
|
+
/***/ }),
|
|
2569
|
+
|
|
2570
|
+
/***/ "./node_modules/@vaadin/map/node_modules/ol/layer/Vector.js":
|
|
2571
|
+
/*!******************************************************************!*\
|
|
2572
|
+
!*** ./node_modules/@vaadin/map/node_modules/ol/layer/Vector.js ***!
|
|
2573
|
+
\******************************************************************/
|
|
2574
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
2575
|
+
|
|
2576
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2577
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2578
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2579
|
+
/* harmony export */ });
|
|
2580
|
+
/* harmony import */ var _renderer_canvas_VectorLayer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../renderer/canvas/VectorLayer.js */ "./node_modules/@vaadin/map/node_modules/ol/renderer/canvas/VectorLayer.js");
|
|
2581
|
+
/* harmony import */ var _BaseVector_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BaseVector.js */ "./node_modules/@vaadin/map/node_modules/ol/layer/BaseVector.js");
|
|
2582
|
+
/**
|
|
2583
|
+
* @module ol/layer/Vector
|
|
2584
|
+
*/
|
|
2585
|
+
|
|
2586
|
+
|
|
2587
|
+
|
|
2588
|
+
/**
|
|
2589
|
+
* @template {import("../source/Vector.js").default<FeatureType>} [VectorSourceType=import("../source/Vector.js").default<*>]
|
|
2590
|
+
* @template {import('../Feature.js').FeatureLike} [FeatureType=import("./BaseVector.js").ExtractedFeatureType<VectorSourceType>]
|
|
2591
|
+
* @typedef {Object} Options
|
|
2592
|
+
* @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
|
|
2593
|
+
* @property {number} [opacity=1] Opacity (0, 1).
|
|
2594
|
+
* @property {boolean} [visible=true] Visibility.
|
|
2595
|
+
* @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
|
|
2596
|
+
* rendered outside of this extent.
|
|
2597
|
+
* @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
|
|
2598
|
+
* will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
|
|
2599
|
+
* for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
|
|
2600
|
+
* method was used.
|
|
2601
|
+
* @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
|
|
2602
|
+
* visible.
|
|
2603
|
+
* @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
|
|
2604
|
+
* be visible.
|
|
2605
|
+
* @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
|
|
2606
|
+
* visible.
|
|
2607
|
+
* @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
|
|
2608
|
+
* be visible.
|
|
2609
|
+
* @property {import("../render.js").OrderFunction} [renderOrder] Render order. Function to be used when sorting
|
|
2610
|
+
* features before rendering. By default features are drawn in the order that they are created. Use
|
|
2611
|
+
* `null` to avoid the sort, but get an undefined draw order.
|
|
2612
|
+
* @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the
|
|
2613
|
+
* renderer when getting features from the vector source for the rendering or hit-detection.
|
|
2614
|
+
* Recommended value: the size of the largest symbol, line width or label.
|
|
2615
|
+
* @property {VectorSourceType} [source] Source.
|
|
2616
|
+
* @property {import("../Map.js").default} [map] Sets the layer as overlay on a map. The map will not manage
|
|
2617
|
+
* this layer in its layers collection, and the layer will be rendered on top. This is useful for
|
|
2618
|
+
* temporary layers. The standard way to add a layer to a map and have it managed by the map is to
|
|
2619
|
+
* use [map.addLayer()]{@link import("../Map.js").default#addLayer}.
|
|
2620
|
+
* @property {boolean|string|number} [declutter=false] Declutter images and text. Any truthy value will enable
|
|
2621
|
+
* decluttering. Within a layer, a feature rendered before another has higher priority. All layers with the
|
|
2622
|
+
* same `declutter` value will be decluttered together. The priority is determined by the drawing order of the
|
|
2623
|
+
* layers with the same `declutter` value. Higher in the layer stack means higher priority. To declutter distinct
|
|
2624
|
+
* layers or groups of layers separately, use different truthy values for `declutter`.
|
|
2625
|
+
* @property {import("../style/Style.js").StyleLike|import("../style/flat.js").FlatStyleLike|null} [style] Layer style. When set to `null`, only
|
|
2626
|
+
* features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style
|
|
2627
|
+
* which will be used if this is not set.
|
|
2628
|
+
* @property {import("./Base.js").BackgroundColor} [background] Background color for the layer. If not specified, no background
|
|
2629
|
+
* will be rendered.
|
|
2630
|
+
* @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will
|
|
2631
|
+
* be recreated during animations. This means that no vectors will be shown clipped, but the
|
|
2632
|
+
* setting will have a performance impact for large amounts of vector data. When set to `false`,
|
|
2633
|
+
* batches will be recreated when no animation is active.
|
|
2634
|
+
* @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will
|
|
2635
|
+
* be recreated during interactions. See also `updateWhileAnimating`.
|
|
2636
|
+
* @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
|
|
2637
|
+
*/
|
|
2638
|
+
|
|
2639
|
+
/**
|
|
2640
|
+
* @classdesc
|
|
2641
|
+
* Vector data is rendered client-side, as vectors. This layer type provides most accurate rendering
|
|
2642
|
+
* even during animations. Points and labels stay upright on rotated views. For very large
|
|
2643
|
+
* amounts of vector data, performance may suffer during pan and zoom animations. In this case,
|
|
2644
|
+
* try {@link module:ol/layer/VectorImage~VectorImageLayer}.
|
|
2645
|
+
*
|
|
2646
|
+
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
|
|
2647
|
+
* property on the layer object; for example, setting `title: 'My Title'` in the
|
|
2648
|
+
* options means that `title` is observable, and has get/set accessors.
|
|
2649
|
+
*
|
|
2650
|
+
* @template {import("../source/Vector.js").default<FeatureType>} [VectorSourceType=import("../source/Vector.js").default<*>]
|
|
2651
|
+
* @template {import('../Feature.js').FeatureLike} [FeatureType=import("./BaseVector.js").ExtractedFeatureType<VectorSourceType>]
|
|
2652
|
+
* @extends {BaseVectorLayer<FeatureType, VectorSourceType, CanvasVectorLayerRenderer>}
|
|
2653
|
+
* @api
|
|
2654
|
+
*/
|
|
2655
|
+
class VectorLayer extends _BaseVector_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
2656
|
+
/**
|
|
2657
|
+
* @param {Options<VectorSourceType, FeatureType>} [options] Options.
|
|
2658
|
+
*/
|
|
2659
|
+
constructor(options) {
|
|
2660
|
+
super(options);
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
/**
|
|
2664
|
+
* @override
|
|
2665
|
+
*/
|
|
2666
|
+
createRenderer() {
|
|
2667
|
+
return new _renderer_canvas_VectorLayer_js__WEBPACK_IMPORTED_MODULE_1__["default"](this);
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (VectorLayer);
|
|
2672
|
+
|
|
2673
|
+
|
|
1838
2674
|
/***/ })
|
|
1839
2675
|
|
|
1840
2676
|
}])
|