@geode/opengeodeweb-front 10.44.0-rc.3 → 10.44.0-rc.5

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 (125) hide show
  1. package/.build/server/utils/microservices.js +9 -85
  2. package/.build/server/utils/microservices_process.js +85 -0
  3. package/app/components/ClippingPlanes.vue +16 -82
  4. package/app/components/DragAndDrop.vue +1 -74
  5. package/app/components/ThresholdCard.vue +205 -0
  6. package/app/components/ThresholdFilter.vue +77 -216
  7. package/app/components/ViewToolbar.vue +15 -231
  8. package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
  9. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
  10. package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +221 -0
  11. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
  12. package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
  13. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
  14. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +13 -0
  15. package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +227 -0
  16. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
  17. package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
  18. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
  19. package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
  20. package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
  21. package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -294
  22. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
  23. package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
  24. package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
  25. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
  26. package/app/components/Viewer/Options/AttributeSelector.vue +26 -133
  27. package/app/components/Viewer/Options/ColoringTypeSelector.vue +48 -74
  28. package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
  29. package/app/components/Viewer/Options/Sliders/Opacity.vue +22 -0
  30. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +13 -0
  31. package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
  32. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
  33. package/app/components/Viewer/Surface/PolygonsColoring.vue +224 -0
  34. package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
  35. package/app/composables/attribute_selector.ts +126 -0
  36. package/app/composables/batch_style_model.ts +34 -0
  37. package/app/composables/clipping_slices.ts +166 -0
  38. package/app/composables/view_toolbar_options.ts +126 -0
  39. package/app/composables/view_toolbar_tool_options.ts +115 -0
  40. package/app/composables/view_toolbar_tools.ts +108 -0
  41. package/app/composables/virtual_tree.ts +20 -138
  42. package/app/composables/virtual_tree_flatten.ts +86 -0
  43. package/app/composables/virtual_tree_types.ts +81 -0
  44. package/app/stores/app.ts +8 -55
  45. package/app/stores/app_helpers/registry.ts +69 -0
  46. package/app/stores/menu.ts +1 -124
  47. package/app/stores/menu_helpers/menus_data.ts +127 -0
  48. package/app/stores/viewer.ts +17 -78
  49. package/app/stores/viewer_helpers/actions.ts +68 -0
  50. package/app/stores/viewer_helpers/request.ts +61 -0
  51. package/app/utils/clipping_planes.ts +4 -132
  52. package/app/utils/clipping_planes_scene.ts +131 -0
  53. package/app/utils/coloring_styles.ts +101 -0
  54. package/app/utils/default_styles/mesh_components.ts +168 -0
  55. package/app/utils/default_styles/meshes.ts +13 -153
  56. package/app/utils/default_styles/model_components.ts +170 -0
  57. package/app/utils/default_styles/models.ts +16 -153
  58. package/app/utils/drag_and_drop.ts +80 -0
  59. package/app/utils/model_component_coloring.ts +46 -0
  60. package/app/utils/threshold.ts +33 -0
  61. package/app/utils/threshold_sources.ts +51 -0
  62. package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
  63. package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
  64. package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
  65. package/internal/stores/data_style/mesh/cells/color.ts +3 -1
  66. package/internal/stores/data_style/mesh/cells/index.ts +17 -1
  67. package/internal/stores/data_style/mesh/cells/opacity.ts +54 -0
  68. package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
  69. package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
  70. package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
  71. package/internal/stores/data_style/mesh/edges/color.ts +3 -1
  72. package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
  73. package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
  74. package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
  75. package/internal/stores/data_style/mesh/edges/index.ts +17 -1
  76. package/internal/stores/data_style/mesh/edges/opacity.ts +54 -0
  77. package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
  78. package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
  79. package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
  80. package/internal/stores/data_style/mesh/points/color.ts +3 -1
  81. package/internal/stores/data_style/mesh/points/index.ts +17 -1
  82. package/internal/stores/data_style/mesh/points/opacity.ts +54 -0
  83. package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
  84. package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
  85. package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
  86. package/internal/stores/data_style/mesh/polygons/color.ts +3 -1
  87. package/internal/stores/data_style/mesh/polygons/index.ts +17 -1
  88. package/internal/stores/data_style/mesh/polygons/opacity.ts +54 -0
  89. package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
  90. package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
  91. package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
  92. package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
  93. package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
  94. package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
  95. package/internal/stores/data_style/mesh/polyhedra/color.ts +3 -1
  96. package/internal/stores/data_style/mesh/polyhedra/index.ts +17 -1
  97. package/internal/stores/data_style/mesh/polyhedra/opacity.ts +54 -0
  98. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
  99. package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
  100. package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
  101. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
  102. package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
  103. package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
  104. package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
  105. package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
  106. package/internal/stores/data_style/model/blocks/index.ts +12 -140
  107. package/internal/stores/data_style/model/common.ts +10 -119
  108. package/internal/stores/data_style/model/common_mutations.ts +184 -0
  109. package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
  110. package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
  111. package/internal/stores/data_style/model/lines/index.ts +10 -134
  112. package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
  113. package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
  114. package/internal/stores/data_style/model/surfaces/index.ts +16 -160
  115. package/internal/stores/data_style/model/visibility.ts +3 -156
  116. package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
  117. package/internal/stores/data_style/state.ts +1 -181
  118. package/internal/stores/data_style/state_shared.ts +191 -0
  119. package/internal/stores/hybrid_viewer/camera.ts +7 -161
  120. package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
  121. package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
  122. package/internal/stores/hybrid_viewer/filters.ts +54 -11
  123. package/package.json +1 -1
  124. package/server/utils/microservices.ts +10 -109
  125. package/server/utils/microservices_process.ts +127 -0
