@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
@@ -1,19 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { type AttributeSchemas, fetchAttributeRange } from "@ogw_front/utils/attribute_range";
3
- import {
4
- MESH_ELEMENT_KINDS,
5
- MODEL_COMPONENT_ATTRIBUTE_SCHEMAS,
6
- MODEL_COMPONENT_KINDS,
7
- attributeArrayName,
8
- getAttributeRange,
9
- } from "@ogw_front/utils/attributes";
10
- import type { JsonRpcSchema } from "@ogw_shared/utils/types.js";
2
+ import type { Threshold, ThresholdAttribute } from "@ogw_internal/stores/hybrid_viewer/filters";
3
+ import type { AttributeSource } from "@ogw_front/utils/threshold";
4
+ import ThresholdCard from "@ogw_front/components/ThresholdCard.vue";
11
5
  import ToolPanel from "@ogw_front/components/ToolPanel.vue";
12
- import ViewerOptionsAttributeRangeSelector from "@ogw_front/components/Viewer/Options/AttributeRangeSelector.vue";
13
- import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
14
- import { useBackStore } from "@ogw_front/stores/back";
6
+ import { fetchSources } from "@ogw_front/utils/threshold_sources";
15
7
  import { useDataStore } from "@ogw_front/stores/data";
16
- import { useDataStyleStore } from "@ogw_front/stores/data_style";
17
8
  import { useDebounceFn } from "@vueuse/core";
18
9
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
19
10
 
@@ -25,34 +16,18 @@ interface Props {
25
16
 
26
17
  const { escapeFunction = undefined } = defineProps<Props>();
27
18
 
28
- interface AttributeSource {
29
- title: string;
30
- schemas: AttributeSchemas;
31
- timeStepKey: string;
32
- params: { id: string; component_ids?: string[] };
33
- location: "point" | "cell";
34
- }
35
-
36
- interface AttributeInfo {
37
- attribute_name: string;
38
- nb_items: number;
39
- time_steps?: number[];
40
- [key: string]: unknown;
41
- }
42
-
43
19
  const show = defineModel<boolean>("show", { default: false });
44
- const backStore = useBackStore();
45
20
  const dataStore = useDataStore();
46
- const dataStyleStore = useDataStyleStore();
47
21
  const hybridViewerStore = useHybridViewerStore();
48
22
  const selectedDatasetId = ref<string>();
49
23
  const sources = ref<AttributeSource[]>([]);
50
- const selectedSourceIndex = ref<number>();
51
- const attributes = ref<AttributeInfo[]>([]);
52
- const attributeName = ref<string>();
53
- const attributeItem = ref<number>(0);
54
- const minimum = ref<number>();
55
- const maximum = ref<number>();
24
+ const thresholds = computed<Threshold[]>(() => {
25
+ if (!selectedDatasetId.value) {
26
+ return [];
27
+ }
28
+ return hybridViewerStore.getThresholds(selectedDatasetId.value);
29
+ });
30
+ const cards = useTemplateRef("cards");
56
31
 
57
32
  const allItems = dataStore.refAllItems();
58
33
  const availableDatasets = computed<{ title: string; value: string }[]>(() =>
@@ -61,165 +36,74 @@ const availableDatasets = computed<{ title: string; value: string }[]>(() =>
61
36
  value: item.id,
62
37
  })),
63
38
  );
64
- const availableSources = computed<{ title: string; value: number }[]>(() =>
65
- sources.value.map((source, index) => ({ title: source.title, value: index })),
66
- );
67
- const currentAttribute = computed<AttributeInfo | undefined>(() =>
68
- attributes.value.find((attribute) => attribute.attribute_name === attributeName.value),
69
- );
70
- const currentTimeStep = computed<number | undefined>(() => {
71
- const source = sources.value[selectedSourceIndex.value ?? -1];
72
- if (!selectedDatasetId.value || !source || !currentAttribute.value?.time_steps?.length) {
73
- return undefined;
74
- }
75
- const step =
76
- dataStyleStore.attributeTimeStep(
77
- selectedDatasetId.value,
78
- source.timeStepKey,
79
- attributeName.value,
80
- ) ?? 0;
81
- return Math.min(step, currentAttribute.value.time_steps.length - 1);
82
- });
83
- const itemOptions = computed<{ title: string; value: number }[]>(() =>
84
- Array.from({ length: currentAttribute.value?.nb_items ?? 0 }, (_, index) => ({
85
- title: `Item ${index + 1}`,
86
- value: index,
87
- })),
88
- );
89
39
 
