@geode/opengeodeweb-front 10.44.0-rc.1 → 10.44.0-rc.10

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 (245) 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/scripts.js +34 -23
  5. package/.build/server/utils/typed_handler.js +5 -1
  6. package/.build/server/utils/ws_client.js +7 -2
  7. package/.build/shared/utils/fetch_raw.js +2 -2
  8. package/.build/shared/utils/parse_boolean.js +2 -1
  9. package/app/assets/geode_objects.ts +1 -0
  10. package/app/components/BasemapAttribution.vue +28 -0
  11. package/app/components/ClippingPlanes.vue +22 -78
  12. package/app/components/DragAndDrop.vue +16 -79
  13. package/app/components/FileSelector.vue +9 -6
  14. package/app/components/HybridViewerTooltip.vue +8 -2
  15. package/app/components/MissingFilesSelector.vue +40 -23
  16. package/app/components/ObjectSelector.vue +34 -20
  17. package/app/components/Screenshot.vue +17 -59
  18. package/app/components/ThresholdCard.vue +205 -0
  19. package/app/components/ThresholdFilter.vue +81 -216
  20. package/app/components/ViewToolbar.vue +15 -231
  21. package/app/components/Viewer/Basemap/CropOptions.vue +50 -0
  22. package/app/components/Viewer/Basemap/OpacityOptions.vue +52 -0
  23. package/app/components/Viewer/ContextMenu/CircularItems.vue +1 -2
  24. package/app/components/Viewer/ContextMenu/ContextMenu.vue +11 -6
  25. package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +10 -7
  26. package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
  27. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
  28. package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +221 -0
  29. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
  30. package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
  31. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
  32. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +13 -0
  33. package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +227 -0
  34. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
  35. package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
  36. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
  37. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +14 -12
  38. package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
  39. package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
  40. package/app/components/Viewer/Generic/Model/CornersOptions.vue +15 -294
  41. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
  42. package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
  43. package/app/components/Viewer/Generic/Model/LinesOptions.vue +15 -427
  44. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
  45. package/app/components/Viewer/Generic/Model/ModelCardTabs.vue +35 -0
  46. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +34 -25
  47. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +34 -25
  48. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +17 -5
  49. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +16 -12
  50. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
  51. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +55 -11
  52. package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
  53. package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
  54. package/app/components/Viewer/Options/ColorPicker.vue +4 -1
  55. package/app/components/Viewer/Options/ColoringTypeSelector.vue +48 -74
  56. package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
  57. package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
  58. package/app/components/Viewer/Options/Sliders/Opacity.vue +22 -0
  59. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +13 -0
  60. package/app/components/Viewer/Scene/BackgroundOptions.vue +37 -0
  61. package/app/components/Viewer/Scene/OrientationWidgetOptions.vue +48 -0
  62. package/app/components/Viewer/Scene/TextOptions.vue +63 -0
  63. package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
  64. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
  65. package/app/components/Viewer/Surface/PolygonsColoring.vue +224 -0
  66. package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
  67. package/app/components/Viewer/Ui.vue +6 -1
  68. package/app/components/csv-preview/CsvPreviewer.vue +4 -1
  69. package/app/composables/attribute_coloring_style.ts +8 -2
  70. package/app/composables/attribute_selector.ts +126 -0
  71. package/app/composables/batch_style_model.ts +34 -0
  72. package/app/composables/clipping_slices.ts +166 -0
  73. package/app/composables/global_attribute_style.ts +4 -3
  74. package/app/composables/hover_highlight.ts +19 -18
  75. package/app/composables/model_tabs.ts +86 -0
  76. package/app/composables/overlapping_picker_menu.ts +43 -0
  77. package/app/composables/project_manager.ts +6 -97
  78. package/app/composables/project_manager_helpers/reset.ts +34 -0
  79. package/app/composables/project_manager_helpers/restore.ts +67 -0
  80. package/app/composables/project_manager_helpers/types.ts +24 -0
  81. package/app/composables/project_manager_helpers/viewer_session.ts +25 -0
  82. package/app/composables/stepper_tree.ts +10 -2
  83. package/app/composables/tree_filter.ts +11 -2
  84. package/app/composables/tree_keyboard_nav.ts +4 -2
  85. package/app/composables/use_overlapping_picker.ts +30 -42
  86. package/app/composables/view_toolbar_options.ts +126 -0
  87. package/app/composables/view_toolbar_tool_options.ts +115 -0
  88. package/app/composables/view_toolbar_tools.ts +108 -0
  89. package/app/composables/viewer_context_menu.ts +19 -1
  90. package/app/composables/virtual_tree.ts +20 -131
  91. package/app/composables/virtual_tree_flatten.ts +109 -0
  92. package/app/composables/virtual_tree_types.ts +81 -0
  93. package/app/stores/app.ts +8 -55
  94. package/app/stores/app_helpers/extension.ts +90 -51
  95. package/app/stores/app_helpers/registry.ts +69 -0
  96. package/app/stores/basemap.ts +52 -0
  97. package/app/stores/basemap_detail.ts +51 -0
  98. package/app/stores/basemap_helpers/builds.ts +158 -0
  99. package/app/stores/basemap_helpers/detail_layers.ts +72 -0
  100. package/app/stores/basemap_helpers/detail_map.ts +62 -0
  101. package/app/stores/basemap_helpers/detail_refresh.ts +134 -0
  102. package/app/stores/basemap_helpers/detail_view.ts +94 -0
  103. package/app/stores/basemap_helpers/extent.ts +40 -0
  104. package/app/stores/basemap_helpers/georeferenced.ts +50 -0
  105. package/app/stores/basemap_helpers/layers.ts +66 -0
  106. package/app/stores/basemap_helpers/settings.ts +87 -0
  107. package/app/stores/basemap_helpers/viewer.ts +114 -0
  108. package/app/stores/data_style.ts +8 -0
  109. package/app/stores/feedback.ts +2 -2
  110. package/app/stores/hybrid_viewer.ts +1 -1
  111. package/app/stores/infra.ts +26 -21
  112. package/app/stores/menu.ts +8 -124
  113. package/app/stores/menu_helpers/basemap.ts +10 -0
  114. package/app/stores/menu_helpers/menus_data.ts +27 -0
  115. package/app/stores/menu_helpers/mesh/edged_curve.ts +12 -0
  116. package/app/stores/menu_helpers/mesh/grid.ts +24 -0
  117. package/app/stores/menu_helpers/mesh/point_set.ts +11 -0
  118. package/app/stores/menu_helpers/mesh/solid.ts +29 -0
  119. package/app/stores/menu_helpers/mesh/surface.ts +22 -0
  120. package/app/stores/menu_helpers/model.ts +25 -0
  121. package/app/stores/menu_helpers/scene.ts +10 -0
  122. package/app/stores/menu_helpers/types.ts +5 -0
  123. package/app/stores/treeview.ts +17 -10
  124. package/app/stores/viewer.ts +17 -79
  125. package/app/stores/viewer_helpers/actions.ts +68 -0
  126. package/app/stores/viewer_helpers/request.ts +61 -0
  127. package/app/utils/basemap_tree.ts +76 -0
  128. package/app/utils/clipping_planes.ts +4 -131
  129. package/app/utils/clipping_planes_scene.ts +131 -0
  130. package/app/utils/color_picker.ts +18 -15
  131. package/app/utils/coloring_styles.ts +101 -0
  132. package/app/utils/default_styles/constants.ts +10 -0
  133. package/app/utils/default_styles/index.ts +17 -1
  134. package/app/utils/default_styles/mesh_components.ts +168 -0
  135. package/app/utils/default_styles/meshes.ts +13 -153
  136. package/app/utils/default_styles/model_components.ts +170 -0
  137. package/app/utils/default_styles/models.ts +16 -153
  138. package/app/utils/drag_and_drop.ts +80 -0
  139. package/app/utils/extension.ts +1 -1
  140. package/app/utils/import_workflow.ts +6 -4
  141. package/app/utils/model_component_coloring.ts +46 -0
  142. package/app/utils/threshold.ts +33 -0
  143. package/app/utils/threshold_sources.ts +51 -0
  144. package/app/utils/treeview.ts +12 -1
  145. package/app/utils/upload_path.ts +15 -9
  146. package/app/utils/visible_map_area.ts +129 -0
  147. package/internal/database/base_database.ts +2 -0
  148. package/internal/database/database.ts +47 -29
  149. package/internal/database/tables/scene_style.ts +6 -0
  150. package/internal/stores/data_style/mesh/base_style.ts +74 -0
  151. package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
  152. package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
  153. package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
  154. package/internal/stores/data_style/mesh/cells/color.ts +3 -1
  155. package/internal/stores/data_style/mesh/cells/index.ts +17 -1
  156. package/internal/stores/data_style/mesh/cells/opacity.ts +54 -0
  157. package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
  158. package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
  159. package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
  160. package/internal/stores/data_style/mesh/edges/color.ts +3 -1
  161. package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
  162. package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
  163. package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
  164. package/internal/stores/data_style/mesh/edges/index.ts +17 -1
  165. package/internal/stores/data_style/mesh/edges/opacity.ts +54 -0
  166. package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
  167. package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
  168. package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
  169. package/internal/stores/data_style/mesh/index.ts +2 -57
  170. package/internal/stores/data_style/mesh/points/color.ts +3 -1
  171. package/internal/stores/data_style/mesh/points/index.ts +17 -1
  172. package/internal/stores/data_style/mesh/points/opacity.ts +54 -0
  173. package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
  174. package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
  175. package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
  176. package/internal/stores/data_style/mesh/polygons/color.ts +3 -1
  177. package/internal/stores/data_style/mesh/polygons/index.ts +17 -1
  178. package/internal/stores/data_style/mesh/polygons/opacity.ts +54 -0
  179. package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
  180. package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
  181. package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
  182. package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
  183. package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
  184. package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
  185. package/internal/stores/data_style/mesh/polyhedra/color.ts +3 -1
  186. package/internal/stores/data_style/mesh/polyhedra/index.ts +17 -1
  187. package/internal/stores/data_style/mesh/polyhedra/opacity.ts +54 -0
  188. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
  189. package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
  190. package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
  191. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
  192. package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
  193. package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
  194. package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
  195. package/internal/stores/data_style/model/blocks/color.ts +58 -57
  196. package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
  197. package/internal/stores/data_style/model/blocks/index.ts +12 -140
  198. package/internal/stores/data_style/model/blocks/polyhedron.ts +102 -54
  199. package/internal/stores/data_style/model/blocks/vertex.ts +102 -54
  200. package/internal/stores/data_style/model/color.ts +25 -26
  201. package/internal/stores/data_style/model/common.ts +10 -119
  202. package/internal/stores/data_style/model/common_mutations.ts +184 -0
  203. package/internal/stores/data_style/model/corners/index.ts +85 -78
  204. package/internal/stores/data_style/model/corners/vertex.ts +97 -49
  205. package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
  206. package/internal/stores/data_style/model/lines/color.ts +53 -40
  207. package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
  208. package/internal/stores/data_style/model/lines/edge.ts +102 -54
  209. package/internal/stores/data_style/model/lines/index.ts +10 -134
  210. package/internal/stores/data_style/model/lines/vertex.ts +102 -54
  211. package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
  212. package/internal/stores/data_style/model/surfaces/color.ts +68 -56
  213. package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
  214. package/internal/stores/data_style/model/surfaces/index.ts +16 -160
  215. package/internal/stores/data_style/model/surfaces/polygon.ts +94 -46
  216. package/internal/stores/data_style/model/surfaces/vertex.ts +94 -46
  217. package/internal/stores/data_style/model/visibility.ts +3 -156
  218. package/internal/stores/data_style/model/visibility_dispatch.ts +110 -0
  219. package/internal/stores/data_style/scene.ts +118 -0
  220. package/internal/stores/data_style/state.ts +5 -181
  221. package/internal/stores/data_style/state_shared.ts +199 -0
  222. package/internal/stores/data_style/types.ts +24 -1
  223. package/internal/stores/hybrid_viewer/brightness.ts +8 -2
  224. package/internal/stores/hybrid_viewer/camera.ts +7 -161
  225. package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
  226. package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
  227. package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
  228. package/internal/stores/hybrid_viewer/filters.ts +54 -11
  229. package/internal/stores/hybrid_viewer/highlight.ts +80 -63
  230. package/internal/stores/hybrid_viewer/ruler.ts +4 -3
  231. package/internal/stores/hybrid_viewer/scene.ts +31 -25
  232. package/internal/stores/hybrid_viewer/vtk_types.ts +2 -1
  233. package/internal/utils/ws_client.ts +8 -1
  234. package/package.json +2 -2
  235. package/server/api/local/extensions/run.post.ts +6 -4
  236. package/server/api/local/extensions/upload.put.ts +47 -20
  237. package/server/utils/cleanup.ts +12 -2
  238. package/server/utils/microservices.ts +10 -102
  239. package/server/utils/microservices_process.ts +127 -0
  240. package/server/utils/scripts.ts +35 -30
  241. package/server/utils/typed_handler.ts +8 -1
  242. package/server/utils/ws_client.ts +15 -2
  243. package/shared/utils/fetch_raw.ts +2 -2
  244. package/shared/utils/parse_boolean.ts +4 -1
  245. package/app/components/Viewer/Options/OptionsSection.vue +0 -76
