@geode/opengeodeweb-front 10.44.0-rc.2 → 10.44.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/.build/server/utils/cleanup.js +7 -2
  2. package/.build/server/utils/microservices.js +9 -81
  3. package/.build/server/utils/microservices_process.js +85 -0
  4. package/.build/server/utils/typed_handler.js +5 -1
  5. package/.build/server/utils/ws_client.js +7 -2
  6. package/.build/shared/utils/fetch_raw.js +2 -2
  7. package/.build/shared/utils/parse_boolean.js +2 -1
  8. package/app/components/ClippingPlanes.vue +22 -78
  9. package/app/components/DragAndDrop.vue +16 -79
  10. package/app/components/FileSelector.vue +9 -6
  11. package/app/components/HybridViewerTooltip.vue +8 -2
  12. package/app/components/MissingFilesSelector.vue +10 -6
  13. package/app/components/ObjectSelector.vue +6 -3
  14. package/app/components/Screenshot.vue +9 -2
  15. package/app/components/ThresholdCard.vue +205 -0
  16. package/app/components/ThresholdFilter.vue +81 -216
  17. package/app/components/ViewToolbar.vue +15 -231
  18. package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
  19. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
  20. package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +228 -0
  21. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
  22. package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
  23. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
  24. package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +234 -0
  25. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
  26. package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
  27. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
  28. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +7 -5
  29. package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
  30. package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
  31. package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -292
  32. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
  33. package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
  34. package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
  35. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
  36. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +12 -10
  37. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +12 -10
  38. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +9 -5
  39. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
  40. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
  41. package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
  42. package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
  43. package/app/components/Viewer/Options/ColorPicker.vue +4 -1
  44. package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
  45. package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
  46. package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
  47. package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
  48. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
  49. package/app/components/Viewer/Surface/PolygonsColoring.vue +231 -0
  50. package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
  51. package/app/components/csv-preview/CsvPreviewer.vue +4 -1
  52. package/app/composables/attribute_coloring_style.ts +8 -2
  53. package/app/composables/attribute_selector.ts +126 -0
  54. package/app/composables/clipping_slices.ts +166 -0
  55. package/app/composables/global_attribute_style.ts +4 -3
  56. package/app/composables/hover_highlight.ts +6 -5
  57. package/app/composables/project_manager.ts +5 -5
  58. package/app/composables/stepper_tree.ts +10 -2
  59. package/app/composables/tree_filter.ts +11 -2
  60. package/app/composables/tree_keyboard_nav.ts +4 -2
  61. package/app/composables/use_overlapping_picker.ts +5 -5
  62. package/app/composables/view_toolbar_options.ts +126 -0
  63. package/app/composables/view_toolbar_tool_options.ts +115 -0
  64. package/app/composables/view_toolbar_tools.ts +108 -0
  65. package/app/composables/virtual_tree.ts +20 -131
  66. package/app/composables/virtual_tree_flatten.ts +86 -0
  67. package/app/composables/virtual_tree_types.ts +81 -0
  68. package/app/stores/app.ts +8 -55
  69. package/app/stores/app_helpers/extension.ts +1 -1
  70. package/app/stores/app_helpers/registry.ts +69 -0
  71. package/app/stores/feedback.ts +2 -2
  72. package/app/stores/hybrid_viewer.ts +1 -1
  73. package/app/stores/menu.ts +1 -124
  74. package/app/stores/menu_helpers/menus_data.ts +127 -0
  75. package/app/stores/treeview.ts +17 -10
  76. package/app/stores/viewer.ts +17 -78
  77. package/app/stores/viewer_helpers/actions.ts +68 -0
  78. package/app/stores/viewer_helpers/request.ts +61 -0
  79. package/app/utils/clipping_planes.ts +4 -131
  80. package/app/utils/clipping_planes_scene.ts +131 -0
  81. package/app/utils/coloring_styles.ts +101 -0
  82. package/app/utils/default_styles/mesh_components.ts +168 -0
  83. package/app/utils/default_styles/meshes.ts +13 -153
  84. package/app/utils/default_styles/model_components.ts +170 -0
  85. package/app/utils/default_styles/models.ts +16 -153
  86. package/app/utils/drag_and_drop.ts +80 -0
  87. package/app/utils/extension.ts +1 -1
  88. package/app/utils/import_workflow.ts +6 -4
  89. package/app/utils/model_component_coloring.ts +46 -0
  90. package/app/utils/threshold.ts +33 -0
  91. package/app/utils/threshold_sources.ts +51 -0
  92. package/app/utils/upload_path.ts +15 -9
  93. package/internal/database/database.ts +4 -1
  94. package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
  95. package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
  96. package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
  97. package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
  98. package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
  99. package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
  100. package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
  101. package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
  102. package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
  103. package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
  104. package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
  105. package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
  106. package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
  107. package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
  108. package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
  109. package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
  110. package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
  111. package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
  112. package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
  113. package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
  114. package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
  115. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
  116. package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
  117. package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
  118. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
  119. package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
  120. package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
  121. package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
  122. package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
  123. package/internal/stores/data_style/model/blocks/index.ts +12 -140
  124. package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
  125. package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
  126. package/internal/stores/data_style/model/common.ts +10 -119
  127. package/internal/stores/data_style/model/common_mutations.ts +184 -0
  128. package/internal/stores/data_style/model/corners/vertex.ts +14 -10
  129. package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
  130. package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
  131. package/internal/stores/data_style/model/lines/edge.ts +14 -10
  132. package/internal/stores/data_style/model/lines/index.ts +10 -134
  133. package/internal/stores/data_style/model/lines/vertex.ts +14 -10
  134. package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
  135. package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
  136. package/internal/stores/data_style/model/surfaces/index.ts +16 -160
  137. package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
  138. package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
  139. package/internal/stores/data_style/model/visibility.ts +3 -156
  140. package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
  141. package/internal/stores/data_style/state.ts +1 -181
  142. package/internal/stores/data_style/state_shared.ts +191 -0
  143. package/internal/stores/hybrid_viewer/brightness.ts +8 -2
  144. package/internal/stores/hybrid_viewer/camera.ts +7 -161
  145. package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
  146. package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
  147. package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
  148. package/internal/stores/hybrid_viewer/filters.ts +54 -11
  149. package/internal/stores/hybrid_viewer/highlight.ts +10 -9
  150. package/internal/stores/hybrid_viewer/ruler.ts +4 -3
  151. package/internal/utils/ws_client.ts +8 -1
  152. package/package.json +2 -2
  153. package/server/api/local/extensions/run.post.ts +6 -4
  154. package/server/utils/cleanup.ts +12 -2
  155. package/server/utils/microservices.ts +10 -102
  156. package/server/utils/microservices_process.ts +127 -0
  157. package/server/utils/typed_handler.ts +8 -1
  158. package/server/utils/ws_client.ts +15 -2
  159. package/shared/utils/fetch_raw.ts +2 -2
  160. package/shared/utils/parse_boolean.ts +4 -1