90
- function attributeSchema(kind: string, isModel: boolean, route: "names" | "range"): JsonRpcSchema {
91
- const prefix = isModel ? "model_component_" : "";
92
- return back_schemas.opengeodeweb_back[
93
- `${prefix}${kind}_attribute_${route}` as keyof typeof back_schemas.opengeodeweb_back
94
- ] as JsonRpcSchema;
40
+ async function applyThresholds(): Promise<void> {
41
+ if (!selectedDatasetId.value) {
42
+ return;
43
+ }
44
+ await hybridViewerStore.setThreshold(
45
+ [selectedDatasetId.value],
46
+ thresholds.value
47
+ .map((threshold) => threshold.thresholdAttribute)
48
+ .filter((attribute): attribute is ThresholdAttribute => attribute !== undefined),
49
+ );
95
50
  }
96
51
 
97
- function attributeSource(
98
- kind: string,
99
- title: string,
100
- params: { id: string; component_ids?: string[] },
101
- modelType?: string,
102
- ): AttributeSource {
103
- const isModel = modelType !== undefined;
104
- const schema = attributeSchema(kind, isModel, "names");
105
- return {
106
- title: `${title}${kind} attribute`,
107
- schemas: { names: schema, range: attributeSchema(kind, isModel, "range") },
108
- timeStepKey:
109
- modelType === undefined
110
- ? schema.$id
111
- : (MODEL_COMPONENT_ATTRIBUTE_SCHEMAS[modelType]?.[kind]?.$id ?? schema.$id),
112
- params,
113
- location: kind === "vertex" ? "point" : "cell",
114
- };
115
- }
52
+ const debouncedApply = useDebounceFn(() => applyThresholds(), DEBOUNCE_DELAY);
116
53
 
117
- async function fetchSources(id: string): Promise<AttributeSource[]> {
118
- const item = await dataStore.item(id);
119
- if (item.viewer_type !== "model") {
120
- return ["vertex", MESH_ELEMENT_KINDS[item.geode_object_type]]
121
- .filter((kind): kind is string => kind !== undefined)
122
- .map((kind) => attributeSource(kind, "", { id }));
54
+ function addThreshold(): void {
55
+ if (selectedDatasetId.value) {
56
+ hybridViewerStore.addThreshold(selectedDatasetId.value);
123
57
  }
124
- const modelSources = await Promise.all(
125
- Object.entries(MODEL_COMPONENT_KINDS).map(async ([type, kinds]) => {
126
- const component_ids = await dataStore.getMeshComponentGeodeIds(id, type);
127
- if (component_ids.length === 0) {
128
- return [];
129
- }
130
- return kinds.map((kind) => attributeSource(kind, `${type} `, { id, component_ids }, type));
131
- }),
132
- );
133
- return modelSources.flat();
134
58
  }
135
59
 
136
- async function applyThreshold(): Promise<void> {
137
- const source = sources.value[selectedSourceIndex.value ?? -1];
138
- if (
139
- !selectedDatasetId.value ||
140
- !source ||
141
- !attributeName.value ||
142
- minimum.value === undefined ||
143
- maximum.value === undefined ||
144
- minimum.value > maximum.value
145
- ) {
146
- return;
60
+ function removeThreshold(index: number): void {
61
+ if (selectedDatasetId.value) {
62
+ hybridViewerStore.removeThreshold(selectedDatasetId.value, index);
147
63
  }
148
- await hybridViewerStore.setThreshold([selectedDatasetId.value], {
149
- name: attributeArrayName(attributeName.value, currentTimeStep.value),
150
- location: source.location,
151
- item: attributeItem.value,
152
- minimum: minimum.value,
153
- maximum: maximum.value,
154
- });
155
64
  }
156
65
 
157
- const debouncedApply = useDebounceFn(() => applyThreshold(), DEBOUNCE_DELAY);
66
+ async function clearThresholds(id: string): Promise<void> {
67
+ hybridViewerStore.removeThresholds(id);
68
+ await hybridViewerStore.setThreshold([id], []);
69
+ }
158
70
 
159
- async function resetRange(): Promise<void> {
160
- const source = sources.value[selectedSourceIndex.value ?? -1];
161
- const name = attributeName.value;
162
- if (!source || name === undefined) {
163
- return;
164
- }
165
- const range = await fetchAttributeRange(source.schemas.range, source.params, name);
166
- if (name !== attributeName.value) {
167
- return;
168
- }
169
- const { min, max } = getAttributeRange(range, attributeItem.value);
170
- minimum.value = min;
171
- maximum.value = max;
71
+ async function resetRanges(): Promise<void> {
72
+ await Promise.all((cards.value ?? []).map((card) => card?.resetRange()));
172
73
  }
173
74
 
174
- async function removeThreshold(): Promise<void> {
175
- attributeName.value = undefined;
75
+ async function removeThresholds(): Promise<void> {
176
76
  if (selectedDatasetId.value) {
177
- await hybridViewerStore.setThreshold([selectedDatasetId.value]);
77
+ await clearThresholds(selectedDatasetId.value);
78
+ hybridViewerStore.addThreshold(selectedDatasetId.value);
178
79
  }
179
80
  }
180
81
 
181
82
  watch(selectedDatasetId, async (id, previousId) => {
182
83
  if (previousId) {
183
- await hybridViewerStore.setThreshold([previousId]);
84
+ await clearThresholds(previousId);
184
85
  }
185
- selectedSourceIndex.value = undefined;
186
- sources.value = id ? await fetchSources(id) : [];
187
- });
188
-
189
- watch(selectedSourceIndex, async (index) => {
190
- attributeName.value = undefined;
191
- attributes.value = [];
192
- const source = sources.value[index ?? -1];
193
- if (!source) {
194
- return;
86
+ if (id) {
87
+ sources.value = await fetchSources(dataStore, id);
88
+ } else {
89
+ sources.value = [];
90
+ }
91
+ if (id && hybridViewerStore.getThresholds(id).length === 0) {
92
+ hybridViewerStore.addThreshold(id);
195
93
  }
196
- const response = (await backStore.request({
197
- schema: source.schemas.names,
198
- params: source.params,
199
- })) as { attributes: AttributeInfo[] };
200
- attributes.value = response.attributes;
201
- });
202
-
203
- watch(attributeName, async () => {
204
- attributeItem.value = 0;
205
- await resetRange();
206
- });
207
-
208
- watch(attributeItem, async () => {
209
- await resetRange();
210
- });
211
-
212
- watch(currentTimeStep, () => {
213
- debouncedApply();
214
94
  });
215
95
 
216
- watch([minimum, maximum], () => {
217
- debouncedApply();
218
- });
96
+ watch(
97
+ thresholds,
98
+ () => {
99
+ debouncedApply();
100
+ },
101
+ { deep: true },
102
+ );
219
103
 
220
104
  watch(show, (visible) => {
221
105
  if (visible) {
222
- applyThreshold();
106
+ applyThresholds();
223
107
  }
224
108
  });
225
109
  </script>
@@ -245,50 +129,31 @@ watch(show, (visible) => {
245
129
  class="mb-3 text-caption"
246
130
  />
247
131
 
248
- <v-select
249
- v-if="selectedDatasetId"
250
- v-model="selectedSourceIndex"
251
- data-testid="thresholdAttributeTypeSelect"
252
- :items="availableSources"
253
- label="Select an attribute type"
254
- variant="outlined"
255
- density="compact"
256
- hide-details
257
- class="mb-3 text-caption"
258
- />
259
-
260
- <v-select
261
- v-if="selectedSourceIndex !== undefined"
262
- v-model="attributeName"
263
- data-testid="thresholdAttributeSelect"
264
- :items="attributes.map((attribute) => attribute.attribute_name)"
265
- label="Select an attribute"
266
- variant="outlined"
267
- density="compact"
268
- hide-details
269
- class="mb-3 text-caption"
270
- />
271
-
272
- <v-select
273
- v-if="currentAttribute && currentAttribute.nb_items > 1"
274
- v-model="attributeItem"
275
- data-testid="thresholdItemSelect"
276
- :items="itemOptions"
277
- label="Select an item"
278
- variant="outlined"
279
- density="compact"
280
- hide-details
281
- class="mb-3 text-caption"
282
- />
283
-
284
- <template v-if="attributeName">
285
- <v-divider class="my-3" />
286
- <span class="text-caption font-weight-bold">Range</span>
287
- <ViewerOptionsAttributeRangeSelector
288
- v-model:minimum="minimum"
289
- v-model:maximum="maximum"
290
- class="mt-2"
291
- @reset="resetRange"
132
+ <template v-if="selectedDatasetId">
133
+ <v-divider class="my-2" />
134
+ <v-row align="center" justify="space-between" no-gutters class="mb-2">
135
+ <v-col class="text-caption font-weight-bold">Thresholds ({{ thresholds.length }})</v-col>
136
+ <v-col cols="auto">
137
+ <v-btn
138
+ data-testid="addThresholdButton"
139
+ size="x-small"
140
+ variant="tonal"
141
+ color="primary"
142
+ icon="mdi-plus"
143
+ @click="addThreshold"
144
+ />
145
+ </v-col>
146
+ </v-row>
147
+
148
+ <ThresholdCard
149
+ v-for="(threshold, idx) in thresholds"
150
+ :key="threshold.id"
151
+ ref="cards"
152
+ :threshold="threshold"
153
+ :dataset-id="selectedDatasetId"
154
+ :sources="sources"
155
+ :index="idx"
156
+ @remove="removeThreshold(idx)"
292
157
  />
293
158
  </template>
294
159
  </v-card-text>
@@ -301,9 +166,9 @@ watch(show, (visible) => {
301
166
  size="small"
302
167
  color="error"
303
168
  class="text-caption text-none"
304
- @click="removeThreshold"
169
+ @click="removeThresholds"
305
170
  >
306
- Remove Threshold
171
+ Remove all thresholds
307
172
  </v-btn>
308
173
  <v-btn
309
174
  data-testid="resetThresholdButton"
@@ -311,7 +176,7 @@ watch(show, (visible) => {
311
176
  size="small"
312
177
  color="secondary"
313
178
  class="text-caption text-none"
314
- @click="resetRange"
179
+ @click="resetRanges"
315
180
  >
316
181
  Reset
317
182
  </v-btn>
@@ -1,9 +1,5 @@
1
1
  <script setup lang="ts">
2
- import schemas, {
3
- type PickedFieldType,
4
- } from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
5
2
  import ActionButton from "@ogw_front/components/ActionButton.vue";
6
- import CameraBookmarkIcon from "@ogw_front/assets/viewer_svgs/camera-bookmark.svg";
7
3
  import CameraManager from "@ogw_front/components/CameraManager.vue";
8
4
  import CameraOrientation from "@ogw_front/components/CameraOrientation.vue";
9
5
  import ClippingPlanes from "@ogw_front/components/ClippingPlanes.vue";
@@ -15,35 +11,25 @@ import ThresholdFilter from "@ogw_front/components/ThresholdFilter.vue";
15
11
  import ZScaling from "@ogw_front/components/ZScaling.vue";
16
12
  import { onKeyStroke } from "@vueuse/core";
17
13
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
18
- import { useViewerStore } from "@ogw_front/stores/viewer";
14
+ import { useViewToolbarOptions } from "@ogw_front/composables/view_toolbar_options";
15
+ import { useViewToolbarTools } from "@ogw_front/composables/view_toolbar_tools";
19
16
 
20
17
  const hybridViewerStore = useHybridViewerStore();
21
- const viewerStore = useViewerStore();
22
- const { is_picking, is_zoom_box_active } = storeToRefs(hybridViewerStore);
23
- const { picking_mode } = storeToRefs(viewerStore);
24
- const showScreenshot = ref<boolean>(false);
25
- const showCameraManager = ref<boolean>(false);
26
- const showCameraOrientation = ref<boolean>(false);
27
- const showZScaling = ref<boolean>(false);
28
- const showClippingPlanes = ref<boolean>(false);
29
- const showShrinkFilter = ref<boolean>(false);
30
- const showExplodeFilter = ref<boolean>(false);
31
- const showThresholdFilter = ref<boolean>(false);
32
- const showRuler = ref<boolean>(false);
33
- const gridScale = ref<boolean>(false);
18
+ const tools = useViewToolbarTools();
19
+ const {
20
+ showScreenshot,
21
+ showCameraManager,
22
+ showCameraOrientation,
23
+ showZScaling,
24
+ showClippingPlanes,
25
+ showShrinkFilter,
26
+ showExplodeFilter,
27
+ showThresholdFilter,
28
+ showRuler,
29
+ } = tools;
34
30
  const zScale = ref<number>(hybridViewerStore.zScale);
35
31
  const openSubMenus = ref<Record<string, boolean>>({});
36
-
37
- interface CameraOptionAction {
38
- title?: string;
39
- testId: string;
40
- tooltip?: string;
41
- icon: string;
42
- iconSize?: number;
43
- color?: string;
44
- action?: () => void;
45
- menu?: CameraOptionAction[];
46
- }
32
+ const camera_options = useViewToolbarOptions(tools);
47
33
 
48
34
  watch(
49
35
  () => hybridViewerStore.zScale,
@@ -65,208 +51,6 @@ onKeyStroke("Escape", () => {
65
51
  }
66
52
  }
67
53
  });
68
-
69
- function stopHoverHighlight(): void {
70
- hybridViewerStore.is_hover_highlight = false;
71
- hybridViewerStore.clearHoverHighlight();
72
- }
73
-
74
- function closeAllToolsExcept(toolRef: Ref<boolean>): void {
75
- const tools = [
76
- showCameraOrientation,
77
- showCameraManager,
78
- showScreenshot,
79
- showZScaling,
80
- showClippingPlanes,
81
- showShrinkFilter,
82
- showExplodeFilter,
83
- showThresholdFilter,
84
- showRuler,
85
- is_picking,
86
- is_zoom_box_active,
87
- picking_mode,
88
- ];
89
- for (const tool of tools) {
90
- if (tool !== toolRef) {
91
- tool.value = false;
92
- }
93
- }
94
- if (toolRef !== showRuler) {
95
- void nextTick(stopHoverHighlight);
96
- }
97
- }
98
-
99
- function toggleTool(toolRef: Ref<boolean>): void {
100
- closeAllToolsExcept(toolRef);
101
- toolRef.value = !toolRef.value;
102
- }
103
-
104
- function toggleHoverHighlight(fieldType: PickedFieldType): void {
105
- const activate =
106
- !hybridViewerStore.is_hover_highlight ||
107
- hybridViewerStore.hover_highlight_field_type !== fieldType;
108
- closeAllToolsExcept(showRuler);
109
- if (activate) {
110
- hybridViewerStore.is_hover_highlight = true;
111
- hybridViewerStore.hover_highlight_field_type = fieldType;
112
- } else {
113
- stopHoverHighlight();
114
- }
115
- }
116
-
117
- const camera_options = computed<CameraOptionAction[]>(() => [
118
- {
119
- testId: "resetCameraButton",
120
- tooltip: "Reset camera",
121
- icon: "mdi-cube-scan",
122
- action: (): void => {
123
- hybridViewerStore.resetCamera();
124
- },
125
- },
126
- {
127
- testId: "centerOnClickButton",
128
- tooltip: "Center on click",
129
- icon: "mdi-crosshairs-question",
130
- color: hybridViewerStore.is_picking ? "primary" : undefined,
131
- action: (): void => {
132
- toggleTool(is_picking);
133
- },
134
- },
135
- {
136
- testId: "zoomToBoxButton",
137
- tooltip: "Zoom to box",
138
- icon: "mdi-magnify-scan",
139
- color: hybridViewerStore.is_zoom_box_active ? "primary" : undefined,
140
- action: (): void => {
141
- toggleTool(is_zoom_box_active);
142
- },
143
- },
144
- {
145
- testId: "highlightOnHoverButton",
146
- tooltip: "Highlight on hover",
147
- icon: "mdi-cursor-default-click",
148
- color: hybridViewerStore.is_hover_highlight ? "primary" : undefined,
149
- action: hybridViewerStore.is_hover_highlight ? stopHoverHighlight : undefined,
150
- menu: [
151
- {
152
- title: "Cells",
153
- testId: "highlightOnHoverCellsButton",
154
- icon: "mdi-select-all",
155
- action: (): void => {
156
- toggleHoverHighlight("CELL");
157
- },
158
- },
159
- {
160
- title: "Points",
161
- testId: "highlightOnHoverPointsButton",
162
- icon: "mdi-select-drag",
163
- action: (): void => {
164
- toggleHoverHighlight("POINT");
165
- },
166
- },
167
- ],
168
- },
169
- {
170
- testId: "cameraOrientationButton",
171
- tooltip: "Camera orientation",
172
- icon: "mdi-rotate-3d",
173
- action: (): void => {
174
- toggleTool(showCameraOrientation);
175
- },
176
- },
177
- {
178
- testId: "cameraManagerButton",
179
- tooltip: "Manage camera positions",
180
- icon: CameraBookmarkIcon,
181
- iconSize: 34,
182
- action: (): void => {
183
- toggleTool(showCameraManager);
184
- },
185
- },
186
- {
187
- testId: "screenshotButton",
188
- tooltip: "Take a screenshot",
189
- icon: "mdi-camera",
190
- action: (): void => {
191
- toggleTool(showScreenshot);
192
- },
193
- },
194
- {
195
- testId: "gridScaleButton",
196
- tooltip: "Toggle grid scale",
197
- icon: "mdi-ruler-square",
198
- color: gridScale.value ? "primary" : undefined,
199
- action: (): void => {
200
- const schema = schemas.opengeodeweb_viewer.viewer.grid_scale;
201
- const params = { visibility: !gridScale.value };
202
- viewerStore.request(
203
- {
204
- schema,
205
- params,
206
- },
207
- {
208
- response_function: () => {
209
- gridScale.value = !gridScale.value;
210
- hybridViewerStore.remoteRender();
211
- },
212
- },
213
- );
214
- },
215
- },
216
- {
217
- testId: "zScalingButton",
218
- tooltip: "Z Scaling Control",
219
- icon: "mdi-sort",
220
- action: (): void => {
221
- toggleTool(showZScaling);
222
- },
223
- },
224
- {
225
- testId: "clippingPlanesButton",
226
- tooltip: "Clipping Planes",
227
- icon: "mdi-content-cut",
228
- color: showClippingPlanes.value ? "primary" : undefined,
229
- action: (): void => {
230
- toggleTool(showClippingPlanes);
231
- },
232
- },
233
- {
234
- testId: "shrinkFilterButton",
235
- tooltip: "Shrink Filter",
236
- icon: "mdi-arrow-collapse-all",
237
- color: showShrinkFilter.value ? "primary" : undefined,
238
- action: (): void => {
239
- toggleTool(showShrinkFilter);
240
- },
241
- },
242
- {
243
- testId: "explodeFilterButton",
244
- tooltip: "Exploded View",
245
- icon: "mdi-arrow-expand-all",
246
- color: showExplodeFilter.value ? "primary" : undefined,
247
- action: (): void => {
248
- toggleTool(showExplodeFilter);
249
- },
250
- },
251
- {
252
- testId: "thresholdFilterButton",
253
- tooltip: "Threshold Filter",
254
- icon: "mdi-filter-variant",
255
- color: showThresholdFilter.value ? "primary" : undefined,
256
- action: (): void => {
257
- toggleTool(showThresholdFilter);
258
- },
259
- },
260
- {
261
- testId: "rulerButton",
262
- tooltip: "Ruler",
263
- icon: "mdi-ruler",
264
- color: showRuler.value ? "primary" : undefined,
265
- action: (): void => {
266
- toggleTool(showRuler);
267
- },
268
- },
269
- ]);
270
54
  </script>
271
55
 
272
56
  <template>
@@ -0,0 +1,50 @@
1
+ <script setup lang="ts">
2
+ import { MAP_STYLES, mapStyleOf } from "@ogw_front/utils/basemap_tree";
3
+ import ViewerContextMenuItem, {
4
+ type ItemProps,
5
+ } from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
6
+ import { useBasemapStore } from "@ogw_front/stores/basemap";
7
+
8
+ interface Props {
9
+ itemProps: ItemProps & { index: number };
10
+ tooltip?: string;
11
+ }
12
+
13
+ const { itemProps, tooltip = "Crop to data" } = defineProps<Props>();
14
+ const basemapStore = useBasemapStore();
15
+ // A map menu crops that map, the basemap category menu crops every map
16
+ const mapStyles = computed(() => {
17
+ const mapStyle = mapStyleOf(itemProps.id);
18
+ if (mapStyle === undefined) {
19
+ return MAP_STYLES;
20
+ }
21
+ return [mapStyle];
22
+ });
23
+ // Cropped: only the map draped on the top surfaces, without the flat map around
24
+ const cropped = computed(() => mapStyles.value.map((mapStyle) => basemapStore.crop[mapStyle]));
25
+ const indeterminate = computed(() => new Set(cropped.value).size > 1);
26
+ </script>
27
+
28
+ <template>
29
+ <ViewerContextMenuItem
30
+ data-testid="basemapCropMenu"
31
+ :index="itemProps.index"
32
+ :itemProps="itemProps"
33
+ :tooltip="tooltip"
34
+ btnIcon="mdi-panorama-outline"
35
+ >
36
+ <template #options>
37
+ <v-switch
38
+ :model-value="!indeterminate && cropped.every(Boolean)"
39
+ :indeterminate="indeterminate"
40
+ label="Crop to data"
41
+ data-testid="basemapCrop"
42
+ density="compact"
43
+ color="primary"
44
+ hide-details
45
+ class="px-1"
46
+ @update:model-value="(value) => basemapStore.setCrop(Boolean(value), mapStyles)"
47
+ />
48
+ </template>
49
+ </ViewerContextMenuItem>
50
+ </template>