@open-pioneer/feature-editing 1.4.0-dev.20260625074633 → 1.4.0
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/CHANGELOG.md +8 -2
- package/README.md +1 -3
- package/api/editor/context.js.map +1 -1
- package/api/editor/editor.d.ts +2 -2
- package/api/editor/editor.js.map +1 -1
- package/api/model/InteractionOptions.d.ts +1 -1
- package/implementation/FeatureEditor.js.map +1 -1
- package/implementation/components/action-selector/ActionSelector.js.map +1 -1
- package/implementation/components/action-selector/DrawingControls.js.map +1 -1
- package/implementation/components/action-selector/SelectButton.js.map +1 -1
- package/implementation/components/action-selector/TemplateItem.js.map +1 -1
- package/implementation/components/action-selector/TemplateSelector.js.map +1 -1
- package/implementation/components/controls/ColorPickerControl.js +1 -1
- package/implementation/components/controls/ColorPickerControl.js.map +1 -1
- package/implementation/components/controls/ComboBoxControl.js.map +1 -1
- package/implementation/components/controls/DefaultControl.js +1 -1
- package/implementation/components/controls/DefaultControl.js.map +1 -1
- package/implementation/components/controls/NumberFieldControl.js.map +1 -1
- package/implementation/components/controls/RadioGroupControl.js.map +1 -1
- package/implementation/components/controls/SelectControl.js.map +1 -1
- package/implementation/components/controls/option-hooks.js.map +1 -1
- package/implementation/components/property-editor/ButtonRow.js +1 -1
- package/implementation/components/property-editor/ButtonRow.js.map +1 -1
- package/implementation/components/property-editor/CancelConfirmationDialog.js.map +1 -1
- package/implementation/components/property-editor/DeleteConfirmationDialog.js.map +1 -1
- package/implementation/components/property-editor/PropertyEditor.js +6 -3
- package/implementation/components/property-editor/PropertyEditor.js.map +1 -1
- package/implementation/components/property-editor/PropertyField.js.map +1 -1
- package/implementation/components/property-editor/PropertyForm.js +1 -1
- package/implementation/components/property-editor/PropertyForm.js.map +1 -1
- package/implementation/context/PropertyFormContext.d.ts +0 -1
- package/implementation/context/PropertyFormContext.js +2 -2
- package/implementation/context/PropertyFormContext.js.map +1 -1
- package/implementation/context/usePropertyFormContext.js.map +1 -1
- package/implementation/editor/editorHooks.d.ts +1 -1
- package/implementation/editor/editorHooks.js +1 -1
- package/implementation/editor/editorHooks.js.map +1 -1
- package/implementation/editor/useEditingCallbacks.d.ts +1 -1
- package/implementation/editor/useEditingCallbacks.js +1 -1
- package/implementation/editor/useEditingCallbacks.js.map +1 -1
- package/implementation/geometry-editing/controller/DrawingSession.d.ts +1 -6
- package/implementation/geometry-editing/controller/DrawingSession.js +33 -33
- package/implementation/geometry-editing/controller/DrawingSession.js.map +1 -1
- package/implementation/geometry-editing/controller/EditingController.d.ts +3 -9
- package/implementation/geometry-editing/controller/EditingController.js +40 -40
- package/implementation/geometry-editing/controller/EditingController.js.map +1 -1
- package/implementation/geometry-editing/controller/UndoManager.d.ts +1 -4
- package/implementation/geometry-editing/controller/UndoManager.js +14 -14
- package/implementation/geometry-editing/controller/UndoManager.js.map +1 -1
- package/implementation/geometry-editing/controller/geometryState.js.map +1 -1
- package/implementation/geometry-editing/interactions/BaseInteraction.d.ts +1 -3
- package/implementation/geometry-editing/interactions/BaseInteraction.js +12 -12
- package/implementation/geometry-editing/interactions/BaseInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/DoubleClickInteraction.d.ts +1 -1
- package/implementation/geometry-editing/interactions/DoubleClickInteraction.js +2 -2
- package/implementation/geometry-editing/interactions/DoubleClickInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/DrawingInteraction.d.ts +5 -7
- package/implementation/geometry-editing/interactions/DrawingInteraction.js +13 -13
- package/implementation/geometry-editing/interactions/DrawingInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/HighlightingInteraction.d.ts +1 -2
- package/implementation/geometry-editing/interactions/HighlightingInteraction.js +4 -4
- package/implementation/geometry-editing/interactions/HighlightingInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/KeyboardInteraction.d.ts +2 -6
- package/implementation/geometry-editing/interactions/KeyboardInteraction.js +10 -10
- package/implementation/geometry-editing/interactions/KeyboardInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/ModificationInteraction.d.ts +2 -3
- package/implementation/geometry-editing/interactions/ModificationInteraction.js +4 -4
- package/implementation/geometry-editing/interactions/ModificationInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/SelectionInteraction.d.ts +3 -7
- package/implementation/geometry-editing/interactions/SelectionInteraction.js +11 -11
- package/implementation/geometry-editing/interactions/SelectionInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/SnappingInteraction.d.ts +1 -1
- package/implementation/geometry-editing/interactions/SnappingInteraction.js.map +1 -1
- package/implementation/geometry-editing/useGeometryEditing.d.ts +1 -1
- package/implementation/geometry-editing/useGeometryEditing.js.map +1 -1
- package/package.json +12 -12
|
@@ -8,86 +8,86 @@ import { SnappingInteraction } from '../interactions/SnappingInteraction.js';
|
|
|
8
8
|
import { DrawingSession } from './DrawingSession.js';
|
|
9
9
|
|
|
10
10
|
class EditingController {
|
|
11
|
+
#currentInteractions = [];
|
|
12
|
+
#snappingSources = [];
|
|
13
|
+
#interactionOptions = {};
|
|
14
|
+
drawingSession = new DrawingSession();
|
|
15
|
+
#mapModel;
|
|
16
|
+
#layerFactory;
|
|
17
|
+
#tooltipMessages;
|
|
11
18
|
constructor(mapModel, layerFactory, tooltipMessages) {
|
|
12
|
-
this
|
|
13
|
-
this
|
|
14
|
-
this
|
|
19
|
+
this.#mapModel = mapModel;
|
|
20
|
+
this.#layerFactory = layerFactory;
|
|
21
|
+
this.#tooltipMessages = tooltipMessages;
|
|
15
22
|
}
|
|
16
|
-
mapModel;
|
|
17
|
-
layerFactory;
|
|
18
|
-
tooltipMessages;
|
|
19
|
-
currentInteractions = [];
|
|
20
|
-
snappingSources = [];
|
|
21
|
-
interactionOptions = {};
|
|
22
|
-
drawingSession = new DrawingSession();
|
|
23
23
|
startDrawingFeature({
|
|
24
24
|
geometryType,
|
|
25
25
|
drawingOptions,
|
|
26
26
|
completionHandler
|
|
27
27
|
}) {
|
|
28
|
-
this
|
|
29
|
-
new DrawingInteraction(this
|
|
28
|
+
this.#replaceInteractions(
|
|
29
|
+
new DrawingInteraction(this.#mapModel, {
|
|
30
30
|
geometryType,
|
|
31
31
|
tracker: this.drawingSession,
|
|
32
|
-
drawingOptions: { ...this
|
|
32
|
+
drawingOptions: { ...this.#interactionOptions.drawingOptions, ...drawingOptions },
|
|
33
33
|
completionHandler,
|
|
34
|
-
layerFactory: this
|
|
35
|
-
tooltipMessages: this
|
|
34
|
+
layerFactory: this.#layerFactory,
|
|
35
|
+
tooltipMessages: this.#tooltipMessages
|
|
36
36
|
}),
|
|
37
|
-
new KeyboardInteraction(this
|
|
37
|
+
new KeyboardInteraction(this.#mapModel, {
|
|
38
38
|
actions: this.drawingSession
|
|
39
39
|
}),
|
|
40
|
-
new SnappingInteraction(this
|
|
41
|
-
snappingSources: this
|
|
42
|
-
snappingOptions: this
|
|
40
|
+
new SnappingInteraction(this.#mapModel, {
|
|
41
|
+
snappingSources: this.#snappingSources,
|
|
42
|
+
snappingOptions: this.#interactionOptions.snappingOptions
|
|
43
43
|
}),
|
|
44
|
-
new DoubleClickInteraction(this
|
|
44
|
+
new DoubleClickInteraction(this.#mapModel)
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
startSelectingFeature({ layers, completionHandler }) {
|
|
48
|
-
this
|
|
49
|
-
new SelectionInteraction(this
|
|
48
|
+
this.#replaceInteractions(
|
|
49
|
+
new SelectionInteraction(this.#mapModel, {
|
|
50
50
|
layers,
|
|
51
|
-
selectionOptions: this
|
|
51
|
+
selectionOptions: this.#interactionOptions.selectionOptions,
|
|
52
52
|
completionHandler,
|
|
53
|
-
tooltipMessages: this
|
|
53
|
+
tooltipMessages: this.#tooltipMessages
|
|
54
54
|
})
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
startModifyingFeature({ feature, drawLayer }) {
|
|
58
|
-
this
|
|
59
|
-
new ModificationInteraction(this
|
|
58
|
+
this.#replaceInteractions(
|
|
59
|
+
new ModificationInteraction(this.#mapModel, {
|
|
60
60
|
feature,
|
|
61
61
|
drawLayer,
|
|
62
|
-
modificationOptions: this
|
|
63
|
-
tooltipMessages: this
|
|
62
|
+
modificationOptions: this.#interactionOptions.modificationOptions,
|
|
63
|
+
tooltipMessages: this.#tooltipMessages
|
|
64
64
|
}),
|
|
65
|
-
new HighlightingInteraction(this
|
|
65
|
+
new HighlightingInteraction(this.#mapModel, {
|
|
66
66
|
feature,
|
|
67
|
-
highlightOptions: this
|
|
67
|
+
highlightOptions: this.#interactionOptions.highlightingOptions
|
|
68
68
|
}),
|
|
69
|
-
new SnappingInteraction(this
|
|
70
|
-
snappingSources: this
|
|
71
|
-
snappingOptions: this
|
|
69
|
+
new SnappingInteraction(this.#mapModel, {
|
|
70
|
+
snappingSources: this.#snappingSources,
|
|
71
|
+
snappingOptions: this.#interactionOptions.snappingOptions
|
|
72
72
|
})
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
setSnappingSources(sources) {
|
|
76
|
-
this
|
|
76
|
+
this.#snappingSources = sources ?? [];
|
|
77
77
|
}
|
|
78
78
|
setInteractionOptions(options) {
|
|
79
|
-
this
|
|
79
|
+
this.#interactionOptions = options;
|
|
80
80
|
}
|
|
81
81
|
stopCurrentInteractions() {
|
|
82
|
-
this
|
|
82
|
+
this.#currentInteractions.forEach((interaction) => {
|
|
83
83
|
interaction.stop();
|
|
84
84
|
});
|
|
85
|
-
this
|
|
85
|
+
this.#currentInteractions = [];
|
|
86
86
|
}
|
|
87
|
-
replaceInteractions(...interactions) {
|
|
87
|
+
#replaceInteractions(...interactions) {
|
|
88
88
|
this.stopCurrentInteractions();
|
|
89
|
-
this
|
|
90
|
-
this
|
|
89
|
+
this.#currentInteractions = interactions;
|
|
90
|
+
this.#currentInteractions.forEach((interaction) => {
|
|
91
91
|
interaction.start();
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditingController.js","sources":["EditingController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { LayerFactory, MapModel } from \"@open-pioneer/map\";\nimport type { Vector as VectorSource } from \"ol/source\";\nimport type { InteractionOptions } from \"../../../api/model/InteractionOptions\";\nimport { BaseInteraction } from \"../interactions/BaseInteraction\";\nimport { DoubleClickInteraction } from \"../interactions/DoubleClickInteraction\";\nimport { DrawingInteraction, type DrawingParameters } from \"../interactions/DrawingInteraction\";\nimport { HighlightingInteraction } from \"../interactions/HighlightingInteraction\";\nimport { KeyboardInteraction } from \"../interactions/KeyboardInteraction\";\nimport {\n ModificationInteraction,\n type ModificationParameters\n} from \"../interactions/ModificationInteraction\";\nimport {\n SelectionInteraction,\n type SelectionParameters\n} from \"../interactions/SelectionInteraction\";\nimport { SnappingInteraction } from \"../interactions/SnappingInteraction\";\nimport { DrawingSession } from \"./DrawingSession\";\
|
|
1
|
+
{"version":3,"file":"EditingController.js","sources":["EditingController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LayerFactory, MapModel } from \"@open-pioneer/map\";\nimport type { Type as GeometryType } from \"ol/geom/Geometry\";\nimport type { Vector as VectorSource } from \"ol/source\";\nimport { ReactNode } from \"react\";\nimport type { InteractionOptions } from \"../../../api/model/InteractionOptions\";\nimport { BaseInteraction } from \"../interactions/BaseInteraction\";\nimport { DoubleClickInteraction } from \"../interactions/DoubleClickInteraction\";\nimport { DrawingInteraction, type DrawingParameters } from \"../interactions/DrawingInteraction\";\nimport { HighlightingInteraction } from \"../interactions/HighlightingInteraction\";\nimport { KeyboardInteraction } from \"../interactions/KeyboardInteraction\";\nimport {\n ModificationInteraction,\n type ModificationParameters\n} from \"../interactions/ModificationInteraction\";\nimport {\n SelectionInteraction,\n type SelectionParameters\n} from \"../interactions/SelectionInteraction\";\nimport { SnappingInteraction } from \"../interactions/SnappingInteraction\";\nimport { DrawingSession } from \"./DrawingSession\";\n\ntype StartDrawingFeatureOptions = Required<\n Omit<DrawingParameters, \"tracker\" | \"layerFactory\" | \"tooltipMessages\">\n>;\ntype StartSelectingFeatureOptions = Pick<SelectionParameters, \"layers\" | \"completionHandler\">;\ntype StartModifyingFeatureOptions = Pick<ModificationParameters, \"feature\" | \"drawLayer\">;\n\nexport interface TooltipMessages {\n getSelectionMessage(): ReactNode;\n getDrawingMessages(): Map<GeometryType, ReactNode>;\n getModificationMessages(): Map<string, ReactNode>;\n}\n\nexport class EditingController {\n #currentInteractions: BaseInteraction<unknown, unknown>[] = [];\n #snappingSources: VectorSource[] = [];\n #interactionOptions: InteractionOptions = {};\n\n readonly drawingSession = new DrawingSession();\n\n readonly #mapModel: MapModel;\n readonly #layerFactory: LayerFactory;\n readonly #tooltipMessages: TooltipMessages;\n\n constructor(mapModel: MapModel, layerFactory: LayerFactory, tooltipMessages: TooltipMessages) {\n this.#mapModel = mapModel;\n this.#layerFactory = layerFactory;\n this.#tooltipMessages = tooltipMessages;\n }\n\n startDrawingFeature({\n geometryType,\n drawingOptions,\n completionHandler\n }: StartDrawingFeatureOptions): void {\n this.#replaceInteractions(\n new DrawingInteraction(this.#mapModel, {\n geometryType,\n tracker: this.drawingSession,\n drawingOptions: { ...this.#interactionOptions.drawingOptions, ...drawingOptions },\n completionHandler,\n layerFactory: this.#layerFactory,\n tooltipMessages: this.#tooltipMessages\n }),\n new KeyboardInteraction(this.#mapModel, {\n actions: this.drawingSession\n }),\n new SnappingInteraction(this.#mapModel, {\n snappingSources: this.#snappingSources,\n snappingOptions: this.#interactionOptions.snappingOptions\n }),\n new DoubleClickInteraction(this.#mapModel)\n );\n }\n\n startSelectingFeature({ layers, completionHandler }: StartSelectingFeatureOptions): void {\n this.#replaceInteractions(\n new SelectionInteraction(this.#mapModel, {\n layers,\n selectionOptions: this.#interactionOptions.selectionOptions,\n completionHandler,\n tooltipMessages: this.#tooltipMessages\n })\n );\n }\n\n startModifyingFeature({ feature, drawLayer }: StartModifyingFeatureOptions): void {\n this.#replaceInteractions(\n new ModificationInteraction(this.#mapModel, {\n feature,\n drawLayer,\n modificationOptions: this.#interactionOptions.modificationOptions,\n tooltipMessages: this.#tooltipMessages\n }),\n new HighlightingInteraction(this.#mapModel, {\n feature,\n highlightOptions: this.#interactionOptions.highlightingOptions\n }),\n new SnappingInteraction(this.#mapModel, {\n snappingSources: this.#snappingSources,\n snappingOptions: this.#interactionOptions.snappingOptions\n })\n );\n }\n\n setSnappingSources(sources: VectorSource[] | undefined): void {\n this.#snappingSources = sources ?? [];\n }\n\n setInteractionOptions(options: InteractionOptions): void {\n this.#interactionOptions = options;\n }\n\n stopCurrentInteractions(): void {\n this.#currentInteractions.forEach((interaction) => {\n interaction.stop();\n });\n this.#currentInteractions = [];\n }\n\n #replaceInteractions(...interactions: BaseInteraction<unknown, unknown>[]): void {\n this.stopCurrentInteractions();\n this.#currentInteractions = interactions;\n this.#currentInteractions.forEach((interaction) => {\n interaction.start();\n });\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
export declare class UndoManager<T> {
|
|
2
|
+
#private;
|
|
2
3
|
addEdit(edit: T): void;
|
|
3
4
|
undo(): T | undefined;
|
|
4
5
|
redo(): T | undefined;
|
|
5
6
|
reset(): void;
|
|
6
7
|
get canUndo(): boolean;
|
|
7
8
|
get canRedo(): boolean;
|
|
8
|
-
private undoStack;
|
|
9
|
-
private redoStack;
|
|
10
|
-
private canUndoSignal;
|
|
11
|
-
private canRedoSignal;
|
|
12
9
|
}
|
|
@@ -2,37 +2,37 @@ import { reactiveArray, computed } from '@conterra/reactivity-core';
|
|
|
2
2
|
|
|
3
3
|
class UndoManager {
|
|
4
4
|
addEdit(edit) {
|
|
5
|
-
this
|
|
6
|
-
this
|
|
5
|
+
this.#undoStack.push(edit);
|
|
6
|
+
this.#redoStack.splice(0);
|
|
7
7
|
}
|
|
8
8
|
undo() {
|
|
9
|
-
const edit = this
|
|
9
|
+
const edit = this.#undoStack.pop();
|
|
10
10
|
if (edit != null) {
|
|
11
|
-
this
|
|
11
|
+
this.#redoStack.push(edit);
|
|
12
12
|
}
|
|
13
13
|
return edit;
|
|
14
14
|
}
|
|
15
15
|
redo() {
|
|
16
|
-
const edit = this
|
|
16
|
+
const edit = this.#redoStack.pop();
|
|
17
17
|
if (edit != null) {
|
|
18
|
-
this
|
|
18
|
+
this.#undoStack.push(edit);
|
|
19
19
|
}
|
|
20
20
|
return edit;
|
|
21
21
|
}
|
|
22
22
|
reset() {
|
|
23
|
-
this
|
|
24
|
-
this
|
|
23
|
+
this.#undoStack.splice(0);
|
|
24
|
+
this.#redoStack.splice(0);
|
|
25
25
|
}
|
|
26
26
|
get canUndo() {
|
|
27
|
-
return this
|
|
27
|
+
return this.#canUndoSignal.value;
|
|
28
28
|
}
|
|
29
29
|
get canRedo() {
|
|
30
|
-
return this
|
|
30
|
+
return this.#canRedoSignal.value;
|
|
31
31
|
}
|
|
32
|
-
undoStack = reactiveArray();
|
|
33
|
-
redoStack = reactiveArray();
|
|
34
|
-
canUndoSignal = computed(() => this
|
|
35
|
-
canRedoSignal = computed(() => this
|
|
32
|
+
#undoStack = reactiveArray();
|
|
33
|
+
#redoStack = reactiveArray();
|
|
34
|
+
#canUndoSignal = computed(() => this.#undoStack.length >= 1);
|
|
35
|
+
#canRedoSignal = computed(() => this.#redoStack.length >= 1);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export { UndoManager };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UndoManager.js","sources":["UndoManager.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { computed, reactiveArray } from \"@conterra/reactivity-core\";\n\nexport class UndoManager<T> {\n addEdit(edit: T): void {\n this
|
|
1
|
+
{"version":3,"file":"UndoManager.js","sources":["UndoManager.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { computed, reactiveArray } from \"@conterra/reactivity-core\";\n\nexport class UndoManager<T> {\n addEdit(edit: T): void {\n this.#undoStack.push(edit);\n this.#redoStack.splice(0);\n }\n\n undo(): T | undefined {\n const edit = this.#undoStack.pop();\n if (edit != null) {\n this.#redoStack.push(edit);\n }\n return edit;\n }\n\n redo(): T | undefined {\n const edit = this.#redoStack.pop();\n if (edit != null) {\n this.#undoStack.push(edit);\n }\n return edit;\n }\n\n reset(): void {\n this.#undoStack.splice(0);\n this.#redoStack.splice(0);\n }\n\n get canUndo(): boolean {\n return this.#canUndoSignal.value;\n }\n\n get canRedo(): boolean {\n return this.#canRedoSignal.value;\n }\n\n #undoStack = reactiveArray<T>();\n #redoStack = reactiveArray<T>();\n\n #canUndoSignal = computed(() => this.#undoStack.length >= 1);\n #canRedoSignal = computed(() => this.#redoStack.length >= 1);\n}\n"],"names":[],"mappings":";;AAKO,MAAM,WAAA,CAAe;AAAA,EACxB,QAAQ,IAAA,EAAe;AACnB,IAAA,IAAA,CAAK,UAAA,CAAW,KAAK,IAAI,CAAA;AACzB,IAAA,IAAA,CAAK,UAAA,CAAW,OAAO,CAAC,CAAA;AAAA,EAC5B;AAAA,EAEA,IAAA,GAAsB;AAClB,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,UAAA,CAAW,GAAA,EAAI;AACjC,IAAA,IAAI,QAAQ,IAAA,EAAM;AACd,MAAA,IAAA,CAAK,UAAA,CAAW,KAAK,IAAI,CAAA;AAAA,IAC7B;AACA,IAAA,OAAO,IAAA;AAAA,EACX;AAAA,EAEA,IAAA,GAAsB;AAClB,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,UAAA,CAAW,GAAA,EAAI;AACjC,IAAA,IAAI,QAAQ,IAAA,EAAM;AACd,MAAA,IAAA,CAAK,UAAA,CAAW,KAAK,IAAI,CAAA;AAAA,IAC7B;AACA,IAAA,OAAO,IAAA;AAAA,EACX;AAAA,EAEA,KAAA,GAAc;AACV,IAAA,IAAA,CAAK,UAAA,CAAW,OAAO,CAAC,CAAA;AACxB,IAAA,IAAA,CAAK,UAAA,CAAW,OAAO,CAAC,CAAA;AAAA,EAC5B;AAAA,EAEA,IAAI,OAAA,GAAmB;AACnB,IAAA,OAAO,KAAK,cAAA,CAAe,KAAA;AAAA,EAC/B;AAAA,EAEA,IAAI,OAAA,GAAmB;AACnB,IAAA,OAAO,KAAK,cAAA,CAAe,KAAA;AAAA,EAC/B;AAAA,EAEA,aAAa,aAAA,EAAiB;AAAA,EAC9B,aAAa,aAAA,EAAiB;AAAA,EAE9B,iBAAiB,QAAA,CAAS,MAAM,IAAA,CAAK,UAAA,CAAW,UAAU,CAAC,CAAA;AAAA,EAC3D,iBAAiB,QAAA,CAAS,MAAM,IAAA,CAAK,UAAA,CAAW,UAAU,CAAC,CAAA;AAC/D;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryState.js","sources":["geometryState.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type { Coordinate } from \"ol/coordinate\";\nimport type { Geometry, LineString, Polygon } from \"ol/geom\";\n\nexport function canBeFinished(\n geometry: Geometry,\n numberOfVertices: number | undefined\n): boolean | undefined {\n if (isLineString(geometry) && numberOfVertices != null) {\n return numberOfVertices >= 3;\n } else if (isPolygon(geometry) && numberOfVertices != null) {\n return numberOfVertices >= 4;\n } else {\n return undefined;\n }\n}\n\nexport function canBeReset(\n geometry: Geometry,\n numberOfVertices: number | undefined\n): boolean | undefined {\n if ((isLineString(geometry) || isPolygon(geometry)) && numberOfVertices != null) {\n return numberOfVertices >= 1;\n } else {\n return undefined;\n }\n}\n\nexport function getNumberOfVertices(geometry: Geometry): number | undefined {\n if (isLineString(geometry)) {\n return geometry.getCoordinates().length;\n } else if (isPolygon(geometry)) {\n return geometry.getFlatCoordinates().length / 2 - 1;\n } else {\n return undefined;\n }\n}\n\nexport function getLastCoordinate(geometry: Geometry): Coordinate | undefined {\n if (isLineString(geometry)) {\n const lastCoordinate = geometry.getLastCoordinate();\n return lastCoordinate.length >= 2 ? lastCoordinate : undefined;\n } else if (isPolygon(geometry)) {\n const coordinates = geometry.getLinearRing(0)?.getCoordinates();\n return coordinates?.[coordinates.length - 2] ?? undefined;\n } else {\n return undefined;\n }\n}\n\nfunction isLineString(geometry: Geometry): geometry is LineString {\n return geometry.getType() === \"LineString\";\n}\n\nfunction isPolygon(geometry: Geometry): geometry is Polygon {\n return geometry.getType() === \"Polygon\";\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geometryState.js","sources":["geometryState.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Coordinate } from \"ol/coordinate\";\nimport type { Geometry, LineString, Polygon } from \"ol/geom\";\n\nexport function canBeFinished(\n geometry: Geometry,\n numberOfVertices: number | undefined\n): boolean | undefined {\n if (isLineString(geometry) && numberOfVertices != null) {\n return numberOfVertices >= 3;\n } else if (isPolygon(geometry) && numberOfVertices != null) {\n return numberOfVertices >= 4;\n } else {\n return undefined;\n }\n}\n\nexport function canBeReset(\n geometry: Geometry,\n numberOfVertices: number | undefined\n): boolean | undefined {\n if ((isLineString(geometry) || isPolygon(geometry)) && numberOfVertices != null) {\n return numberOfVertices >= 1;\n } else {\n return undefined;\n }\n}\n\nexport function getNumberOfVertices(geometry: Geometry): number | undefined {\n if (isLineString(geometry)) {\n return geometry.getCoordinates().length;\n } else if (isPolygon(geometry)) {\n return geometry.getFlatCoordinates().length / 2 - 1;\n } else {\n return undefined;\n }\n}\n\nexport function getLastCoordinate(geometry: Geometry): Coordinate | undefined {\n if (isLineString(geometry)) {\n const lastCoordinate = geometry.getLastCoordinate();\n return lastCoordinate.length >= 2 ? lastCoordinate : undefined;\n } else if (isPolygon(geometry)) {\n const coordinates = geometry.getLinearRing(0)?.getCoordinates();\n return coordinates?.[coordinates.length - 2] ?? undefined;\n } else {\n return undefined;\n }\n}\n\nfunction isLineString(geometry: Geometry): geometry is LineString {\n return geometry.getType() === \"LineString\";\n}\n\nfunction isPolygon(geometry: Geometry): geometry is Polygon {\n return geometry.getType() === \"Polygon\";\n}\n"],"names":[],"mappings":"AAMO,SAAS,aAAA,CACZ,UACA,gBAAA,EACmB;AACnB,EAAA,IAAI,YAAA,CAAa,QAAQ,CAAA,IAAK,gBAAA,IAAoB,IAAA,EAAM;AACpD,IAAA,OAAO,gBAAA,IAAoB,CAAA;AAAA,EAC/B,CAAA,MAAA,IAAW,SAAA,CAAU,QAAQ,CAAA,IAAK,oBAAoB,IAAA,EAAM;AACxD,IAAA,OAAO,gBAAA,IAAoB,CAAA;AAAA,EAC/B,CAAA,MAAO;AACH,IAAA,OAAO,MAAA;AAAA,EACX;AACJ;AAEO,SAAS,UAAA,CACZ,UACA,gBAAA,EACmB;AACnB,EAAA,IAAA,CAAK,aAAa,QAAQ,CAAA,IAAK,UAAU,QAAQ,CAAA,KAAM,oBAAoB,IAAA,EAAM;AAC7E,IAAA,OAAO,gBAAA,IAAoB,CAAA;AAAA,EAC/B,CAAA,MAAO;AACH,IAAA,OAAO,MAAA;AAAA,EACX;AACJ;AAEO,SAAS,oBAAoB,QAAA,EAAwC;AACxE,EAAA,IAAI,YAAA,CAAa,QAAQ,CAAA,EAAG;AACxB,IAAA,OAAO,QAAA,CAAS,gBAAe,CAAE,MAAA;AAAA,EACrC,CAAA,MAAA,IAAW,SAAA,CAAU,QAAQ,CAAA,EAAG;AAC5B,IAAA,OAAO,QAAA,CAAS,kBAAA,EAAmB,CAAE,MAAA,GAAS,CAAA,GAAI,CAAA;AAAA,EACtD,CAAA,MAAO;AACH,IAAA,OAAO,MAAA;AAAA,EACX;AACJ;AAEO,SAAS,kBAAkB,QAAA,EAA4C;AAC1E,EAAA,IAAI,YAAA,CAAa,QAAQ,CAAA,EAAG;AACxB,IAAA,MAAM,cAAA,GAAiB,SAAS,iBAAA,EAAkB;AAClD,IAAA,OAAO,cAAA,CAAe,MAAA,IAAU,CAAA,GAAI,cAAA,GAAiB,MAAA;AAAA,EACzD,CAAA,MAAA,IAAW,SAAA,CAAU,QAAQ,CAAA,EAAG;AAC5B,IAAA,MAAM,WAAA,GAAc,QAAA,CAAS,aAAA,CAAc,CAAC,GAAG,cAAA,EAAe;AAC9D,IAAA,OAAO,WAAA,GAAc,WAAA,CAAY,MAAA,GAAS,CAAC,CAAA,IAAK,MAAA;AAAA,EACpD,CAAA,MAAO;AACH,IAAA,OAAO,MAAA;AAAA,EACX;AACJ;AAEA,SAAS,aAAa,QAAA,EAA4C;AAC9D,EAAA,OAAO,QAAA,CAAS,SAAQ,KAAM,YAAA;AAClC;AAEA,SAAS,UAAU,QAAA,EAAyC;AACxD,EAAA,OAAO,QAAA,CAAS,SAAQ,KAAM,SAAA;AAClC;;;;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { MapModel } from "@open-pioneer/map";
|
|
2
2
|
import type { Map } from "ol";
|
|
3
3
|
export declare abstract class BaseInteraction<Params, Data> {
|
|
4
|
-
private
|
|
5
|
-
private readonly parameters;
|
|
6
|
-
private state;
|
|
4
|
+
#private;
|
|
7
5
|
constructor(mapModelInstance: MapModel, parameters: Params);
|
|
8
6
|
start(): void;
|
|
9
7
|
stop(): void;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
class BaseInteraction {
|
|
2
|
+
#state = { type: "idle" };
|
|
3
|
+
#mapModelInstance;
|
|
4
|
+
#parameters;
|
|
2
5
|
constructor(mapModelInstance, parameters) {
|
|
3
|
-
this
|
|
4
|
-
this
|
|
6
|
+
this.#mapModelInstance = mapModelInstance;
|
|
7
|
+
this.#parameters = parameters;
|
|
5
8
|
}
|
|
6
|
-
mapModelInstance;
|
|
7
|
-
parameters;
|
|
8
|
-
state = { type: "idle" };
|
|
9
9
|
start() {
|
|
10
|
-
if (this
|
|
11
|
-
const data = this.startInteraction(this
|
|
12
|
-
this
|
|
10
|
+
if (this.#state.type === "idle") {
|
|
11
|
+
const data = this.startInteraction(this.#parameters);
|
|
12
|
+
this.#state = { type: "active", data };
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
stop() {
|
|
16
|
-
if (this
|
|
17
|
-
this.stopInteraction(this
|
|
18
|
-
this
|
|
16
|
+
if (this.#state.type === "active") {
|
|
17
|
+
this.stopInteraction(this.#state.data);
|
|
18
|
+
this.#state = { type: "idle" };
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
get map() {
|
|
22
22
|
return this.mapModel.olMap;
|
|
23
23
|
}
|
|
24
24
|
get mapModel() {
|
|
25
|
-
return this
|
|
25
|
+
return this.#mapModelInstance;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInteraction.js","sources":["BaseInteraction.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type { MapModel } from \"@open-pioneer/map\";\nimport type { Map } from \"ol\";\n\ntype EditingWorkflowState<T> = IdleState | ActiveState<T>;\n\ninterface IdleState {\n readonly type: \"idle\";\n}\n\ninterface ActiveState<T> {\n readonly type: \"active\";\n readonly data: T;\n}\n\nexport abstract class BaseInteraction<Params, Data> {\n
|
|
1
|
+
{"version":3,"file":"BaseInteraction.js","sources":["BaseInteraction.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MapModel } from \"@open-pioneer/map\";\nimport type { Map } from \"ol\";\n\ntype EditingWorkflowState<T> = IdleState | ActiveState<T>;\n\ninterface IdleState {\n readonly type: \"idle\";\n}\n\ninterface ActiveState<T> {\n readonly type: \"active\";\n readonly data: T;\n}\n\nexport abstract class BaseInteraction<Params, Data> {\n #state: EditingWorkflowState<Data> = { type: \"idle\" };\n\n readonly #mapModelInstance: MapModel;\n readonly #parameters: Params;\n\n constructor(mapModelInstance: MapModel, parameters: Params) {\n this.#mapModelInstance = mapModelInstance;\n this.#parameters = parameters;\n }\n\n start(): void {\n if (this.#state.type === \"idle\") {\n const data = this.startInteraction(this.#parameters);\n this.#state = { type: \"active\", data };\n }\n }\n\n stop(): void {\n if (this.#state.type === \"active\") {\n this.stopInteraction(this.#state.data);\n this.#state = { type: \"idle\" };\n }\n }\n\n protected get map(): Map {\n return this.mapModel.olMap;\n }\n\n protected get mapModel(): MapModel {\n return this.#mapModelInstance;\n }\n\n protected abstract startInteraction(parameters: Params): Data;\n protected abstract stopInteraction(interactionData: Data): void;\n}\n"],"names":[],"mappings":"AAiBO,MAAe,eAAA,CAA8B;AAAA,EAChD,MAAA,GAAqC,EAAE,IAAA,EAAM,MAAA,EAAO;AAAA,EAE3C,iBAAA;AAAA,EACA,WAAA;AAAA,EAET,WAAA,CAAY,kBAA4B,UAAA,EAAoB;AACxD,IAAA,IAAA,CAAK,iBAAA,GAAoB,gBAAA;AACzB,IAAA,IAAA,CAAK,WAAA,GAAc,UAAA;AAAA,EACvB;AAAA,EAEA,KAAA,GAAc;AACV,IAAA,IAAI,IAAA,CAAK,MAAA,CAAO,IAAA,KAAS,MAAA,EAAQ;AAC7B,MAAA,MAAM,IAAA,GAAO,IAAA,CAAK,gBAAA,CAAiB,IAAA,CAAK,WAAW,CAAA;AACnD,MAAA,IAAA,CAAK,MAAA,GAAS,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAK;AAAA,IACzC;AAAA,EACJ;AAAA,EAEA,IAAA,GAAa;AACT,IAAA,IAAI,IAAA,CAAK,MAAA,CAAO,IAAA,KAAS,QAAA,EAAU;AAC/B,MAAA,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA;AACrC,MAAA,IAAA,CAAK,MAAA,GAAS,EAAE,IAAA,EAAM,MAAA,EAAO;AAAA,IACjC;AAAA,EACJ;AAAA,EAEA,IAAc,GAAA,GAAW;AACrB,IAAA,OAAO,KAAK,QAAA,CAAS,KAAA;AAAA,EACzB;AAAA,EAEA,IAAc,QAAA,GAAqB;AAC/B,IAAA,OAAO,IAAA,CAAK,iBAAA;AAAA,EAChB;AAIJ;;;;"}
|
|
@@ -6,9 +6,9 @@ interface DoubleClickData {
|
|
|
6
6
|
readonly wasActive: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare class DoubleClickInteraction extends BaseInteraction<{}, DoubleClickData> {
|
|
9
|
+
#private;
|
|
9
10
|
constructor(mapModel: MapModel);
|
|
10
11
|
protected startInteraction(): DoubleClickData;
|
|
11
12
|
protected stopInteraction({ doubleClickZoom, wasActive }: DoubleClickData): void;
|
|
12
|
-
private getDoubleClickZoom;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -6,7 +6,7 @@ class DoubleClickInteraction extends BaseInteraction {
|
|
|
6
6
|
super(mapModel, {});
|
|
7
7
|
}
|
|
8
8
|
startInteraction() {
|
|
9
|
-
const doubleClickZoom = this
|
|
9
|
+
const doubleClickZoom = this.#getDoubleClickZoom();
|
|
10
10
|
const wasActive = doubleClickZoom?.getActive() ?? false;
|
|
11
11
|
doubleClickZoom?.setActive(false);
|
|
12
12
|
return { doubleClickZoom, wasActive };
|
|
@@ -14,7 +14,7 @@ class DoubleClickInteraction extends BaseInteraction {
|
|
|
14
14
|
stopInteraction({ doubleClickZoom, wasActive }) {
|
|
15
15
|
doubleClickZoom?.setActive(wasActive);
|
|
16
16
|
}
|
|
17
|
-
getDoubleClickZoom() {
|
|
17
|
+
#getDoubleClickZoom() {
|
|
18
18
|
return this.map.getInteractions().getArray().find((interaction) => interaction instanceof DoubleClickZoom);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoubleClickInteraction.js","sources":["DoubleClickInteraction.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type { MapModel } from \"@open-pioneer/map\";\nimport { DoubleClickZoom, type Interaction } from \"ol/interaction\";\nimport { BaseInteraction } from \"./BaseInteraction\";\n\ninterface DoubleClickData {\n readonly doubleClickZoom: Interaction | undefined;\n readonly wasActive: boolean;\n}\n\n// A double-click is used to finish drawing a feature. Hence, disable the double-click zoom\n// interaction, which would otherwise be triggered along with it.\nexport class DoubleClickInteraction extends BaseInteraction<{}, DoubleClickData> {\n constructor(mapModel: MapModel) {\n super(mapModel, {});\n }\n\n protected startInteraction(): DoubleClickData {\n const doubleClickZoom = this
|
|
1
|
+
{"version":3,"file":"DoubleClickInteraction.js","sources":["DoubleClickInteraction.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MapModel } from \"@open-pioneer/map\";\nimport { DoubleClickZoom, type Interaction } from \"ol/interaction\";\nimport { BaseInteraction } from \"./BaseInteraction\";\n\ninterface DoubleClickData {\n readonly doubleClickZoom: Interaction | undefined;\n readonly wasActive: boolean;\n}\n\n// A double-click is used to finish drawing a feature. Hence, disable the double-click zoom\n// interaction, which would otherwise be triggered along with it.\nexport class DoubleClickInteraction extends BaseInteraction<{}, DoubleClickData> {\n constructor(mapModel: MapModel) {\n super(mapModel, {});\n }\n\n protected startInteraction(): DoubleClickData {\n const doubleClickZoom = this.#getDoubleClickZoom();\n const wasActive = doubleClickZoom?.getActive() ?? false;\n\n doubleClickZoom?.setActive(false);\n\n return { doubleClickZoom, wasActive };\n }\n\n protected stopInteraction({ doubleClickZoom, wasActive }: DoubleClickData): void {\n doubleClickZoom?.setActive(wasActive);\n }\n\n #getDoubleClickZoom(): Interaction | undefined {\n return this.map\n .getInteractions()\n .getArray()\n .find((interaction) => interaction instanceof DoubleClickZoom);\n }\n}\n"],"names":[],"mappings":";;;AAcO,MAAM,+BAA+B,eAAA,CAAqC;AAAA,EAC7E,YAAY,QAAA,EAAoB;AAC5B,IAAA,KAAA,CAAM,QAAA,EAAU,EAAE,CAAA;AAAA,EACtB;AAAA,EAEU,gBAAA,GAAoC;AAC1C,IAAA,MAAM,eAAA,GAAkB,KAAK,mBAAA,EAAoB;AACjD,IAAA,MAAM,SAAA,GAAY,eAAA,EAAiB,SAAA,EAAU,IAAK,KAAA;AAElD,IAAA,eAAA,EAAiB,UAAU,KAAK,CAAA;AAEhC,IAAA,OAAO,EAAE,iBAAiB,SAAA,EAAU;AAAA,EACxC;AAAA,EAEU,eAAA,CAAgB,EAAE,eAAA,EAAiB,SAAA,EAAU,EAA0B;AAC7E,IAAA,eAAA,EAAiB,UAAU,SAAS,CAAA;AAAA,EACxC;AAAA,EAEA,mBAAA,GAA+C;AAC3C,IAAA,OAAO,IAAA,CAAK,GAAA,CACP,eAAA,EAAgB,CAChB,QAAA,GACA,IAAA,CAAK,CAAC,WAAA,KAAgB,WAAA,YAAuB,eAAe,CAAA;AAAA,EACrE;AACJ;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LayerFactory, SimpleLayer } from "@open-pioneer/map";
|
|
2
2
|
import type { Feature } from "ol";
|
|
3
3
|
import type { EventsKey } from "ol/events";
|
|
4
4
|
import type { Type as GeometryType } from "ol/geom/Geometry";
|
|
5
|
-
import {
|
|
6
|
-
import type { DrawingTracker } from "../controller/DrawingSession";
|
|
5
|
+
import { Draw } from "ol/interaction";
|
|
7
6
|
import type { DrawingOptions } from "../../../api/model/InteractionOptions";
|
|
8
|
-
import {
|
|
7
|
+
import type { DrawingTracker } from "../controller/DrawingSession";
|
|
9
8
|
import { TooltipMessages } from "../controller/EditingController";
|
|
9
|
+
import { BaseInteraction } from "./BaseInteraction";
|
|
10
10
|
export interface DrawingParameters {
|
|
11
11
|
readonly geometryType: GeometryType;
|
|
12
12
|
readonly tracker: DrawingTracker;
|
|
@@ -22,10 +22,8 @@ interface DrawingData {
|
|
|
22
22
|
readonly tracker: DrawingTracker;
|
|
23
23
|
}
|
|
24
24
|
export declare class DrawingInteraction extends BaseInteraction<DrawingParameters, DrawingData> {
|
|
25
|
-
private
|
|
26
|
-
private drawLayer;
|
|
25
|
+
#private;
|
|
27
26
|
protected startInteraction(parameters: DrawingParameters): DrawingData;
|
|
28
27
|
protected stopInteraction(data: DrawingData): void;
|
|
29
|
-
private createHelpTooltip;
|
|
30
28
|
}
|
|
31
29
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { destroyResource } from '@open-pioneer/core';
|
|
2
|
+
import { SimpleLayer } from '@open-pioneer/map';
|
|
1
3
|
import { Draw } from 'ol/interaction.js';
|
|
2
4
|
import { Vector as Vector$1 } from 'ol/layer.js';
|
|
3
5
|
import { unByKey } from 'ol/Observable.js';
|
|
4
6
|
import { Vector } from 'ol/source.js';
|
|
5
7
|
import { BaseInteraction } from './BaseInteraction.js';
|
|
6
|
-
import { SimpleLayer } from '@open-pioneer/map';
|
|
7
|
-
import { destroyResource } from '@open-pioneer/core';
|
|
8
8
|
|
|
9
9
|
class DrawingInteraction extends BaseInteraction {
|
|
10
|
-
tooltip;
|
|
11
|
-
drawLayer;
|
|
10
|
+
#tooltip;
|
|
11
|
+
#drawLayer;
|
|
12
12
|
startInteraction(parameters) {
|
|
13
13
|
const {
|
|
14
14
|
geometryType,
|
|
@@ -19,7 +19,7 @@ class DrawingInteraction extends BaseInteraction {
|
|
|
19
19
|
tooltipMessages
|
|
20
20
|
} = parameters;
|
|
21
21
|
const source = new Vector();
|
|
22
|
-
const drawLayer = this
|
|
22
|
+
const drawLayer = this.#drawLayer = layerFactory.create({
|
|
23
23
|
type: SimpleLayer,
|
|
24
24
|
internal: true,
|
|
25
25
|
title: "editing-draw-layer",
|
|
@@ -38,16 +38,16 @@ class DrawingInteraction extends BaseInteraction {
|
|
|
38
38
|
draw.on("drawstart", ({ feature }) => tracker.trackCapabilities(feature, handler)),
|
|
39
39
|
draw.on("drawabort", () => tracker.untrackCapabilities()),
|
|
40
40
|
draw.once("drawend", ({ feature }) => {
|
|
41
|
-
const drawLayer2 = this
|
|
41
|
+
const drawLayer2 = this.#drawLayer;
|
|
42
42
|
if (!drawLayer2) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
this.mapModel.layers.removeLayer(drawLayer2);
|
|
46
|
-
this
|
|
46
|
+
this.#drawLayer = void 0;
|
|
47
47
|
completionHandler(feature, drawLayer2);
|
|
48
48
|
})
|
|
49
49
|
];
|
|
50
|
-
this
|
|
50
|
+
this.#tooltip = this.#createHelpTooltip(this.mapModel, tooltipMessages, geometryType);
|
|
51
51
|
this.mapModel.layers.addLayer(drawLayer, { at: "topmost" });
|
|
52
52
|
this.map.addInteraction(draw);
|
|
53
53
|
return { draw, eventsKeys, tracker };
|
|
@@ -55,15 +55,15 @@ class DrawingInteraction extends BaseInteraction {
|
|
|
55
55
|
stopInteraction(data) {
|
|
56
56
|
const { draw, eventsKeys, tracker } = data;
|
|
57
57
|
this.map.removeInteraction(draw);
|
|
58
|
-
if (this
|
|
59
|
-
this.mapModel.layers.removeLayer(this
|
|
60
|
-
this
|
|
58
|
+
if (this.#drawLayer) {
|
|
59
|
+
this.mapModel.layers.removeLayer(this.#drawLayer);
|
|
60
|
+
this.#drawLayer = destroyResource(this.#drawLayer);
|
|
61
61
|
}
|
|
62
|
-
this
|
|
62
|
+
this.#tooltip?.destroy();
|
|
63
63
|
unByKey(eventsKeys);
|
|
64
64
|
tracker.untrackCapabilities();
|
|
65
65
|
}
|
|
66
|
-
createHelpTooltip(mapModel, tooltipMessages, geometryType) {
|
|
66
|
+
#createHelpTooltip(mapModel, tooltipMessages, geometryType) {
|
|
67
67
|
const message = tooltipMessages.getDrawingMessages().get(geometryType);
|
|
68
68
|
if (!message) {
|
|
69
69
|
return void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawingInteraction.js","sources":["DrawingInteraction.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {
|
|
1
|
+
{"version":3,"file":"DrawingInteraction.js","sources":["DrawingInteraction.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { destroyResource } from \"@open-pioneer/core\";\nimport { LayerFactory, MapModel, Overlay, SimpleLayer } from \"@open-pioneer/map\";\nimport type { Feature } from \"ol\";\nimport type { EventsKey } from \"ol/events\";\nimport type { Type as GeometryType } from \"ol/geom/Geometry\";\nimport { Draw } from \"ol/interaction\";\nimport { Vector as VectorLayer } from \"ol/layer\";\nimport { unByKey } from \"ol/Observable\";\nimport { Vector as VectorSource } from \"ol/source\";\nimport type { DrawingOptions } from \"../../../api/model/InteractionOptions\";\nimport type { DrawingTracker, DrawingActionHandler } from \"../controller/DrawingSession\";\nimport { TooltipMessages } from \"../controller/EditingController\";\nimport { BaseInteraction } from \"./BaseInteraction\";\n\nexport interface DrawingParameters {\n readonly geometryType: GeometryType;\n readonly tracker: DrawingTracker;\n readonly drawingOptions?: DrawingOptions;\n /** The completion handler takes ownership of the drawLayer and needs to destroy it if it is no longer needed. */\n readonly completionHandler: (feature: Feature, drawLayer: SimpleLayer) => void;\n readonly layerFactory: LayerFactory;\n readonly tooltipMessages: TooltipMessages;\n}\n\ninterface DrawingData {\n readonly draw: Draw;\n readonly eventsKeys: EventsKey[];\n readonly tracker: DrawingTracker;\n}\n\nexport class DrawingInteraction extends BaseInteraction<DrawingParameters, DrawingData> {\n #tooltip?: Overlay;\n #drawLayer: SimpleLayer | undefined;\n\n protected override startInteraction(parameters: DrawingParameters): DrawingData {\n const {\n geometryType,\n tracker,\n drawingOptions,\n completionHandler,\n layerFactory,\n tooltipMessages\n } = parameters;\n\n const source = new VectorSource();\n const drawLayer = (this.#drawLayer = layerFactory.create({\n type: SimpleLayer,\n internal: true,\n title: \"editing-draw-layer\",\n olLayer: new VectorLayer<VectorSource, Feature>({\n source: source\n })\n }));\n const draw = new Draw({ source, type: geometryType, ...drawingOptions });\n\n const handler: DrawingActionHandler = {\n undo: () => draw.removeLastPoint(),\n redo: (coordinate) => draw.appendCoordinates([coordinate]),\n finish: () => draw.finishDrawing(),\n reset: () => draw.abortDrawing()\n };\n\n const eventsKeys = [\n draw.on(\"drawstart\", ({ feature }) => tracker.trackCapabilities(feature, handler)),\n draw.on(\"drawabort\", () => tracker.untrackCapabilities()),\n draw.once(\"drawend\", ({ feature }) => {\n const drawLayer = this.#drawLayer;\n if (!drawLayer) {\n return;\n }\n\n // Remove from map but DO NOT destroy: completionHandler takes ownership\n this.mapModel.layers.removeLayer(drawLayer);\n this.#drawLayer = undefined;\n completionHandler(feature, drawLayer);\n })\n ];\n\n this.#tooltip = this.#createHelpTooltip(this.mapModel, tooltipMessages, geometryType);\n\n this.mapModel.layers.addLayer(drawLayer, { at: \"topmost\" });\n\n this.map.addInteraction(draw);\n\n return { draw, eventsKeys, tracker };\n }\n\n protected override stopInteraction(data: DrawingData): void {\n const { draw, eventsKeys, tracker } = data;\n\n this.map.removeInteraction(draw);\n\n // Cleanup draw layer if it wasn't passed to the completionHandler\n if (this.#drawLayer) {\n this.mapModel.layers.removeLayer(this.#drawLayer);\n this.#drawLayer = destroyResource(this.#drawLayer);\n }\n this.#tooltip?.destroy();\n unByKey(eventsKeys);\n tracker.untrackCapabilities();\n }\n\n #createHelpTooltip(\n mapModel: MapModel,\n tooltipMessages: TooltipMessages,\n geometryType: GeometryType\n ): Overlay | undefined {\n const message = tooltipMessages.getDrawingMessages().get(geometryType);\n if (!message) {\n return undefined;\n }\n\n const helpOverlay = mapModel.overlays.add({\n className: \"editing-tooltip printing-hide\",\n position: \"follow-pointer\",\n tag: \"editing-draw-overlay\",\n offset: [15, 0],\n positioning: \"center-left\",\n ariaRole: \"tooltip\",\n content: message\n });\n\n return helpOverlay;\n }\n}\n"],"names":["VectorSource","VectorLayer","drawLayer"],"mappings":"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"}
|
|
@@ -9,9 +9,8 @@ interface Data {
|
|
|
9
9
|
readonly highlight?: Highlight;
|
|
10
10
|
}
|
|
11
11
|
export declare class HighlightingInteraction extends BaseInteraction<HighlightingParameters, Data> {
|
|
12
|
+
#private;
|
|
12
13
|
protected startInteraction(parameters: HighlightingParameters): Data;
|
|
13
14
|
protected stopInteraction({ highlight }: Data): void;
|
|
14
|
-
private getHighlightOptions;
|
|
15
|
-
private static readonly DEFAULT_POINT_HIGHLIGHT_STYLE;
|
|
16
15
|
}
|
|
17
16
|
export {};
|
|
@@ -6,7 +6,7 @@ class HighlightingInteraction extends BaseInteraction {
|
|
|
6
6
|
const { feature, highlightOptions } = parameters;
|
|
7
7
|
const geometry = feature.getGeometry();
|
|
8
8
|
if (geometry != null) {
|
|
9
|
-
const options = this
|
|
9
|
+
const options = this.#getHighlightOptions(highlightOptions);
|
|
10
10
|
const highlight = this.mapModel.highlights.add([geometry], options);
|
|
11
11
|
return { highlight };
|
|
12
12
|
} else {
|
|
@@ -16,16 +16,16 @@ class HighlightingInteraction extends BaseInteraction {
|
|
|
16
16
|
stopInteraction({ highlight }) {
|
|
17
17
|
highlight?.destroy();
|
|
18
18
|
}
|
|
19
|
-
getHighlightOptions(highlightOptions) {
|
|
19
|
+
#getHighlightOptions(highlightOptions) {
|
|
20
20
|
return {
|
|
21
21
|
...highlightOptions,
|
|
22
22
|
highlightStyle: {
|
|
23
|
-
Point: HighlightingInteraction
|
|
23
|
+
Point: HighlightingInteraction.#DEFAULT_POINT_HIGHLIGHT_STYLE,
|
|
24
24
|
...highlightOptions?.highlightStyle
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
static DEFAULT_POINT_HIGHLIGHT_STYLE = new Style({
|
|
28
|
+
static #DEFAULT_POINT_HIGHLIGHT_STYLE = new Style({
|
|
29
29
|
image: new Circle({
|
|
30
30
|
stroke: new Stroke({
|
|
31
31
|
color: "cyan",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightingInteraction.js","sources":["HighlightingInteraction.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type { Highlight, HighlightOptions } from \"@open-pioneer/map\";\nimport type { Feature } from \"ol\";\nimport { Circle, Fill, Stroke, Style } from \"ol/style\";\nimport { BaseInteraction } from \"./BaseInteraction\";\n\nexport interface HighlightingParameters {\n readonly feature: Feature;\n readonly highlightOptions?: HighlightOptions;\n}\n\ninterface Data {\n readonly highlight?: Highlight;\n}\n\nexport class HighlightingInteraction extends BaseInteraction<HighlightingParameters, Data> {\n protected override startInteraction(parameters: HighlightingParameters): Data {\n const { feature, highlightOptions } = parameters;\n const geometry = feature.getGeometry();\n\n if (geometry != null) {\n const options = this
|
|
1
|
+
{"version":3,"file":"HighlightingInteraction.js","sources":["HighlightingInteraction.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Highlight, HighlightOptions } from \"@open-pioneer/map\";\nimport type { Feature } from \"ol\";\nimport { Circle, Fill, Stroke, Style } from \"ol/style\";\nimport { BaseInteraction } from \"./BaseInteraction\";\n\nexport interface HighlightingParameters {\n readonly feature: Feature;\n readonly highlightOptions?: HighlightOptions;\n}\n\ninterface Data {\n readonly highlight?: Highlight;\n}\n\nexport class HighlightingInteraction extends BaseInteraction<HighlightingParameters, Data> {\n protected override startInteraction(parameters: HighlightingParameters): Data {\n const { feature, highlightOptions } = parameters;\n const geometry = feature.getGeometry();\n\n if (geometry != null) {\n const options = this.#getHighlightOptions(highlightOptions);\n const highlight = this.mapModel.highlights.add([geometry], options);\n return { highlight };\n } else {\n return {};\n }\n }\n\n protected override stopInteraction({ highlight }: Data): void {\n highlight?.destroy();\n }\n\n #getHighlightOptions(highlightOptions: HighlightOptions | undefined): HighlightOptions {\n return {\n ...highlightOptions,\n highlightStyle: {\n Point: HighlightingInteraction.#DEFAULT_POINT_HIGHLIGHT_STYLE,\n ...highlightOptions?.highlightStyle\n }\n };\n }\n\n static readonly #DEFAULT_POINT_HIGHLIGHT_STYLE = new Style({\n image: new Circle({\n stroke: new Stroke({\n color: \"cyan\",\n width: 4.0\n }),\n fill: new Fill({\n color: \"rgba(224,255,255,0.35)\"\n }),\n radius: 12.0\n })\n });\n}\n"],"names":[],"mappings":";;;AAiBO,MAAM,gCAAgC,eAAA,CAA8C;AAAA,EACpE,iBAAiB,UAAA,EAA0C;AAC1E,IAAA,MAAM,EAAE,OAAA,EAAS,gBAAA,EAAiB,GAAI,UAAA;AACtC,IAAA,MAAM,QAAA,GAAW,QAAQ,WAAA,EAAY;AAErC,IAAA,IAAI,YAAY,IAAA,EAAM;AAClB,MAAA,MAAM,OAAA,GAAU,IAAA,CAAK,oBAAA,CAAqB,gBAAgB,CAAA;AAC1D,MAAA,MAAM,SAAA,GAAY,KAAK,QAAA,CAAS,UAAA,CAAW,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;AAClE,MAAA,OAAO,EAAE,SAAA,EAAU;AAAA,IACvB,CAAA,MAAO;AACH,MAAA,OAAO,EAAC;AAAA,IACZ;AAAA,EACJ;AAAA,EAEmB,eAAA,CAAgB,EAAE,SAAA,EAAU,EAAe;AAC1D,IAAA,SAAA,EAAW,OAAA,EAAQ;AAAA,EACvB;AAAA,EAEA,qBAAqB,gBAAA,EAAkE;AACnF,IAAA,OAAO;AAAA,MACH,GAAG,gBAAA;AAAA,MACH,cAAA,EAAgB;AAAA,QACZ,OAAO,uBAAA,CAAwB,8BAAA;AAAA,QAC/B,GAAG,gBAAA,EAAkB;AAAA;AACzB,KACJ;AAAA,EACJ;AAAA,EAEA,OAAgB,8BAAA,GAAiC,IAAI,KAAA,CAAM;AAAA,IACvD,KAAA,EAAO,IAAI,MAAA,CAAO;AAAA,MACd,MAAA,EAAQ,IAAI,MAAA,CAAO;AAAA,QACf,KAAA,EAAO,MAAA;AAAA,QACP,KAAA,EAAO;AAAA,OACV,CAAA;AAAA,MACD,IAAA,EAAM,IAAI,IAAA,CAAK;AAAA,QACX,KAAA,EAAO;AAAA,OACV,CAAA;AAAA,MACD,MAAA,EAAQ;AAAA,KACX;AAAA,GACJ,CAAA;AACL;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseInteraction } from "./BaseInteraction";
|
|
2
1
|
import { type DrawingState } from "../useGeometryEditing";
|
|
2
|
+
import { BaseInteraction } from "./BaseInteraction";
|
|
3
3
|
interface KeyboardParameters {
|
|
4
4
|
readonly actions: DrawingState;
|
|
5
5
|
}
|
|
@@ -8,12 +8,8 @@ interface KeyboardData {
|
|
|
8
8
|
}
|
|
9
9
|
type KeyboardListener = Parameters<typeof document.addEventListener<"keydown">>[1];
|
|
10
10
|
export declare class KeyboardInteraction extends BaseInteraction<KeyboardParameters, KeyboardData> {
|
|
11
|
+
#private;
|
|
11
12
|
protected startInteraction({ actions }: KeyboardParameters): KeyboardData;
|
|
12
13
|
protected stopInteraction({ keyboardListener }: KeyboardData): void;
|
|
13
|
-
private addKeyboardListener;
|
|
14
|
-
private matchesShortcut;
|
|
15
|
-
private isApplePlatform;
|
|
16
|
-
private getPlatform;
|
|
17
|
-
private static readonly APPLE_REGEX;
|
|
18
14
|
}
|
|
19
15
|
export {};
|