@@ -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 };
@@ -10,6 +10,34 @@ import { useHybridViewerCore } from "./core";
10
10
  import { useHybridViewerScene } from "./scene";
11
11
  import { useViewerStore } from "@ogw_front/stores/viewer";
12
12
 
13
+ async function lookupModelName(modelId: string): Promise<string | undefined> {
14
+ const modelRecord = (await database.data?.get(modelId)) as { name?: string } | undefined;
15
+ return modelRecord?.name;
16
+ }
17
+
18
+ async function lookupComponentInfo(
19
+ modelId: string,
20
+ geodeId: string | undefined,
21
+ ): Promise<HoverComponentInfo | undefined> {
22
+ const modelComponentsTable = database.model_components;
23
+ if (geodeId === undefined || !modelComponentsTable) {
24
+ return undefined;
25
+ }
26
+ const components = modelComponentsTable.where("[id+geode_id]");
27
+ const query = components.equals([modelId, geodeId] as IndexableType);
28
+ const component = (await query.first()) as
29
+ | { name?: string; geode_id?: string; type?: string }
30
+ | undefined;
31
+ if (!component) {
32
+ return undefined;
33
+ }
34
+ return {
35
+ name: component.name ?? "",
36
+ id: component.geode_id ?? "",
37
+ type: component.type ?? "",
38
+ };
39
+ }
40
+
13
41
  // Shared via createSharedComposable (rather than merged into the parent hybridViewer store) so sibling slices, e.g. ruler.ts and viewport.ts, can read hover state/clearHoverHighlight/hoverHighlight 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.