@@ -0,0 +1,231 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ type RangesPerData,
4
+ applyRangesPerData,
5
+ useBatchStyle,
6
+ } from "@ogw_front/composables/batch_style";
7
+ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
8
+ import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
9
+ import { useDataStyleStore } from "@ogw_front/stores/data_style";
10
+ import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
11
+
12
+ interface Texture {
13
+ id: string;
14
+ texture_name: string;
15
+ }
16
+
17
+ const dataStyleStore = useDataStyleStore();
18
+ const hybridViewerStore = useHybridViewerStore();
19
+ const { applyBatchStyle } = useBatchStyle();
20
+
21
+ interface Props {
22
+ id: string;
23
+ }
24
+
25
+ const { id } = defineProps<Props>();
26
+
27
+ const coloring_style_key = computed<string>({
28
+ get: () => dataStyleStore.meshPolygonsActiveColoring(id),
29
+ set: async (newValue) => {
30
+ await applyBatchStyle(id, (targetId: string) =>
31
+ dataStyleStore.setMeshPolygonsActiveColoring(targetId, newValue),
32
+ );
33
+ hybridViewerStore.remoteRender();
34
+ },
35
+ });
36
+ const color = computed<RGBAColor | undefined>({
37
+ get: () => dataStyleStore.meshPolygonsColor(id) as RGBAColor | undefined,
38
+ set: async (newValue) => {
39
+ if (newValue === undefined) {
40
+ return;
41
+ }
42
+ await applyBatchStyle(id, (targetId: string) =>
43
+ dataStyleStore.setMeshPolygonsColor(targetId, newValue),
44
+ );
45
+ hybridViewerStore.remoteRender();
46
+ },
47
+ });
48
+ const textures = computed<Texture[] | undefined>({
49
+ get: () => dataStyleStore.meshPolygonsTextures(id) as Texture[] | undefined,
50
+ set: async (newValue) => {
51
+ if (newValue === undefined) {
52
+ return;
53
+ }
54
+ await applyBatchStyle(id, (targetId: string) =>
55
+ dataStyleStore.setMeshPolygonsTextures(targetId, newValue),
56
+ );
57
+ hybridViewerStore.remoteRender();
58
+ },
59
+ });
60
+ const vertex_attribute_name = computed<string | undefined>({
61
+ get: () => dataStyleStore.meshPolygonsVertexAttributeName(id),
62
+ set: async (newValue) => {
63
+ if (newValue === undefined) {
64
+ return;
65
+ }
66
+ await applyBatchStyle(id, (targetId: string) =>
67
+ Promise.resolve(dataStyleStore.setMeshPolygonsVertexAttributeName(targetId, newValue)),
68
+ );
69
+ hybridViewerStore.remoteRender();
70
+ },
71
+ });
72
+
73
+ const vertex_attribute_time_step = computed<number | undefined>({
74
+ get: () => dataStyleStore.meshPolygonsVertexAttributeTimeStep(id),
75
+ set: async (newValue) => {
76
+ if (newValue === undefined) {
77
+ return;
78
+ }
79
+ await applyBatchStyle(id, (targetId: string) =>
80
+ Promise.resolve(dataStyleStore.setMeshPolygonsVertexAttributeTimeStep(targetId, newValue)),
81
+ );
82
+ hybridViewerStore.remoteRender();
83
+ },
84
+ });
85
+ const vertex_attribute_item = computed<string | undefined>({
86
+ get: () => dataStyleStore.meshPolygonsVertexAttributeItem(id),
87
+ set: async (newValue) => {
88
+ await applyBatchStyle(id, (targetId: string) =>
89
+ Promise.resolve(dataStyleStore.setMeshPolygonsVertexAttributeItem(targetId, newValue)),
90
+ );
91
+ hybridViewerStore.remoteRender();
92
+ },
93
+ });
94
+ const vertex_attribute_range = computed<[number, number] | undefined>({
95
+ get: () => dataStyleStore.meshPolygonsVertexAttributeRange(id),
96
+ set: async (newValue) => {
97
+ const [minimum, maximum] = newValue;
98
+ if (minimum === undefined || maximum === undefined) {
99
+ return;
100
+ }
101
+ await applyBatchStyle(id, (targetId: string) =>
102
+ Promise.resolve(
103
+ dataStyleStore.setMeshPolygonsVertexAttributeRange(targetId, minimum, maximum),
104
+ ),
105
+ );
106
+ hybridViewerStore.remoteRender();
107
+ },
108
+ });
109
+ const vertex_attribute_color_map = computed<Map<string, RGBAColor> | undefined>({
110
+ get: () => dataStyleStore.meshPolygonsVertexAttributeColorMap(id),
111
+ set: async (newValue) => {
112
+ await applyBatchStyle(id, (targetId: string) =>
113
+ Promise.resolve(dataStyleStore.setMeshPolygonsVertexAttributeColorMap(targetId, newValue)),
114
+ );
115
+ hybridViewerStore.remoteRender();
116
+ },
117
+ });
118
+ const vertex_attribute_no_data_color = computed<RGBAColor>({
119
+ get: () => dataStyleStore.meshPolygonsVertexAttributeNoDataColor(id),
120
+ set: async (newValue) => {
121
+ await applyBatchStyle(id, (targetId: string) =>
122
+ dataStyleStore.setMeshPolygonsVertexAttributeNoDataColor(targetId, newValue),
123
+ );
124
+ hybridViewerStore.remoteRender();
125
+ },
126
+ });
127
+ const polygon_attribute_name = computed<string | undefined>({
128
+ get: () => dataStyleStore.meshPolygonsPolygonAttributeName(id),
129
+ set: async (newValue) => {
130
+ if (newValue === undefined) {
131
+ return;
132
+ }
133
+ await applyBatchStyle(id, (targetId: string) =>
134
+ Promise.resolve(dataStyleStore.setMeshPolygonsPolygonAttributeName(targetId, newValue)),
135
+ );
136
+ hybridViewerStore.remoteRender();
137
+ },
138
+ });
139
+
140
+ const polygon_attribute_time_step = computed<number | undefined>({
141
+ get: () => dataStyleStore.meshPolygonsPolygonAttributeTimeStep(id),
142
+ set: async (newValue) => {
143
+ if (newValue === undefined) {
144
+ return;
145
+ }
146
+ await applyBatchStyle(id, (targetId: string) =>
147
+ Promise.resolve(dataStyleStore.setMeshPolygonsPolygonAttributeTimeStep(targetId, newValue)),
148
+ );
149
+ hybridViewerStore.remoteRender();
150
+ },
151
+ });
152
+ const polygon_attribute_item = computed<string | undefined>({
153
+ get: () => dataStyleStore.meshPolygonsPolygonAttributeItem(id),
154
+ set: async (newValue) => {
155
+ await applyBatchStyle(id, (targetId: string) =>
156
+ Promise.resolve(dataStyleStore.setMeshPolygonsPolygonAttributeItem(targetId, newValue)),
157
+ );
158
+ hybridViewerStore.remoteRender();
159
+ },
160
+ });
161
+ const polygon_attribute_range = computed<[number, number] | undefined>({
162
+ get: () => dataStyleStore.meshPolygonsPolygonAttributeRange(id),
163
+ set: async (newValue) => {
164
+ const [minimum, maximum] = newValue;
165
+ if (minimum === undefined || maximum === undefined) {
166
+ return;
167
+ }
168
+ await applyBatchStyle(id, (targetId: string) =>
169
+ Promise.resolve(
170
+ dataStyleStore.setMeshPolygonsPolygonAttributeRange(targetId, minimum, maximum),
171
+ ),
172
+ );
173
+ hybridViewerStore.remoteRender();
174
+ },
175
+ });
176
+ const polygon_attribute_color_map = computed<Map<string, RGBAColor> | undefined>({
177
+ get: () => dataStyleStore.meshPolygonsPolygonAttributeColorMap(id),
178
+ set: async (newValue) => {
179
+ await applyBatchStyle(id, (targetId: string) =>
180
+ Promise.resolve(dataStyleStore.setMeshPolygonsPolygonAttributeColorMap(targetId, newValue)),
181
+ );
182
+ hybridViewerStore.remoteRender();
183
+ },
184
+ });
185
+ const polygon_attribute_no_data_color = computed<RGBAColor>({
186
+ get: () => dataStyleStore.meshPolygonsPolygonAttributeNoDataColor(id),
187
+ set: async (newValue) => {
188
+ await applyBatchStyle(id, (targetId: string) =>
189
+ dataStyleStore.setMeshPolygonsPolygonAttributeNoDataColor(targetId, newValue),
190
+ );
191
+ hybridViewerStore.remoteRender();
192
+ },
193
+ });
194
+
195
+ async function setVertexAttributeRangesPerData(ranges: RangesPerData): Promise<void> {
196
+ await applyRangesPerData(ranges, (targetId, minimum, maximum) =>
197
+ dataStyleStore.setMeshPolygonsVertexAttributeRange(targetId, minimum, maximum),
198
+ );
199
+ hybridViewerStore.remoteRender();
200
+ }
201
+
202
+ async function setPolygonAttributeRangesPerData(ranges: RangesPerData): Promise<void> {
203
+ await applyRangesPerData(ranges, (targetId, minimum, maximum) =>
204
+ dataStyleStore.setMeshPolygonsPolygonAttributeRange(targetId, minimum, maximum),
205
+ );
206
+ hybridViewerStore.remoteRender();
207
+ }
208
+ </script>
209
+
210
+ <template>
211
+ <ViewerOptionsColoringTypeSelector
212
+ :id="id"
213
+ v-model:coloring_style_key="coloring_style_key"
214
+ v-model:color="color"
215
+ v-model:textures="textures"
216
+ v-model:vertex_attribute_name="vertex_attribute_name"
217
+ v-model:vertex_attribute_item="vertex_attribute_item"
218
+ v-model:vertex_attribute_range="vertex_attribute_range"
219
+ @vertex_attribute_ranges_per_data="setVertexAttributeRangesPerData"
220
+ v-model:vertex_attribute_color_map="vertex_attribute_color_map"
221
+ v-model:vertex_attribute_no_data_color="vertex_attribute_no_data_color"
222
+ v-model:vertex_attribute_time_step="vertex_attribute_time_step"
223
+ v-model:polygon_attribute_name="polygon_attribute_name"
224
+ v-model:polygon_attribute_item="polygon_attribute_item"
225
+ v-model:polygon_attribute_range="polygon_attribute_range"
226
+ @polygon_attribute_ranges_per_data="setPolygonAttributeRangesPerData"
227
+ v-model:polygon_attribute_color_map="polygon_attribute_color_map"
228
+ v-model:polygon_attribute_no_data_color="polygon_attribute_no_data_color"
229
+ v-model:polygon_attribute_time_step="polygon_attribute_time_step"
230
+ />
231
+ </template>
@@ -1,16 +1,11 @@
1
1
  <script setup lang="ts">
