@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.
Files changed (160) hide show
  1. package/.build/server/utils/cleanup.js +7 -2
  2. package/.build/server/utils/microservices.js +9 -81
  3. package/.build/server/utils/microservices_process.js +85 -0
  4. package/.build/server/utils/typed_handler.js +5 -1
  5. package/.build/server/utils/ws_client.js +7 -2
  6. package/.build/shared/utils/fetch_raw.js +2 -2
  7. package/.build/shared/utils/parse_boolean.js +2 -1
  8. package/app/components/ClippingPlanes.vue +22 -78
  9. package/app/components/DragAndDrop.vue +16 -79
  10. package/app/components/FileSelector.vue +9 -6
  11. package/app/components/HybridViewerTooltip.vue +8 -2
  12. package/app/components/MissingFilesSelector.vue +10 -6
  13. package/app/components/ObjectSelector.vue +6 -3
  14. package/app/components/Screenshot.vue +9 -2
  15. package/app/components/ThresholdCard.vue +205 -0
  16. package/app/components/ThresholdFilter.vue +81 -216
  17. package/app/components/ViewToolbar.vue +15 -231
  18. package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
  19. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
  20. package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +228 -0
  21. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
  22. package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
  23. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
  24. package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +234 -0
  25. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
  26. package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
  27. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
  28. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +7 -5
  29. package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
  30. package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
  31. package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -292
  32. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
  33. package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
  34. package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
  35. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
  36. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +12 -10
  37. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +12 -10
  38. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +9 -5
  39. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
  40. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
  41. package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
  42. package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
  43. package/app/components/Viewer/Options/ColorPicker.vue +4 -1
  44. package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
  45. package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
  46. package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
  47. package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
  48. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
  49. package/app/components/Viewer/Surface/PolygonsColoring.vue +231 -0
  50. package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
  51. package/app/components/csv-preview/CsvPreviewer.vue +4 -1
  52. package/app/composables/attribute_coloring_style.ts +8 -2
  53. package/app/composables/attribute_selector.ts +126 -0
  54. package/app/composables/clipping_slices.ts +166 -0
  55. package/app/composables/global_attribute_style.ts +4 -3
  56. package/app/composables/hover_highlight.ts +6 -5
  57. package/app/composables/project_manager.ts +5 -5
  58. package/app/composables/stepper_tree.ts +10 -2
  59. package/app/composables/tree_filter.ts +11 -2
  60. package/app/composables/tree_keyboard_nav.ts +4 -2
  61. package/app/composables/use_overlapping_picker.ts +5 -5
  62. package/app/composables/view_toolbar_options.ts +126 -0
  63. package/app/composables/view_toolbar_tool_options.ts +115 -0
  64. package/app/composables/view_toolbar_tools.ts +108 -0
  65. package/app/composables/virtual_tree.ts +20 -131
  66. package/app/composables/virtual_tree_flatten.ts +86 -0
  67. package/app/composables/virtual_tree_types.ts +81 -0
  68. package/app/stores/app.ts +8 -55
  69. package/app/stores/app_helpers/extension.ts +1 -1
  70. package/app/stores/app_helpers/registry.ts +69 -0
  71. package/app/stores/feedback.ts +2 -2
  72. package/app/stores/hybrid_viewer.ts +1 -1
  73. package/app/stores/menu.ts +1 -124
  74. package/app/stores/menu_helpers/menus_data.ts +127 -0
  75. package/app/stores/treeview.ts +17 -10
  76. package/app/stores/viewer.ts +17 -78
  77. package/app/stores/viewer_helpers/actions.ts +68 -0
  78. package/app/stores/viewer_helpers/request.ts +61 -0
  79. package/app/utils/clipping_planes.ts +4 -131
  80. package/app/utils/clipping_planes_scene.ts +131 -0
  81. package/app/utils/coloring_styles.ts +101 -0
  82. package/app/utils/default_styles/mesh_components.ts +168 -0
  83. package/app/utils/default_styles/meshes.ts +13 -153
  84. package/app/utils/default_styles/model_components.ts +170 -0
  85. package/app/utils/default_styles/models.ts +16 -153
  86. package/app/utils/drag_and_drop.ts +80 -0
  87. package/app/utils/extension.ts +1 -1
  88. package/app/utils/import_workflow.ts +6 -4
  89. package/app/utils/model_component_coloring.ts +46 -0
  90. package/app/utils/threshold.ts +33 -0
  91. package/app/utils/threshold_sources.ts +51 -0
  92. package/app/utils/upload_path.ts +15 -9
  93. package/internal/database/database.ts +4 -1
  94. package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
  95. package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
  96. package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
  97. package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
  98. package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
  99. package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
  100. package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
  101. package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
  102. package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
  103. package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
  104. package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
  105. package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
  106. package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
  107. package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
  108. package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
  109. package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
  110. package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
  111. package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
  112. package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
  113. package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
  114. package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
  115. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
  116. package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
  117. package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
  118. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
  119. package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
  120. package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
  121. package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
  122. package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
  123. package/internal/stores/data_style/model/blocks/index.ts +12 -140
  124. package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
  125. package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
  126. package/internal/stores/data_style/model/common.ts +10 -119
  127. package/internal/stores/data_style/model/common_mutations.ts +184 -0
  128. package/internal/stores/data_style/model/corners/vertex.ts +14 -10
  129. package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
  130. package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
  131. package/internal/stores/data_style/model/lines/edge.ts +14 -10
  132. package/internal/stores/data_style/model/lines/index.ts +10 -134
  133. package/internal/stores/data_style/model/lines/vertex.ts +14 -10
  134. package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
  135. package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
  136. package/internal/stores/data_style/model/surfaces/index.ts +16 -160
  137. package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
  138. package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
  139. package/internal/stores/data_style/model/visibility.ts +3 -156
  140. package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
  141. package/internal/stores/data_style/state.ts +1 -181
  142. package/internal/stores/data_style/state_shared.ts +191 -0
  143. package/internal/stores/hybrid_viewer/brightness.ts +8 -2
  144. package/internal/stores/hybrid_viewer/camera.ts +7 -161
  145. package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
  146. package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
  147. package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
  148. package/internal/stores/hybrid_viewer/filters.ts +54 -11
  149. package/internal/stores/hybrid_viewer/highlight.ts +10 -9
  150. package/internal/stores/hybrid_viewer/ruler.ts +4 -3
  151. package/internal/utils/ws_client.ts +8 -1
  152. package/package.json +2 -2
  153. package/server/api/local/extensions/run.post.ts +6 -4
  154. package/server/utils/cleanup.ts +12 -2
  155. package/server/utils/microservices.ts +10 -102
  156. package/server/utils/microservices_process.ts +127 -0
  157. package/server/utils/typed_handler.ts +8 -1
  158. package/server/utils/ws_client.ts +15 -2
  159. package/shared/utils/fetch_raw.ts +2 -2
  160. package/shared/utils/parse_boolean.ts +4 -1