14
42
  const useHybridViewerHighlight = createSharedComposable(() => {
15
43
  const is_hover_highlight = ref(false);
@@ -67,73 +95,62 @@ const useHybridViewerHighlight = createSharedComposable(() => {
67
95
  .catch(() => undefined);
68
96
  }
69
97
 
98
+ async function handleHoverResponse(
99
+ response: ViewerHighlightResponse,
100
+ relativeMousePosition: { x: number; y: number },
101
+ ): Promise<void> {
102
+ if (
103
+ !is_hover_highlight.value ||
104
+ response.id === undefined ||
105
+ response.picked_id === undefined ||
106
+ response.picked_id === -1
107
+ ) {
108
+ clearHoverData();
109
+ return;
110
+ }
111
+ const hoverKey = `${response.id}_${response.field_type}_${response.picked_id}`;
112
+ if (currentHoverId.value === hoverKey) {
113
+ return;
114
+ }
115
+ if (hoverTimeoutRef.value) {
116
+ clearTimeout(hoverTimeoutRef.value);
117
+ hoverTimeoutRef.value = undefined;
118
+ }
119
+ hoverData.value = undefined;
120
+ currentHoverId.value = hoverKey;
121
+ const modelName = await lookupModelName(response.id);
122
+ const componentInfo = await lookupComponentInfo(response.id, response.geode_id);
123
+ const newHoverData: HoverData = {
124
+ modelId: response.id,
125
+ modelName,
126
+ blockName: response.geode_id,
127
+ pickedId: response.picked_id,
128
+ fieldType: response.field_type,
129
+ component: componentInfo,
130
+ attributes: response.attributes ?? {},
131
+ };
132
+ hoverTimeoutRef.value = setTimeout(() => {
133
+ hoverPosition.value = relativeMousePosition;
134
+ hoverData.value = newHoverData;
135
+ hoverTimeoutRef.value = undefined;
136
+ }, HOVER_TIMEOUT_MS);
137
+ }
138
+
70
139
  const hoverHighlight = useDebounceFn((event: MouseEvent) => {
71
140
  const { genericRenderWindow } = useHybridViewerCore();
72
141
  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
- };
82
- requestHoverHighlight(event, async (response) => {
83
- if (
84
- !is_hover_highlight.value ||
85
- response.id === undefined ||
86
- response.picked_id === undefined ||
87
- response.picked_id === -1
88
- ) {
89
- clearHoverData();
90
- return;
91
- }
92
- const hoverKey = `${response.id}_${response.field_type}_${response.picked_id}`;
93
- if (currentHoverId.value === hoverKey) {
94
- return;
95
- }
96
- if (hoverTimeoutRef.value) {
97
- clearTimeout(hoverTimeoutRef.value);
98
- hoverTimeoutRef.value = undefined;
99
- }
100
- hoverData.value = undefined;
101
- currentHoverId.value = hoverKey;
102
- let componentInfo: HoverComponentInfo | undefined = undefined;
103
- let modelName: string | undefined = undefined;
104
- const modelRecord = (await database.data?.get(response.id)) as { name?: string } | undefined;
105
- if (modelRecord) {
106
- modelName = modelRecord.name;
107
- }
108
- const modelComponentsTable = database.model_components;
109
- if (response.geode_id !== undefined && modelComponentsTable) {
110
- const components = modelComponentsTable.where("[id+geode_id]");
111
- const query = components.equals([response.id, response.geode_id] as IndexableType);
112
- const component = (await query.first()) as
113
- | { name?: string; geode_id?: string; type?: string }
114
- | undefined;
115
- if (component) {
116
- componentInfo = {
117
- name: component.name ?? "",
118
- id: component.geode_id ?? "",
119
- type: component.type ?? "",
120
- };
121
- }
122
- }
123
- const newHoverData: HoverData = {
124
- modelId: response.id,
125
- modelName,
126
- blockName: response.geode_id,
127
- pickedId: response.picked_id,
128
- fieldType: response.field_type,
129
- component: componentInfo,
130
- attributes: response.attributes ?? {},
142
+ let relativeMousePosition = {
143
+ x: event.clientX,
144
+ y: event.clientY,
145
+ };
146
+ if (containerElement) {
147
+ relativeMousePosition = {
148
+ x: event.clientX - containerElement.getBoundingClientRect().left,
149
+ y: event.clientY - containerElement.getBoundingClientRect().top,
131
150
  };
132
- hoverTimeoutRef.value = setTimeout(() => {
133
- hoverPosition.value = relativeMousePosition;
134
- hoverData.value = newHoverData;
135
- hoverTimeoutRef.value = undefined;
136
- }, HOVER_TIMEOUT_MS);
151
+ }
152
+ requestHoverHighlight(event, async (response) => {
153
+ await handleHoverResponse(response, relativeMousePosition);
137
154
  });
138
155
  }, HOVER_DEBOUNCE_MS);
139
156
 
@@ -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;