@geode/opengeodeweb-front 10.43.2 → 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 (254) 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/CrsSelector.vue +53 -46
  13. package/app/components/DragAndDrop.vue +16 -79
  14. package/app/components/FeedBack/Snackers.vue +27 -0
  15. package/app/components/FileSelector.vue +9 -6
  16. package/app/components/HybridViewerTooltip.vue +8 -2
  17. package/app/components/MissingFilesSelector.vue +40 -23
  18. package/app/components/ObjectSelector.vue +34 -20
  19. package/app/components/ProjectCrs.vue +37 -0
  20. package/app/components/Screenshot.vue +17 -59
  21. package/app/components/ThresholdCard.vue +205 -0
  22. package/app/components/ThresholdFilter.vue +81 -216
  23. package/app/components/ViewToolbar.vue +15 -231
  24. package/app/components/Viewer/Basemap/CropOptions.vue +50 -0
  25. package/app/components/Viewer/Basemap/OpacityOptions.vue +52 -0
  26. package/app/components/Viewer/ContextMenu/CircularItems.vue +1 -2
  27. package/app/components/Viewer/ContextMenu/ContextMenu.vue +11 -6
  28. package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +10 -7
  29. package/app/components/Viewer/ContextMenu/InfoCard.vue +30 -0
  30. package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
  31. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
  32. package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +221 -0
  33. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
  34. package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
  35. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
  36. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +13 -0
  37. package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +227 -0
  38. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
  39. package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
  40. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
  41. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +14 -12
  42. package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
  43. package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
  44. package/app/components/Viewer/Generic/Model/CornersOptions.vue +15 -294
  45. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
  46. package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
  47. package/app/components/Viewer/Generic/Model/LinesOptions.vue +15 -427
  48. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
  49. package/app/components/Viewer/Generic/Model/ModelCardTabs.vue +35 -0
  50. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +34 -25
  51. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +34 -25
  52. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +17 -5
  53. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +16 -12
  54. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
  55. package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +71 -1
  56. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +55 -10
  57. package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
  58. package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
  59. package/app/components/Viewer/Options/ColorPicker.vue +4 -1
  60. package/app/components/Viewer/Options/ColoringTypeSelector.vue +48 -74
  61. package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
  62. package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
  63. package/app/components/Viewer/Options/Sliders/Opacity.vue +22 -0
  64. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +13 -0
  65. package/app/components/Viewer/Scene/BackgroundOptions.vue +37 -0
  66. package/app/components/Viewer/Scene/OrientationWidgetOptions.vue +48 -0
  67. package/app/components/Viewer/Scene/TextOptions.vue +63 -0
  68. package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
  69. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
  70. package/app/components/Viewer/Surface/PolygonsColoring.vue +224 -0
  71. package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
  72. package/app/components/Viewer/Ui.vue +9 -0
  73. package/app/components/csv-preview/CsvPreviewer.vue +4 -1
  74. package/app/composables/attribute_coloring_style.ts +8 -2
  75. package/app/composables/attribute_selector.ts +126 -0
  76. package/app/composables/batch_style_model.ts +34 -0
  77. package/app/composables/clipping_slices.ts +166 -0
  78. package/app/composables/global_attribute_style.ts +4 -3
  79. package/app/composables/hover_highlight.ts +19 -18
  80. package/app/composables/live_data_item.ts +39 -0
  81. package/app/composables/model_tabs.ts +86 -0
  82. package/app/composables/overlapping_picker_menu.ts +43 -0
  83. package/app/composables/project_manager.ts +5 -81
  84. package/app/composables/project_manager_helpers/reset.ts +34 -0
  85. package/app/composables/project_manager_helpers/restore.ts +67 -0
  86. package/app/composables/project_manager_helpers/types.ts +24 -0
  87. package/app/composables/project_manager_helpers/viewer_session.ts +25 -0
  88. package/app/composables/stepper_tree.ts +10 -2
  89. package/app/composables/tree_filter.ts +11 -2
  90. package/app/composables/tree_keyboard_nav.ts +4 -2
  91. package/app/composables/use_overlapping_picker.ts +30 -42
  92. package/app/composables/view_toolbar_options.ts +126 -0
  93. package/app/composables/view_toolbar_tool_options.ts +115 -0
  94. package/app/composables/view_toolbar_tools.ts +108 -0
  95. package/app/composables/viewer_context_menu.ts +19 -1
  96. package/app/composables/virtual_tree.ts +20 -131
  97. package/app/composables/virtual_tree_flatten.ts +109 -0
  98. package/app/composables/virtual_tree_types.ts +81 -0
  99. package/app/stores/app.ts +8 -55
  100. package/app/stores/app_helpers/extension.ts +90 -51
  101. package/app/stores/app_helpers/registry.ts +69 -0
  102. package/app/stores/basemap.ts +52 -0
  103. package/app/stores/basemap_detail.ts +51 -0
  104. package/app/stores/basemap_helpers/builds.ts +158 -0
  105. package/app/stores/basemap_helpers/detail_layers.ts +72 -0
  106. package/app/stores/basemap_helpers/detail_map.ts +62 -0
  107. package/app/stores/basemap_helpers/detail_refresh.ts +134 -0
  108. package/app/stores/basemap_helpers/detail_view.ts +94 -0
  109. package/app/stores/basemap_helpers/extent.ts +40 -0
  110. package/app/stores/basemap_helpers/georeferenced.ts +50 -0
  111. package/app/stores/basemap_helpers/layers.ts +66 -0
  112. package/app/stores/basemap_helpers/settings.ts +87 -0
  113. package/app/stores/basemap_helpers/viewer.ts +114 -0
  114. package/app/stores/crs.ts +136 -0
  115. package/app/stores/data.ts +24 -1
  116. package/app/stores/data_style.ts +8 -0
  117. package/app/stores/feedback.ts +12 -2
  118. package/app/stores/hybrid_viewer.ts +1 -1
  119. package/app/stores/infra.ts +26 -21
  120. package/app/stores/menu.ts +8 -124
  121. package/app/stores/menu_helpers/basemap.ts +10 -0
  122. package/app/stores/menu_helpers/menus_data.ts +27 -0
  123. package/app/stores/menu_helpers/mesh/edged_curve.ts +12 -0
  124. package/app/stores/menu_helpers/mesh/grid.ts +24 -0
  125. package/app/stores/menu_helpers/mesh/point_set.ts +11 -0
  126. package/app/stores/menu_helpers/mesh/solid.ts +29 -0
  127. package/app/stores/menu_helpers/mesh/surface.ts +22 -0
  128. package/app/stores/menu_helpers/model.ts +25 -0
  129. package/app/stores/menu_helpers/scene.ts +10 -0
  130. package/app/stores/menu_helpers/types.ts +5 -0
  131. package/app/stores/treeview.ts +17 -10
  132. package/app/stores/viewer.ts +17 -79
  133. package/app/stores/viewer_helpers/actions.ts +68 -0
  134. package/app/stores/viewer_helpers/request.ts +61 -0
  135. package/app/utils/basemap_tree.ts +76 -0
  136. package/app/utils/clipping_planes.ts +4 -131
  137. package/app/utils/clipping_planes_scene.ts +131 -0
  138. package/app/utils/color_picker.ts +18 -15
  139. package/app/utils/coloring_styles.ts +101 -0
  140. package/app/utils/crs.ts +38 -0
  141. package/app/utils/default_styles/constants.ts +10 -0
  142. package/app/utils/default_styles/index.ts +17 -1
  143. package/app/utils/default_styles/mesh_components.ts +168 -0
  144. package/app/utils/default_styles/meshes.ts +13 -153
  145. package/app/utils/default_styles/model_components.ts +170 -0
  146. package/app/utils/default_styles/models.ts +16 -153
  147. package/app/utils/drag_and_drop.ts +80 -0
  148. package/app/utils/extension.ts +1 -1
  149. package/app/utils/import_workflow.ts +26 -11
  150. package/app/utils/model_component_coloring.ts +46 -0
  151. package/app/utils/threshold.ts +33 -0
  152. package/app/utils/threshold_sources.ts +51 -0
  153. package/app/utils/treeview.ts +12 -1
  154. package/app/utils/upload_path.ts +15 -9
  155. package/app/utils/visible_map_area.ts +129 -0
  156. package/internal/database/base_database.ts +2 -0
  157. package/internal/database/database.ts +47 -29
  158. package/internal/database/tables/scene_style.ts +6 -0
  159. package/internal/stores/data_style/mesh/base_style.ts +74 -0
  160. package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
  161. package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
  162. package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
  163. package/internal/stores/data_style/mesh/cells/color.ts +3 -1
  164. package/internal/stores/data_style/mesh/cells/index.ts +17 -1
  165. package/internal/stores/data_style/mesh/cells/opacity.ts +54 -0
  166. package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
  167. package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
  168. package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
  169. package/internal/stores/data_style/mesh/edges/color.ts +3 -1
  170. package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
  171. package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
  172. package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
  173. package/internal/stores/data_style/mesh/edges/index.ts +17 -1
  174. package/internal/stores/data_style/mesh/edges/opacity.ts +54 -0
  175. package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
  176. package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
  177. package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
  178. package/internal/stores/data_style/mesh/index.ts +2 -57
  179. package/internal/stores/data_style/mesh/points/color.ts +3 -1
  180. package/internal/stores/data_style/mesh/points/index.ts +17 -1
  181. package/internal/stores/data_style/mesh/points/opacity.ts +54 -0
  182. package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
  183. package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
  184. package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
  185. package/internal/stores/data_style/mesh/polygons/color.ts +3 -1
  186. package/internal/stores/data_style/mesh/polygons/index.ts +17 -1
  187. package/internal/stores/data_style/mesh/polygons/opacity.ts +54 -0
  188. package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
  189. package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
  190. package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
  191. package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
  192. package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
  193. package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
  194. package/internal/stores/data_style/mesh/polyhedra/color.ts +3 -1
  195. package/internal/stores/data_style/mesh/polyhedra/index.ts +17 -1
  196. package/internal/stores/data_style/mesh/polyhedra/opacity.ts +54 -0
  197. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
  198. package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
  199. package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
  200. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
  201. package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
  202. package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
  203. package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
  204. package/internal/stores/data_style/model/blocks/color.ts +58 -57
  205. package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
  206. package/internal/stores/data_style/model/blocks/index.ts +12 -140
  207. package/internal/stores/data_style/model/blocks/polyhedron.ts +102 -54
  208. package/internal/stores/data_style/model/blocks/vertex.ts +102 -54
  209. package/internal/stores/data_style/model/color.ts +25 -26
  210. package/internal/stores/data_style/model/common.ts +10 -119
  211. package/internal/stores/data_style/model/common_mutations.ts +184 -0
  212. package/internal/stores/data_style/model/corners/index.ts +85 -78
  213. package/internal/stores/data_style/model/corners/vertex.ts +97 -49
  214. package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
  215. package/internal/stores/data_style/model/lines/color.ts +53 -40
  216. package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
  217. package/internal/stores/data_style/model/lines/edge.ts +102 -54
  218. package/internal/stores/data_style/model/lines/index.ts +10 -134
  219. package/internal/stores/data_style/model/lines/vertex.ts +102 -54
  220. package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
  221. package/internal/stores/data_style/model/surfaces/color.ts +68 -56
  222. package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
  223. package/internal/stores/data_style/model/surfaces/index.ts +16 -160
  224. package/internal/stores/data_style/model/surfaces/polygon.ts +94 -46
  225. package/internal/stores/data_style/model/surfaces/vertex.ts +94 -46
  226. package/internal/stores/data_style/model/visibility.ts +3 -156
  227. package/internal/stores/data_style/model/visibility_dispatch.ts +110 -0
  228. package/internal/stores/data_style/scene.ts +118 -0
  229. package/internal/stores/data_style/state.ts +5 -181
  230. package/internal/stores/data_style/state_shared.ts +199 -0
  231. package/internal/stores/data_style/types.ts +24 -1
  232. package/internal/stores/hybrid_viewer/brightness.ts +8 -2
  233. package/internal/stores/hybrid_viewer/camera.ts +7 -161
  234. package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
  235. package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
  236. package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
  237. package/internal/stores/hybrid_viewer/filters.ts +54 -11
  238. package/internal/stores/hybrid_viewer/highlight.ts +80 -63
  239. package/internal/stores/hybrid_viewer/ruler.ts +4 -3
  240. package/internal/stores/hybrid_viewer/scene.ts +34 -26
  241. package/internal/stores/hybrid_viewer/vtk_types.ts +2 -1
  242. package/internal/utils/ws_client.ts +8 -1
  243. package/package.json +5 -5
  244. package/server/api/local/extensions/run.post.ts +6 -4
  245. package/server/api/local/extensions/upload.put.ts +47 -20
  246. package/server/utils/cleanup.ts +12 -2
  247. package/server/utils/microservices.ts +10 -102
  248. package/server/utils/microservices_process.ts +127 -0
  249. package/server/utils/scripts.ts +35 -30
  250. package/server/utils/typed_handler.ts +8 -1
  251. package/server/utils/ws_client.ts +15 -2
  252. package/shared/utils/fetch_raw.ts +2 -2
  253. package/shared/utils/parse_boolean.ts +4 -1
  254. package/app/components/Viewer/Options/OptionsSection.vue +0 -76