2
- import {
3
- type RangesPerData,
4
- applyRangesPerData,
5
- useBatchStyle,
6
- } from "@ogw_front/composables/batch_style";
7
2
  import ViewerContextMenuItem, {
8
3
  type ItemProps,
9
4
  } from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
10
5
  import PolygonalSurfacePolygons from "@ogw_front/assets/viewer_svgs/surface_triangles.svg";
11
- import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
12
- import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
13
6
  import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
7
+ import ViewerSurfacePolygonsColoring from "@ogw_front/components/Viewer/Surface/PolygonsColoring.vue";
8
+ import { useBatchStyle } from "@ogw_front/composables/batch_style";
14
9
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
15
10
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
16
11
 
@@ -18,11 +13,6 @@ const dataStyleStore = useDataStyleStore();
18
13
  const hybridViewerStore = useHybridViewerStore();
19
14
  const { applyBatchStyle } = useBatchStyle();
20
15
 
21
- interface Texture {
22
- id: string;
23
- texture_name: string;
24
- }
25
-
26
16
  interface Props {
27
17
  itemProps: ItemProps & { index: number };
28
18
  tooltip?: string;
@@ -41,187 +31,6 @@ const visibility = computed<boolean>({
41
31
  hybridViewerStore.remoteRender();
42
32
  },
43
33
  });