@@ -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>
@@ -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,87 +65,29 @@ 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
- },
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
74
  },
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 };
141
- }
142
- if (!hasSelectedComponent(componentIds)) {
143
- return undefined;
144
- }
145
- return { id, component_ids: componentIds };
146
- }
147
-
148
- function getRangeTargets(
149
- name: string,
150
- ): [string, { id: string; component_ids?: string[] } | undefined][] {
90
+ function getRangeTargets(name: string): [string, AttributeRequestParams | undefined][] {
151
91
  if (groupTargetIds.value) {
152
92
  return [...attributesPerTarget]
153
93
  .filter(([, targetAttributes]) =>
@@ -217,13 +157,8 @@ async function initGroupAttribute(name: string, item: number): Promise<void> {
217
157
  if (attributeName.value !== name) {
218
158
  return;
219
159
  }
220
- const ranges = new Map<string, AttributeRange>();
221
- for (const [targetId, range] of rangesPerTarget.value) {
222
- const { min, max } = getAttributeRange(range, item);
223
- ranges.set(targetId, [min, max]);
224
- }
225
160
  emit("update:attributeColorMap", attributeColorMap.value ?? "batlow");
226
- emit("ranges_per_data", ranges);
161
+ emit("ranges_per_data", attributeRangesPerTarget(rangesPerTarget.value, item));
227
162
  }
228
163
 
229
164
  async function getAttributes(): Promise<void> {
@@ -311,29 +246,7 @@ watch([attributeName, attributeItem, currentAttribute], async () => {
311
246
  hide-details
312
247
  />
313
248
  <ViewerOptionsTimeStepSlider v-model="attributeTimeStep" :time-steps="timeSteps" />
314
- <div
315
- v-if="currentAttribute && noData"
316
- class="text-caption text-high-emphasis mt-1 d-flex align-center ga-1"
317
- data-testid="noDataInfo"
318
- >
319
- <v-icon icon="mdi-information-outline" size="14" color="info" />
320
- <span>Contains unmapped elements</span>
321
- <v-menu :close-on-content-click="false">
322
- <template #activator="{ props }">
323
- <button
324
- v-bind="props"
325
- type="button"
326
- class="color-picker-rect-btn ml-1"
327
- :style="{ backgroundColor: cssNoDataColor }"
328
- v-tooltip="'Change unmapped elements color'"
329
- data-testid="noDataColorBtn"
330
- />
331
- </template>
332
- <v-card class="pa-2">
333
- <ViewerOptionsColorPicker v-model="attributeNoDataColor" disabled-alpha />
334
- </v-card>
335
- </v-menu>
336
- </div>
249
+ <ViewerOptionsNoDataColorInfo v-if="currentAttribute && noData" v-model="attributeNoDataColor" />
337
250
  <ViewerOptionsAttributeColorBar
338
251
  v-if="attributeName"
339
252
  v-model:minimum="rangeMin"
@@ -343,23 +256,3 @@ watch([attributeName, attributeItem, currentAttribute], async () => {
343
256
  @reset="resetRange"
344
257
  />
345
258
  </template>
346
-
347
- <style scoped>
348
- .color-picker-rect-btn {
349
- width: 26px;
350
- height: 15px;
351
- border-radius: 3px;
352
- border: 2px solid rgba(255, 255, 255, 0.912);
353
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
354
- cursor: pointer;
355
- outline: none;
356
- transition:
357
- border-color 0.15s ease,
358
- transform 0.15s ease;
359
- }
360
-
361
- .color-picker-rect-btn:hover {
362
- border-color: rgba(255, 255, 255, 0.9);
363
- transform: scale(1.1);
364
- }
365
- </style>
@@ -1,11 +1,16 @@
1
1
  <script setup lang="ts">
2
- import type { AttributeSchemas } from "@ogw_front/utils/attribute_range";
2
+ import {
3
+ COLORING_STYLES,
4
+ type Schemas,
5
+ buildColoringStyles,
6
+ resolveAttributeSchemas,
7
+ } from "@ogw_front/utils/coloring_styles";
3
8
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
4
9
  import type { RangesPerData } from "@ogw_front/composables/batch_style";
5
10
  import ViewerOptionsAttributeSelector from "@ogw_front/components/Viewer/Options/AttributeSelector.vue";
6
11
  import ViewerOptionsColorPicker from "@ogw_front/components/Viewer/Options/ColorPicker.vue";
12
+ import ViewerOptionsOpacitySlider from "@ogw_front/components/Viewer/Options/Sliders/Opacity.vue";
7
13
  import ViewerOptionsTexturesSelector from "@ogw_front/components/Viewer/Options/TexturesSelector.vue";
8
- import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
9
14
 
10
15
  interface Texture {
11
16
  id: string;
@@ -17,14 +22,6 @@ interface CapabilityConfig {
17
22
  hasColorMap?: boolean;
18
23
  }
19
24
 
20
- interface Schemas {
21
- vertex?: AttributeSchemas;
22
- edge?: AttributeSchemas;
23
- cell?: AttributeSchemas;
24
- polygon?: AttributeSchemas;
25
- polyhedron?: AttributeSchemas;
26
- }
27
-
28
25
  const coloring_style_key = defineModel<string>("coloring_style_key");
29
26
 
30
27
  interface Emits {
@@ -38,6 +35,7 @@ interface Emits {
38
35
  const emit = defineEmits<Emits>();
39
36
 
40
37
  const color = defineModel<RGBAColor>("color");
38
+ const opacity = defineModel<number>("opacity");
41
39
  const textures = defineModel<Texture[]>("textures");
42
40
 
43
41
  const vertex_attribute_name = defineModel<string>("vertex_attribute_name");
@@ -95,27 +93,13 @@ const {
95
93
  allowRandom = false,
96
94
  } = defineProps<Props>();
97
95
 
98
- const backSchemas = back_schemas.opengeodeweb_back;
99
- const vertexSchemas = schemas.vertex ?? {
100
- names: backSchemas.vertex_attribute_names,
101
- range: backSchemas.vertex_attribute_range,
102
- };
103
- const edgeSchemas = schemas.edge ?? {
104
- names: backSchemas.edge_attribute_names,
105
- range: backSchemas.edge_attribute_range,
106
- };
107
- const cellSchemas = schemas.cell ?? {
108
- names: backSchemas.cell_attribute_names,
109
- range: backSchemas.cell_attribute_range,
110
- };
111
- const polygonSchemas = schemas.polygon ?? {
112
- names: backSchemas.polygon_attribute_names,
113
- range: backSchemas.polygon_attribute_range,
114
- };
115
- const polyhedronSchemas = schemas.polyhedron ?? {
116
- names: backSchemas.polyhedron_attribute_names,
117
- range: backSchemas.polyhedron_attribute_range,
118
- };
96
+ const {
97
+ vertex: vertexSchemas,
98
+ edge: edgeSchemas,
99
+ cell: cellSchemas,
100
+ polygon: polygonSchemas,
101
+ polyhedron: polyhedronSchemas,
102
+ } = resolveAttributeSchemas(schemas);
119
103
 
120
104
  function isAvailable(key: string): boolean {
121
105
  if (capabilities[key] && capabilities[key].available === false) {
@@ -156,49 +140,29 @@ const has_polyhedra = computed<boolean>(
156
140
  hasColorMap("polyhedron"),
157
141
  );
158
142
 
159
- const color_dict = { name: "Constant", value: "constant" };
160
- const random_dict = { name: "Random", value: "random" };
161
- const textures_dict = { name: "Textures", value: "textures" };
162
- const vertex_dict = { name: "Vertex attribute", value: "vertex" };
163
- const edge_dict = { name: "Edge attribute", value: "edge" };
164
- const cell_dict = { name: "Cell attribute", value: "cell" };
165
- const polygon_dict = { name: "Polygon attribute", value: "polygon" };
166
- const polyhedron_dict = {
167
- name: "Polyhedron attribute",
168
- value: "polyhedron",
169
- };
170
- const coloring_styles = computed<{ labels: string[]; values: string[] }>(() => {
171
- const array = [];
172
- if (has_color.value) {
173
- array.push(color_dict);
174
- if (allowRandom) {
175
- array.push(random_dict);
176
- }
177
- }
178
- if (has_textures.value) {
179
- array.push(textures_dict);
180
- }
181
- if (has_vertex.value) {
182
- array.push(vertex_dict);
183
- }
184
- if (has_edge.value) {
185
- array.push(edge_dict);
186
- }
187
- if (has_cells.value) {
188
- array.push(cell_dict);
189
- }
190
- if (has_polygons.value) {
191
- array.push(polygon_dict);
192
- }
193
- if (has_polyhedra.value) {
194
- array.push(polyhedron_dict);
195
- }
196
-
197
- const labels = array.map((coloring) => coloring.name);
198
- const values = array.map((coloring) => coloring.value);
199
-
200
- return { labels, values };
201
- });
143
+ const {
144
+ color: color_dict,
145
+ textures: textures_dict,
146
+ vertex: vertex_dict,
147
+ edge: edge_dict,
148
+ cell: cell_dict,
149
+ polygon: polygon_dict,
150
+ polyhedron: polyhedron_dict,
151
+ } = COLORING_STYLES;
152
+ const coloring_styles = computed<{ labels: string[]; values: string[] }>(() =>
153
+ buildColoringStyles(
154
+ {
155
+ color: has_color.value,
156
+ textures: has_textures.value,
157
+ vertex: has_vertex.value,
158
+ edge: has_edge.value,
159
+ cell: has_cells.value,
160
+ polygon: has_polygons.value,
161
+ polyhedron: has_polyhedra.value,
162
+ },
163
+ allowRandom,
164
+ ),
165
+ );
202
166
 
203
167
  const coloring_style_label = ref<string>("");
204
168
 
@@ -207,6 +171,11 @@ const active_key = computed<string | undefined>(() => {
207
171
  return index === -1 ? coloring_style_key.value : coloring_styles.value.values[index];
208
172
  });
209
173
 
174
+ // The constant color picker already edits the opacity as its alpha
175
+ const has_opacity = computed<boolean>(
176
+ () => opacity.value !== undefined && active_key.value !== color_dict.value,
177
+ );
178
+
210
179
  watch(
211
180
  [
212
181
  coloring_style_label,
@@ -342,4 +311,9 @@ watch(
342
311
  </template>
343
312
  </v-col>
344
313
  </v-row>
314
+ <v-row v-if="has_opacity" class="mt-2" no-gutters>
315
+ <v-col cols="12">
316
+ <ViewerOptionsOpacitySlider v-model="opacity" />
317
+ </v-col>
318
+ </v-row>
345
319
  </template>
@@ -0,0 +1,56 @@
1
+ <script setup lang="ts">
2
+ import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
3
+ import ViewerOptionsColorPicker from "@ogw_front/components/Viewer/Options/ColorPicker.vue";
4
+
5
+ const attributeNoDataColor = defineModel<typeof DEFAULT_NO_DATA_COLOR>();
6
+
7
+ const cssNoDataColor = computed<string>(() => {
8
+ const { red, green, blue, alpha } = attributeNoDataColor.value ?? DEFAULT_NO_DATA_COLOR;
9
+ return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
10
+ });
11
+ </script>
12
+
13
+ <template>
14
+ <div
15
+ class="text-caption text-high-emphasis mt-1 d-flex align-center ga-1"
16
+ data-testid="noDataInfo"
17
+ >
18
+ <v-icon icon="mdi-information-outline" size="14" color="info" />
19
+ <span>Contains unmapped elements</span>
20
+ <v-menu :close-on-content-click="false">
21
+ <template #activator="{ props }">
22
+ <button
23
+ v-bind="props"
24
+ type="button"
25
+ class="color-picker-rect-btn ml-1"
26
+ :style="{ backgroundColor: cssNoDataColor }"
27
+ v-tooltip="'Change unmapped elements color'"
28
+ data-testid="noDataColorBtn"
29
+ />
30
+ </template>
31
+ <v-card class="pa-2">
32
+ <ViewerOptionsColorPicker v-model="attributeNoDataColor" disabled-alpha />
33
+ </v-card>
34
+ </v-menu>
35
+ </div>
36
+ </template>
37
+
38
+ <style scoped>
39
+ .color-picker-rect-btn {
40
+ width: 26px;
41
+ height: 15px;
42
+ border-radius: 3px;
43
+ border: 2px solid rgba(255, 255, 255, 0.912);
44
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
45
+ cursor: pointer;
46
+ outline: none;
47
+ transition:
48
+ border-color 0.15s ease,
49
+ transform 0.15s ease;
50
+ }
51
+
52
+ .color-picker-rect-btn:hover {
53
+ border-color: rgba(255, 255, 255, 0.9);
54
+ transform: scale(1.1);
55
+ }
56
+ </style>
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ const opacity = defineModel<number>();
3
+ </script>
4
+
5
+ <template>
6
+ <v-row align="center" no-gutters class="px-2">
7
+ <v-col cols="auto" class="mr-2">
8
+ <v-icon size="18" icon="mdi-circle-opacity" v-tooltip:left="'Opacity'" />
9
+ </v-col>
10
+ <v-col>
11
+ <v-slider
12
+ data-testid="opacitySlider"
13
+ v-model="opacity"
14
+ hide-details
15
+ min="0"
16
+ max="1"
17
+ step="0.05"
18
+ density="compact"
19
+ />
20
+ </v-col>
21
+ </v-row>
22
+ </template>