@@ -118,12 +118,28 @@ interface UseModelSurfacesPolygonAttributeReturn {
118
118
  ) => Promise<void>;
119
119
  }
120
120
 
121
+ type ModelSurfacesPolygonAttributeGetters = Pick<
122
+ UseModelSurfacesPolygonAttributeReturn,
123
+ | "modelSurfacesPolygonAttributeStoredConfig"
124
+ | "modelSurfacesPolygonAttributeName"
125
+ | "modelSurfacesPolygonAttributeItem"
126
+ | "modelSurfacesPolygonAttributeRange"
127
+ | "modelSurfacesPolygonAttributeColorMap"
128
+ | "modelSurfacesPolygonAttributeNoDataColor"
129
+ | "modelSurfacesPolygonAttributeTimeStep"
130
+ > & {
131
+ modelSurfacesPolygonAttributeLastItem: (
132
+ modelId: string,
133
+ componentId: string | undefined,
134
+ name: string | undefined,
135
+ ) => number;
136
+ };
137
+
121
138
  // oxlint-disable-next-line max-lines-per-function
122
- function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeReturn {
123
- const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
124
- const dataStore = useDataStore();
125
- const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
126
- const viewerStore = useViewerStore();
139
+ function useModelSurfacesPolygonAttributeGetters(
140
+ modelSurfacesCommonStyle: ReturnType<typeof useModelSurfacesCommonStyle>,
141
+ ): ModelSurfacesPolygonAttributeGetters {
142
+ const { attributeTimeStep } = useAttributeTimeStepStyle();
127
143
  function modelSurfacesPolygonAttribute(modelId: string, surfaceId?: string): AttributeState {
128
144
  return (
129
145
  // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.polygon shape is defined by the data style schema.
@@ -149,37 +165,6 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
149
165
  no_data_color: DEFAULT_NO_DATA_COLOR,
150
166
  };
151
167
  }
152
- async function mutateModelSurfacesPolygonStyle(
153
- modelId: string,
154
- surfaceIds: string[],
155
- values: Record<string, unknown>,
156
- ): Promise<void> {
157
- const tasks: Promise<void>[] = [
158
- modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
159
- polygon: values,
160
- }),
161
- ];
162
- const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
163
- if (surfaceIds.length === totalSurfaceIds.length) {
164
- tasks.push(
165
- modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, {
166
- polygon: values,
167
- }),
168
- );
169
- }
170
- await Promise.all(tasks);
171
- }
172
- async function setModelSurfacesPolygonAttributeStoredConfig(
173
- modelId: string,
174
- surfaceIds: string[],
175
- name: string | undefined,
176
- item: number | undefined,
177
- config: Partial<AttributeStoredConfig>,
178
- ): Promise<void> {
179
- await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, {
180
- storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
181
- });
182
- }
183
168
  function modelSurfacesPolygonAttributeName(
184
169
  modelId: string,
185
170
  surfaceId?: string,
@@ -243,6 +228,65 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
243
228
  modelSurfacesPolygonAttribute(modelId, surfaceId).name,
244
229
  );