44
- const coloring_style_key = computed<string>({
45
- get: () => dataStyleStore.meshPolygonsActiveColoring(id.value),
46
- set: async (newValue) => {
47
- await applyBatchStyle(id.value, (targetId: string) =>
48
- dataStyleStore.setMeshPolygonsActiveColoring(targetId, newValue),
49
- );
50
- hybridViewerStore.remoteRender();
51
- },
52
- });
53
- const color = computed<RGBAColor | undefined>({
54
- get: () => dataStyleStore.meshPolygonsColor(id.value) as RGBAColor | undefined,
55
- set: async (newValue) => {
56
- if (newValue === undefined) {
57
- return;
58
- }
59
- await applyBatchStyle(id.value, (targetId: string) =>
60
- dataStyleStore.setMeshPolygonsColor(targetId, newValue),
61
- );
62
- hybridViewerStore.remoteRender();
63
- },
64
- });
65
- const textures = computed<Texture[] | undefined>({
66
- get: () => dataStyleStore.meshPolygonsTextures(id.value) as Texture[] | undefined,
67
- set: async (newValue) => {
68
- if (newValue === undefined) {
69
- return;
70
- }
71
- await applyBatchStyle(id.value, (targetId: string) =>
72
- dataStyleStore.setMeshPolygonsTextures(targetId, newValue),
73
- );
74
- hybridViewerStore.remoteRender();
75
- },
76
- });
77
- const vertex_attribute_name = computed<string | undefined>({
78
- get: () => dataStyleStore.meshPolygonsVertexAttributeName(id.value),
79
- set: async (newValue) => {
80
- if (newValue === undefined) {
81
- return;
82
- }
83
- await applyBatchStyle(id.value, (targetId: string) =>
84
- Promise.resolve(dataStyleStore.setMeshPolygonsVertexAttributeName(targetId, newValue)),
85
- );
86
- hybridViewerStore.remoteRender();
87
- },
88
- });
89
-
90
- const vertex_attribute_time_step = computed<number | undefined>({
91
- get: () => dataStyleStore.meshPolygonsVertexAttributeTimeStep(id.value),
92
- set: async (newValue) => {
93
- if (newValue === undefined) {
94
- return;
95
- }
96
- await applyBatchStyle(id.value, (targetId: string) =>
97
- Promise.resolve(dataStyleStore.setMeshPolygonsVertexAttributeTimeStep(targetId, newValue)),
98
- );
99
- hybridViewerStore.remoteRender();
100
- },
101
- });
102
- const vertex_attribute_item = computed<string | undefined>({
103
- get: () => dataStyleStore.meshPolygonsVertexAttributeItem(id.value),
104
- set: async (newValue) => {
105
- await applyBatchStyle(id.value, (targetId: string) =>
106
- Promise.resolve(dataStyleStore.setMeshPolygonsVertexAttributeItem(targetId, newValue)),
107
- );
108
- hybridViewerStore.remoteRender();
109
- },
110
- });
111
- const vertex_attribute_range = computed<[number, number] | undefined>({
112
- get: () => dataStyleStore.meshPolygonsVertexAttributeRange(id.value),
113
- set: async (newValue) => {
114
- const [minimum, maximum] = newValue;
115
- if (minimum === undefined || maximum === undefined) {
116
- return;
117
- }
118
- await applyBatchStyle(id.value, (targetId: string) =>
119
- Promise.resolve(
120
- dataStyleStore.setMeshPolygonsVertexAttributeRange(targetId, minimum, maximum),
121
- ),
122
- );
123
- hybridViewerStore.remoteRender();
124
- },
125
- });
126
- const vertex_attribute_color_map = computed<Map<string, RGBAColor> | undefined>({
127
- get: () => dataStyleStore.meshPolygonsVertexAttributeColorMap(id.value),
128
- set: async (newValue) => {
129
- await applyBatchStyle(id.value, (targetId: string) =>
130
- Promise.resolve(dataStyleStore.setMeshPolygonsVertexAttributeColorMap(targetId, newValue)),
131
- );
132
- hybridViewerStore.remoteRender();
133
- },
134
- });
135
- const vertex_attribute_no_data_color = computed<RGBAColor>({
136
- get: () => dataStyleStore.meshPolygonsVertexAttributeNoDataColor(id.value),
137
- set: async (newValue) => {
138
- await applyBatchStyle(id.value, (targetId: string) =>
139
- dataStyleStore.setMeshPolygonsVertexAttributeNoDataColor(targetId, newValue),
140
- );
141
- hybridViewerStore.remoteRender();
142
- },
143
- });
144
- const polygon_attribute_name = computed<string | undefined>({
145
- get: () => dataStyleStore.meshPolygonsPolygonAttributeName(id.value),
146
- set: async (newValue) => {
147
- if (newValue === undefined) {
148
- return;
149
- }
150
- await applyBatchStyle(id.value, (targetId: string) =>
151
- Promise.resolve(dataStyleStore.setMeshPolygonsPolygonAttributeName(targetId, newValue)),
152
- );
153
- hybridViewerStore.remoteRender();
154
- },
155
- });
156
-
157
- const polygon_attribute_time_step = computed<number | undefined>({
158
- get: () => dataStyleStore.meshPolygonsPolygonAttributeTimeStep(id.value),
159
- set: async (newValue) => {
160
- if (newValue === undefined) {
161
- return;
162
- }
163
- await applyBatchStyle(id.value, (targetId: string) =>
164
- Promise.resolve(dataStyleStore.setMeshPolygonsPolygonAttributeTimeStep(targetId, newValue)),
165
- );
166
- hybridViewerStore.remoteRender();
167
- },
168
- });
169
- const polygon_attribute_item = computed<string | undefined>({
170
- get: () => dataStyleStore.meshPolygonsPolygonAttributeItem(id.value),
171
- set: async (newValue) => {
172
- await applyBatchStyle(id.value, (targetId: string) =>
173
- Promise.resolve(dataStyleStore.setMeshPolygonsPolygonAttributeItem(targetId, newValue)),
174
- );
175
- hybridViewerStore.remoteRender();
176
- },
177
- });
178
- const polygon_attribute_range = computed<[number, number] | undefined>({
179
- get: () => dataStyleStore.meshPolygonsPolygonAttributeRange(id.value),
180
- set: async (newValue) => {
181
- const [minimum, maximum] = newValue;
182
- if (minimum === undefined || maximum === undefined) {
183
- return;
184
- }
185
- await applyBatchStyle(id.value, (targetId: string) =>
186
- Promise.resolve(
187
- dataStyleStore.setMeshPolygonsPolygonAttributeRange(targetId, minimum, maximum),
188
- ),
189
- );
190
- hybridViewerStore.remoteRender();
191
- },
192
- });
193
- const polygon_attribute_color_map = computed<Map<string, RGBAColor> | undefined>({
194
- get: () => dataStyleStore.meshPolygonsPolygonAttributeColorMap(id.value),
195
- set: async (newValue) => {
196
- await applyBatchStyle(id.value, (targetId: string) =>
197
- Promise.resolve(dataStyleStore.setMeshPolygonsPolygonAttributeColorMap(targetId, newValue)),
198
- );
199
- hybridViewerStore.remoteRender();
200
- },
201
- });
202
- const polygon_attribute_no_data_color = computed<RGBAColor>({
203
- get: () => dataStyleStore.meshPolygonsPolygonAttributeNoDataColor(id.value),
204
- set: async (newValue) => {
205
- await applyBatchStyle(id.value, (targetId: string) =>
206
- dataStyleStore.setMeshPolygonsPolygonAttributeNoDataColor(targetId, newValue),
207
- );
208
- hybridViewerStore.remoteRender();
209
- },
210
- });
211
-
212
- async function setVertexAttributeRangesPerData(ranges: RangesPerData): Promise<void> {
213
- await applyRangesPerData(ranges, (targetId, minimum, maximum) =>
214
- dataStyleStore.setMeshPolygonsVertexAttributeRange(targetId, minimum, maximum),
215
- );
216
- hybridViewerStore.remoteRender();
217
- }
218
-
219
- async function setPolygonAttributeRangesPerData(ranges: RangesPerData): Promise<void> {
220
- await applyRangesPerData(ranges, (targetId, minimum, maximum) =>
221
- dataStyleStore.setMeshPolygonsPolygonAttributeRange(targetId, minimum, maximum),
222
- );
223
- hybridViewerStore.remoteRender();
224
- }
225
34
  </script>
