@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,229 @@
1
+ <script setup lang="ts">
2
+ import type { CollectionComponent } from "@ogw_front/stores/data_helpers/collections";
3
+ import { MODEL_LINE_COLORING } from "@ogw_front/utils/model_component_coloring";
4
+ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
5
+ import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
6
+ import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
7
+ import { useDataStyleStore } from "@ogw_front/stores/data_style";
8
+ import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
9
+
10
+ interface Props {
11
+ modelId: string;
12
+ targetLineIds: string[];
13
+ collections?: CollectionComponent[];
14
+ activeTab?: string;
15
+ }
16
+
17
+ const {
18
+ modelId,
19
+ targetLineIds,
20
+ collections = undefined,
21
+ activeTab = undefined,
22
+ } = defineProps<Props>();
23
+
24
+ const dataStyleStore = useDataStyleStore();
25
+ const hybridViewerStore = useHybridViewerStore();
26
+
27
+ const referenceLineId = computed<string | undefined>(() =>
28
+ collections ? targetLineIds[0] : undefined,
29
+ );
30
+
31
+ // Visibility
32
+ const linesVisibility = computed<boolean>({
33
+ get: () => {
34
+ if (collections) {
35
+ return targetLineIds.every((id) => dataStyleStore.modelLineVisibility(modelId, id));
36
+ }
37
+ return dataStyleStore.modelComponentTypeVisibility(modelId, "Line");
38
+ },
39
+ set: async (newValue) => {
40
+ await dataStyleStore.setModelLinesVisibility(modelId, targetLineIds, newValue);
41
+ hybridViewerStore.remoteRender();
42
+ },
43
+ });
44
+
45
+ // Color
46
+ const linesColor = computed<RGBAColor | undefined>({
47
+ get: () => dataStyleStore.modelLineColor(modelId, referenceLineId.value) as RGBAColor | undefined,
48
+ set: async (color) => {
49
+ await dataStyleStore.setModelLinesColor(modelId, targetLineIds, color);
50
+ hybridViewerStore.remoteRender();
51
+ },
52
+ });
53
+
54
+ const linesActiveColoring = computed<string | undefined>({
55
+ get: () =>
56
+ dataStyleStore.modelLineActiveColoring(modelId, referenceLineId.value) as string | undefined,
57
+ set: async (coloringType) => {
58
+ if (typeof coloringType !== "string") {
59
+ return;
60
+ }
61
+ if (collections && coloringType === "random") {
62
+ await Promise.all(
63
+ collections.map((collection) =>
64
+ dataStyleStore.setModelLinesActiveColoring(
65
+ modelId,
66
+ collection.children.map((child) => child.id),
67
+ coloringType,
68
+ collection.id,
69
+ ),
70
+ ),
71
+ );
72
+ } else {
73
+ await dataStyleStore.setModelLinesActiveColoring(modelId, targetLineIds, coloringType);
74
+ }
75
+ hybridViewerStore.remoteRender();
76
+ },
77
+ });
78
+
79
+ // Group Attributes
80
+ const linesVertexAttributeName = computed<string | undefined>({
81
+ get: () => dataStyleStore.modelLinesVertexAttributeName(modelId, referenceLineId.value),
82
+ set: async (newValue) => {
83
+ if (newValue === undefined) {
84
+ return;
85
+ }
86
+ await dataStyleStore.setModelLinesVertexAttributeName(modelId, targetLineIds, newValue);
87
+ hybridViewerStore.remoteRender();
88
+ },
89
+ });
90
+
91
+ const linesVertexAttributeTimeStep = computed<number | undefined>({
92
+ get: () => dataStyleStore.modelLinesVertexAttributeTimeStep(modelId, referenceLineId.value),
93
+ set: async (newValue) => {
94
+ if (newValue === undefined) {
95
+ return;
96
+ }
97
+ await dataStyleStore.setModelLinesVertexAttributeTimeStep(modelId, targetLineIds, newValue);
98
+ hybridViewerStore.remoteRender();
99
+ },
100
+ });
101
+
102
+ const linesVertexAttributeItem = computed<string | undefined>({
103
+ get: () => dataStyleStore.modelLinesVertexAttributeItem(modelId, referenceLineId.value),
104
+ set: async (newValue) => {
105
+ await dataStyleStore.setModelLinesVertexAttributeItem(modelId, targetLineIds, newValue);
106
+ hybridViewerStore.remoteRender();
107
+ },
108
+ });
109
+
110
+ const linesVertexAttributeRange = computed<[number, number] | undefined>({
111
+ get: () => dataStyleStore.modelLinesVertexAttributeRange(modelId, referenceLineId.value),
112
+ set: async (newValue) => {
113
+ const [minimum, maximum] = newValue;
114
+ if (minimum === undefined || maximum === undefined) {
115
+ return;
116
+ }
117
+ await dataStyleStore.setModelLinesVertexAttributeRange(
118
+ modelId,
119
+ targetLineIds,
120
+ minimum,
121
+ maximum,
122
+ );
123
+ hybridViewerStore.remoteRender();
124
+ },
125
+ });
126
+
127
+ const linesVertexAttributeColorMap = computed<RGBAColorMap | undefined>({
128
+ get: () => dataStyleStore.modelLinesVertexAttributeColorMap(modelId, referenceLineId.value),
129
+ set: async (newValue) => {
130
+ await dataStyleStore.setModelLinesVertexAttributeColorMap(modelId, targetLineIds, newValue);
131
+ hybridViewerStore.remoteRender();
132
+ },
133
+ });
134
+
135
+ const linesVertexAttributeNoDataColor = computed<RGBAColor>({
136
+ get: () => dataStyleStore.modelLinesVertexAttributeNoDataColor(modelId, referenceLineId.value),
137
+ set: async (newValue) => {
138
+ await dataStyleStore.setModelLinesVertexAttributeNoDataColor(modelId, targetLineIds, newValue);
139
+ hybridViewerStore.remoteRender();
140
+ },
141
+ });
142
+
143
+ const linesEdgeAttributeName = computed<string | undefined>({
144
+ get: () => dataStyleStore.modelLinesEdgeAttributeName(modelId, referenceLineId.value),
145
+ set: async (newValue) => {
146
+ if (newValue === undefined) {
147
+ return;
148
+ }
149
+ await dataStyleStore.setModelLinesEdgeAttributeName(modelId, targetLineIds, newValue);
150
+ hybridViewerStore.remoteRender();
151
+ },
152
+ });
153
+
154
+ const linesEdgeAttributeTimeStep = computed<number | undefined>({
155
+ get: () => dataStyleStore.modelLinesEdgeAttributeTimeStep(modelId, referenceLineId.value),
156
+ set: async (newValue) => {
157
+ if (newValue === undefined) {
158
+ return;
159
+ }
160
+ await dataStyleStore.setModelLinesEdgeAttributeTimeStep(modelId, targetLineIds, newValue);
161
+ hybridViewerStore.remoteRender();
162
+ },
163
+ });
164
+
165
+ const linesEdgeAttributeItem = computed<string | undefined>({
166
+ get: () => dataStyleStore.modelLinesEdgeAttributeItem(modelId, referenceLineId.value),
167
+ set: async (newValue) => {
168
+ await dataStyleStore.setModelLinesEdgeAttributeItem(modelId, targetLineIds, newValue);
169
+ hybridViewerStore.remoteRender();
170
+ },
171
+ });
172
+
173
+ const linesEdgeAttributeRange = computed<[number, number] | undefined>({
174
+ get: () => dataStyleStore.modelLinesEdgeAttributeRange(modelId, referenceLineId.value),
175
+ set: async (newValue) => {
176
+ const [minimum, maximum] = newValue;
177
+ if (minimum === undefined || maximum === undefined) {
178
+ return;
179
+ }
180
+ await dataStyleStore.setModelLinesEdgeAttributeRange(modelId, targetLineIds, minimum, maximum);
181
+ hybridViewerStore.remoteRender();
182
+ },
183
+ });
184
+
185
+ const linesEdgeAttributeColorMap = computed<Map<string, RGBAColor> | undefined>({
186
+ get: () => dataStyleStore.modelLinesEdgeAttributeColorMap(modelId, referenceLineId.value),
187
+ set: async (newValue) => {
188
+ await dataStyleStore.setModelLinesEdgeAttributeColorMap(modelId, targetLineIds, newValue);
189
+ hybridViewerStore.remoteRender();
190
+ },
191
+ });
192
+
193
+ const linesEdgeAttributeNoDataColor = computed<RGBAColor>({
194
+ get: () => dataStyleStore.modelLinesEdgeAttributeNoDataColor(modelId, referenceLineId.value),
195
+ set: async (newValue) => {
196
+ await dataStyleStore.setModelLinesEdgeAttributeNoDataColor(modelId, targetLineIds, newValue);
197
+ hybridViewerStore.remoteRender();
198
+ },
199
+ });
200
+
201
+ const { capabilities, schemas: attributeSchemas } = MODEL_LINE_COLORING;
202
+ </script>
203
+
204
+ <template>
205
+ <div v-show="!activeTab || activeTab === 'type'" data-testid="modelComponentTypeOptions">
206
+ <VisibilitySwitch data-testid="modelLinesVisibilitySwitch" v-model="linesVisibility" />
207
+ <ViewerOptionsColoringTypeSelector
208
+ :id="modelId"
209
+ :componentIds="targetLineIds"
210
+ v-model:coloring_style_key="linesActiveColoring"
211
+ v-model:color="linesColor"
212
+ v-model:vertex_attribute_name="linesVertexAttributeName"
213
+ v-model:vertex_attribute_item="linesVertexAttributeItem"
214
+ v-model:vertex_attribute_range="linesVertexAttributeRange"
215
+ v-model:vertex_attribute_color_map="linesVertexAttributeColorMap"
216
+ v-model:vertex_attribute_no_data_color="linesVertexAttributeNoDataColor"
217
+ v-model:vertex_attribute_time_step="linesVertexAttributeTimeStep"
218
+ v-model:edge_attribute_name="linesEdgeAttributeName"
219
+ v-model:edge_attribute_item="linesEdgeAttributeItem"
220
+ v-model:edge_attribute_range="linesEdgeAttributeRange"
221
+ v-model:edge_attribute_color_map="linesEdgeAttributeColorMap"
222
+ v-model:edge_attribute_no_data_color="linesEdgeAttributeNoDataColor"
223
+ v-model:edge_attribute_time_step="linesEdgeAttributeTimeStep"
224
+ :capabilities="capabilities"
225
+ :schemas="attributeSchemas"
226
+ :allowRandom="true"
227
+ />
228
+ </div>
229
+ </template>
@@ -88,20 +88,22 @@ watch(
88
88
  { immediate: true },
89
89
  );
