@deck.gl-community/editable-layers 9.0.0-alpha.1
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/README.md +82 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.js +14 -0
- package/dist/curve-utils.d.ts +2 -0
- package/dist/curve-utils.js +61 -0
- package/dist/edit-modes/composite-mode.d.ts +14 -0
- package/dist/edit-modes/composite-mode.js +47 -0
- package/dist/edit-modes/draw-90degree-polygon-mode.d.ts +11 -0
- package/dist/edit-modes/draw-90degree-polygon-mode.js +179 -0
- package/dist/edit-modes/draw-circle-by-diameter-mode.d.ts +24 -0
- package/dist/edit-modes/draw-circle-by-diameter-mode.js +78 -0
- package/dist/edit-modes/draw-circle-from-center-mode.d.ts +22 -0
- package/dist/edit-modes/draw-circle-from-center-mode.js +70 -0
- package/dist/edit-modes/draw-ellipse-by-bounding-box-mode.d.ts +5 -0
- package/dist/edit-modes/draw-ellipse-by-bounding-box-mode.js +20 -0
- package/dist/edit-modes/draw-ellipse-using-three-points-mode.d.ts +5 -0
- package/dist/edit-modes/draw-ellipse-using-three-points-mode.js +16 -0
- package/dist/edit-modes/draw-line-string-mode.d.ts +25 -0
- package/dist/edit-modes/draw-line-string-mode.js +170 -0
- package/dist/edit-modes/draw-point-mode.d.ts +8 -0
- package/dist/edit-modes/draw-point-mode.js +28 -0
- package/dist/edit-modes/draw-polygon-by-dragging-mode.d.ts +14 -0
- package/dist/edit-modes/draw-polygon-by-dragging-mode.js +87 -0
- package/dist/edit-modes/draw-polygon-mode.d.ts +10 -0
- package/dist/edit-modes/draw-polygon-mode.js +143 -0
- package/dist/edit-modes/draw-rectangle-from-center-mode.d.ts +5 -0
- package/dist/edit-modes/draw-rectangle-from-center-mode.js +17 -0
- package/dist/edit-modes/draw-rectangle-mode.d.ts +5 -0
- package/dist/edit-modes/draw-rectangle-mode.js +11 -0
- package/dist/edit-modes/draw-rectangle-using-three-points-mode.d.ts +5 -0
- package/dist/edit-modes/draw-rectangle-using-three-points-mode.js +28 -0
- package/dist/edit-modes/draw-square-from-center-mode.d.ts +5 -0
- package/dist/edit-modes/draw-square-from-center-mode.js +35 -0
- package/dist/edit-modes/draw-square-mode.d.ts +5 -0
- package/dist/edit-modes/draw-square-mode.js +28 -0
- package/dist/edit-modes/duplicate-mode.d.ts +7 -0
- package/dist/edit-modes/duplicate-mode.js +17 -0
- package/dist/edit-modes/edit-mode.d.ts +11 -0
- package/dist/edit-modes/edit-mode.js +2 -0
- package/dist/edit-modes/elevation-mode.d.ts +13 -0
- package/dist/edit-modes/elevation-mode.js +49 -0
- package/dist/edit-modes/extend-line-string-mode.d.ts +9 -0
- package/dist/edit-modes/extend-line-string-mode.js +72 -0
- package/dist/edit-modes/extrude-mode.d.ts +15 -0
- package/dist/edit-modes/extrude-mode.js +186 -0
- package/dist/edit-modes/geojson-edit-mode.d.ts +33 -0
- package/dist/edit-modes/geojson-edit-mode.js +208 -0
- package/dist/edit-modes/immutable-feature-collection.d.ts +43 -0
- package/dist/edit-modes/immutable-feature-collection.js +300 -0
- package/dist/edit-modes/measure-angle-mode.d.ts +11 -0
- package/dist/edit-modes/measure-angle-mode.js +99 -0
- package/dist/edit-modes/measure-area-mode.d.ts +8 -0
- package/dist/edit-modes/measure-area-mode.js +50 -0
- package/dist/edit-modes/measure-distance-mode.d.ts +19 -0
- package/dist/edit-modes/measure-distance-mode.js +171 -0
- package/dist/edit-modes/modify-mode.d.ts +15 -0
- package/dist/edit-modes/modify-mode.js +203 -0
- package/dist/edit-modes/resize-circle-mode.d.ts +16 -0
- package/dist/edit-modes/resize-circle-mode.js +142 -0
- package/dist/edit-modes/rotate-mode.d.ts +17 -0
- package/dist/edit-modes/rotate-mode.js +151 -0
- package/dist/edit-modes/scale-mode.d.ts +27 -0
- package/dist/edit-modes/scale-mode.js +173 -0
- package/dist/edit-modes/snappable-mode.d.ts +21 -0
- package/dist/edit-modes/snappable-mode.js +109 -0
- package/dist/edit-modes/split-polygon-mode.d.ts +10 -0
- package/dist/edit-modes/split-polygon-mode.js +164 -0
- package/dist/edit-modes/three-click-polygon-mode.d.ts +10 -0
- package/dist/edit-modes/three-click-polygon-mode.js +72 -0
- package/dist/edit-modes/transform-mode.d.ts +9 -0
- package/dist/edit-modes/transform-mode.js +63 -0
- package/dist/edit-modes/translate-mode.d.ts +13 -0
- package/dist/edit-modes/translate-mode.js +113 -0
- package/dist/edit-modes/two-click-polygon-mode.d.ts +13 -0
- package/dist/edit-modes/two-click-polygon-mode.js +93 -0
- package/dist/edit-modes/types.d.ts +86 -0
- package/dist/edit-modes/types.js +1 -0
- package/dist/edit-modes/utils.d.ts +36 -0
- package/dist/edit-modes/utils.js +381 -0
- package/dist/edit-modes/view-mode.d.ts +3 -0
- package/dist/edit-modes/view-mode.js +3 -0
- package/dist/editable-layers/editable-geojson-layer.d.ts +98 -0
- package/dist/editable-layers/editable-geojson-layer.js +450 -0
- package/dist/editable-layers/editable-h3-cluster-layer.d.ts +34 -0
- package/dist/editable-layers/editable-h3-cluster-layer.js +164 -0
- package/dist/editable-layers/editable-layer.d.ts +49 -0
- package/dist/editable-layers/editable-layer.js +195 -0
- package/dist/editable-layers/editable-path-layer.d.ts +9 -0
- package/dist/editable-layers/editable-path-layer.js +34 -0
- package/dist/editable-layers/elevated-edit-handle-layer.d.ts +7 -0
- package/dist/editable-layers/elevated-edit-handle-layer.js +24 -0
- package/dist/editable-layers/junction-scatterplot-layer.d.ts +14 -0
- package/dist/editable-layers/junction-scatterplot-layer.js +41 -0
- package/dist/editable-layers/path-marker-layer/arrow-2d-geometry.d.ts +4 -0
- package/dist/editable-layers/path-marker-layer/arrow-2d-geometry.js +55 -0
- package/dist/editable-layers/path-marker-layer/create-path-markers.d.ts +16 -0
- package/dist/editable-layers/path-marker-layer/create-path-markers.js +75 -0
- package/dist/editable-layers/path-marker-layer/path-marker-layer.d.ts +40 -0
- package/dist/editable-layers/path-marker-layer/path-marker-layer.js +121 -0
- package/dist/editable-layers/path-marker-layer/polyline.d.ts +18 -0
- package/dist/editable-layers/path-marker-layer/polyline.js +37 -0
- package/dist/editable-layers/path-outline-layer/path-outline-layer.d.ts +26 -0
- package/dist/editable-layers/path-outline-layer/path-outline-layer.js +106 -0
- package/dist/editable-layers/selection-layer.d.ts +26 -0
- package/dist/editable-layers/selection-layer.js +167 -0
- package/dist/geojson-types.d.ts +58 -0
- package/dist/geojson-types.js +2 -0
- package/dist/index.cjs +5825 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +62 -0
- package/dist/lib/constants.d.ts +6 -0
- package/dist/lib/constants.js +6 -0
- package/dist/lib/deck-renderer/deck-cache.d.ts +14 -0
- package/dist/lib/deck-renderer/deck-cache.js +51 -0
- package/dist/lib/deck-renderer/deck-drawer.d.ts +63 -0
- package/dist/lib/deck-renderer/deck-drawer.js +232 -0
- package/dist/lib/feature.d.ts +10 -0
- package/dist/lib/feature.js +16 -0
- package/dist/lib/layer-mouse-event.d.ts +11 -0
- package/dist/lib/layer-mouse-event.js +24 -0
- package/dist/lib/layers/junctions-layer.d.ts +8 -0
- package/dist/lib/layers/junctions-layer.js +33 -0
- package/dist/lib/layers/segments-layer.d.ts +18 -0
- package/dist/lib/layers/segments-layer.js +94 -0
- package/dist/lib/layers/texts-layer.d.ts +8 -0
- package/dist/lib/layers/texts-layer.js +32 -0
- package/dist/lib/math.d.ts +11 -0
- package/dist/lib/math.js +22 -0
- package/dist/lib/nebula-layer.d.ts +13 -0
- package/dist/lib/nebula-layer.js +26 -0
- package/dist/lib/nebula.d.ts +34 -0
- package/dist/lib/nebula.js +254 -0
- package/dist/lib/style.d.ts +19 -0
- package/dist/lib/style.js +20 -0
- package/dist/memoize.d.ts +6 -0
- package/dist/memoize.js +40 -0
- package/dist/mode-handlers/composite-mode-handler.d.ts +24 -0
- package/dist/mode-handlers/composite-mode-handler.js +55 -0
- package/dist/mode-handlers/draw-90degree-polygon-handler.d.ts +13 -0
- package/dist/mode-handlers/draw-90degree-polygon-handler.js +169 -0
- package/dist/mode-handlers/draw-circle-by-bounding-box-handler.d.ts +9 -0
- package/dist/mode-handlers/draw-circle-by-bounding-box-handler.js +29 -0
- package/dist/mode-handlers/draw-circle-from-center-handler.d.ts +9 -0
- package/dist/mode-handlers/draw-circle-from-center-handler.js +27 -0
- package/dist/mode-handlers/draw-ellipse-by-bounding-box-handler.d.ts +9 -0
- package/dist/mode-handlers/draw-ellipse-by-bounding-box-handler.js +30 -0
- package/dist/mode-handlers/draw-ellipse-using-three-points-handler.d.ts +9 -0
- package/dist/mode-handlers/draw-ellipse-using-three-points-handler.js +37 -0
- package/dist/mode-handlers/draw-line-string-handler.d.ts +9 -0
- package/dist/mode-handlers/draw-line-string-handler.js +83 -0
- package/dist/mode-handlers/draw-point-handler.d.ts +5 -0
- package/dist/mode-handlers/draw-point-handler.js +11 -0
- package/dist/mode-handlers/draw-polygon-handler.d.ts +11 -0
- package/dist/mode-handlers/draw-polygon-handler.js +92 -0
- package/dist/mode-handlers/draw-rectangle-handler.d.ts +9 -0
- package/dist/mode-handlers/draw-rectangle-handler.js +18 -0
- package/dist/mode-handlers/draw-rectangle-using-three-points-handler.d.ts +9 -0
- package/dist/mode-handlers/draw-rectangle-using-three-points-handler.js +49 -0
- package/dist/mode-handlers/duplicate-handler.d.ts +9 -0
- package/dist/mode-handlers/duplicate-handler.js +19 -0
- package/dist/mode-handlers/elevation-handler.d.ts +19 -0
- package/dist/mode-handlers/elevation-handler.js +48 -0
- package/dist/mode-handlers/extrude-handler.d.ts +18 -0
- package/dist/mode-handlers/extrude-handler.js +176 -0
- package/dist/mode-handlers/mode-handler.d.ts +61 -0
- package/dist/mode-handlers/mode-handler.js +286 -0
- package/dist/mode-handlers/modify-handler.d.ts +19 -0
- package/dist/mode-handlers/modify-handler.js +193 -0
- package/dist/mode-handlers/rotate-handler.d.ts +17 -0
- package/dist/mode-handlers/rotate-handler.js +74 -0
- package/dist/mode-handlers/scale-handler.d.ts +17 -0
- package/dist/mode-handlers/scale-handler.js +76 -0
- package/dist/mode-handlers/snappable-handler.d.ts +33 -0
- package/dist/mode-handlers/snappable-handler.js +133 -0
- package/dist/mode-handlers/split-polygon-handler.d.ts +11 -0
- package/dist/mode-handlers/split-polygon-handler.js +154 -0
- package/dist/mode-handlers/three-click-polygon-handler.d.ts +5 -0
- package/dist/mode-handlers/three-click-polygon-handler.js +18 -0
- package/dist/mode-handlers/translate-handler.d.ts +17 -0
- package/dist/mode-handlers/translate-handler.js +72 -0
- package/dist/mode-handlers/two-click-polygon-handler.d.ts +5 -0
- package/dist/mode-handlers/two-click-polygon-handler.js +18 -0
- package/dist/mode-handlers/view-handler.d.ts +8 -0
- package/dist/mode-handlers/view-handler.js +10 -0
- package/dist/shaderlib/color/color.d.ts +8 -0
- package/dist/shaderlib/color/color.js +51 -0
- package/dist/shaderlib/outline/outline.d.ts +8 -0
- package/dist/shaderlib/outline/outline.js +97 -0
- package/dist/shaderlib/utils/utils.d.ts +8 -0
- package/dist/shaderlib/utils/utils.js +28 -0
- package/dist/translateFromCenter.d.ts +4 -0
- package/dist/translateFromCenter.js +19 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +144 -0
- package/package.json +84 -0
- package/src/constants.ts +15 -0
- package/src/curve-utils.ts +77 -0
- package/src/edit-modes/composite-mode.ts +74 -0
- package/src/edit-modes/draw-90degree-polygon-mode.ts +220 -0
- package/src/edit-modes/draw-circle-by-diameter-mode.ts +88 -0
- package/src/edit-modes/draw-circle-from-center-mode.ts +79 -0
- package/src/edit-modes/draw-ellipse-by-bounding-box-mode.ts +25 -0
- package/src/edit-modes/draw-ellipse-using-three-points-mode.ts +23 -0
- package/src/edit-modes/draw-line-string-mode.ts +200 -0
- package/src/edit-modes/draw-point-mode.ts +35 -0
- package/src/edit-modes/draw-polygon-by-dragging-mode.ts +106 -0
- package/src/edit-modes/draw-polygon-mode.ts +171 -0
- package/src/edit-modes/draw-rectangle-from-center-mode.ts +23 -0
- package/src/edit-modes/draw-rectangle-mode.ts +14 -0
- package/src/edit-modes/draw-rectangle-using-three-points-mode.ts +36 -0
- package/src/edit-modes/draw-square-from-center-mode.ts +46 -0
- package/src/edit-modes/draw-square-mode.ts +36 -0
- package/src/edit-modes/duplicate-mode.ts +21 -0
- package/src/edit-modes/edit-mode.ts +30 -0
- package/src/edit-modes/elevation-mode.ts +86 -0
- package/src/edit-modes/extend-line-string-mode.ts +87 -0
- package/src/edit-modes/extrude-mode.ts +254 -0
- package/src/edit-modes/geojson-edit-mode.ts +283 -0
- package/src/edit-modes/immutable-feature-collection.ts +417 -0
- package/src/edit-modes/measure-angle-mode.ts +127 -0
- package/src/edit-modes/measure-area-mode.ts +62 -0
- package/src/edit-modes/measure-distance-mode.ts +215 -0
- package/src/edit-modes/modify-mode.ts +293 -0
- package/src/edit-modes/resize-circle-mode.ts +202 -0
- package/src/edit-modes/rotate-mode.ts +208 -0
- package/src/edit-modes/scale-mode.ts +231 -0
- package/src/edit-modes/snappable-mode.ts +174 -0
- package/src/edit-modes/split-polygon-mode.ts +201 -0
- package/src/edit-modes/three-click-polygon-mode.ts +111 -0
- package/src/edit-modes/transform-mode.ts +75 -0
- package/src/edit-modes/translate-mode.ts +161 -0
- package/src/edit-modes/two-click-polygon-mode.ts +132 -0
- package/src/edit-modes/types.ts +135 -0
- package/src/edit-modes/utils.ts +513 -0
- package/src/edit-modes/view-mode.ts +3 -0
- package/src/editable-layers/editable-geojson-layer.ts +603 -0
- package/src/editable-layers/editable-h3-cluster-layer.ts +226 -0
- package/src/editable-layers/editable-layer.ts +252 -0
- package/src/editable-layers/editable-path-layer.ts +51 -0
- package/src/editable-layers/elevated-edit-handle-layer.ts +33 -0
- package/src/editable-layers/junction-scatterplot-layer.ts +53 -0
- package/src/editable-layers/path-marker-layer/arrow-2d-geometry.ts +61 -0
- package/src/editable-layers/path-marker-layer/create-path-markers.ts +107 -0
- package/src/editable-layers/path-marker-layer/path-marker-layer.ts +179 -0
- package/src/editable-layers/path-marker-layer/polyline.ts +40 -0
- package/src/editable-layers/path-outline-layer/path-outline-layer.ts +147 -0
- package/src/editable-layers/selection-layer.ts +209 -0
- package/src/geojson-types.ts +89 -0
- package/src/index.ts +125 -0
- package/src/lib/constants.ts +6 -0
- package/src/lib/deck-renderer/deck-cache.ts +61 -0
- package/src/lib/deck-renderer/deck-drawer.ts +263 -0
- package/src/lib/feature.ts +27 -0
- package/src/lib/layer-mouse-event.ts +32 -0
- package/src/lib/layers/junctions-layer.ts +40 -0
- package/src/lib/layers/segments-layer.ts +108 -0
- package/src/lib/layers/texts-layer.ts +43 -0
- package/src/lib/math.ts +26 -0
- package/src/lib/nebula-layer.ts +33 -0
- package/src/lib/nebula.ts +323 -0
- package/src/lib/style.ts +22 -0
- package/src/memoize.ts +43 -0
- package/src/mode-handlers/composite-mode-handler.ts +89 -0
- package/src/mode-handlers/draw-90degree-polygon-handler.ts +201 -0
- package/src/mode-handlers/draw-circle-by-bounding-box-handler.ts +39 -0
- package/src/mode-handlers/draw-circle-from-center-handler.ts +38 -0
- package/src/mode-handlers/draw-ellipse-by-bounding-box-handler.ts +41 -0
- package/src/mode-handlers/draw-ellipse-using-three-points-handler.ts +46 -0
- package/src/mode-handlers/draw-line-string-handler.ts +108 -0
- package/src/mode-handlers/draw-point-handler.ts +15 -0
- package/src/mode-handlers/draw-polygon-handler.ts +121 -0
- package/src/mode-handlers/draw-rectangle-handler.ts +28 -0
- package/src/mode-handlers/draw-rectangle-using-three-points-handler.ts +60 -0
- package/src/mode-handlers/duplicate-handler.ts +25 -0
- package/src/mode-handlers/elevation-handler.ts +88 -0
- package/src/mode-handlers/extrude-handler.ts +245 -0
- package/src/mode-handlers/mode-handler.ts +394 -0
- package/src/mode-handlers/modify-handler.ts +263 -0
- package/src/mode-handlers/rotate-handler.ts +107 -0
- package/src/mode-handlers/scale-handler.ts +105 -0
- package/src/mode-handlers/snappable-handler.ts +184 -0
- package/src/mode-handlers/split-polygon-handler.ts +177 -0
- package/src/mode-handlers/three-click-polygon-handler.ts +25 -0
- package/src/mode-handlers/translate-handler.ts +110 -0
- package/src/mode-handlers/two-click-polygon-handler.ts +25 -0
- package/src/mode-handlers/view-handler.ts +13 -0
- package/src/shaderlib/color/color.ts +56 -0
- package/src/shaderlib/outline/outline.ts +101 -0
- package/src/shaderlib/utils/utils.ts +33 -0
- package/src/translateFromCenter.ts +48 -0
- package/src/types.ts +39 -0
- package/src/utils.ts +185 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import bearing from '@turf/bearing';
|
|
2
|
+
import {
|
|
3
|
+
generatePointsParallelToLinePoints,
|
|
4
|
+
getPickedEditHandle,
|
|
5
|
+
getPickedIntermediateEditHandle,
|
|
6
|
+
} from './utils';
|
|
7
|
+
import { FeatureCollection } from '../geojson-types';
|
|
8
|
+
import { ModeProps, StartDraggingEvent, StopDraggingEvent, DraggingEvent } from './types';
|
|
9
|
+
import { ModifyMode } from './modify-mode';
|
|
10
|
+
import { ImmutableFeatureCollection } from './immutable-feature-collection';
|
|
11
|
+
|
|
12
|
+
export class ExtrudeMode extends ModifyMode {
|
|
13
|
+
// this mode is busted =(
|
|
14
|
+
|
|
15
|
+
isPointAdded = false;
|
|
16
|
+
|
|
17
|
+
handleDragging(event: DraggingEvent, props: ModeProps<FeatureCollection>): void {
|
|
18
|
+
const editHandle = getPickedEditHandle(event.pointerDownPicks);
|
|
19
|
+
|
|
20
|
+
if (editHandle) {
|
|
21
|
+
const { featureIndex } = editHandle.properties;
|
|
22
|
+
let { positionIndexes } = editHandle.properties;
|
|
23
|
+
|
|
24
|
+
const size = this.coordinatesSize(positionIndexes, featureIndex, props.data);
|
|
25
|
+
positionIndexes = this.isPointAdded
|
|
26
|
+
? this.nextPositionIndexes(positionIndexes, size)
|
|
27
|
+
: positionIndexes;
|
|
28
|
+
// p1 and p1 are end points for edge
|
|
29
|
+
const p1 = this.getPointForPositionIndexes(
|
|
30
|
+
this.prevPositionIndexes(positionIndexes, size),
|
|
31
|
+
featureIndex,
|
|
32
|
+
props.data
|
|
33
|
+
);
|
|
34
|
+
const p2 = this.getPointForPositionIndexes(positionIndexes, featureIndex, props.data);
|
|
35
|
+
if (p1 && p2) {
|
|
36
|
+
// p3 and p4 are end points for moving (extruding) edge
|
|
37
|
+
const [p3, p4] = generatePointsParallelToLinePoints(p1, p2, event.mapCoords);
|
|
38
|
+
|
|
39
|
+
const updatedData = new ImmutableFeatureCollection(props.data)
|
|
40
|
+
.replacePosition(featureIndex, this.prevPositionIndexes(positionIndexes, size), p4)
|
|
41
|
+
.replacePosition(featureIndex, positionIndexes, p3)
|
|
42
|
+
.getObject();
|
|
43
|
+
|
|
44
|
+
props.onEdit({
|
|
45
|
+
updatedData,
|
|
46
|
+
editType: 'extruding',
|
|
47
|
+
editContext: {
|
|
48
|
+
featureIndexes: [featureIndex],
|
|
49
|
+
positionIndexes: this.nextPositionIndexes(positionIndexes, size),
|
|
50
|
+
position: p3,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
event.cancelPan();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>) {
|
|
60
|
+
const selectedFeatureIndexes = props.selectedIndexes;
|
|
61
|
+
|
|
62
|
+
const editHandle = getPickedIntermediateEditHandle(event.picks);
|
|
63
|
+
if (selectedFeatureIndexes.length && editHandle) {
|
|
64
|
+
const { positionIndexes, featureIndex } = editHandle.properties;
|
|
65
|
+
|
|
66
|
+
const size = this.coordinatesSize(positionIndexes, featureIndex, props.data);
|
|
67
|
+
// p1 and p1 are end points for edge
|
|
68
|
+
const p1 = this.getPointForPositionIndexes(
|
|
69
|
+
this.prevPositionIndexes(positionIndexes, size),
|
|
70
|
+
featureIndex,
|
|
71
|
+
props.data
|
|
72
|
+
);
|
|
73
|
+
const p2 = this.getPointForPositionIndexes(positionIndexes, featureIndex, props.data);
|
|
74
|
+
|
|
75
|
+
if (p1 && p2) {
|
|
76
|
+
let updatedData = new ImmutableFeatureCollection(props.data);
|
|
77
|
+
if (!this.isOrthogonal(positionIndexes, featureIndex, size, props.data)) {
|
|
78
|
+
updatedData = updatedData.addPosition(featureIndex, positionIndexes, p2);
|
|
79
|
+
}
|
|
80
|
+
if (
|
|
81
|
+
!this.isOrthogonal(
|
|
82
|
+
this.prevPositionIndexes(positionIndexes, size),
|
|
83
|
+
featureIndex,
|
|
84
|
+
size,
|
|
85
|
+
props.data
|
|
86
|
+
)
|
|
87
|
+
) {
|
|
88
|
+
updatedData = updatedData.addPosition(featureIndex, positionIndexes, p1);
|
|
89
|
+
this.isPointAdded = true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
props.onEdit({
|
|
93
|
+
updatedData: updatedData.getObject(),
|
|
94
|
+
editType: 'startExtruding',
|
|
95
|
+
editContext: {
|
|
96
|
+
featureIndexes: [featureIndex],
|
|
97
|
+
positionIndexes,
|
|
98
|
+
position: p1,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>) {
|
|
106
|
+
const selectedFeatureIndexes = props.selectedIndexes;
|
|
107
|
+
const editHandle = getPickedEditHandle(event.pointerDownPicks);
|
|
108
|
+
if (selectedFeatureIndexes.length && editHandle) {
|
|
109
|
+
const { featureIndex } = editHandle.properties;
|
|
110
|
+
let { positionIndexes } = editHandle.properties;
|
|
111
|
+
|
|
112
|
+
const size = this.coordinatesSize(positionIndexes, featureIndex, props.data);
|
|
113
|
+
positionIndexes = this.isPointAdded
|
|
114
|
+
? this.nextPositionIndexes(positionIndexes, size)
|
|
115
|
+
: positionIndexes;
|
|
116
|
+
// p1 and p1 are end points for edge
|
|
117
|
+
const p1 = this.getPointForPositionIndexes(
|
|
118
|
+
this.prevPositionIndexes(positionIndexes, size),
|
|
119
|
+
featureIndex,
|
|
120
|
+
props.data
|
|
121
|
+
);
|
|
122
|
+
const p2 = this.getPointForPositionIndexes(positionIndexes, featureIndex, props.data);
|
|
123
|
+
|
|
124
|
+
if (p1 && p2) {
|
|
125
|
+
// p3 and p4 are end points for new moved (extruded) edge
|
|
126
|
+
const [p3, p4] = generatePointsParallelToLinePoints(p1, p2, event.mapCoords);
|
|
127
|
+
|
|
128
|
+
const updatedData = new ImmutableFeatureCollection(props.data)
|
|
129
|
+
.replacePosition(featureIndex, this.prevPositionIndexes(positionIndexes, size), p4)
|
|
130
|
+
.replacePosition(featureIndex, positionIndexes, p3)
|
|
131
|
+
.getObject();
|
|
132
|
+
|
|
133
|
+
props.onEdit({
|
|
134
|
+
updatedData,
|
|
135
|
+
editType: 'extruded',
|
|
136
|
+
editContext: {
|
|
137
|
+
featureIndexes: [featureIndex],
|
|
138
|
+
positionIndexes,
|
|
139
|
+
position: p3,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
this.isPointAdded = false;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
coordinatesSize(
|
|
148
|
+
positionIndexes: number[] | null | undefined,
|
|
149
|
+
featureIndex: number,
|
|
150
|
+
{ features }: FeatureCollection
|
|
151
|
+
) {
|
|
152
|
+
let size = 0;
|
|
153
|
+
if (Array.isArray(positionIndexes)) {
|
|
154
|
+
const feature = features[featureIndex];
|
|
155
|
+
const coordinates: any = feature.geometry.coordinates;
|
|
156
|
+
// for Multi polygons, length will be 3
|
|
157
|
+
if (positionIndexes.length === 3) {
|
|
158
|
+
const [a, b] = positionIndexes;
|
|
159
|
+
if (coordinates.length && coordinates[a].length) {
|
|
160
|
+
size = coordinates[a][b].length;
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
const [b] = positionIndexes;
|
|
164
|
+
if (coordinates.length && coordinates[b].length) {
|
|
165
|
+
size = coordinates[b].length;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return size;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
getBearing(p1: any, p2: any) {
|
|
173
|
+
const angle = bearing(p1, p2);
|
|
174
|
+
if (angle < 0) {
|
|
175
|
+
return Math.floor(360 + angle);
|
|
176
|
+
}
|
|
177
|
+
return Math.floor(angle);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
isOrthogonal(
|
|
181
|
+
positionIndexes: number[] | null | undefined,
|
|
182
|
+
featureIndex: number,
|
|
183
|
+
size: number,
|
|
184
|
+
features: FeatureCollection
|
|
185
|
+
) {
|
|
186
|
+
if (!Array.isArray(positionIndexes)) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
if (positionIndexes[positionIndexes.length - 1] === size - 1) {
|
|
190
|
+
positionIndexes[positionIndexes.length - 1] = 0;
|
|
191
|
+
}
|
|
192
|
+
const prevPoint = this.getPointForPositionIndexes(
|
|
193
|
+
this.prevPositionIndexes(positionIndexes, size),
|
|
194
|
+
featureIndex,
|
|
195
|
+
features
|
|
196
|
+
);
|
|
197
|
+
const nextPoint = this.getPointForPositionIndexes(
|
|
198
|
+
this.nextPositionIndexes(positionIndexes, size),
|
|
199
|
+
featureIndex,
|
|
200
|
+
features
|
|
201
|
+
);
|
|
202
|
+
const currentPoint = this.getPointForPositionIndexes(positionIndexes, featureIndex, features);
|
|
203
|
+
const prevAngle = this.getBearing(currentPoint, prevPoint);
|
|
204
|
+
const nextAngle = this.getBearing(currentPoint, nextPoint);
|
|
205
|
+
return [89, 90, 91, 269, 270, 271].includes(Math.abs(prevAngle - nextAngle));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
nextPositionIndexes(positionIndexes: number[] | null | undefined, size: number): number[] {
|
|
209
|
+
if (!Array.isArray(positionIndexes)) {
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
212
|
+
const next = [...positionIndexes];
|
|
213
|
+
if (next.length) {
|
|
214
|
+
next[next.length - 1] = next[next.length - 1] === size - 1 ? 0 : next[next.length - 1] + 1;
|
|
215
|
+
}
|
|
216
|
+
return next;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
prevPositionIndexes(positionIndexes: number[] | null | undefined, size: number): number[] {
|
|
220
|
+
if (!Array.isArray(positionIndexes)) {
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
const prev = [...positionIndexes];
|
|
224
|
+
if (prev.length) {
|
|
225
|
+
prev[prev.length - 1] = prev[prev.length - 1] === 0 ? size - 2 : prev[prev.length - 1] - 1;
|
|
226
|
+
}
|
|
227
|
+
return prev;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
getPointForPositionIndexes(
|
|
231
|
+
positionIndexes: number[] | null | undefined,
|
|
232
|
+
featureIndex: number,
|
|
233
|
+
{ features }: FeatureCollection
|
|
234
|
+
) {
|
|
235
|
+
let p1;
|
|
236
|
+
if (Array.isArray(positionIndexes)) {
|
|
237
|
+
const feature = features[featureIndex];
|
|
238
|
+
const coordinates: any = feature.geometry.coordinates;
|
|
239
|
+
// for Multi polygons, length will be 3
|
|
240
|
+
if (positionIndexes.length === 3) {
|
|
241
|
+
const [a, b, c] = positionIndexes;
|
|
242
|
+
if (coordinates.length && coordinates[a].length) {
|
|
243
|
+
p1 = coordinates[a][b][c];
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
const [b, c] = positionIndexes;
|
|
247
|
+
if (coordinates.length && coordinates[b].length) {
|
|
248
|
+
p1 = coordinates[b][c];
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return p1;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import turfUnion from '@turf/union';
|
|
2
|
+
import turfDifference from '@turf/difference';
|
|
3
|
+
import turfIntersect from '@turf/intersect';
|
|
4
|
+
import rewind from '@turf/rewind';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
EditAction,
|
|
8
|
+
ClickEvent,
|
|
9
|
+
PointerMoveEvent,
|
|
10
|
+
StartDraggingEvent,
|
|
11
|
+
StopDraggingEvent,
|
|
12
|
+
DraggingEvent,
|
|
13
|
+
Pick,
|
|
14
|
+
Tooltip,
|
|
15
|
+
ModeProps,
|
|
16
|
+
GuideFeatureCollection,
|
|
17
|
+
TentativeFeature,
|
|
18
|
+
} from './types';
|
|
19
|
+
import { FeatureCollection, Feature, Polygon, Geometry, Position } from '../geojson-types';
|
|
20
|
+
import { getPickedEditHandles, getNonGuidePicks } from './utils';
|
|
21
|
+
import { EditMode } from './edit-mode';
|
|
22
|
+
import { ImmutableFeatureCollection } from './immutable-feature-collection';
|
|
23
|
+
|
|
24
|
+
export type GeoJsonEditAction = EditAction<FeatureCollection>;
|
|
25
|
+
|
|
26
|
+
const DEFAULT_GUIDES: GuideFeatureCollection = {
|
|
27
|
+
type: 'FeatureCollection',
|
|
28
|
+
features: [],
|
|
29
|
+
};
|
|
30
|
+
const DEFAULT_TOOLTIPS: Tooltip[] = [];
|
|
31
|
+
|
|
32
|
+
// Main interface for `EditMode`s that edit GeoJSON
|
|
33
|
+
export type GeoJsonEditModeType = EditMode<FeatureCollection, FeatureCollection>;
|
|
34
|
+
|
|
35
|
+
export interface GeoJsonEditModeConstructor {
|
|
36
|
+
new (): GeoJsonEditModeType;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeatureCollection> {
|
|
40
|
+
_clickSequence: Position[] = [];
|
|
41
|
+
|
|
42
|
+
getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {
|
|
43
|
+
return DEFAULT_GUIDES;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
getTooltips(props: ModeProps<FeatureCollection>): Tooltip[] {
|
|
47
|
+
return DEFAULT_TOOLTIPS;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getSelectedFeature(props: ModeProps<FeatureCollection>): Feature | null | undefined {
|
|
51
|
+
if (props.selectedIndexes.length === 1) {
|
|
52
|
+
return props.data.features[props.selectedIndexes[0]];
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
getSelectedGeometry(props: ModeProps<FeatureCollection>): Geometry | null | undefined {
|
|
58
|
+
const feature = this.getSelectedFeature(props);
|
|
59
|
+
if (feature) {
|
|
60
|
+
return feature.geometry;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
getSelectedFeaturesAsFeatureCollection(props: ModeProps<FeatureCollection>): FeatureCollection {
|
|
66
|
+
const { features } = props.data;
|
|
67
|
+
const selectedFeatures = props.selectedIndexes.map((selectedIndex) => features[selectedIndex]);
|
|
68
|
+
return {
|
|
69
|
+
type: 'FeatureCollection',
|
|
70
|
+
features: selectedFeatures,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
getClickSequence(): Position[] {
|
|
75
|
+
return this._clickSequence;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
addClickSequence({ mapCoords }: ClickEvent): void {
|
|
79
|
+
this._clickSequence.push(mapCoords);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
resetClickSequence(): void {
|
|
83
|
+
this._clickSequence = [];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
getTentativeGuide(props: ModeProps<FeatureCollection>): TentativeFeature | null | undefined {
|
|
87
|
+
const guides = this.getGuides(props);
|
|
88
|
+
return guides.features.find(
|
|
89
|
+
(f) => f.properties && f.properties.guideType === 'tentative'
|
|
90
|
+
) as TentativeFeature;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
isSelectionPicked(picks: Pick[], props: ModeProps<FeatureCollection>): boolean {
|
|
94
|
+
if (!picks.length) return false;
|
|
95
|
+
const pickedFeatures = getNonGuidePicks(picks).map(({ index }) => index);
|
|
96
|
+
const pickedHandles = getPickedEditHandles(picks).map(
|
|
97
|
+
({ properties }) => properties.featureIndex
|
|
98
|
+
);
|
|
99
|
+
const pickedIndexes = new Set([...pickedFeatures, ...pickedHandles]);
|
|
100
|
+
return props.selectedIndexes.some((index) => pickedIndexes.has(index));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
rewindPolygon(feature: Feature): Feature {
|
|
104
|
+
const { geometry } = feature;
|
|
105
|
+
|
|
106
|
+
const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
|
|
107
|
+
if (isPolygonal) {
|
|
108
|
+
// @ts-expect-error turf type too wide
|
|
109
|
+
return rewind(feature);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return feature;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
getAddFeatureAction(
|
|
116
|
+
featureOrGeometry: Geometry | Feature,
|
|
117
|
+
features: FeatureCollection
|
|
118
|
+
): GeoJsonEditAction {
|
|
119
|
+
// Unsure why flow can't deal with Geometry type, but there I fixed it
|
|
120
|
+
const featureOrGeometryAsAny: any = featureOrGeometry;
|
|
121
|
+
|
|
122
|
+
const feature: any =
|
|
123
|
+
featureOrGeometryAsAny.type === 'Feature'
|
|
124
|
+
? featureOrGeometryAsAny
|
|
125
|
+
: {
|
|
126
|
+
type: 'Feature',
|
|
127
|
+
properties: {},
|
|
128
|
+
geometry: featureOrGeometryAsAny,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const rewindFeature = this.rewindPolygon(feature);
|
|
132
|
+
const updatedData = new ImmutableFeatureCollection(features)
|
|
133
|
+
.addFeature(rewindFeature)
|
|
134
|
+
.getObject();
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
updatedData,
|
|
138
|
+
editType: 'addFeature',
|
|
139
|
+
editContext: {
|
|
140
|
+
featureIndexes: [updatedData.features.length - 1],
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
getAddManyFeaturesAction(
|
|
146
|
+
{ features: featuresToAdd }: FeatureCollection,
|
|
147
|
+
features: FeatureCollection
|
|
148
|
+
): GeoJsonEditAction {
|
|
149
|
+
let updatedData = new ImmutableFeatureCollection(features);
|
|
150
|
+
const initialIndex = updatedData.getObject().features.length;
|
|
151
|
+
const updatedIndexes: number[] = [];
|
|
152
|
+
for (const feature of featuresToAdd) {
|
|
153
|
+
const { properties, geometry } = feature;
|
|
154
|
+
const geometryAsAny: any = geometry;
|
|
155
|
+
updatedData = updatedData.addFeature({
|
|
156
|
+
type: 'Feature',
|
|
157
|
+
properties,
|
|
158
|
+
geometry: geometryAsAny,
|
|
159
|
+
});
|
|
160
|
+
updatedIndexes.push(initialIndex + updatedIndexes.length);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
updatedData: updatedData.getObject(),
|
|
165
|
+
editType: 'addFeature',
|
|
166
|
+
editContext: {
|
|
167
|
+
featureIndexes: updatedIndexes,
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
getAddFeatureOrBooleanPolygonAction(
|
|
173
|
+
featureOrGeometry: Polygon | Feature,
|
|
174
|
+
props: ModeProps<FeatureCollection>
|
|
175
|
+
): GeoJsonEditAction | null | undefined {
|
|
176
|
+
const featureOrGeometryAsAny: any = featureOrGeometry;
|
|
177
|
+
|
|
178
|
+
const selectedFeature = this.getSelectedFeature(props);
|
|
179
|
+
const { modeConfig } = props;
|
|
180
|
+
if (modeConfig && modeConfig.booleanOperation) {
|
|
181
|
+
if (
|
|
182
|
+
!selectedFeature ||
|
|
183
|
+
(selectedFeature.geometry.type !== 'Polygon' &&
|
|
184
|
+
selectedFeature.geometry.type !== 'MultiPolygon')
|
|
185
|
+
) {
|
|
186
|
+
// eslint-disable-next-line no-console,no-undef
|
|
187
|
+
console.warn(
|
|
188
|
+
'booleanOperation only supported for single Polygon or MultiPolygon selection'
|
|
189
|
+
);
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const feature =
|
|
194
|
+
featureOrGeometryAsAny.type === 'Feature'
|
|
195
|
+
? featureOrGeometryAsAny
|
|
196
|
+
: {
|
|
197
|
+
type: 'Feature',
|
|
198
|
+
geometry: featureOrGeometryAsAny,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
let updatedGeometry;
|
|
202
|
+
if (modeConfig.booleanOperation === 'union') {
|
|
203
|
+
// @ts-expect-error selectedFeature type too wide
|
|
204
|
+
updatedGeometry = turfUnion(selectedFeature, feature);
|
|
205
|
+
} else if (modeConfig.booleanOperation === 'difference') {
|
|
206
|
+
// @ts-expect-error selectedFeature type too wide
|
|
207
|
+
updatedGeometry = turfDifference(selectedFeature, feature);
|
|
208
|
+
} else if (modeConfig.booleanOperation === 'intersection') {
|
|
209
|
+
// @ts-expect-error selectedFeature type too wide
|
|
210
|
+
updatedGeometry = turfIntersect(selectedFeature, feature);
|
|
211
|
+
} else {
|
|
212
|
+
// eslint-disable-next-line no-console,no-undef
|
|
213
|
+
console.warn(`Invalid booleanOperation ${modeConfig.booleanOperation}`);
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (!updatedGeometry) {
|
|
218
|
+
// eslint-disable-next-line no-console,no-undef
|
|
219
|
+
console.warn('Canceling edit. Boolean operation erased entire polygon.');
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const featureIndex = props.selectedIndexes[0];
|
|
224
|
+
|
|
225
|
+
const updatedData = new ImmutableFeatureCollection(props.data)
|
|
226
|
+
.replaceGeometry(featureIndex, updatedGeometry.geometry)
|
|
227
|
+
.getObject();
|
|
228
|
+
|
|
229
|
+
const editAction: GeoJsonEditAction = {
|
|
230
|
+
updatedData,
|
|
231
|
+
editType: 'unionGeometry',
|
|
232
|
+
editContext: {
|
|
233
|
+
featureIndexes: [featureIndex],
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
return editAction;
|
|
238
|
+
}
|
|
239
|
+
return this.getAddFeatureAction(featureOrGeometry, props.data);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
createTentativeFeature(props: ModeProps<FeatureCollection>): TentativeFeature | null {
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>): void {}
|
|
247
|
+
handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>): void {
|
|
248
|
+
const tentativeFeature = this.createTentativeFeature(props);
|
|
249
|
+
if (tentativeFeature) {
|
|
250
|
+
props.onEdit({
|
|
251
|
+
updatedData: props.data,
|
|
252
|
+
editType: 'updateTentativeFeature',
|
|
253
|
+
editContext: {
|
|
254
|
+
feature: tentativeFeature,
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>): void {}
|
|
260
|
+
handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>): void {}
|
|
261
|
+
handleDragging(event: DraggingEvent, props: ModeProps<FeatureCollection>): void {}
|
|
262
|
+
|
|
263
|
+
handleKeyUp(event: KeyboardEvent, props: ModeProps<FeatureCollection>): void {
|
|
264
|
+
if (event.key === 'Escape') {
|
|
265
|
+
this.resetClickSequence();
|
|
266
|
+
props.onEdit({
|
|
267
|
+
// Because the new drawing feature is dropped, so the data will keep as the same.
|
|
268
|
+
updatedData: props.data,
|
|
269
|
+
editType: 'cancelFeature',
|
|
270
|
+
editContext: {},
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export function getIntermediatePosition(position1: Position, position2: Position): Position {
|
|
277
|
+
const intermediatePosition: Position = [
|
|
278
|
+
(position1[0] + position2[0]) / 2.0,
|
|
279
|
+
(position1[1] + position2[1]) / 2.0,
|
|
280
|
+
];
|
|
281
|
+
|
|
282
|
+
return intermediatePosition;
|
|
283
|
+
}
|