226
35
 
227
36
  <template>
@@ -238,26 +47,7 @@ async function setPolygonAttributeRangesPerData(ranges: RangesPerData): Promise<
238
47
  v-model="visibility"
239
48
  />
240
49
  <template v-if="visibility">
241
- <ViewerOptionsColoringTypeSelector
242
- :id="id"
243
- v-model:coloring_style_key="coloring_style_key"
244
- v-model:color="color"
245
- v-model:textures="textures"
246
- v-model:vertex_attribute_name="vertex_attribute_name"
247
- v-model:vertex_attribute_item="vertex_attribute_item"
248
- v-model:vertex_attribute_range="vertex_attribute_range"
249
- @vertex_attribute_ranges_per_data="setVertexAttributeRangesPerData"
250
- v-model:vertex_attribute_color_map="vertex_attribute_color_map"
251
- v-model:vertex_attribute_no_data_color="vertex_attribute_no_data_color"
252
- v-model:vertex_attribute_time_step="vertex_attribute_time_step"
253
- v-model:polygon_attribute_name="polygon_attribute_name"
254
- v-model:polygon_attribute_item="polygon_attribute_item"
255
- v-model:polygon_attribute_range="polygon_attribute_range"
256
- @polygon_attribute_ranges_per_data="setPolygonAttributeRangesPerData"
257
- v-model:polygon_attribute_color_map="polygon_attribute_color_map"
258
- v-model:polygon_attribute_no_data_color="polygon_attribute_no_data_color"
259
- v-model:polygon_attribute_time_step="polygon_attribute_time_step"
260
- />
50
+ <ViewerSurfacePolygonsColoring :id="id" />
261
51
  </template>
