@geode/opengeodeweb-front 10.44.0-rc.3 → 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/microservices.js +9 -85
- package/.build/server/utils/microservices_process.js +85 -0
- package/app/components/ClippingPlanes.vue +16 -82
- package/app/components/DragAndDrop.vue +1 -74
- package/app/components/ThresholdCard.vue +205 -0
- package/app/components/ThresholdFilter.vue +77 -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/ComponentPointsOptions.vue +2 -18
- package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -294
- 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/Options/AttributeSelector.vue +26 -133
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
- 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/composables/attribute_selector.ts +126 -0
- package/app/composables/clipping_slices.ts +166 -0
- 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 -138
- 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/registry.ts +69 -0
- package/app/stores/menu.ts +1 -124
- package/app/stores/menu_helpers/menus_data.ts +127 -0
- 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 -132
- 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/model_component_coloring.ts +46 -0
- package/app/utils/threshold.ts +33 -0
- package/app/utils/threshold_sources.ts +51 -0
- 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/common.ts +10 -119
- package/internal/stores/data_style/model/common_mutations.ts +184 -0
- 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/index.ts +10 -134
- 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/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/camera.ts +7 -161
- 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/package.json +1 -1
- package/server/utils/microservices.ts +10 -109
- package/server/utils/microservices_process.ts +127 -0
|
@@ -1,123 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
LONG_ANIMATION_DURATION,
|
|
4
|
-
SHORT_ANIMATION_DURATION,
|
|
5
|
-
animateCamera,
|
|
6
|
-
computeAnimationDuration,
|
|
7
|
-
getCameraOptions,
|
|
8
|
-
} from "./camera_animation";
|
|
1
|
+
import { EASE_EXPONENT, applyCameraOptions, getImageStyle, toBounds } from "./camera_helpers";
|
|
2
|
+
import { animateCamera, computeAnimationDuration, getCameraOptions } from "./camera_animation";
|
|
9
3
|
import { requireRenderWindow, useHybridViewerCore } from "./core";
|
|
10
|
-
import {
|
|
4
|
+
import type { CameraOptions } from "./vtk_types";
|
|
5
|
+
import { animateCameraOrientation } from "./camera_orientation";
|
|
11
6
|
import { useHybridViewerScene } from "./scene";
|
|
12
7
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
13
8
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
14
9
|
|
|
15
|
-
const BUMP_MULTIPLIER = 0.2;
|
|
16
|
-
const ALIGNMENT_THRESHOLD = 0.9;
|
|
17
|
-
const EASE_EXPONENT = 1.1;
|
|
18
|
-
|
|
19
|
-
interface OrientationConfig {
|
|
20
|
-
position: Vector3;
|
|
21
|
-
view_up: Vector3;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const ORIENTATIONS: Record<string, OrientationConfig> = {
|
|
25
|
-
zplus: {
|
|
26
|
-
position: [0, 0, 1],
|
|
27
|
-
view_up: [0, 1, 0],
|
|
28
|
-
},
|
|
29
|
-
zminus: {
|
|
30
|
-
position: [0, 0, -1],
|
|
31
|
-
view_up: [0, 1, 0],
|
|
32
|
-
},
|
|
33
|
-
yplus: {
|
|
34
|
-
position: [0, 1, 0],
|
|
35
|
-
view_up: [0, 0, 1],
|
|
36
|
-
},
|
|
37
|
-
yminus: {
|
|
38
|
-
position: [0, -1, 0],
|
|
39
|
-
view_up: [0, 0, 1],
|
|
40
|
-
},
|
|
41
|
-
xplus: {
|
|
42
|
-
position: [1, 0, 0],
|
|
43
|
-
view_up: [0, 0, 1],
|
|
44
|
-
},
|
|
45
|
-
xminus: {
|
|
46
|
-
position: [-1, 0, 0],
|
|
47
|
-
view_up: [0, 0, 1],
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
function getImageStyle(): CSSStyleDeclaration | undefined {
|
|
52
|
-
const { genericRenderWindow } = useHybridViewerCore();
|
|
53
|
-
if (!genericRenderWindow.value) {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
// oxlint-disable-next-line no-unsafe-assignment -- vtk.js has no types for getApiSpecificRenderWindow(); narrowed below.
|
|
57
|
-
const apiSpecificRenderWindow = genericRenderWindow.value.getApiSpecificRenderWindow();
|
|
58
|
-
// oxlint-disable-next-line no-unsafe-type-assertion -- trusted vtk.js OpenGL render window API boundary.
|
|
59
|
-
const webGLRenderWindow = apiSpecificRenderWindow as unknown as vtkOpenGLRenderWindow;
|
|
60
|
-
const bgImage: unknown = webGLRenderWindow.getReferenceByName("bgImage");
|
|
61
|
-
return bgImage instanceof HTMLImageElement ? bgImage.style : undefined;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function applyCameraOptions(
|
|
65
|
-
camera: vtkCamera | undefined,
|
|
66
|
-
options: Partial<CameraOptions> | undefined,
|
|
67
|
-
): void {
|
|
68
|
-
if (camera && options) {
|
|
69
|
-
camera.set({
|
|
70
|
-
focalPoint: options.focal_point,
|
|
71
|
-
viewUp: options.view_up,
|
|
72
|
-
position: options.position,
|
|
73
|
-
viewAngle: options.view_angle,
|
|
74
|
-
clippingRange: options.clipping_range,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const BOUNDS_LENGTH = 6;
|
|
80
|
-
|
|
81
|
-
function isBounds(value: unknown): value is [number, number, number, number, number, number] {
|
|
82
|
-
return (
|
|
83
|
-
Array.isArray(value) &&
|
|
84
|
-
value.length === BOUNDS_LENGTH &&
|
|
85
|
-
value.every((item): item is number => typeof item === "number")
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function toBounds(value: unknown): [number, number, number, number, number, number] {
|
|
90
|
-
if (!isBounds(value)) {
|
|
91
|
-
throw new Error("Expected a six-element numeric bounds array");
|
|
92
|
-
}
|
|
93
|
-
return value;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function centerCameraOnPosition(
|
|
97
|
-
camera: vtkCamera | undefined,
|
|
98
|
-
pickedPosition: Vector3 | undefined,
|
|
99
|
-
): void {
|
|
100
|
-
if (!camera || !pickedPosition) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const position = camera.getPosition();
|
|
104
|
-
const directionOfProjection = camera.getDirectionOfProjection();
|
|
105
|
-
const distance = dot(
|
|
106
|
-
[
|
|
107
|
-
pickedPosition[0] - position[0],
|
|
108
|
-
pickedPosition[1] - position[1],
|
|
109
|
-
pickedPosition[2] - position[2],
|
|
110
|
-
],
|
|
111
|
-
directionOfProjection,
|
|
112
|
-
);
|
|
113
|
-
camera.setFocalPoint(...pickedPosition);
|
|
114
|
-
camera.setPosition(
|
|
115
|
-
pickedPosition[0] - distance * directionOfProjection[0],
|
|
116
|
-
pickedPosition[1] - distance * directionOfProjection[1],
|
|
117
|
-
pickedPosition[2] - distance * directionOfProjection[2],
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
10
|
// Shared via createSharedComposable (rather than merged into the parent hybridViewer store) so sibling slices, e.g. viewport.ts and ruler.ts, can read camera_options/setCamera/syncRemoteCamera directly without importing the parent store and creating a cycle. A Pinia store would work too but its $id/$patch/... properties would leak into the composed store's spread and collapse its inferred type.
|
|
122
11
|
const useHybridViewerCamera = createSharedComposable(() => {
|
|
123
12
|
const camera_options = reactive<Record<string, unknown>>({});
|
|
@@ -231,50 +120,8 @@ const useHybridViewerCamera = createSharedComposable(() => {
|
|
|
231
120
|
await performFocusCameraOnObject(id, block_ids);
|
|
232
121
|
}
|
|
233
122
|
|
|
234
|
-
function performCameraOrientation(orientation: string): void {
|
|
235
|
-
const config = ORIENTATIONS[orientation.toLowerCase()];
|
|
236
|
-
if (!config) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
const { genericRenderWindow, is_moving } = useHybridViewerCore();
|
|
240
|
-
const imageStyle = getImageStyle();
|
|
241
|
-
const renderer = requireRenderWindow(genericRenderWindow).getRenderer();
|
|
242
|
-
const camera = renderer.getActiveCamera();
|
|
243
|
-
const startState = getCameraOptions(camera);
|
|
244
|
-
applyCameraOptions(camera, {
|
|
245
|
-
...config,
|
|
246
|
-
focal_point: [0, 0, 0],
|
|
247
|
-
});
|
|
248
|
-
renderer.resetCamera();
|
|
249
|
-
const targetState = getCameraOptions(camera);
|
|
250
|
-
applyCameraOptions(camera, startState);
|
|
251
|
-
const alignment = dot(camera.getDirectionOfProjection(), config.position);
|
|
252
|
-
const duration =
|
|
253
|
-
alignment > ALIGNMENT_THRESHOLD ? LONG_ANIMATION_DURATION : SHORT_ANIMATION_DURATION;
|
|
254
|
-
is_moving.value = true;
|
|
255
|
-
if (imageStyle) {
|
|
256
|
-
imageStyle.opacity = "0";
|
|
257
|
-
}
|
|
258
|
-
animateCamera({
|
|
259
|
-
camera,
|
|
260
|
-
startState,
|
|
261
|
-
targetState,
|
|
262
|
-
duration,
|
|
263
|
-
bumpMultiplier: BUMP_MULTIPLIER,
|
|
264
|
-
easeExponent: EASE_EXPONENT,
|
|
265
|
-
onUpdate: () => {
|
|
266
|
-
const renderWindow = requireRenderWindow(genericRenderWindow).getRenderWindow();
|
|
267
|
-
renderWindow.render();
|
|
268
|
-
},
|
|
269
|
-
onEnd: () => {
|
|
270
|
-
is_moving.value = false;
|
|
271
|
-
performSyncRemoteCamera();
|
|
272
|
-
},
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
|
|
276
123
|
function setCameraOrientation(orientation: string): void {
|
|
277
|
-
|
|
124
|
+
animateCameraOrientation(orientation, performSyncRemoteCamera);
|
|
278
125
|
}
|
|
279
126
|
|
|
280
127
|
return {
|
|
@@ -309,8 +156,7 @@ export {
|
|
|
309
156
|
EASE_EXPONENT,
|
|
310
157
|
ORIENTATIONS,
|
|
311
158
|
applyCameraOptions,
|
|
312
|
-
applySnapshot,
|
|
313
159
|
centerCameraOnPosition,
|
|
314
|
-
|
|
315
|
-
};
|
|
160
|
+
} from "./camera_helpers";
|
|
161
|
+
export { applySnapshot, useHybridViewerCamera };
|
|
316
162
|
export type { CameraSnapshot };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { CameraOptions, Vector3, vtkCamera, vtkOpenGLRenderWindow } from "./vtk_types";
|
|
2
|
+
import { dot } from "@kitware/vtk.js/Common/Core/Math";
|
|
3
|
+
import { useHybridViewerCore } from "./core";
|
|
4
|
+
|
|
5
|
+
const BUMP_MULTIPLIER = 0.2;
|
|
6
|
+
const ALIGNMENT_THRESHOLD = 0.9;
|
|
7
|
+
const EASE_EXPONENT = 1.1;
|
|
8
|
+
|
|
9
|
+
interface OrientationConfig {
|
|
10
|
+
position: Vector3;
|
|
11
|
+
view_up: Vector3;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const ORIENTATIONS: Record<string, OrientationConfig> = {
|
|
15
|
+
zplus: {
|
|
16
|
+
position: [0, 0, 1],
|
|
17
|
+
view_up: [0, 1, 0],
|
|
18
|
+
},
|
|
19
|
+
zminus: {
|
|
20
|
+
position: [0, 0, -1],
|
|
21
|
+
view_up: [0, 1, 0],
|
|
22
|
+
},
|
|
23
|
+
yplus: {
|
|
24
|
+
position: [0, 1, 0],
|
|
25
|
+
view_up: [0, 0, 1],
|
|
26
|
+
},
|
|
27
|
+
yminus: {
|
|
28
|
+
position: [0, -1, 0],
|
|
29
|
+
view_up: [0, 0, 1],
|
|
30
|
+
},
|
|
31
|
+
xplus: {
|
|
32
|
+
position: [1, 0, 0],
|
|
33
|
+
view_up: [0, 0, 1],
|
|
34
|
+
},
|
|
35
|
+
xminus: {
|
|
36
|
+
position: [-1, 0, 0],
|
|
37
|
+
view_up: [0, 0, 1],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
function getImageStyle(): CSSStyleDeclaration | undefined {
|
|
42
|
+
const { genericRenderWindow } = useHybridViewerCore();
|
|
43
|
+
if (!genericRenderWindow.value) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
// oxlint-disable-next-line no-unsafe-assignment -- vtk.js has no types for getApiSpecificRenderWindow(); narrowed below.
|
|
47
|
+
const apiSpecificRenderWindow = genericRenderWindow.value.getApiSpecificRenderWindow();
|
|
48
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- trusted vtk.js OpenGL render window API boundary.
|
|
49
|
+
const webGLRenderWindow = apiSpecificRenderWindow as unknown as vtkOpenGLRenderWindow;
|
|
50
|
+
const bgImage: unknown = webGLRenderWindow.getReferenceByName("bgImage");
|
|
51
|
+
return bgImage instanceof HTMLImageElement ? bgImage.style : undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function applyCameraOptions(
|
|
55
|
+
camera: vtkCamera | undefined,
|
|
56
|
+
options: Partial<CameraOptions> | undefined,
|
|
57
|
+
): void {
|
|
58
|
+
if (camera && options) {
|
|
59
|
+
camera.set({
|
|
60
|
+
focalPoint: options.focal_point,
|
|
61
|
+
viewUp: options.view_up,
|
|
62
|
+
position: options.position,
|
|
63
|
+
viewAngle: options.view_angle,
|
|
64
|
+
clippingRange: options.clipping_range,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const BOUNDS_LENGTH = 6;
|
|
70
|
+
|
|
71
|
+
function isBounds(value: unknown): value is [number, number, number, number, number, number] {
|
|
72
|
+
return (
|
|
73
|
+
Array.isArray(value) &&
|
|
74
|
+
value.length === BOUNDS_LENGTH &&
|
|
75
|
+
value.every((item): item is number => typeof item === "number")
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function toBounds(value: unknown): [number, number, number, number, number, number] {
|
|
80
|
+
if (!isBounds(value)) {
|
|
81
|
+
throw new Error("Expected a six-element numeric bounds array");
|
|
82
|
+
}
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function centerCameraOnPosition(
|
|
87
|
+
camera: vtkCamera | undefined,
|
|
88
|
+
pickedPosition: Vector3 | undefined,
|
|
89
|
+
): void {
|
|
90
|
+
if (!camera || !pickedPosition) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const position = camera.getPosition();
|
|
94
|
+
const directionOfProjection = camera.getDirectionOfProjection();
|
|
95
|
+
const distance = dot(
|
|
96
|
+
[
|
|
97
|
+
pickedPosition[0] - position[0],
|
|
98
|
+
pickedPosition[1] - position[1],
|
|
99
|
+
pickedPosition[2] - position[2],
|
|
100
|
+
],
|
|
101
|
+
directionOfProjection,
|
|
102
|
+
);
|
|
103
|
+
camera.setFocalPoint(...pickedPosition);
|
|
104
|
+
camera.setPosition(
|
|
105
|
+
pickedPosition[0] - distance * directionOfProjection[0],
|
|
106
|
+
pickedPosition[1] - distance * directionOfProjection[1],
|
|
107
|
+
pickedPosition[2] - distance * directionOfProjection[2],
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
ALIGNMENT_THRESHOLD,
|
|
113
|
+
BUMP_MULTIPLIER,
|
|
114
|
+
EASE_EXPONENT,
|
|
115
|
+
ORIENTATIONS,
|
|
116
|
+
applyCameraOptions,
|
|
117
|
+
centerCameraOnPosition,
|
|
118
|
+
getImageStyle,
|
|
119
|
+
toBounds,
|
|
120
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ALIGNMENT_THRESHOLD,
|
|
3
|
+
BUMP_MULTIPLIER,
|
|
4
|
+
EASE_EXPONENT,
|
|
5
|
+
ORIENTATIONS,
|
|
6
|
+
applyCameraOptions,
|
|
7
|
+
getImageStyle,
|
|
8
|
+
} from "./camera_helpers";
|
|
9
|
+
import {
|
|
10
|
+
LONG_ANIMATION_DURATION,
|
|
11
|
+
SHORT_ANIMATION_DURATION,
|
|
12
|
+
animateCamera,
|
|
13
|
+
getCameraOptions,
|
|
14
|
+
} from "./camera_animation";
|
|
15
|
+
import { requireRenderWindow, useHybridViewerCore } from "./core";
|
|
16
|
+
import { dot } from "@kitware/vtk.js/Common/Core/Math";
|
|
17
|
+
|
|
18
|
+
function animateCameraOrientation(orientation: string, syncRemoteCamera: () => void): void {
|
|
19
|
+
const config = ORIENTATIONS[orientation.toLowerCase()];
|
|
20
|
+
if (!config) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const { genericRenderWindow, is_moving } = useHybridViewerCore();
|
|
24
|
+
const imageStyle = getImageStyle();
|
|
25
|
+
const renderer = requireRenderWindow(genericRenderWindow).getRenderer();
|
|
26
|
+
const camera = renderer.getActiveCamera();
|
|
27
|
+
const startState = getCameraOptions(camera);
|
|
28
|
+
applyCameraOptions(camera, {
|
|
29
|
+
...config,
|
|
30
|
+
focal_point: [0, 0, 0],
|
|
31
|
+
});
|
|
32
|
+
renderer.resetCamera();
|
|
33
|
+
const targetState = getCameraOptions(camera);
|
|
34
|
+
applyCameraOptions(camera, startState);
|
|
35
|
+
const alignment = dot(camera.getDirectionOfProjection(), config.position);
|
|
36
|
+
const duration =
|
|
37
|
+
alignment > ALIGNMENT_THRESHOLD ? LONG_ANIMATION_DURATION : SHORT_ANIMATION_DURATION;
|
|
38
|
+
is_moving.value = true;
|
|
39
|
+
if (imageStyle) {
|
|
40
|
+
imageStyle.opacity = "0";
|
|
41
|
+
}
|
|
42
|
+
animateCamera({
|
|
43
|
+
camera,
|
|
44
|
+
startState,
|
|
45
|
+
targetState,
|
|
46
|
+
duration,
|
|
47
|
+
bumpMultiplier: BUMP_MULTIPLIER,
|
|
48
|
+
easeExponent: EASE_EXPONENT,
|
|
49
|
+
onUpdate: () => {
|
|
50
|
+
const renderWindow = requireRenderWindow(genericRenderWindow).getRenderWindow();
|
|
51
|
+
renderWindow.render();
|
|
52
|
+
},
|
|
53
|
+
onEnd: () => {
|
|
54
|
+
is_moving.value = false;
|
|
55
|
+
syncRemoteCamera();
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { animateCameraOrientation };
|
|
@@ -60,29 +60,72 @@ interface ThresholdAttribute {
|
|
|
60
60
|
minimum: number;
|
|
61
61
|
maximum: number;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
interface Threshold {
|
|
64
|
+
id: number;
|
|
65
|
+
sourceIndex: number | undefined;
|
|
66
|
+
attributeName: string | undefined;
|
|
67
|
+
item: number;
|
|
68
|
+
minimum: number | undefined;
|
|
69
|
+
maximum: number | undefined;
|
|
70
|
+
thresholdAttribute: ThresholdAttribute | undefined;
|
|
71
|
+
}
|
|
72
|
+
async function setThreshold(ids: string[], attributes: ThresholdAttribute[]): Promise<void> {
|
|
64
73
|
await requestAndRender(viewer_schemas.opengeodeweb_viewer.viewer.threshold, {
|
|
65
74
|
ids,
|
|
66
|
-
|
|
75
|
+
attributes,
|
|
67
76
|
});
|
|
68
77
|
}
|
|
69
78
|
function useHybridViewerFilters(): {
|
|
70
|
-
setClippingPlanes:
|
|
71
|
-
setShrink:
|
|
72
|
-
setExplode:
|
|
73
|
-
setSlice:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
) =>
|
|
77
|
-
|
|
79
|
+
setClippingPlanes: typeof setClippingPlanes;
|
|
80
|
+
setShrink: typeof setShrink;
|
|
81
|
+
setExplode: typeof setExplode;
|
|
82
|
+
setSlice: typeof setSlice;
|
|
83
|
+
setThreshold: typeof setThreshold;
|
|
84
|
+
getThresholds: (id: string) => Threshold[];
|
|
85
|
+
addThreshold: (id: string) => void;
|
|
86
|
+
removeThreshold: (id: string, index: number) => void;
|
|
87
|
+
removeThresholds: (id: string) => void;
|
|
78
88
|
} {
|
|
89
|
+
const thresholds = reactive<Record<string, Threshold[]>>({});
|
|
90
|
+
let lastThresholdId = 0;
|
|
91
|
+
|
|
92
|
+
function getThresholds(id: string): Threshold[] {
|
|
93
|
+
return thresholds[id] ?? [];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function addThreshold(id: string): void {
|
|
97
|
+
lastThresholdId += 1;
|
|
98
|
+
thresholds[id] ??= [];
|
|
99
|
+
thresholds[id].push({
|
|
100
|
+
id: lastThresholdId,
|
|
101
|
+
sourceIndex: undefined,
|
|
102
|
+
attributeName: undefined,
|
|
103
|
+
item: 0,
|
|
104
|
+
minimum: undefined,
|
|
105
|
+
maximum: undefined,
|
|
106
|
+
thresholdAttribute: undefined,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function removeThreshold(id: string, index: number): void {
|
|
111
|
+
thresholds[id]?.splice(index, 1);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function removeThresholds(id: string): void {
|
|
115
|
+
thresholds[id] = [];
|
|
116
|
+
}
|
|
117
|
+
|
|
79
118
|
return {
|
|
80
119
|
setClippingPlanes,
|
|
81
120
|
setShrink,
|
|
82
121
|
setExplode,
|
|
83
122
|
setSlice,
|
|
84
123
|
setThreshold,
|
|
124
|
+
getThresholds,
|
|
125
|
+
addThreshold,
|
|
126
|
+
removeThreshold,
|
|
127
|
+
removeThresholds,
|
|
85
128
|
};
|
|
86
129
|
}
|
|
87
130
|
export { useHybridViewerFilters };
|
|
88
|
-
export type { ThresholdAttribute };
|
|
131
|
+
export type { Threshold, ThresholdAttribute };
|
package/package.json
CHANGED
|
@@ -1,101 +1,25 @@
|
|
|
1
1
|
// Node imports
|
|
2
2
|
import child_process from "node:child_process";
|
|
3
3
|
import fs from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
4
|
|
|
6
5
|
// Third party imports
|
|
7
6
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json" with { type: "json" };
|
|
8
7
|
import { consola } from "consola";
|
|
9
8
|
|
|
10
9
|
// Local imports
|
|
10
|
+
import {
|
|
11
|
+
DEFAULT_RUN_ARGS,
|
|
12
|
+
MAX_PORT_RETRIES,
|
|
13
|
+
type RunArgs,
|
|
14
|
+
backArgs,
|
|
15
|
+
isPortInUseError,
|
|
16
|
+
runScript,
|
|
17
|
+
waitUntilListening,
|
|
18
|
+
} from "./microservices_process.js";
|
|
11
19
|
import { type Microservice, microservicesMetadatasPath, projectMicroservices } from "./cleanup.js";
|
|
12
|
-
import { type NamedChildProcess, getAvailablePort, waitForReady } from "./scripts.js";
|
|
13
20
|
import { addNginxLocation, addSupervisorProgram } from "./cloud.js";
|
|
14
21
|
import { executablePath } from "./path.js";
|
|
15
|
-
|
|
16
|
-
interface RunArgs {
|
|
17
|
-
projectFolderPath: string;
|
|
18
|
-
uploadFolderPath?: string;
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const MILLISECONDS_PER_SECOND = 1000;
|
|
23
|
-
const DEFAULT_TIMEOUT_SECONDS = 120;
|
|
24
|
-
const MAX_PORT_RETRIES = 1;
|
|
25
|
-
const DEFAULT_RUN_ARGS: RunArgs = { projectFolderPath: "" };
|
|
26
|
-
const LISTENING_LOG_PATTERN = /^Listening on https?:\/\/.+:\d+\/?\s*$/mu;
|
|
27
|
-
|
|
28
|
-
async function runScript(
|
|
29
|
-
execPath: string,
|
|
30
|
-
execName: string,
|
|
31
|
-
args: readonly string[],
|
|
32
|
-
expectedResponse: string,
|
|
33
|
-
timeoutSeconds = DEFAULT_TIMEOUT_SECONDS,
|
|
34
|
-
): Promise<NamedChildProcess> {
|
|
35
|
-
const command = executablePath(execPath, execName);
|
|
36
|
-
consola.debug("runScript", command, args);
|
|
37
|
-
const child = child_process.spawn(command, args, {
|
|
38
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
39
|
-
}) as NamedChildProcess;
|
|
40
|
-
child.name = command.replace(/^.*[\\/]/u, "");
|
|
41
|
-
child.on("spawn", () => {
|
|
42
|
-
consola.info(`[${child.name}] spawned, pid=${child.pid}`);
|
|
43
|
-
});
|
|
44
|
-
const controller = new AbortController();
|
|
45
|
-
const timer = setTimeout(() => {
|
|
46
|
-
controller.abort();
|
|
47
|
-
}, timeoutSeconds * MILLISECONDS_PER_SECOND);
|
|
48
|
-
if (typeof timer.unref === "function") {
|
|
49
|
-
timer.unref();
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
const result = await waitForReady(child, expectedResponse, controller.signal);
|
|
53
|
-
clearTimeout(timer);
|
|
54
|
-
return result;
|
|
55
|
-
} catch (error) {
|
|
56
|
-
clearTimeout(timer);
|
|
57
|
-
child.kill();
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function isPortInUseError(error: unknown): boolean {
|
|
63
|
-
return /EADDRINUSE|address already in use|port already in use/iu.test(String(error));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function resolveUploadFolderPath(
|
|
67
|
-
projectFolderPath: string,
|
|
68
|
-
uploadFolderPath: string | undefined,
|
|
69
|
-
): string {
|
|
70
|
-
if (uploadFolderPath !== undefined && uploadFolderPath !== "") {
|
|
71
|
-
return uploadFolderPath;
|
|
72
|
-
}
|
|
73
|
-
return path.join(projectFolderPath, "uploads");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function backArgs(args: RunArgs, port: number): string[] {
|
|
77
|
-
const { projectFolderPath } = args;
|
|
78
|
-
if (!projectFolderPath) {
|
|
79
|
-
throw new Error("projectFolderPath is required");
|
|
80
|
-
}
|
|
81
|
-
const uploadFolderPath = resolveUploadFolderPath(projectFolderPath, args.uploadFolderPath);
|
|
82
|
-
const executableArgs = [
|
|
83
|
-
"--port",
|
|
84
|
-
String(port),
|
|
85
|
-
"--project_folder_path",
|
|
86
|
-
projectFolderPath,
|
|
87
|
-
"--upload_folder_path",
|
|
88
|
-
uploadFolderPath,
|
|
89
|
-
"--allowed_origins",
|
|
90
|
-
"http://localhost:*",
|
|
91
|
-
"--timeout",
|
|
92
|
-
"0",
|
|
93
|
-
];
|
|
94
|
-
if (process.env.NODE_ENV === undefined || process.env.NODE_ENV === "development") {
|
|
95
|
-
executableArgs.push("--debug");
|
|
96
|
-
}
|
|
97
|
-
return executableArgs;
|
|
98
|
-
}
|
|
22
|
+
import { getAvailablePort } from "./scripts.js";
|
|
99
23
|
|
|
100
24
|
async function runBack(
|
|
101
25
|
execName: string,
|
|
@@ -191,29 +115,6 @@ async function runExtension(
|
|
|
191
115
|
}
|
|
192
116
|
throw new Error(`runExtension failed to run ${extensionId}`);
|
|
193
117
|
}
|
|
194
|
-
async function waitUntilListening(
|
|
195
|
-
child: child_process.ChildProcessWithoutNullStreams,
|
|
196
|
-
): Promise<void> {
|
|
197
|
-
child.stderr.on("data", (data: Buffer) => {
|
|
198
|
-
consola.info(`[${child.spawnfile}] STDERR:`, data.toString().trim());
|
|
199
|
-
});
|
|
200
|
-
child.on("close", (code) => {
|
|
201
|
-
consola.info(`[${child.spawnfile}] exited with code ${code}`);
|
|
202
|
-
});
|
|
203
|
-
// oxlint-disable-next-line typescript/no-unnecessary-condition
|
|
204
|
-
for await (const chunk of child.stdout) {
|
|
205
|
-
const output = String(chunk);
|
|
206
|
-
consola.info(`[${child.spawnfile}] STDOUT:`, output.trim());
|
|
207
|
-
if (LISTENING_LOG_PATTERN.test(output)) {
|
|
208
|
-
child.stdout.on("data", (data: Buffer) => {
|
|
209
|
-
consola.info(`[${child.spawnfile}] STDOUT:`, data.toString().trim());
|
|
210
|
-
});
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
throw new Error(`${child.spawnfile} exited before becoming ready`);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
118
|
async function runExtensionServer(entryPath: string, attempts = 0): Promise<number> {
|
|
218
119
|
let port: number | undefined = undefined;
|
|
219
120
|
try {
|