@geode/opengeodeweb-front 10.44.0-rc.2 → 10.44.0-rc.4
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/.build/server/utils/cleanup.js +7 -2
- package/.build/server/utils/microservices.js +9 -81
- package/.build/server/utils/microservices_process.js +85 -0
- package/.build/server/utils/typed_handler.js +5 -1
- package/.build/server/utils/ws_client.js +7 -2
- package/.build/shared/utils/fetch_raw.js +2 -2
- package/.build/shared/utils/parse_boolean.js +2 -1
- package/app/components/ClippingPlanes.vue +22 -78
- package/app/components/DragAndDrop.vue +16 -79
- package/app/components/FileSelector.vue +9 -6
- package/app/components/HybridViewerTooltip.vue +8 -2
- package/app/components/MissingFilesSelector.vue +10 -6
- package/app/components/ObjectSelector.vue +6 -3
- package/app/components/Screenshot.vue +9 -2
- package/app/components/ThresholdCard.vue +205 -0
- package/app/components/ThresholdFilter.vue +81 -216
- package/app/components/ViewToolbar.vue +15 -231
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +228 -0
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +234 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +7 -5
- package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
- package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -292
- package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
- package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
- package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
- package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +12 -10
- package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +12 -10
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +9 -5
- package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
- package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
- package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
- package/app/components/Viewer/Options/ColorPicker.vue +4 -1
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
- package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
- package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
- package/app/components/Viewer/Surface/PolygonsColoring.vue +231 -0
- package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
- package/app/components/csv-preview/CsvPreviewer.vue +4 -1
- package/app/composables/attribute_coloring_style.ts +8 -2
- package/app/composables/attribute_selector.ts +126 -0
- package/app/composables/clipping_slices.ts +166 -0
- package/app/composables/global_attribute_style.ts +4 -3
- package/app/composables/hover_highlight.ts +6 -5
- package/app/composables/project_manager.ts +5 -5
- package/app/composables/stepper_tree.ts +10 -2
- package/app/composables/tree_filter.ts +11 -2
- package/app/composables/tree_keyboard_nav.ts +4 -2
- package/app/composables/use_overlapping_picker.ts +5 -5
- package/app/composables/view_toolbar_options.ts +126 -0
- package/app/composables/view_toolbar_tool_options.ts +115 -0
- package/app/composables/view_toolbar_tools.ts +108 -0
- package/app/composables/virtual_tree.ts +20 -131
- package/app/composables/virtual_tree_flatten.ts +86 -0
- package/app/composables/virtual_tree_types.ts +81 -0
- package/app/stores/app.ts +8 -55
- package/app/stores/app_helpers/extension.ts +1 -1
- package/app/stores/app_helpers/registry.ts +69 -0
- package/app/stores/feedback.ts +2 -2
- package/app/stores/hybrid_viewer.ts +1 -1
- package/app/stores/menu.ts +1 -124
- package/app/stores/menu_helpers/menus_data.ts +127 -0
- package/app/stores/treeview.ts +17 -10
- package/app/stores/viewer.ts +17 -78
- package/app/stores/viewer_helpers/actions.ts +68 -0
- package/app/stores/viewer_helpers/request.ts +61 -0
- package/app/utils/clipping_planes.ts +4 -131
- package/app/utils/clipping_planes_scene.ts +131 -0
- package/app/utils/coloring_styles.ts +101 -0
- package/app/utils/default_styles/mesh_components.ts +168 -0
- package/app/utils/default_styles/meshes.ts +13 -153
- package/app/utils/default_styles/model_components.ts +170 -0
- package/app/utils/default_styles/models.ts +16 -153
- package/app/utils/drag_and_drop.ts +80 -0
- package/app/utils/extension.ts +1 -1
- package/app/utils/import_workflow.ts +6 -4
- package/app/utils/model_component_coloring.ts +46 -0
- package/app/utils/threshold.ts +33 -0
- package/app/utils/threshold_sources.ts +51 -0
- package/app/utils/upload_path.ts +15 -9
- package/internal/database/database.ts +4 -1
- package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
- package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
- package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
- package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
- package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
- package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
- package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
- package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/blocks/index.ts +12 -140
- package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
- package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
- package/internal/stores/data_style/model/common.ts +10 -119
- package/internal/stores/data_style/model/common_mutations.ts +184 -0
- package/internal/stores/data_style/model/corners/vertex.ts +14 -10
- package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
- package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/lines/edge.ts +14 -10
- package/internal/stores/data_style/model/lines/index.ts +10 -134
- package/internal/stores/data_style/model/lines/vertex.ts +14 -10
- package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
- package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/surfaces/index.ts +16 -160
- package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
- package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
- package/internal/stores/data_style/model/visibility.ts +3 -156
- package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
- package/internal/stores/data_style/state.ts +1 -181
- package/internal/stores/data_style/state_shared.ts +191 -0
- package/internal/stores/hybrid_viewer/brightness.ts +8 -2
- package/internal/stores/hybrid_viewer/camera.ts +7 -161
- package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
- package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
- package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
- package/internal/stores/hybrid_viewer/filters.ts +54 -11
- package/internal/stores/hybrid_viewer/highlight.ts +10 -9
- package/internal/stores/hybrid_viewer/ruler.ts +4 -3
- package/internal/utils/ws_client.ts +8 -1
- package/package.json +2 -2
- package/server/api/local/extensions/run.post.ts +6 -4
- package/server/utils/cleanup.ts +12 -2
- package/server/utils/microservices.ts +10 -102
- package/server/utils/microservices_process.ts +127 -0
- package/server/utils/typed_handler.ts +8 -1
- package/server/utils/ws_client.ts +15 -2
- package/shared/utils/fetch_raw.ts +2 -2
- package/shared/utils/parse_boolean.ts +4 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_SLICE_AXIS,
|
|
3
|
+
SLICE_AXES,
|
|
4
|
+
type SliceAxis,
|
|
5
|
+
areAllGrids,
|
|
6
|
+
} from "@ogw_front/utils/slice";
|
|
7
|
+
import type { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
8
|
+
|
|
9
|
+
interface Slice {
|
|
10
|
+
id: number;
|
|
11
|
+
axis: SliceAxis;
|
|
12
|
+
index: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface SliceList {
|
|
16
|
+
sliceEnabled: Ref<boolean>;
|
|
17
|
+
slices: Ref<Slice[]>;
|
|
18
|
+
addSlice: () => void;
|
|
19
|
+
removeSlice: (index: number) => void;
|
|
20
|
+
resetSlices: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface SliceSyncParams {
|
|
24
|
+
slices: Ref<Slice[]>;
|
|
25
|
+
sliceMaxIndices: Ref<[number, number, number]>;
|
|
26
|
+
isAllGrid: ComputedRef<boolean>;
|
|
27
|
+
isSliceActive: ComputedRef<boolean>;
|
|
28
|
+
targetIds: ComputedRef<string[]>;
|
|
29
|
+
getUntargetedIds: () => string[];
|
|
30
|
+
hybridViewerStore: ReturnType<typeof useHybridViewerStore>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface ClippingSlicesParams {
|
|
34
|
+
allItems: ComputedRef<{ id: string; geode_object_type: string }[]>;
|
|
35
|
+
targetIds: ComputedRef<string[]>;
|
|
36
|
+
getUntargetedIds: () => string[];
|
|
37
|
+
newItemId: () => number;
|
|
38
|
+
hybridViewerStore: ReturnType<typeof useHybridViewerStore>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface ClippingSlices extends SliceList {
|
|
42
|
+
sliceMaxIndices: Ref<[number, number, number]>;
|
|
43
|
+
isAllGrid: ComputedRef<boolean>;
|
|
44
|
+
isSliceActive: ComputedRef<boolean>;
|
|
45
|
+
applySlices: () => Promise<void>;
|
|
46
|
+
removeSlices: (allIds: string[]) => Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function useSliceList(newItemId: () => number): SliceList {
|
|
50
|
+
const sliceEnabled = ref<boolean>(false);
|
|
51
|
+
const slices = ref<Slice[]>([{ id: newItemId(), axis: DEFAULT_SLICE_AXIS, index: 0 }]);
|
|
52
|
+
|
|
53
|
+
function addSlice(): void {
|
|
54
|
+
const lastSlice = slices.value.at(-1);
|
|
55
|
+
slices.value.push({
|
|
56
|
+
id: newItemId(),
|
|
57
|
+
axis: lastSlice ? SLICE_AXES[lastSlice.axis].next : DEFAULT_SLICE_AXIS,
|
|
58
|
+
index: 0,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function removeSlice(index: number): void {
|
|
63
|
+
slices.value.splice(index, 1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function resetSlices(): void {
|
|
67
|
+
sliceEnabled.value = false;
|
|
68
|
+
slices.value = [{ id: newItemId(), axis: DEFAULT_SLICE_AXIS, index: 0 }];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return { sliceEnabled, slices, addSlice, removeSlice, resetSlices };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Runs the tasks one after the other, whatever the outcome of the previous one
|
|
75
|
+
function createSliceQueue(): (task: () => Promise<void>) => Promise<void> {
|
|
76
|
+
let pendingSlices: Promise<void> = Promise.resolve();
|
|
77
|
+
|
|
78
|
+
return async (task) => {
|
|
79
|
+
const previous = pendingSlices;
|
|
80
|
+
pendingSlices = (async (): Promise<void> => {
|
|
81
|
+
await Promise.allSettled([previous]);
|
|
82
|
+
await task();
|
|
83
|
+
})();
|
|
84
|
+
await pendingSlices;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function useSliceSync(params: SliceSyncParams): {
|
|
89
|
+
applySlices: () => Promise<void>;
|
|
90
|
+
removeSlices: (allIds: string[]) => Promise<void>;
|
|
91
|
+
} {
|
|
92
|
+
const { slices, sliceMaxIndices, isAllGrid, isSliceActive, targetIds, hybridViewerStore } =
|
|
93
|
+
params;
|
|
94
|
+
const queueSliceTask = createSliceQueue();
|
|
95
|
+
let areSlicesApplied = false;
|
|
96
|
+
|
|
97
|
+
function getSlicesPayload(isActive: boolean): { axis: SliceAxis; index: number }[] {
|
|
98
|
+
if (!isActive) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
return slices.value.map(({ axis, index }) => ({ axis, index }));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function sendSlices(): Promise<void> {
|
|
105
|
+
if (!isAllGrid.value && !areSlicesApplied) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const isActive = isSliceActive.value;
|
|
109
|
+
const untargetedIds = params.getUntargetedIds();
|
|
110
|
+
if (targetIds.value.length > 0) {
|
|
111
|
+
const maxIndices = await hybridViewerStore.setSlice(
|
|
112
|
+
targetIds.value,
|
|
113
|
+
getSlicesPayload(isActive),
|
|
114
|
+
);
|
|
115
|
+
if (isAllGrid.value) {
|
|
116
|
+
sliceMaxIndices.value = maxIndices;
|
|
117
|
+
}
|
|
118
|
+
if (isActive) {
|
|
119
|
+
for (const slice of slices.value) {
|
|
120
|
+
slice.index = Math.min(slice.index, maxIndices[slice.axis]);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (areSlicesApplied && untargetedIds.length > 0) {
|
|
125
|
+
await hybridViewerStore.setSlice(untargetedIds, []);
|
|
126
|
+
}
|
|
127
|
+
areSlicesApplied = isActive;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async function applySlices(): Promise<void> {
|
|
131
|
+
await queueSliceTask(sendSlices);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function removeSlices(allIds: string[]): Promise<void> {
|
|
135
|
+
await queueSliceTask(async () => {
|
|
136
|
+
if (areSlicesApplied) {
|
|
137
|
+
await hybridViewerStore.setSlice(allIds, []);
|
|
138
|
+
areSlicesApplied = false;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return { applySlices, removeSlices };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// The slices applied to the targeted grids
|
|
147
|
+
function useClippingSlices(params: ClippingSlicesParams): ClippingSlices {
|
|
148
|
+
const { allItems, targetIds, getUntargetedIds, newItemId, hybridViewerStore } = params;
|
|
149
|
+
const list = useSliceList(newItemId);
|
|
150
|
+
const sliceMaxIndices = ref<[number, number, number]>([0, 0, 0]);
|
|
151
|
+
const isAllGrid = computed<boolean>(() => areAllGrids(allItems.value, targetIds.value));
|
|
152
|
+
const isSliceActive = computed<boolean>(() => isAllGrid.value && list.sliceEnabled.value);
|
|
153
|
+
const sync = useSliceSync({
|
|
154
|
+
slices: list.slices,
|
|
155
|
+
sliceMaxIndices,
|
|
156
|
+
isAllGrid,
|
|
157
|
+
isSliceActive,
|
|
158
|
+
targetIds,
|
|
159
|
+
getUntargetedIds,
|
|
160
|
+
hybridViewerStore,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
return { ...list, ...sync, sliceMaxIndices, isAllGrid, isSliceActive };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export { useClippingSlices };
|
|
@@ -61,9 +61,10 @@ export function useGlobalAttributeStyle(
|
|
|
61
61
|
return MESH_ELEMENTS.flatMap((element) => {
|
|
62
62
|
const coloring: unknown = style[element.styleKey]?.coloring;
|
|
63
63
|
const activeColoring = isColoring(coloring) ? coloring.active : undefined;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
if (activeColoring !== undefined && ATTRIBUTE_COLORINGS.has(activeColoring)) {
|
|
65
|
+
return [meshColoring(dataId, element, activeColoring)];
|
|
66
|
+
}
|
|
67
|
+
return [];
|
|
67
68
|
});
|
|
68
69
|
});
|
|
69
70
|
|
|
@@ -40,11 +40,12 @@ export function useHoverhighlight(): {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
let block_ids: number[] = [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
let block_ids: number[] = [];
|
|
44
|
+
if (typeof block_ids_provider === "function") {
|
|
45
|
+
block_ids = [...(await block_ids_provider())];
|
|
46
|
+
} else {
|
|
47
|
+
block_ids = [...block_ids_provider];
|
|
48
|
+
}
|
|
48
49
|
|
|
49
50
|
block_ids = (Array.isArray(block_ids) ? block_ids : [])
|
|
50
51
|
.map((blockId) => Math.trunc(blockId))
|
|
@@ -118,11 +118,11 @@ async function importProject(file: File): Promise<void> {
|
|
|
118
118
|
// After every data item is added: on partial data the project CRS would follow them.
|
|
119
119
|
// A project saved without a project CRS takes the one of its oldest data, read in the
|
|
120
120
|
// Snapshot: the stored items carry the import time as creation date
|
|
121
|
-
|
|
122
|
-
snapshot.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
if (snapshot.crs?.projectCrs === undefined) {
|
|
122
|
+
crsStore.importStores({ projectCrs: oldestCrs(snapshot.data?.items ?? []) });
|
|
123
|
+
} else {
|
|
124
|
+
crsStore.importStores(snapshot.crs);
|
|
125
|
+
}
|
|
126
126
|
await hybridViewerStore.importStores(snapshot.hybridViewer);
|
|
127
127
|
if (snapshot.dataStyle !== undefined) {
|
|
128
128
|
await dataStyleStore.importStores(snapshot.dataStyle);
|
|
@@ -21,7 +21,11 @@ function build_initial_state_unref(
|
|
|
21
21
|
const initial_state_unref: Record<string, unknown> = {};
|
|
22
22
|
for (const [key, value] of Object.entries(initial_state)) {
|
|
23
23
|
const unref_val: unknown = unref(value);
|
|
24
|
-
|
|
24
|
+
if (isUnknownArray(unref_val)) {
|
|
25
|
+
initial_state_unref[key] = [...unref_val];
|
|
26
|
+
} else {
|
|
27
|
+
initial_state_unref[key] = unref_val;
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
return initial_state_unref;
|
|
27
31
|
}
|
|
@@ -65,7 +69,11 @@ export function useStepperTree(
|
|
|
65
69
|
state.current_step_index = 0;
|
|
66
70
|
state.navigating_back = false;
|
|
67
71
|
for (const [key, initial_val] of Object.entries(initial_state_unref)) {
|
|
68
|
-
|
|
72
|
+
if (isUnknownArray(initial_val)) {
|
|
73
|
+
state[key] = [...initial_val];
|
|
74
|
+
} else {
|
|
75
|
+
state[key] = initial_val;
|
|
76
|
+
}
|
|
69
77
|
}
|
|
70
78
|
}
|
|
71
79
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Ref } from "vue";
|
|
1
|
+
import type { ComputedRef, Ref } from "vue";
|
|
2
2
|
|
|
3
3
|
// Same shape as Vue's MaybeRefOrGetter<T>, kept as a local alias for readability at call sites.
|
|
4
4
|
type ReadonlyMaybeRefOrGetter<Value> = Value | Ref<Value> | (() => Value);
|
|
@@ -98,11 +98,20 @@ function sortAndFormatItems(
|
|
|
98
98
|
return sorted;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
function toItemsRef(
|
|
102
|
+
itemsIn: ReadonlyMaybeRefOrGetter<readonly FilterableItem[]>,
|
|
103
|
+
): ComputedRef<readonly FilterableItem[]> | Ref<readonly FilterableItem[]> {
|
|
104
|
+
if (typeof itemsIn === "function") {
|
|
105
|
+
return computed(itemsIn);
|
|
106
|
+
}
|
|
107
|
+
return toRef(itemsIn);
|
|
108
|
+
}
|
|
109
|
+
|
|
101
110
|
function useTreeFilter(
|
|
102
111
|
itemsIn: ReadonlyMaybeRefOrGetter<readonly FilterableItem[]>,
|
|
103
112
|
options: TreeFilterOptions = {},
|
|
104
113
|
): UseTreeFilterReturn {
|
|
105
|
-
const rawItems =
|
|
114
|
+
const rawItems = toItemsRef(itemsIn);
|
|
106
115
|
const search = ref("");
|
|
107
116
|
const sortType = ref(options.defaultSort ?? "name");
|
|
108
117
|
const filterOptions = ref<Record<string, boolean>>({ ...options.defaultFilters });
|
|
@@ -82,8 +82,10 @@ export function useTreeKeyboardNav(
|
|
|
82
82
|
return undefined;
|
|
83
83
|
}
|
|
84
84
|
const firstVisible = Math.max(0, Math.floor(info.scrollTop / info.itemHeight));
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
let visibleCount = 1;
|
|
86
|
+
if (info.containerHeight > 0) {
|
|
87
|
+
visibleCount = Math.floor(info.containerHeight / info.itemHeight);
|
|
88
|
+
}
|
|
87
89
|
const lastVisible = Math.max(firstVisible, firstVisible + visibleCount - 1);
|
|
88
90
|
return { firstVisible, lastVisible };
|
|
89
91
|
}
|
|
@@ -172,11 +172,11 @@ export function useOverlappingPicker(): UseOverlappingPickerReturn {
|
|
|
172
172
|
return new Promise<ViewerIdResult>((resolve) => {
|
|
173
173
|
resolveIntermediate = (chosenResult: ProposedItem | undefined): void => {
|
|
174
174
|
displayIntermediate.value = false;
|
|
175
|
-
|
|
176
|
-
chosenResult
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
if (chosenResult) {
|
|
176
|
+
resolve({ id: chosenResult.id, viewer_id: chosenResult.viewer_id });
|
|
177
|
+
} else {
|
|
178
|
+
resolve({ id: undefined, viewer_id: undefined });
|
|
179
|
+
}
|
|
180
180
|
};
|
|
181
181
|
});
|
|
182
182
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CameraOptionAction,
|
|
3
|
+
controlOptions,
|
|
4
|
+
filterOptions,
|
|
5
|
+
panelOptions,
|
|
6
|
+
rulerOption,
|
|
7
|
+
} from "@ogw_front/composables/view_toolbar_tool_options";
|
|
8
|
+
import type { ViewToolbarTools } from "@ogw_front/composables/view_toolbar_tools";
|
|
9
|
+
import schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
10
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
12
|
+
|
|
13
|
+
type HybridViewerStore = ReturnType<typeof useHybridViewerStore>;
|
|
14
|
+
|
|
15
|
+
function pickingOptions(
|
|
16
|
+
hybridViewerStore: HybridViewerStore,
|
|
17
|
+
tools: ViewToolbarTools,
|
|
18
|
+
): CameraOptionAction[] {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
testId: "resetCameraButton",
|
|
22
|
+
tooltip: "Reset camera",
|
|
23
|
+
icon: "mdi-cube-scan",
|
|
24
|
+
action: (): void => {
|
|
25
|
+
hybridViewerStore.resetCamera();
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
testId: "centerOnClickButton",
|
|
30
|
+
tooltip: "Center on click",
|
|
31
|
+
icon: "mdi-crosshairs-question",
|
|
32
|
+
color: hybridViewerStore.is_picking ? "primary" : undefined,
|
|
33
|
+
action: (): void => {
|
|
34
|
+
tools.toggleTool(tools.is_picking);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
testId: "zoomToBoxButton",
|
|
39
|
+
tooltip: "Zoom to box",
|
|
40
|
+
icon: "mdi-magnify-scan",
|
|
41
|
+
color: hybridViewerStore.is_zoom_box_active ? "primary" : undefined,
|
|
42
|
+
action: (): void => {
|
|
43
|
+
tools.toggleTool(tools.is_zoom_box_active);
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function hoverHighlightOption(
|
|
50
|
+
hybridViewerStore: HybridViewerStore,
|
|
51
|
+
tools: ViewToolbarTools,
|
|
52
|
+
): CameraOptionAction {
|
|
53
|
+
return {
|
|
54
|
+
testId: "highlightOnHoverButton",
|
|
55
|
+
tooltip: "Highlight on hover",
|
|
56
|
+
icon: "mdi-cursor-default-click",
|
|
57
|
+
color: hybridViewerStore.is_hover_highlight ? "primary" : undefined,
|
|
58
|
+
action: hybridViewerStore.is_hover_highlight ? tools.stopHoverHighlight : undefined,
|
|
59
|
+
menu: [
|
|
60
|
+
{
|
|
61
|
+
title: "Cells",
|
|
62
|
+
testId: "highlightOnHoverCellsButton",
|
|
63
|
+
icon: "mdi-select-all",
|
|
64
|
+
action: (): void => {
|
|
65
|
+
tools.toggleHoverHighlight("CELL");
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: "Points",
|
|
70
|
+
testId: "highlightOnHoverPointsButton",
|
|
71
|
+
icon: "mdi-select-drag",
|
|
72
|
+
action: (): void => {
|
|
73
|
+
tools.toggleHoverHighlight("POINT");
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function gridScaleOption(
|
|
81
|
+
hybridViewerStore: HybridViewerStore,
|
|
82
|
+
viewerStore: ReturnType<typeof useViewerStore>,
|
|
83
|
+
gridScale: Ref<boolean>,
|
|
84
|
+
): CameraOptionAction {
|
|
85
|
+
return {
|
|
86
|
+
testId: "gridScaleButton",
|
|
87
|
+
tooltip: "Toggle grid scale",
|
|
88
|
+
icon: "mdi-ruler-square",
|
|
89
|
+
color: gridScale.value ? "primary" : undefined,
|
|
90
|
+
action: (): void => {
|
|
91
|
+
const schema = schemas.opengeodeweb_viewer.viewer.grid_scale;
|
|
92
|
+
const params = { visibility: !gridScale.value };
|
|
93
|
+
void viewerStore.request(
|
|
94
|
+
{
|
|
95
|
+
schema,
|
|
96
|
+
params,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
response_function: () => {
|
|
100
|
+
gridScale.value = !gridScale.value;
|
|
101
|
+
void hybridViewerStore.remoteRender();
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// The buttons of the view toolbar
|
|
110
|
+
function useViewToolbarOptions(tools: ViewToolbarTools): ComputedRef<CameraOptionAction[]> {
|
|
111
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
112
|
+
const viewerStore = useViewerStore();
|
|
113
|
+
const gridScale = ref<boolean>(false);
|
|
114
|
+
|
|
115
|
+
return computed<CameraOptionAction[]>(() => [
|
|
116
|
+
...pickingOptions(hybridViewerStore, tools),
|
|
117
|
+
hoverHighlightOption(hybridViewerStore, tools),
|
|
118
|
+
...panelOptions(tools),
|
|
119
|
+
gridScaleOption(hybridViewerStore, viewerStore, gridScale),
|
|
120
|
+
...controlOptions(tools),
|
|
121
|
+
...filterOptions(tools),
|
|
122
|
+
rulerOption(tools),
|
|
123
|
+
]);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { useViewToolbarOptions };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import CameraBookmarkIcon from "@ogw_front/assets/viewer_svgs/camera-bookmark.svg";
|
|
2
|
+
import type { ViewToolbarTools } from "@ogw_front/composables/view_toolbar_tools";
|
|
3
|
+
|
|
4
|
+
interface CameraOptionAction {
|
|
5
|
+
title?: string;
|
|
6
|
+
testId: string;
|
|
7
|
+
tooltip?: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
iconSize?: number;
|
|
10
|
+
color?: string;
|
|
11
|
+
action?: () => void;
|
|
12
|
+
menu?: CameraOptionAction[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// The buttons opening a panel
|
|
16
|
+
function panelOptions(tools: ViewToolbarTools): CameraOptionAction[] {
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
testId: "cameraOrientationButton",
|
|
20
|
+
tooltip: "Camera orientation",
|
|
21
|
+
icon: "mdi-rotate-3d",
|
|
22
|
+
action: (): void => {
|
|
23
|
+
tools.toggleTool(tools.showCameraOrientation);
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
testId: "cameraManagerButton",
|
|
28
|
+
tooltip: "Manage camera positions",
|
|
29
|
+
icon: CameraBookmarkIcon,
|
|
30
|
+
iconSize: 34,
|
|
31
|
+
action: (): void => {
|
|
32
|
+
tools.toggleTool(tools.showCameraManager);
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
testId: "screenshotButton",
|
|
37
|
+
tooltip: "Take a screenshot",
|
|
38
|
+
icon: "mdi-camera",
|
|
39
|
+
action: (): void => {
|
|
40
|
+
tools.toggleTool(tools.showScreenshot);
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// The buttons opening the scene controls
|
|
47
|
+
function controlOptions(tools: ViewToolbarTools): CameraOptionAction[] {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
testId: "zScalingButton",
|
|
51
|
+
tooltip: "Z Scaling Control",
|
|
52
|
+
icon: "mdi-sort",
|
|
53
|
+
action: (): void => {
|
|
54
|
+
tools.toggleTool(tools.showZScaling);
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
testId: "clippingPlanesButton",
|
|
59
|
+
tooltip: "Clipping Planes",
|
|
60
|
+
icon: "mdi-content-cut",
|
|
61
|
+
color: tools.showClippingPlanes.value ? "primary" : undefined,
|
|
62
|
+
action: (): void => {
|
|
63
|
+
tools.toggleTool(tools.showClippingPlanes);
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// The buttons opening the filters
|
|
70
|
+
function filterOptions(tools: ViewToolbarTools): CameraOptionAction[] {
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
testId: "shrinkFilterButton",
|
|
74
|
+
tooltip: "Shrink Filter",
|
|
75
|
+
icon: "mdi-arrow-collapse-all",
|
|
76
|
+
color: tools.showShrinkFilter.value ? "primary" : undefined,
|
|
77
|
+
action: (): void => {
|
|
78
|
+
tools.toggleTool(tools.showShrinkFilter);
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
testId: "explodeFilterButton",
|
|
83
|
+
tooltip: "Exploded View",
|
|
84
|
+
icon: "mdi-arrow-expand-all",
|
|
85
|
+
color: tools.showExplodeFilter.value ? "primary" : undefined,
|
|
86
|
+
action: (): void => {
|
|
87
|
+
tools.toggleTool(tools.showExplodeFilter);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
testId: "thresholdFilterButton",
|
|
92
|
+
tooltip: "Threshold Filter",
|
|
93
|
+
icon: "mdi-filter-variant",
|
|
94
|
+
color: tools.showThresholdFilter.value ? "primary" : undefined,
|
|
95
|
+
action: (): void => {
|
|
96
|
+
tools.toggleTool(tools.showThresholdFilter);
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function rulerOption(tools: ViewToolbarTools): CameraOptionAction {
|
|
103
|
+
return {
|
|
104
|
+
testId: "rulerButton",
|
|
105
|
+
tooltip: "Ruler",
|
|
106
|
+
icon: "mdi-ruler",
|
|
107
|
+
color: tools.showRuler.value ? "primary" : undefined,
|
|
108
|
+
action: (): void => {
|
|
109
|
+
tools.toggleTool(tools.showRuler);
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { controlOptions, filterOptions, panelOptions, rulerOption };
|
|
115
|
+
export type { CameraOptionAction };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { PickedFieldType } from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
2
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
3
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
4
|
+
|
|
5
|
+
interface ToolRefs {
|
|
6
|
+
showScreenshot: Ref<boolean>;
|
|
7
|
+
showCameraManager: Ref<boolean>;
|
|
8
|
+
showCameraOrientation: Ref<boolean>;
|
|
9
|
+
showZScaling: Ref<boolean>;
|
|
10
|
+
showClippingPlanes: Ref<boolean>;
|
|
11
|
+
showShrinkFilter: Ref<boolean>;
|
|
12
|
+
showExplodeFilter: Ref<boolean>;
|
|
13
|
+
showThresholdFilter: Ref<boolean>;
|
|
14
|
+
showRuler: Ref<boolean>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ViewToolbarTools extends ToolRefs {
|
|
18
|
+
is_picking: Ref<boolean>;
|
|
19
|
+
is_zoom_box_active: Ref<boolean>;
|
|
20
|
+
stopHoverHighlight: () => void;
|
|
21
|
+
toggleTool: (toolRef: Ref<boolean>) => void;
|
|
22
|
+
toggleHoverHighlight: (fieldType: PickedFieldType) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function createToolRefs(): ToolRefs {
|
|
26
|
+
return {
|
|
27
|
+
showScreenshot: ref<boolean>(false),
|
|
28
|
+
showCameraManager: ref<boolean>(false),
|
|
29
|
+
showCameraOrientation: ref<boolean>(false),
|
|
30
|
+
showZScaling: ref<boolean>(false),
|
|
31
|
+
showClippingPlanes: ref<boolean>(false),
|
|
32
|
+
showShrinkFilter: ref<boolean>(false),
|
|
33
|
+
showExplodeFilter: ref<boolean>(false),
|
|
34
|
+
showThresholdFilter: ref<boolean>(false),
|
|
35
|
+
showRuler: ref<boolean>(false),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function exclusiveTools(toolRefs: ToolRefs, pickingTools: Ref<boolean>[]): Ref<boolean>[] {
|
|
40
|
+
return [
|
|
41
|
+
toolRefs.showCameraOrientation,
|
|
42
|
+
toolRefs.showCameraManager,
|
|
43
|
+
toolRefs.showScreenshot,
|
|
44
|
+
toolRefs.showZScaling,
|
|
45
|
+
toolRefs.showClippingPlanes,
|
|
46
|
+
toolRefs.showShrinkFilter,
|
|
47
|
+
toolRefs.showExplodeFilter,
|
|
48
|
+
toolRefs.showThresholdFilter,
|
|
49
|
+
toolRefs.showRuler,
|
|
50
|
+
...pickingTools,
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// The toolbar tools are exclusive: opening one closes the others
|
|
55
|
+
function useViewToolbarTools(): ViewToolbarTools {
|
|
56
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
57
|
+
const viewerStore = useViewerStore();
|
|
58
|
+
const { is_picking, is_zoom_box_active } = storeToRefs(hybridViewerStore);
|
|
59
|
+
const { picking_mode } = storeToRefs(viewerStore);
|
|
60
|
+
const toolRefs = createToolRefs();
|
|
61
|
+
const allTools = exclusiveTools(toolRefs, [is_picking, is_zoom_box_active, picking_mode]);
|
|
62
|
+
|
|
63
|
+
function stopHoverHighlight(): void {
|
|
64
|
+
hybridViewerStore.is_hover_highlight = false;
|
|
65
|
+
hybridViewerStore.clearHoverHighlight();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function closeAllToolsExcept(toolRef: Ref<boolean>): void {
|
|
69
|
+
for (const tool of allTools) {
|
|
70
|
+
if (tool !== toolRef) {
|
|
71
|
+
tool.value = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (toolRef !== toolRefs.showRuler) {
|
|
75
|
+
void nextTick(stopHoverHighlight);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function toggleTool(toolRef: Ref<boolean>): void {
|
|
80
|
+
closeAllToolsExcept(toolRef);
|
|
81
|
+
toolRef.value = !toolRef.value;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function toggleHoverHighlight(fieldType: PickedFieldType): void {
|
|
85
|
+
const activate =
|
|
86
|
+
!hybridViewerStore.is_hover_highlight ||
|
|
87
|
+
hybridViewerStore.hover_highlight_field_type !== fieldType;
|
|
88
|
+
closeAllToolsExcept(toolRefs.showRuler);
|
|
89
|
+
if (activate) {
|
|
90
|
+
hybridViewerStore.is_hover_highlight = true;
|
|
91
|
+
hybridViewerStore.hover_highlight_field_type = fieldType;
|
|
92
|
+
} else {
|
|
93
|
+
stopHoverHighlight();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
...toolRefs,
|
|
99
|
+
is_picking,
|
|
100
|
+
is_zoom_box_active,
|
|
101
|
+
stopHoverHighlight,
|
|
102
|
+
toggleTool,
|
|
103
|
+
toggleHoverHighlight,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { useViewToolbarTools };
|
|
108
|
+
export type { ViewToolbarTools };
|