262
52
  </template>
263
53
  </ViewerContextMenuItem>
@@ -105,7 +105,10 @@ function parseContent(): string[] {
105
105
 
106
106
  const allLines = rawContent.value.split(/\r?\n/u).filter((line) => line.trim() !== "");
107
107
  const headerLine = allLines[headerRow.value];
108
- const rawHeaders = headerLine ? splitLine(headerLine) : [];
108
+ let rawHeaders: string[] = [];
109
+ if (headerLine) {
110
+ rawHeaders = splitLine(headerLine);
111
+ }
109
112
 
110
113
  previewHeaders.value = rawHeaders.map((header, index) => ({
111
114
  title: header || `Column ${index + 1}`,
@@ -78,7 +78,10 @@ function useAttributeColoringStyle(colorings: Ref<AttributeColoring[]>): Attribu
78
78
 
79
79
  const currentColormap = computed((): string => {
80
80
  const [coloring] = colorings.value;
81
- return coloring ? String(coloring.read("ColorMap")) : "batlow";
81
+ if (!coloring) {
82
+ return "batlow";
83
+ }
84
+ return String(coloring.read("ColorMap"));
82
85
  });
83
86
 
84
87
  async function applyGlobalColormap(colorMap: string): Promise<void> {
@@ -152,7 +155,10 @@ function useAttributeColoringStyle(colorings: Ref<AttributeColoring[]>): Attribu
152
155
  const currentTimeStep = computed<number>({
153
156
  get(): number {
154
157
  const coloring = temporalColoring.value;
155
- return coloring ? Number(coloring.read("TimeStep") ?? 0) : 0;
158
+ if (!coloring) {
159
+ return 0;
160
+ }
161
+ return Number(coloring.read("TimeStep") ?? 0);
156
162
  },
157
163
  // Setter cannot be async (see `currentRange`), so the write is delegated.
158
164
  set: (step: number): void => {
@@ -0,0 +1,126 @@
1
+ import type { AttributeRangeInfo, AttributeSchemas } from "@ogw_front/utils/attribute_range";
2
+ import type { AttributeRange } from "@ogw_front/composables/batch_style";
3
+ import { getAttributeRange } from "@ogw_front/utils/attributes";
4
+
5
+ interface AttributeInfo {
6
+ attribute_name: string;
7
+ nb_items: number;
8
+ time_steps?: number[];
9
+ [key: string]: unknown;
10
+ }
11
+
12
+ // The minimum and maximum of an attribute range: each one is clamped by the other
13
+ function useAttributeRangeBounds(attributeRange: Ref<(number | undefined)[]>): {
14
+ rangeMin: WritableComputedRef<number | undefined>;
15
+ rangeMax: WritableComputedRef<number | undefined>;
16
+ } {
17
+ const rangeMin = computed<number | undefined>({
18
+ get: () => attributeRange.value[0],
19
+ set: (val: number | undefined) => {
20
+ if (val === undefined) {
21
+ return;
22
+ }
23
+ const [, currentMax] = attributeRange.value;
24
+ let newMin = val;
25
+ if (typeof currentMax === "number" && val > currentMax) {
26
+ newMin = currentMax;
27
+ }
28
+ attributeRange.value = [newMin, currentMax];
29
+ },
30
+ });
31
+ const rangeMax = computed<number | undefined>({
32
+ get: () => attributeRange.value[1],
33
+ set: (val: number | undefined) => {
34
+ if (val === undefined) {
35
+ return;
36
+ }
37
+ const [currentMin] = attributeRange.value;
38
+ let newMax = val;
39
+ if (typeof currentMin === "number" && val < currentMin) {
40
+ newMax = currentMin;
41
+ }
42
+ attributeRange.value = [currentMin, newMax];
43
+ },
44
+ });
45
+ return { rangeMin, rangeMax };
46
+ }
47
+
48
+ // The items of an attribute with several components
49
+ function attributeItemOptions(itemCount: number): { title: string; value: number }[] {
50
+ return Array.from({ length: itemCount }, (_, index) => ({
51
+ title: `Item ${index + 1}`,
52
+ value: index,
53
+ }));
54
+ }
55
+
56
+ // The range of every target for the picked item
57
+ function attributeRangesPerTarget(
58
+ rangesPerTarget: ReadonlyMap<string, AttributeRangeInfo>,
59
+ item: number,
60
+ ): Map<string, AttributeRange> {
61
+ const ranges = new Map<string, AttributeRange>();
62
+ for (const [targetId, range] of rangesPerTarget) {
63
+ const { min, max } = getAttributeRange(range, item);
64
+ ranges.set(targetId, [min, max]);
65
+ }
66
+ return ranges;
67
+ }
68
+
69
+ // Commits the first time step when the picked series changes and the stored one is not valid
70
+ function useSeriesTimeStepCommit(
71
+ timeSteps: ComputedRef<number[]>,
72
+ seriesName: () => string | undefined,
73
+ attributeTimeStep: Readonly<Ref<number | undefined>>,
74
+ resetTimeStep: () => void,
75
+ ): () => void {
76
+ let committedSeries: string | undefined = undefined;
77
+
78
+ return (): void => {
79
+ if (timeSteps.value.length === 0) {
80
+ committedSeries = undefined;
81
+ return;
82
+ }
83
+ const name = seriesName();
84
+ if (name === committedSeries) {
85
+ return;
86
+ }
87
+ committedSeries = name;
88
+ const current = attributeTimeStep.value;
89
+ const valid = current !== undefined && current >= 0 && current < timeSteps.value.length;
90
+ // A valid step is already stored and applied with the series: emitting it again re-applies the attribute
91
+ if (!valid) {
92
+ resetTimeStep();
93
+ }
94
+ };
95
+ }
96
+
97
+ interface AttributeRequestParams {
98
+ id: string;
99
+ component_ids?: string[];
100
+ }
101
+
102
+ // Params of the "names" request, or undefined when the schema needs components and none is selected
103
+ function attributeRequestParams(
104
+ schemas: AttributeSchemas,
105
+ id: string,
106
+ componentIds: string[] | undefined,
107
+ ): AttributeRequestParams | undefined {
108
+ const { properties } = schemas.names;
109
+ if (typeof properties !== "object" || properties === null || !("component_ids" in properties)) {
110
+ return { id };
111
+ }
112
+ if (!Array.isArray(componentIds) || componentIds.length === 0) {
113
+ return undefined;
114
+ }
115
+ return { id, component_ids: componentIds };
116
+ }
117
+
118
+ export {
119
+ type AttributeInfo,
120
+ type AttributeRequestParams,
121
+ attributeItemOptions,
122
+ attributeRequestParams,
123
+ attributeRangesPerTarget,
124
+ useAttributeRangeBounds,
125
+ useSeriesTimeStepCommit,
126
+ };