@@ -1,123 +1,12 @@
1
- import type { CameraOptions, Vector3, vtkCamera, vtkOpenGLRenderWindow } from "./vtk_types";
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 { dot } from "@kitware/vtk.js/Common/Core/Math";
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
- performCameraOrientation(orientation);
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
- useHybridViewerCamera,
315
- };
160
+ } from "./camera_helpers";
161
+ export { applySnapshot, useHybridViewerCamera };
316
162
  export type { CameraSnapshot };
@@ -37,9 +37,10 @@ function slerp(from: Vector3, target: Vector3, ratio: number, mid?: Vector3): Ve
37
37
  ]);
38
38
  }
39
39
  if (dotProduct < -SLERP_LINEAR_THRESHOLD && mid) {
40
- return ratio < MID_ANIMATION_RATIO
41
- ? slerp(normFrom, mid, ratio * 2)
42
- : slerp(mid, normTarget, (ratio - MID_ANIMATION_RATIO) * 2);
40
+ if (ratio < MID_ANIMATION_RATIO) {
41
+ return slerp(normFrom, mid, ratio * 2);
42
+ }
43
+ return slerp(mid, normTarget, (ratio - MID_ANIMATION_RATIO) * 2);
43
44
  }
44
45
  const theta = Math.acos(dotProduct);
45
46
  const sinTheta = Math.sin(theta);
@@ -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
- async function setThreshold(ids: string[], attribute?: ThresholdAttribute): Promise<void> {
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
- attribute,
75
+ attributes,
67
76
  });
68
77
  }