245
230
  }
231
+ return {
232
+ modelSurfacesPolygonAttributeStoredConfig,
233
+ modelSurfacesPolygonAttributeName,
234
+ modelSurfacesPolygonAttributeLastItem,
235
+ modelSurfacesPolygonAttributeItem,
236
+ modelSurfacesPolygonAttributeRange,
237
+ modelSurfacesPolygonAttributeColorMap,
238
+ modelSurfacesPolygonAttributeNoDataColor,
239
+ modelSurfacesPolygonAttributeTimeStep,
240
+ };
241
+ }
242
+
243
+ // oxlint-disable-next-line max-lines-per-function
244
+ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeReturn {
245
+ const { setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
246
+ const dataStore = useDataStore();
247
+ const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
248
+ const {
249
+ modelSurfacesPolygonAttributeStoredConfig,
250
+ modelSurfacesPolygonAttributeName,
251
+ modelSurfacesPolygonAttributeLastItem,
252
+ modelSurfacesPolygonAttributeItem,
253
+ modelSurfacesPolygonAttributeRange,
254
+ modelSurfacesPolygonAttributeColorMap,
255
+ modelSurfacesPolygonAttributeNoDataColor,
256
+ modelSurfacesPolygonAttributeTimeStep,
257
+ } = useModelSurfacesPolygonAttributeGetters(modelSurfacesCommonStyle);
258
+ const viewerStore = useViewerStore();
259
+ async function mutateModelSurfacesPolygonStyle(
260
+ modelId: string,
261
+ surfaceIds: string[],
262
+ values: Record<string, unknown>,
263
+ ): Promise<void> {
264
+ const tasks: Promise<void>[] = [
265
+ modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
266
+ polygon: values,
267
+ }),
268
+ ];
269
+ const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
270
+ if (surfaceIds.length === totalSurfaceIds.length) {
271
+ tasks.push(
272
+ modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, {
273
+ polygon: values,
274
+ }),
275
+ );
276
+ }
277
+ await Promise.all(tasks);
278
+ }
279
+ async function setModelSurfacesPolygonAttributeStoredConfig(
280
+ modelId: string,
281
+ surfaceIds: string[],
282
+ name: string | undefined,
283
+ item: number | undefined,
284
+ config: Partial<AttributeStoredConfig>,
285
+ ): Promise<void> {
286
+ await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, {
287
+ storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
288
+ });
289
+ }
246
290
  async function setModelSurfacesPolygonAttribute(
247
291
  modelId: string,
248
292
  surfaceIds: string[],
@@ -333,16 +377,20 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
333
377
  reapplySameSeries(
334
378
  await dataStore.getSurfacesGeodeIds(modelId),
335
379
  surfaceIds,
336
- (id) =>
337
- modelSurfacesCommonStyle.modelSurfaceColoring(modelId, id).active === "polygon" &&
338
- modelSurfacesPolygonAttributeName(modelId, id) === name
339
- ? [
340
- modelSurfacesPolygonAttributeItem(modelId, id),
341
- modelSurfacesPolygonAttributeRange(modelId, id),
342
- modelSurfacesPolygonAttributeColorMap(modelId, id),
343
- JSON.stringify(modelSurfacesPolygonAttributeNoDataColor(modelId, id)),
344
- ].join("|")
345
- : undefined,
380
+ (id) => {
381
+ if (
382
+ modelSurfacesCommonStyle.modelSurfaceColoring(modelId, id).active === "polygon" &&
383
+ modelSurfacesPolygonAttributeName(modelId, id) === name
384
+ ) {
385
+ return [
386
+ modelSurfacesPolygonAttributeItem(modelId, id),
387
+ modelSurfacesPolygonAttributeRange(modelId, id),
388
+ modelSurfacesPolygonAttributeColorMap(modelId, id),
389
+ JSON.stringify(modelSurfacesPolygonAttributeNoDataColor(modelId, id)),
390
+ ].join("|");
391
+ }
392
+ return undefined;
393
+ },
346
394
  async (ids) => {
347
395
  await applyPolygonAttribute(modelId, ids);
348
396
  },
@@ -112,12 +112,28 @@ interface UseModelSurfacesVertexAttributeReturn {
112
112
  ) => Promise<unknown>;
113
113
  }
114
114
 
115
+ type ModelSurfacesVertexAttributeGetters = Pick<
116
+ UseModelSurfacesVertexAttributeReturn,
117
+ | "modelSurfacesVertexAttributeStoredConfig"
118
+ | "modelSurfacesVertexAttributeName"
119
+ | "modelSurfacesVertexAttributeItem"
120
+ | "modelSurfacesVertexAttributeRange"
121
+ | "modelSurfacesVertexAttributeColorMap"
122
+ | "modelSurfacesVertexAttributeNoDataColor"
123
+ | "modelSurfacesVertexAttributeTimeStep"
124
+ > & {
125
+ modelSurfacesVertexAttributeLastItem: (
126
+ modelId: string,
127
+ componentId: string | undefined,
128
+ name: string | undefined,
129
+ ) => number;
130
+ };
131
+
115
132
  // oxlint-disable-next-line max-lines-per-function
116
- function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeReturn {
117
- const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
118
- const dataStore = useDataStore();
119
- const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
120
- const viewerStore = useViewerStore();
133
+ function useModelSurfacesVertexAttributeGetters(
134
+ modelSurfacesCommonStyle: ReturnType<typeof useModelSurfacesCommonStyle>,
135
+ ): ModelSurfacesVertexAttributeGetters {
136
+ const { attributeTimeStep } = useAttributeTimeStepStyle();
121
137
  function modelSurfacesVertexAttribute(modelId: string, surfaceId?: string): AttributeState {
122
138
  return (
123
139
  // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
@@ -143,37 +159,6 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
143
159
  no_data_color: DEFAULT_NO_DATA_COLOR,
144
160
  };
145
161
  }
146
- async function mutateModelSurfacesVertexStyle(
147
- modelId: string,
148
- surfaceIds: string[],
149
- values: Record<string, unknown>,
150
- ): Promise<void> {
151
- const tasks: Promise<void>[] = [
152
- modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
153
- vertex: values,
154
- }),
155
- ];
156
- const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
157
- if (surfaceIds.length === totalSurfaceIds.length) {
158
- tasks.push(
159
- modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, {
160
- vertex: values,
161
- }),
162
- );
163
- }
164
- await Promise.all(tasks);
165
- }
166
- async function setModelSurfacesVertexAttributeStoredConfig(
167
- modelId: string,
168
- surfaceIds: string[],
169
- name: string | undefined,
170
- item: number | undefined,
171
- config: Partial<AttributeStoredConfig>,
172
- ): Promise<void> {
173
- await mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
174
- storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
175
- });
176
- }
177
162
  function modelSurfacesVertexAttributeName(
178
163
  modelId: string,
179
164
  surfaceId?: string,
@@ -234,6 +219,65 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
234
219
  modelSurfacesVertexAttribute(modelId, surfaceId).name,
235
220
  );
