@geode/opengeodeweb-front 10.18.1 → 10.18.2
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/app/assets/{scientific_colormaps.json → colormaps.json} +1109 -1104
- package/app/components/CameraOrientation.vue +1 -1
- package/app/components/ViewToolbar.vue +79 -3
- package/app/components/Viewer/Options/ColorMapPicker.vue +3 -3
- package/app/composables/project_manager.js +79 -81
- package/app/stores/camera_manager.js +7 -6
- package/app/stores/data.js +22 -19
- package/app/stores/data_style.js +8 -4
- package/app/stores/hybrid_viewer.js +80 -100
- package/app/stores/viewer.js +1 -1
- package/app/utils/colormap.js +4 -5
- package/internal/stores/data_style/model/common.js +14 -13
- package/internal/stores/data_style/state.js +11 -7
- package/internal/stores/hybrid_viewer.js +159 -172
- package/internal/stores/hybrid_viewer_camera.js +220 -0
- package/package.json +1 -1
- package/tests/unit/composables/project_manager.nuxt.test.js +3 -6
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ACTOR_COLOR,
|
|
3
3
|
BACKGROUND_COLOR,
|
|
4
|
+
HOVER_THROTTLE_MS,
|
|
4
5
|
WHEEL_TIME_OUT_MS,
|
|
5
|
-
applySnapshot,
|
|
6
6
|
computeAverageBrightness,
|
|
7
|
+
performAddItem,
|
|
8
|
+
performClearHoverHighlight,
|
|
9
|
+
performClickPicking,
|
|
10
|
+
performHoverHighlight,
|
|
11
|
+
performSetContainer,
|
|
12
|
+
performSetZScaling,
|
|
13
|
+
} from "@ogw_internal/stores/hybrid_viewer";
|
|
14
|
+
import {
|
|
15
|
+
applySnapshot,
|
|
7
16
|
getCameraOptions,
|
|
8
17
|
performCameraOrientation,
|
|
9
|
-
performClickPicking,
|
|
10
18
|
performFocusCameraOnObject,
|
|
11
19
|
performSetCamera,
|
|
12
|
-
|
|
20
|
+
performSyncRemoteCamera,
|
|
21
|
+
} from "@ogw_internal/stores/hybrid_viewer_camera";
|
|
13
22
|
import { newInstance as vtkActor } from "@kitware/vtk.js/Rendering/Core/Actor";
|
|
14
23
|
import { newInstance as vtkGenericRenderWindow } from "@kitware/vtk.js/Rendering/Misc/GenericRenderWindow";
|
|
15
24
|
import { newInstance as vtkMapper } from "@kitware/vtk.js/Rendering/Core/Mapper";
|
|
@@ -30,6 +39,8 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
30
39
|
const status = ref(Status.NOT_CREATED);
|
|
31
40
|
const is_moving = ref(false);
|
|
32
41
|
const is_picking = ref(false);
|
|
42
|
+
const is_hover_highlight = ref(false);
|
|
43
|
+
const hover_highlight_field_type = ref("CELL");
|
|
33
44
|
const zScale = ref(1);
|
|
34
45
|
let imageStyle = undefined;
|
|
35
46
|
let viewStream = undefined;
|
|
@@ -83,25 +94,15 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
83
94
|
}
|
|
84
95
|
|
|
85
96
|
async function addItem(id) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
mapper.setInputData(polydata);
|
|
96
|
-
actor.getProperty().setColor(ACTOR_COLOR);
|
|
97
|
-
actor.setMapper(mapper);
|
|
98
|
-
const renderer = genericRenderWindow.value.getRenderer();
|
|
99
|
-
const isFirst = renderer.getActors().length === 0;
|
|
100
|
-
renderer.addActor(actor);
|
|
101
|
-
if (isFirst) {
|
|
102
|
-
renderer.resetCamera();
|
|
103
|
-
}
|
|
104
|
-
hybridDb[id] = { actor, polydata, mapper };
|
|
97
|
+
await performAddItem(id, {
|
|
98
|
+
genericRenderWindow: genericRenderWindow.value,
|
|
99
|
+
dataStore,
|
|
100
|
+
vtkXMLPolyDataReader,
|
|
101
|
+
vtkActor,
|
|
102
|
+
vtkMapper,
|
|
103
|
+
actorColor: ACTOR_COLOR,
|
|
104
|
+
hybridDb,
|
|
105
|
+
});
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
function removeItem(id) {
|
|
@@ -122,21 +123,14 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
async function setZScaling(z_scale) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
renderer.resetCamera();
|
|
134
|
-
genericRenderWindow.value.getRenderWindow().render();
|
|
135
|
-
const schema = viewer_schemas?.opengeodeweb_viewer?.viewer?.set_z_scaling;
|
|
136
|
-
if (schema) {
|
|
137
|
-
await viewerStore.request(schema, { z_scale });
|
|
138
|
-
}
|
|
139
|
-
remoteRender();
|
|
126
|
+
await performSetZScaling(z_scale, {
|
|
127
|
+
zScale,
|
|
128
|
+
genericRenderWindow: genericRenderWindow.value,
|
|
129
|
+
gridActor,
|
|
130
|
+
viewerStore,
|
|
131
|
+
viewer_schemas,
|
|
132
|
+
remoteRender,
|
|
133
|
+
});
|
|
140
134
|
}
|
|
141
135
|
|
|
142
136
|
function resetCamera() {
|
|
@@ -177,76 +171,59 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
177
171
|
}
|
|
178
172
|
|
|
179
173
|
function syncRemoteCamera() {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
viewer_schemas
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
remoteRender();
|
|
188
|
-
Object.assign(camera_options, options);
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
);
|
|
174
|
+
performSyncRemoteCamera({
|
|
175
|
+
genericRenderWindow: genericRenderWindow.value,
|
|
176
|
+
viewerStore,
|
|
177
|
+
viewer_schemas,
|
|
178
|
+
remoteRender,
|
|
179
|
+
camera_options,
|
|
180
|
+
});
|
|
192
181
|
}
|
|
193
182
|
|
|
194
183
|
function remoteRender() {
|
|
195
184
|
return viewerStore.request(viewer_schemas.opengeodeweb_viewer.viewer.render);
|
|
196
185
|
}
|
|
197
186
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
viewerStore,
|
|
218
|
-
viewer_schemas,
|
|
219
|
-
genericRenderWindow: genericRenderWindow.value,
|
|
220
|
-
syncRemoteCamera,
|
|
221
|
-
});
|
|
222
|
-
is_picking.value = false;
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
is_moving.value = true;
|
|
226
|
-
event.stopPropagation();
|
|
227
|
-
imageStyle.opacity = 0;
|
|
228
|
-
},
|
|
229
|
-
onReleased: () => {
|
|
230
|
-
if (is_moving.value) {
|
|
231
|
-
is_moving.value = false;
|
|
232
|
-
syncRemoteCamera();
|
|
233
|
-
}
|
|
234
|
-
is_moving.value = false;
|
|
235
|
-
genericRenderWindow.value.getRenderer().resetCameraClippingRange();
|
|
236
|
-
syncRemoteCamera();
|
|
237
|
-
},
|
|
187
|
+
const throttledHoverHighlight = useThrottleFn(
|
|
188
|
+
(event) =>
|
|
189
|
+
performHoverHighlight(event, {
|
|
190
|
+
is_hover_highlight,
|
|
191
|
+
genericRenderWindow: genericRenderWindow.value,
|
|
192
|
+
viewerStore,
|
|
193
|
+
viewer_schemas,
|
|
194
|
+
hover_highlight_field_type,
|
|
195
|
+
hybridDb,
|
|
196
|
+
}),
|
|
197
|
+
HOVER_THROTTLE_MS,
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
function clearHoverHighlight() {
|
|
201
|
+
performClearHoverHighlight({
|
|
202
|
+
viewerStore,
|
|
203
|
+
viewer_schemas,
|
|
204
|
+
hover_highlight_field_type,
|
|
205
|
+
hybridDb,
|
|
238
206
|
});
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function setContainer(container) {
|
|
210
|
+
performSetContainer({
|
|
211
|
+
container,
|
|
212
|
+
genericRenderWindow: genericRenderWindow.value,
|
|
213
|
+
imageStyleSetter: (style) => (imageStyle = style),
|
|
214
|
+
resize,
|
|
215
|
+
useMousePressed,
|
|
216
|
+
useEventListener,
|
|
217
|
+
is_picking,
|
|
218
|
+
is_moving,
|
|
219
|
+
clickPickingCallback: performClickPicking,
|
|
220
|
+
viewerStore,
|
|
221
|
+
viewer_schemas,
|
|
222
|
+
syncRemoteCamera,
|
|
223
|
+
throttledHoverHighlight,
|
|
224
|
+
wheelTimeoutMs: WHEEL_TIME_OUT_MS,
|
|
225
|
+
wheelEventEndTimeout,
|
|
226
|
+
wheelTimeoutSetter: (timeout) => (wheelEventEndTimeout = timeout),
|
|
250
227
|
});
|
|
251
228
|
}
|
|
252
229
|
|
|
@@ -317,6 +294,9 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
317
294
|
setContainer,
|
|
318
295
|
zScale,
|
|
319
296
|
is_picking,
|
|
297
|
+
is_hover_highlight,
|
|
298
|
+
hover_highlight_field_type,
|
|
299
|
+
clearHoverHighlight,
|
|
320
300
|
clear,
|
|
321
301
|
exportStores,
|
|
322
302
|
importStores,
|
package/app/stores/viewer.js
CHANGED
|
@@ -145,7 +145,7 @@ export const useViewerStore = defineStore(
|
|
|
145
145
|
return appStore.request(schema, params, {
|
|
146
146
|
response_function: (response) => {
|
|
147
147
|
console.log(`[VIEWER] Viewer launched on port ${response.port}`);
|
|
148
|
-
|
|
148
|
+
default_local_port.value = response.port;
|
|
149
149
|
},
|
|
150
150
|
});
|
|
151
151
|
}
|
package/app/utils/colormap.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import colormaps from "@ogw_front/assets/colormaps.json";
|
|
2
2
|
|
|
3
3
|
function getRGBPointsFromPreset(presetName) {
|
|
4
4
|
return (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
.find((preset) => preset.Name === presetName)?.RGBPoints ?? []
|
|
5
|
+
colormaps.flatMap((category) => category.Children).find((preset) => preset.Name === presetName)
|
|
6
|
+
?.RGBPoints ?? []
|
|
8
7
|
);
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
export { getRGBPointsFromPreset,
|
|
10
|
+
export { getRGBPointsFromPreset, colormaps };
|
|
@@ -3,31 +3,32 @@ import merge from "lodash/merge";
|
|
|
3
3
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
4
4
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
5
5
|
|
|
6
|
+
// oxlint-disable-next-line max-lines-per-function
|
|
6
7
|
export function useModelCommonStyle() {
|
|
7
8
|
const dataStore = useDataStore();
|
|
8
9
|
const viewerStore = useViewerStore();
|
|
10
|
+
const model_component_datastyle_db = database.model_component_datastyle;
|
|
11
|
+
const model_component_type_datastyle_db = database.model_component_type_datastyle;
|
|
9
12
|
|
|
10
13
|
async function mutateComponentStyle(id_model, id_component, values) {
|
|
11
|
-
const table = database.model_component_datastyle;
|
|
12
14
|
const key = [id_model, id_component];
|
|
13
|
-
const entry = (await
|
|
15
|
+
const entry = (await model_component_datastyle_db.get(key)) || { id_model, id_component };
|
|
14
16
|
merge(entry, values);
|
|
15
|
-
return
|
|
17
|
+
return model_component_datastyle_db.put(structuredClone(toRaw(entry)));
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
function mutateModelComponentTypeStyle(id_model, type, values) {
|
|
19
|
-
return database.transaction("rw",
|
|
20
|
-
const table = database.model_component_type_datastyle;
|
|
21
|
+
return database.transaction("rw", model_component_type_datastyle_db, async () => {
|
|
21
22
|
const key = [id_model, type];
|
|
22
|
-
const entry = (await
|
|
23
|
+
const entry = (await model_component_type_datastyle_db.get(key)) || { id_model, type };
|
|
23
24
|
merge(entry, values);
|
|
24
|
-
return
|
|
25
|
+
return model_component_type_datastyle_db.put(structuredClone(toRaw(entry)));
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
function mutateComponentStyles(id_model, id_components, values) {
|
|
29
|
-
return database.transaction("rw",
|
|
30
|
-
const all_styles = await
|
|
30
|
+
return database.transaction("rw", model_component_datastyle_db, async () => {
|
|
31
|
+
const all_styles = await model_component_datastyle_db
|
|
31
32
|
.where("id_model")
|
|
32
33
|
.equals(id_model)
|
|
33
34
|
.toArray();
|
|
@@ -43,14 +44,14 @@ export function useModelCommonStyle() {
|
|
|
43
44
|
return toRaw(style);
|
|
44
45
|
});
|
|
45
46
|
|
|
46
|
-
return
|
|
47
|
+
return model_component_datastyle_db.bulkPut(structuredClone(updates));
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
function bulkMutateComponentStylesPerComponent(id_model, component_updates) {
|
|
51
|
-
return database.transaction("rw",
|
|
52
|
+
return database.transaction("rw", model_component_datastyle_db, async () => {
|
|
52
53
|
const component_ids = new Set(component_updates.map((update) => update.id_component));
|
|
53
|
-
const all_styles = await
|
|
54
|
+
const all_styles = await model_component_datastyle_db
|
|
54
55
|
.where("id_model")
|
|
55
56
|
.equals(id_model)
|
|
56
57
|
.and((style) => component_ids.has(style.id_component))
|
|
@@ -61,7 +62,7 @@ export function useModelCommonStyle() {
|
|
|
61
62
|
merge(style, values);
|
|
62
63
|
return toRaw(style);
|
|
63
64
|
});
|
|
64
|
-
return
|
|
65
|
+
return model_component_datastyle_db.bulkPut(structuredClone(updates));
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -4,9 +4,13 @@ import merge from "lodash/merge";
|
|
|
4
4
|
import { useObservable } from "@vueuse/rxjs";
|
|
5
5
|
|
|
6
6
|
export function useDataStyleState() {
|
|
7
|
+
const data_style_db = database.data_style;
|
|
8
|
+
const model_component_datastyle_db = database.model_component_datastyle;
|
|
9
|
+
const model_component_type_datastyle_db = database.model_component_type_datastyle;
|
|
10
|
+
|
|
7
11
|
const styles = useObservable(
|
|
8
12
|
liveQuery(async () => {
|
|
9
|
-
const allStyles = await
|
|
13
|
+
const allStyles = await data_style_db.toArray();
|
|
10
14
|
const accumulator = {};
|
|
11
15
|
for (const style of allStyles) {
|
|
12
16
|
accumulator[style.id] = style;
|
|
@@ -35,7 +39,7 @@ export function useDataStyleState() {
|
|
|
35
39
|
|
|
36
40
|
const modelComponentTypeStyles = useObservable(
|
|
37
41
|
liveQuery(async () => {
|
|
38
|
-
const all = await
|
|
42
|
+
const all = await model_component_type_datastyle_db.toArray();
|
|
39
43
|
const accumulator = {};
|
|
40
44
|
for (const style of all) {
|
|
41
45
|
const key = `${style.id_model}_${style.type}`;
|
|
@@ -48,7 +52,7 @@ export function useDataStyleState() {
|
|
|
48
52
|
|
|
49
53
|
const componentStyles = useObservable(
|
|
50
54
|
liveQuery(async () => {
|
|
51
|
-
const all = await
|
|
55
|
+
const all = await model_component_datastyle_db.toArray();
|
|
52
56
|
const accumulator = {};
|
|
53
57
|
for (const style of all) {
|
|
54
58
|
const key = `${style.id_model}_${style.id_component}`;
|
|
@@ -66,7 +70,7 @@ export function useDataStyleState() {
|
|
|
66
70
|
function mutateStyle(id, values) {
|
|
67
71
|
const style = getStyle(id);
|
|
68
72
|
merge(style, values);
|
|
69
|
-
return
|
|
73
|
+
return data_style_db.put(structuredClone({ id, ...toRaw(style) }));
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
function getComponentStyle(id_model, id_component) {
|
|
@@ -81,9 +85,9 @@ export function useDataStyleState() {
|
|
|
81
85
|
|
|
82
86
|
function clear() {
|
|
83
87
|
return Promise.all([
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
data_style_db.clear(),
|
|
89
|
+
model_component_datastyle_db.clear(),
|
|
90
|
+
model_component_type_datastyle_db.clear(),
|
|
87
91
|
]);
|
|
88
92
|
}
|
|
89
93
|
|