69
78
  function useHybridViewerFilters(): {
70
- setClippingPlanes: (ids: string[], planes: ViewerClippingPlanesParams["planes"]) => Promise<void>;
71
- setShrink: (ids: string[], shrink_factor: number) => Promise<void>;
72
- setExplode: (ids: string[], explode_factor: number) => Promise<void>;
73
- setSlice: (
74
- ids: string[],
75
- slices: { axis: SliceAxis; index: number }[],
76
- ) => Promise<[number, number, number]>;
77
- setThreshold: (ids: string[], attribute?: ThresholdAttribute) => Promise<void>;
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 };
@@ -70,15 +70,16 @@ const useHybridViewerHighlight = createSharedComposable(() => {
70
70
  const hoverHighlight = useDebounceFn((event: MouseEvent) => {
71
71
  const { genericRenderWindow } = useHybridViewerCore();
72
72
  const containerElement = genericRenderWindow.value?.getContainer();
73
- const relativeMousePosition = containerElement
74
- ? {
75
- x: event.clientX - containerElement.getBoundingClientRect().left,
76
- y: event.clientY - containerElement.getBoundingClientRect().top,
77
- }
78
- : {
79
- x: event.clientX,
80
- y: event.clientY,
81
- };
73
+ let relativeMousePosition = {
74
+ x: event.clientX,
75
+ y: event.clientY,
76
+ };
77
+ if (containerElement) {
78
+ relativeMousePosition = {
79
+ x: event.clientX - containerElement.getBoundingClientRect().left,
80
+ y: event.clientY - containerElement.getBoundingClientRect().top,
81
+ };
82
+ }
82
83
  requestHoverHighlight(event, async (response) => {
83
84
  if (
84
85
  !is_hover_highlight.value ||
@@ -59,9 +59,10 @@ function useHybridViewerRuler(): {
59
59
  if (!ruler_point1.value) {
60
60
  return;
61
61
  }
62
- const points = ruler_point2.value
63
- ? [ruler_point1.value, ruler_point2.value]
64
- : [ruler_point1.value];
62
+ const points = [ruler_point1.value];
63
+ if (ruler_point2.value) {
64
+ points.push(ruler_point2.value);
65
+ }
65
66
  const { remoteRender } = useHybridViewerCore();
66
67
  const viewerStore = useViewerStore();
67
68
  const schema = viewer_schemas.opengeodeweb_viewer.viewer.ruler;
@@ -25,13 +25,20 @@ function isVtkWSLinkClient(value: unknown): value is VtkWSLinkClient {
25
25
  );
26
26
  }
27
27
 
28
+ function resolveClient(initialClient: unknown): VtkWSLinkClient {
29
+ if (isVtkWSLinkClient(initialClient)) {
30
+ return initialClient;
31
+ }
32
+ return newInstance();
33
+ }
34
+
28
35
  async function initWebSocketClient(
29
36
  baseUrl: string,
30
37
  initialClient: unknown = {},
31
38
  { onConnectionClose }: WsClientCallbacks = {},
32
39
  ): Promise<VtkWSLinkClient> {
33
40
  vtkWSLinkClient.setSmartConnectClass(SmartConnect);
34
- const client = isVtkWSLinkClient(initialClient) ? initialClient : newInstance();
41
+ const client = resolveClient(initialClient);
35
42
 
36
43
  client.onConnectionError((httpReq: WsConnectionEvent) => {
37
44
  const message = httpReq.response?.error ?? "Connection error";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.44.0-rc.2",
3
+ "version": "10.44.0-rc.4",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "scripts": {
52
52
  "lint": "oxlint --fix .",
53
- "prepare:types": "cross-env MODE=BROWSER nuxi prepare",
53
+ "prepare:types": "cross-env MODE=BROWSER npx nuxi prepare",
54
54
  "build:back": "npx opengeodeweb-microservice-pyinstaller ../OpenGeodeWeb-Back",
55
55
  "build:viewer": "npx opengeodeweb-microservice-pyinstaller ../OpenGeodeWeb-Viewer",
56
56
  "build:microservices": "concurrently \"npm run build:back\" \"npm run build:viewer\"",
@@ -55,10 +55,12 @@ async function runSingleExtension(
55
55
  port,
56
56
  });
57
57
 
58
- const serverPort =
59
- server === undefined
60
- ? undefined
61
- : await runExtensionServer(extensionServerEntryPath(unzippedExtensionPath, server.entry));
58
+ let serverPort: number | undefined = undefined;
59
+ if (server !== undefined) {
60
+ serverPort = await runExtensionServer(
61
+ extensionServerEntryPath(unzippedExtensionPath, server.entry),
62
+ );
63
+ }
62
64
  if (serverPort !== undefined) {
63
65
  setExtensionServerPort(id, serverPort);
64
66
  }
@@ -56,6 +56,13 @@ function isErrorWithMessage(error: unknown): error is { message: string } {
56
56
  );
57
57
  }
58
58
 
59
+ function describeError(error: unknown): string {
60
+ if (isErrorWithMessage(error)) {
61
+ return error.message;
62
+ }
63
+ return String(error);
64
+ }
65
+
59
66
  async function killHttpMicroservice(microservice: Microservice): Promise<void> {
60
67
  consola.debug("killHttpMicroservice", {
61
68
  ...microservice,
@@ -70,7 +77,7 @@ async function killHttpMicroservice(microservice: Microservice): Promise<void> {
70
77
  method: microservice.method,
71
78
  });
72
79
  } catch (error) {
73
- const message = isErrorWithMessage(error) ? error.message : String(error);
80
+ const message = describeError(error);
74
81
  consola.info(`Expected error during kill of ${microservice.name}:`, message);
75
82
  }
76
83
  }
@@ -180,7 +187,10 @@ function getMicroserviceByName(
180
187
  name: string,
181
188
  ): Microservice | undefined {
182
189
  const found = microservices.find((microservice) => microservice.name === name);
183
- return found === undefined ? undefined : { ...found };
190
+ if (found === undefined) {
191
+ return undefined;
192
+ }
193
+ return { ...found };
184
194
  }
185
195
 
186
196
  export {