236
221
  }
222
+ return {
223
+ modelSurfacesVertexAttributeStoredConfig,
224
+ modelSurfacesVertexAttributeName,
225
+ modelSurfacesVertexAttributeLastItem,
226
+ modelSurfacesVertexAttributeItem,
227
+ modelSurfacesVertexAttributeRange,
228
+ modelSurfacesVertexAttributeColorMap,
229
+ modelSurfacesVertexAttributeNoDataColor,
230
+ modelSurfacesVertexAttributeTimeStep,
231
+ };
232
+ }
233
+
234
+ // oxlint-disable-next-line max-lines-per-function
235
+ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeReturn {
236
+ const { setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
237
+ const dataStore = useDataStore();
238
+ const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
239
+ const {
240
+ modelSurfacesVertexAttributeStoredConfig,
241
+ modelSurfacesVertexAttributeName,
242
+ modelSurfacesVertexAttributeLastItem,
243
+ modelSurfacesVertexAttributeItem,
244
+ modelSurfacesVertexAttributeRange,
245
+ modelSurfacesVertexAttributeColorMap,
246
+ modelSurfacesVertexAttributeNoDataColor,
247
+ modelSurfacesVertexAttributeTimeStep,
248
+ } = useModelSurfacesVertexAttributeGetters(modelSurfacesCommonStyle);
249
+ const viewerStore = useViewerStore();
250
+ async function mutateModelSurfacesVertexStyle(
251
+ modelId: string,
252
+ surfaceIds: string[],
253
+ values: Record<string, unknown>,
254
+ ): Promise<void> {
255
+ const tasks: Promise<void>[] = [
256
+ modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
257
+ vertex: values,
258
+ }),
259
+ ];
260
+ const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
261
+ if (surfaceIds.length === totalSurfaceIds.length) {
262
+ tasks.push(
263
+ modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, {
264
+ vertex: values,
265
+ }),
266
+ );
267
+ }
268
+ await Promise.all(tasks);
269
+ }
270
+ async function setModelSurfacesVertexAttributeStoredConfig(
271
+ modelId: string,
272
+ surfaceIds: string[],
273
+ name: string | undefined,
274
+ item: number | undefined,
275
+ config: Partial<AttributeStoredConfig>,
276
+ ): Promise<void> {
277
+ await mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
278
+ storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
279
+ });
280
+ }
237
281
  async function setModelSurfacesVertexAttribute(
238
282
  modelId: string,
239
283
  surfaceIds: string[],
@@ -328,16 +372,20 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
328
372
  reapplySameSeries(
329
373
  await dataStore.getSurfacesGeodeIds(modelId),
330
374
  surfaceIds,
331
- (id) =>
332
- modelSurfacesCommonStyle.modelSurfaceColoring(modelId, id).active === "vertex" &&
333
- modelSurfacesVertexAttributeName(modelId, id) === name
334
- ? [
335
- modelSurfacesVertexAttributeItem(modelId, id),
336
- modelSurfacesVertexAttributeRange(modelId, id),
337
- modelSurfacesVertexAttributeColorMap(modelId, id),
338
- JSON.stringify(modelSurfacesVertexAttributeNoDataColor(modelId, id)),
339
- ].join("|")
340
- : undefined,
375
+ (id) => {
376
+ if (
377
+ modelSurfacesCommonStyle.modelSurfaceColoring(modelId, id).active === "vertex" &&
378
+ modelSurfacesVertexAttributeName(modelId, id) === name
379
+ ) {
380
+ return [
381
+ modelSurfacesVertexAttributeItem(modelId, id),
382
+ modelSurfacesVertexAttributeRange(modelId, id),
383
+ modelSurfacesVertexAttributeColorMap(modelId, id),
384
+ JSON.stringify(modelSurfacesVertexAttributeNoDataColor(modelId, id)),
385
+ ].join("|");
386
+ }
387
+ return undefined;
388
+ },
341
389
  async (ids) => {
342
390
  await applyVertexAttribute(modelId, ids);
343
391
  },
@@ -1,3 +1,4 @@
1
+ import { type ComponentStyleFunctions, dispatchToComponentTypes } from "./visibility_dispatch";
1
2
  import { MESH_COMPONENT_TYPES } from "@ogw_front/utils/default_styles";
2
3
  import { useDataStore } from "@ogw_front/stores/data";
3
4
  import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
@@ -7,162 +8,7 @@ import { useModelSelection } from "./selection";
7
8
  import { useViewerStore } from "@ogw_front/stores/viewer";
8
9
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
9
10
 
10
- // The four per-component-type style composables (Surface/Line/Block/Corner) each expose a different, large set of methods (color, visibility, per-attribute-kind getters/setters...). This module only cares about looking a handful of them up dynamically by name, so a precise structural type for componentStyleFunctions isn't worth modelling here; `any` keeps the dynamic dispatch table honest about that.
11
- // oxlint-disable-next-line no-explicit-any
12
- type ComponentStyleFunctions = Record<"Surface" | "Line" | "Block" | "Corner", any>;
13
-
14
- interface ModelComponent {
15
- geode_id: string;
16
- type: string;
17
- }
18
-
19
- async function callComponentStyleFunction(
20
- // oxlint-disable-next-line no-explicit-any
21
- target: any,
22
- method: string,
23
- ...args: unknown[]
24
- ): Promise<unknown> {
25
- // oxlint-disable-next-line no-unsafe-call, no-unsafe-member-access, no-unsafe-argument, no-unsafe-assignment -- ComponentStyleFunctions is deliberately dynamically typed; see comment above.
26
- const result = await target[method](...args);
27
- return result;
28
- }
29
-
30
11
  const model_schemas = viewer_schemas.opengeodeweb_viewer.model;
31
- async function getModelComponentsMap(
32
- modelId: string,
33
- ): Promise<{ allComponents: ModelComponent[]; componentsMap: Record<string, ModelComponent> }> {
34
- const dataStore = useDataStore();
35
- const results = await Promise.all(
36
- MESH_COMPONENT_TYPES.map(async (type) => {
37
- const geodeIds = await dataStore.getMeshComponentGeodeIds(modelId, type);
38
- return geodeIds.map((geode_id): ModelComponent => ({
39
- geode_id,
40
- type,
41
- }));
42
- }),
43
- );
44
- const allComponents = results.flat();
45
- return {
46
- allComponents,
47
- componentsMap: Object.fromEntries(
48
- allComponents.map((component): [string, ModelComponent] => [component.geode_id, component]),
49
- ),
50
- };
51
- }
52
- async function dispatchToComponentTypes(
53
- modelId: string,
54
- componentIds: string[],
55
- action: string,
56
- { componentStyleFunctions }: { componentStyleFunctions: ComponentStyleFunctions },
57
- ...args: unknown[]
58
- ): Promise<unknown[]> {
59
- const { componentsMap } = await getModelComponentsMap(modelId);
60
- const idsByComponent: { Block: string[]; Surface: string[]; Line: string[]; Corner: string[] } = {
61
- Block: [],
62
- Surface: [],
63
- Line: [],
64
- Corner: [],
65
- };
66
- for (const id of componentIds) {
67
- const type = componentsMap[id]?.type;
68
- if (type !== undefined && type in idsByComponent) {
69
- (idsByComponent as Record<string, string[]>)[type]?.push(id);
70
- }
71
- }
72
- const promises: Promise<unknown>[] = [];
73
- if (action === "Visibility") {
74
- if (idsByComponent.Block.length > 0) {
75
- promises.push(
76
- callComponentStyleFunction(
77
- componentStyleFunctions.Block,
78
- "setModelBlocksVisibility",
79
- modelId,
80
- idsByComponent.Block,
81
- ...args,
82
- ),
83
- );
84
- }
85
- if (idsByComponent.Surface.length > 0) {
86
- promises.push(
87
- callComponentStyleFunction(
88
- componentStyleFunctions.Surface,
89
- "setModelSurfacesVisibility",
90
- modelId,
91
- idsByComponent.Surface,
92
- ...args,
93
- ),
94
- );
95
- }
96
- if (idsByComponent.Line.length > 0) {
97
- promises.push(
98
- callComponentStyleFunction(
99
- componentStyleFunctions.Line,
100
- "setModelLinesVisibility",
101
- modelId,
102
- idsByComponent.Line,
103
- ...args,
104
- ),
105
- );
106
- }
107
- if (idsByComponent.Corner.length > 0) {
108
- promises.push(
109
- callComponentStyleFunction(
110
- componentStyleFunctions.Corner,
111
- "setModelCornersVisibility",
112
- modelId,
113
- idsByComponent.Corner,
114
- ...args,
115
- ),
116
- );
117
- }
118
- } else if (action === "Color") {
119
- if (idsByComponent.Block.length > 0) {
120
- promises.push(
121
- callComponentStyleFunction(
122
- componentStyleFunctions.Block,
123
- "setModelBlocksColor",
124
- modelId,
125
- idsByComponent.Block,
126
- ...args,
127
- ),
128
- );
129
- }
130
- if (idsByComponent.Surface.length > 0) {
131
- promises.push(
132
- callComponentStyleFunction(
133
- componentStyleFunctions.Surface,
134
- "setModelSurfacesColor",
135
- modelId,
136
- idsByComponent.Surface,
137
- ...args,
138
- ),
139
- );
140
- }
141
- if (idsByComponent.Line.length > 0) {
142
- promises.push(
143
- callComponentStyleFunction(
144
- componentStyleFunctions.Line,
145
- "setModelLinesColor",
146
- modelId,
147
- idsByComponent.Line,
148
- ...args,
149
- ),
150
- );
151
- }
152
- if (idsByComponent.Corner.length > 0) {
153
- promises.push(
154
- callComponentStyleFunction(
155
- componentStyleFunctions.Corner,
156
- "setModelCornersColor",
157
- modelId,
158
- idsByComponent.Corner,
159
- ...args,
160
- ),
161
- );
162
- }
163
- }
164
- return Promise.all(promises);
165
- }
166
12
  interface UseModelVisibilityStyleReturn {
167
13
  modelVisibility: (modelId: string) => boolean | undefined;
168
14
  setModelVisibility: (modelId: string, visibility: boolean) => Promise<unknown>;
@@ -284,4 +130,5 @@ function useModelVisibilityStyle(
284
130
  modelComponentTypeVisibility,
285
131
  };
286
132
  }
287
- export { getModelComponentsMap, dispatchToComponentTypes, useModelVisibilityStyle };
133
+ export { useModelVisibilityStyle };
134
+ export { getModelComponentsMap, dispatchToComponentTypes } from "./visibility_dispatch";
@@ -0,0 +1,110 @@
1
+ import { MESH_COMPONENT_TYPES } from "@ogw_front/utils/default_styles";
2
+ import { useDataStore } from "@ogw_front/stores/data";
3
+
4
+ // The four per-component-type style composables (Surface/Line/Block/Corner) each expose a different, large set of methods (color, visibility, per-attribute-kind getters/setters...). This module only cares about looking a handful of them up dynamically by name, so a precise structural type for componentStyleFunctions isn't worth modelling here; `any` keeps the dynamic dispatch table honest about that.
5
+ // oxlint-disable-next-line no-explicit-any
6
+ type ComponentStyleFunctions = Record<"Surface" | "Line" | "Block" | "Corner", any>;
7
+
8
+ interface ModelComponent {
9
+ geode_id: string;
10
+ type: string;
11
+ }
12
+
13
+ async function callComponentStyleFunction(
14
+ // oxlint-disable-next-line no-explicit-any
15
+ target: any,
16
+ method: string,
17
+ ...args: unknown[]
18
+ ): Promise<unknown> {
19
+ // oxlint-disable-next-line no-unsafe-call, no-unsafe-member-access, no-unsafe-argument, no-unsafe-assignment -- ComponentStyleFunctions is deliberately dynamically typed; see comment above.
20
+ const result = await target[method](...args);
21
+ return result;
22
+ }
23
+
24
+ async function getModelComponentsMap(
25
+ modelId: string,
26
+ ): Promise<{ allComponents: ModelComponent[]; componentsMap: Record<string, ModelComponent> }> {
27
+ const dataStore = useDataStore();
28
+ const results = await Promise.all(
29
+ MESH_COMPONENT_TYPES.map(async (type) => {
30
+ const geodeIds = await dataStore.getMeshComponentGeodeIds(modelId, type);
31
+ return geodeIds.map((geode_id): ModelComponent => ({
32
+ geode_id,
33
+ type,
34
+ }));
35
+ }),
36
+ );
37
+ const allComponents = results.flat();
38
+ return {
39
+ allComponents,
40
+ componentsMap: Object.fromEntries(
41
+ allComponents.map((component): [string, ModelComponent] => [component.geode_id, component]),
42
+ ),
43
+ };
44
+ }
45
+ const COMPONENT_TYPE_NAMES = ["Block", "Surface", "Line", "Corner"] as const;
46
+ type ComponentTypeName = (typeof COMPONENT_TYPE_NAMES)[number];
47
+
48
+ const DISPATCH_METHODS: Partial<Record<string, Record<ComponentTypeName, string>>> = {
49
+ Visibility: {
50
+ Block: "setModelBlocksVisibility",
51
+ Surface: "setModelSurfacesVisibility",
52
+ Line: "setModelLinesVisibility",
53
+ Corner: "setModelCornersVisibility",
54
+ },
55
+ Color: {
56
+ Block: "setModelBlocksColor",
57
+ Surface: "setModelSurfacesColor",
58
+ Line: "setModelLinesColor",
59
+ Corner: "setModelCornersColor",
60
+ },
61
+ };
62
+
63
+ function groupIdsByComponentType(
64
+ componentIds: string[],
65
+ componentsMap: Record<string, ModelComponent>,
66
+ ): Record<ComponentTypeName, string[]> {
67
+ const idsByComponent: Record<ComponentTypeName, string[]> = {
68
+ Block: [],
69
+ Surface: [],
70
+ Line: [],
71
+ Corner: [],
72
+ };
73
+ for (const id of componentIds) {
74
+ const type = componentsMap[id]?.type;
75
+ if (type !== undefined && type in idsByComponent) {
76
+ (idsByComponent as Record<string, string[]>)[type]?.push(id);
77
+ }
78
+ }
79
+ return idsByComponent;
80
+ }
81
+
82
+ async function dispatchToComponentTypes(
83
+ modelId: string,
84
+ componentIds: string[],
85
+ action: string,
86
+ { componentStyleFunctions }: { componentStyleFunctions: ComponentStyleFunctions },
87
+ ...args: unknown[]
88
+ ): Promise<unknown[]> {
89
+ const { componentsMap } = await getModelComponentsMap(modelId);
90
+ const idsByComponent = groupIdsByComponentType(componentIds, componentsMap);
91
+ const methods = DISPATCH_METHODS[action];
92
+ if (methods === undefined) {
93
+ return [];
94
+ }
95
+ const promises = COMPONENT_TYPE_NAMES.filter((type) => idsByComponent[type].length > 0).map(
96
+ async (type) => {
97
+ const result = await callComponentStyleFunction(
98
+ componentStyleFunctions[type],
99
+ methods[type],
100
+ modelId,
101
+ idsByComponent[type],
102
+ ...args,
103
+ );
104
+ return result;
105
+ },
106
+ );
107
+ return Promise.all(promises);
108
+ }
109
+ export { getModelComponentsMap, dispatchToComponentTypes };
110
+ export type { ComponentStyleFunctions };