90
90
 
91
- const typeTargets = computed(() =>
92
- edgesComponentType.value === undefined
93
- ? []
94
- : [{ componentType: edgesComponentType.value, componentIds: targetComponentIds.value }],
95
- );
91
+ const typeTargets = computed(() => {
92
+ if (edgesComponentType.value === undefined) {
93
+ return [];
94
+ }
95
+ return [{ componentType: edgesComponentType.value, componentIds: targetComponentIds.value }];
96
+ });
96
97
  const typeReferenceId = computed<string | undefined>(() =>
97
98
  collections.value ? targetComponentIds.value[0] : undefined,
98
99
  );
99
100
 
100
- const componentTargets = computed(() =>
101
- edgesComponentType.value === undefined || componentId.value === undefined
102
- ? []
103
- : [{ componentType: edgesComponentType.value, componentIds: [componentId.value] }],
104
- );
101
+ const componentTargets = computed(() => {
102
+ if (edgesComponentType.value === undefined || componentId.value === undefined) {
103
+ return [];
104
+ }
105
+ return [{ componentType: edgesComponentType.value, componentIds: [componentId.value] }];
106
+ });
105
107
 
106
108
  const { tabs, activeTab } = useModelTabs({
107
109
  componentType,
@@ -72,20 +72,22 @@ watch(
72
72
  { immediate: true },
73
73
  );
74
74
 
75
- const typeTargets = computed(() =>
76
- pointsComponentType.value === undefined
77
- ? []
78
- : [{ componentType: pointsComponentType.value, componentIds: targetComponentIds.value }],
79
- );
75
+ const typeTargets = computed(() => {
76
+ if (pointsComponentType.value === undefined) {
77
+ return [];
78
+ }
79
+ return [{ componentType: pointsComponentType.value, componentIds: targetComponentIds.value }];
80
+ });
80
81
  const typeReferenceId = computed<string | undefined>(() =>
81
82
  collections.value ? targetComponentIds.value[0] : undefined,
82
83
  );
83
84
 
84
- const componentTargets = computed(() =>
85
- pointsComponentType.value === undefined || componentId.value === undefined
86
- ? []
87
- : [{ componentType: pointsComponentType.value, componentIds: [componentId.value] }],
88
- );
85
+ const componentTargets = computed(() => {
86
+ if (pointsComponentType.value === undefined || componentId.value === undefined) {
87
+ return [];
88
+ }
89
+ return [{ componentType: pointsComponentType.value, componentIds: [componentId.value] }];
90
+ });
89
91
 
90
92
  const { tabs, activeTab } = useModelTabs({
91
93
  componentType,
@@ -31,14 +31,18 @@ const referenceSurfaceId = computed<string | undefined>(() =>
31
31
  collections ? targetSurfaceIds[0] : undefined,
32
32
  );
33
33
 
34
- const surfaceComponentIds = computed<string[]>(() => (surfaceId === undefined ? [] : [surfaceId]));
34
+ const surfaceComponentIds = computed<string[]>(
35
+ () => (surfaceId !== undefined && [surfaceId]) || [],
36
+ );
35
37
 
36
38
  // Visibility
37
39
  const surfacesVisibility = computed<boolean>({
38
- get: () =>
39
- collections
40
- ? targetSurfaceIds.every((id) => dataStyleStore.modelSurfaceVisibility(modelId, id))
41
- : dataStyleStore.modelComponentTypeVisibility(modelId, "Surface"),
40
+ get: () => {
41
+ if (collections) {
42
+ return targetSurfaceIds.every((id) => dataStyleStore.modelSurfaceVisibility(modelId, id));
43
+ }
44
+ return dataStyleStore.modelComponentTypeVisibility(modelId, "Surface");
45
+ },
42
46
  set: async (newValue) => {
43
47
  await dataStyleStore.setModelSurfacesVisibility(modelId, targetSurfaceIds, newValue);
44
48
  hybridViewerStore.remoteRender();
@@ -31,7 +31,10 @@ function summarize(components: readonly FormattedComponent[]): string {
31
31
  return MESH_COMPONENT_TYPES.filter((type) => counts.has(type))
32
32
  .map((type) => {
33
33
  const count = counts.get(type) ?? 0;
34
- return `${count} ${count > 1 ? pluralize(type) : type}`;
34
+ if (count > 1) {
35
+ return `${count} ${pluralize(type)}`;
36
+ }
37
+ return `${count} ${type}`;
35
38
  })
36
39
  .join(", ");
37
40
  }
@@ -126,7 +126,12 @@ function handleHoverEnter({
126
126
 
127
127
  onHoverEnter(
128
128
  actualItem.id,
129
- async () => (is_model ? await dataStore.getAllModelComponentsViewerIds(actualItem.id) : []),
129
+ async () => {
130
+ if (is_model) {
131
+ return await dataStore.getAllModelComponentsViewerIds(actualItem.id);
132
+ }
133
+ return [];
134
+ },
130
135
  is_model ? "model" : "mesh",
131
136
  immediate,
132
137
  );
@@ -11,10 +11,17 @@ const maximum = defineModel<number>("maximum");
11
11
  const minimumText = ref<string>("");
12
12
  const maximumText = ref<string>("");
13
13
 
14
- watch(minimum, (value) => (minimumText.value = value === undefined ? "" : String(value)), {
14
+ function formatValue(value: number | undefined): string {
15
+ if (value === undefined) {
16
+ return "";
17
+ }
18
+ return String(value);
19
+ }
20
+
21
+ watch(minimum, (value) => (minimumText.value = formatValue(value)), {
15
22
  immediate: true,
16
23
  });
17
- watch(maximum, (value) => (maximumText.value = value === undefined ? "" : String(value)), {
24
+ watch(maximum, (value) => (maximumText.value = formatValue(value)), {
18
25
  immediate: true,
19
26
  });
20
27
 
@@ -27,7 +34,7 @@ function parseValue(text: string): number | undefined {
27
34
  function commitMinimum(): void {
28
35
  const value = parseValue(minimumText.value);
29
36
  if (value === undefined) {
30
- minimumText.value = minimum.value === undefined ? "" : String(minimum.value);
37
+ minimumText.value = formatValue(minimum.value);
31
38
  return;
32
39
  }
33
40
  minimum.value = value;
@@ -36,7 +43,7 @@ function commitMinimum(): void {
36
43
  function commitMaximum(): void {
37
44
  const value = parseValue(maximumText.value);
38
45
  if (value === undefined) {
39
- maximumText.value = maximum.value === undefined ? "" : String(maximum.value);
46
+ maximumText.value = formatValue(maximum.value);
40
47
  return;
41
48
  }
42
49
  maximum.value = value;
@@ -1,18 +1,23 @@
1
1
  <script setup lang="ts">
2
2
  import {
3
- type AttributeRange,
4
- type RangesPerData,
5
- useBatchGroup,
6
- } from "@ogw_front/composables/batch_style";
3
+ type AttributeInfo,
4
+ type AttributeRequestParams,
5
+ attributeItemOptions,
6
+ attributeRangesPerTarget,
7
+ attributeRequestParams,
8
+ useAttributeRangeBounds,
9
+ useSeriesTimeStepCommit,
10
+ } from "@ogw_front/composables/attribute_selector";
7
11
  import {
8
12
  type AttributeRangeInfo,
9
13
  type AttributeSchemas,
10
14
  fetchAttributeRange,
11
15
  } from "@ogw_front/utils/attribute_range";
16
+ import { type RangesPerData, useBatchGroup } from "@ogw_front/composables/batch_style";
12
17
  import { getAttributeRange, intersectAttributes } from "@ogw_front/utils/attributes";
13
18
  import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
14
19
  import ViewerOptionsAttributeColorBar from "@ogw_front/components/Viewer/Options/AttributeColorBar.vue";
15
- import ViewerOptionsColorPicker from "@ogw_front/components/Viewer/Options/ColorPicker.vue";
20
+ import ViewerOptionsNoDataColorInfo from "@ogw_front/components/Viewer/Options/NoDataColorInfo.vue";
16
21
  import ViewerOptionsTimeStepSlider from "@ogw_front/components/Viewer/Options/TimeStepSlider.vue";
17
22
  import { requestForTargets } from "@ogw_front/utils/request_for_targets";
18
23
  import { useBackStore } from "@ogw_front/stores/back";
@@ -44,13 +49,6 @@ interface Emits {
44
49
 
45
50
  const emit = defineEmits<Emits>();
46
51
 
47
- interface AttributeInfo {
48
- attribute_name: string;
49
- nb_items: number;
50
- time_steps?: number[];
51
- [key: string]: unknown;
52
- }
53
-
54
52
  const attributes = ref<AttributeInfo[]>([]);
55
53
  let attributesPerTarget = new Map<string, AttributeInfo[]>();
56
54
  const rangesPerTarget = ref(new Map<string, AttributeRangeInfo>());
@@ -67,96 +65,49 @@ const noData = computed<boolean>(() =>
67
65
  [...rangesPerTarget.value.values()].some((range) => range.no_data),
68
66
  );
69
67
 
70
- let committedSeries: string | undefined = undefined;
71
-
72
- function commitSeriesTimeStep(): void {
73
- if (timeSteps.value.length === 0) {
74
- committedSeries = undefined;
75
- return;
76
- }
77
- const name = currentAttribute.value?.attribute_name;
78
- if (name === committedSeries) {
79
- return;
80
- }
81
- committedSeries = name;
82
- const current = attributeTimeStep.value;
83
- const valid = current !== undefined && current >= 0 && current < timeSteps.value.length;
84
- // A valid step is already stored and applied with the series: emitting it again re-applies the attribute
85
- if (!valid) {
68
+ const commitSeriesTimeStep = useSeriesTimeStepCommit(
69
+ timeSteps,
70
+ () => currentAttribute.value?.attribute_name,
71
+ attributeTimeStep,
72
+ () => {
86
73
  emit("update:attributeTimeStep", 0);
87
- }
88
- }
89
-
90
- const cssNoDataColor = computed<string>(() => {
91
- const { red, green, blue, alpha } = attributeNoDataColor.value ?? DEFAULT_NO_DATA_COLOR;
92
- return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
93
- });
94
- const rangeMin = computed<number | undefined>({
95
- get: () => attributeRange.value[0],
96
- set: (val: number | undefined) => {
97
- if (val === undefined) {
98
- return;
99
- }
100
- const [, currentMax] = attributeRange.value;
101
- let newMin = val;
102
- if (typeof currentMax === "number" && val > currentMax) {
103
- newMin = currentMax;
104
- }
105
- attributeRange.value = [newMin, currentMax];
106
74
  },
107
- });
108
- const rangeMax = computed<number | undefined>({
109
- get: () => attributeRange.value[1],
110
- set: (val: number | undefined) => {
111
- if (val === undefined) {
112
- return;
113
- }
114
- const [currentMin] = attributeRange.value;
115
- let newMax = val;
116
- if (typeof currentMin === "number" && val < currentMin) {
117
- newMax = currentMin;
118
- }
119
- attributeRange.value = [currentMin, newMax];
120
- },
121
- });
75
+ );
76
+
77
+ const { rangeMin, rangeMax } = useAttributeRangeBounds(attributeRange);
122
78
 
123
79
  const componentItems = computed<{ title: string; value: number }[]>(() => {
124
- if (!currentAttribute.value) {
125
- return [];
80
+ if (currentAttribute.value) {
81
+ return attributeItemOptions(currentAttribute.value.nb_items);
126
82
  }
127
- return Array.from({ length: currentAttribute.value.nb_items }, (_, index) => ({
128
- title: `Item ${index + 1}`,
129
- value: index,
130
- }));
83
+ return [];
131
84
  });
132
85
 
133
- function hasSelectedComponent(components: unknown): boolean {
134
- return Array.isArray(components) && components.length > 0;
86
+ function requestParams(): AttributeRequestParams | undefined {
87
+ return attributeRequestParams(schemas, id, componentIds);
135
88
  }
136
89
 
137
- function requestParams(): { id: string; component_ids?: string[] } | undefined {
138
- const schemaProperties = schemas.names.properties as Record<string, unknown> | undefined;
139
- if (schemaProperties?.component_ids === undefined) {
140
- return { id };
90
+ function getRangeTargets(name: string): [string, AttributeRequestParams | undefined][] {
91
+ if (groupTargetIds.value) {
92
+ return [...attributesPerTarget]
93
+ .filter(([, targetAttributes]) =>
94
+ targetAttributes.some((attribute) => attribute.attribute_name === name),
95
+ )
96
+ .map(([targetId]) => [targetId, { id: targetId }]);
141
97
  }
142
- return hasSelectedComponent(componentIds) ? { id, component_ids: componentIds } : undefined;
98
+ return [[id, requestParams()]];
143
99
  }
144
100
 
145
101
  // Ranges are computed by the back for the selected attribute only, as scanning every step of every series is slow
146
102
  async function requestRanges(name: string): Promise<void> {
147
- const targets: [string, { id: string; component_ids?: string[] } | undefined][] =
148
- groupTargetIds.value
149
- ? [...attributesPerTarget]
150
- .filter(([, targetAttributes]) =>
151
- targetAttributes.some((attribute) => attribute.attribute_name === name),
152
- )
153
- .map(([targetId]) => [targetId, { id: targetId }])
154
- : [[id, requestParams()]];
103
+ const targets = getRangeTargets(name);
155
104
  const entries = await Promise.all(
156
- targets.map(async ([targetId, params]): Promise<[string, AttributeRangeInfo | undefined]> => [
157
- targetId,
158
- params ? await fetchAttributeRange(schemas.range, params, name) : undefined,
159
- ]),
105
+ targets.map(async ([targetId, params]): Promise<[string, AttributeRangeInfo | undefined]> => {
106
+ if (!params) {
107
+ return [targetId, undefined];
108
+ }
109
+ return [targetId, await fetchAttributeRange(schemas.range, params, name)];
110
+ }),
160
111
  );
161
112
  if (rangesName !== name) {
162
113
  return;
@@ -206,13 +157,8 @@ async function initGroupAttribute(name: string, item: number): Promise<void> {
206
157
  if (attributeName.value !== name) {
207
158
  return;
208
159
  }
209
- const ranges = new Map<string, AttributeRange>();
210
- for (const [targetId, range] of rangesPerTarget.value) {
211
- const { min, max } = getAttributeRange(range, item);
212
- ranges.set(targetId, [min, max]);
213
- }
214
160
  emit("update:attributeColorMap", attributeColorMap.value ?? "batlow");
215
- emit("ranges_per_data", ranges);
161
+ emit("ranges_per_data", attributeRangesPerTarget(rangesPerTarget.value, item));
216
162
  }
217
163
 
218
164
  async function getAttributes(): Promise<void> {
@@ -300,29 +246,7 @@ watch([attributeName, attributeItem, currentAttribute], async () => {
300
246
  hide-details
301
247
  />
302
248
  <ViewerOptionsTimeStepSlider v-model="attributeTimeStep" :time-steps="timeSteps" />
303
- <div
304
- v-if="currentAttribute && noData"
305
- class="text-caption text-high-emphasis mt-1 d-flex align-center ga-1"
306
- data-testid="noDataInfo"
307
- >
308
- <v-icon icon="mdi-information-outline" size="14" color="info" />
309
- <span>Contains unmapped elements</span>
310
- <v-menu :close-on-content-click="false">
311
- <template #activator="{ props }">
312
- <button
313
- v-bind="props"
314
- type="button"
315
- class="color-picker-rect-btn ml-1"
316
- :style="{ backgroundColor: cssNoDataColor }"
317
- v-tooltip="'Change unmapped elements color'"
318
- data-testid="noDataColorBtn"
319
- />
320
- </template>
321
- <v-card class="pa-2">
322
- <ViewerOptionsColorPicker v-model="attributeNoDataColor" disabled-alpha />
323
- </v-card>
324
- </v-menu>
325
- </div>
249
+ <ViewerOptionsNoDataColorInfo v-if="currentAttribute && noData" v-model="attributeNoDataColor" />
326
250
  <ViewerOptionsAttributeColorBar
327
251
  v-if="attributeName"
328
252
  v-model:minimum="rangeMin"
@@ -332,23 +256,3 @@ watch([attributeName, attributeItem, currentAttribute], async () => {
332
256
  @reset="resetRange"
333
257
  />
334
258
  </template>
335
-
336
- <style scoped>
337
- .color-picker-rect-btn {
338
- width: 26px;
339
- height: 15px;
340
- border-radius: 3px;
341
- border: 2px solid rgba(255, 255, 255, 0.912);
342
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
343
- cursor: pointer;
344
- outline: none;
345
- transition:
346
- border-color 0.15s ease,
347
- transform 0.15s ease;
348
- }
349
-
350
- .color-picker-rect-btn:hover {
351
- border-color: rgba(255, 255, 255, 0.9);
352
- transform: scale(1.1);
353
- }
354
- </style>
@@ -50,7 +50,10 @@ function onPickerUpdate(color: VuetifyColor): void {
50
50
  const red = Math.round(color.r);
51
51
  const green = Math.round(color.g);
52
52
  const blue = Math.round(color.b);
53
- const alpha = disabledAlpha ? 1 : Number(color.a.toFixed(2));
53
+ let alpha = 1;
54
+ if (!disabledAlpha) {
55
+ alpha = Number(color.a.toFixed(2));
56
+ }
54
57
 
55
58
  vuetifyColor.value = { r: red, g: green, b: blue, a: alpha };
56
59
  updateInputTextFromColor(red, green, blue, alpha);