@geode/opengeodeweb-front 10.23.0-rc.2 → 10.23.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 (33) hide show
  1. package/app/components/Basic/Slider.vue +1 -1
  2. package/app/components/Basic/Switch.vue +9 -1
  3. package/app/components/HybridRenderingView.vue +23 -1
  4. package/app/components/RemoteRenderingView.vue +23 -5
  5. package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +41 -3
  6. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +13 -19
  7. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +7 -13
  8. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +11 -17
  9. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +37 -47
  10. package/app/components/Viewer/Generic/Model/CornersOptions.vue +31 -41
  11. package/app/components/Viewer/Generic/Model/LinesOptions.vue +37 -47
  12. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +38 -2
  13. package/app/components/Viewer/Generic/Model/PointsOptions.vue +2 -4
  14. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +37 -47
  15. package/app/components/Viewer/Options/AttributeColorBar.vue +3 -3
  16. package/app/components/Viewer/Options/AttributeSelector.vue +1 -0
  17. package/app/components/Viewer/Options/ColorMapList.vue +5 -57
  18. package/app/components/Viewer/Options/ColorMapPicker.vue +9 -72
  19. package/app/components/Viewer/Options/ColorPicker.vue +18 -2
  20. package/app/components/Viewer/Options/ColoringTypeSelector.vue +72 -78
  21. package/app/components/Viewer/Options/ColormapQuickPicker.vue +120 -0
  22. package/app/components/Viewer/Options/OptionsSection.vue +7 -7
  23. package/app/components/Viewer/Options/Sliders/Slider.vue +8 -6
  24. package/app/components/Viewer/Options/TextureItem.vue +2 -1
  25. package/app/components/Viewer/Options/VisibilitySwitch.vue +4 -4
  26. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +11 -22
  27. package/app/composables/use_quick_colormap.js +32 -0
  28. package/app/stores/data.js +2 -2
  29. package/app/utils/colormap.js +62 -5
  30. package/app/utils/import_workflow.js +1 -1
  31. package/internal/stores/data_style/mesh/edges/vertex.js +1 -0
  32. package/package.json +1 -1
  33. package/tests/unit/composables/project_manager.nuxt.test.js +1 -1
@@ -51,10 +51,8 @@ const size = computed({
51
51
  v-model="visibility"
52
52
  />
53
53
  <template v-if="visibility">
54
- <v-row class="pa-0" align="center">
55
- <v-divider />
56
- <ViewerOptionsSizeSlider data-testid="modelPointsSizeSlider" v-model="size" />
57
- </v-row>
54
+ <v-divider class="my-2" />
55
+ <ViewerOptionsSizeSlider data-testid="modelPointsSizeSlider" v-model="size" />
58
56
  </template>
59
57
  </template>
60
58
  </ViewerContextMenuItem>
@@ -210,51 +210,41 @@ const polygonSchema = back_schemas.opengeodeweb_back.model_component_polygon_att
210
210
  </script>
211
211
 
212
212
  <template>
213
- <div>
214
- <OptionsSection title="Surfaces Options" class="mt-6">
215
- <VisibilitySwitch v-model="surfacesVisibility" />
216
- <v-row class="mt-2 pa-0">
217
- <v-col class="pa-0">
218
- <ViewerOptionsColoringTypeSelector
219
- :id="modelId"
220
- :componentId="targetSurfaceIds[0]"
221
- v-model:coloring_style_key="surfacesColorMode"
222
- v-model:color="surfacesColor"
223
- v-model:vertex_attribute_name="surfacesVertexAttributeName"
224
- v-model:vertex_attribute_range="surfacesVertexAttributeRange"
225
- v-model:vertex_attribute_color_map="surfacesVertexAttributeColorMap"
226
- v-model:polygon_attribute_name="surfacesPolygonAttributeName"
227
- v-model:polygon_attribute_range="surfacesPolygonAttributeRange"
228
- v-model:polygon_attribute_color_map="surfacesPolygonAttributeColorMap"
229
- :capabilities="capabilities"
230
- :schemas="{ vertex: vertexSchema, polygon: polygonSchema }"
231
- :allowRandom="true"
232
- />
233
- </v-col>
234
- </v-row>
235
- </OptionsSection>
236
-
237
- <OptionsSection v-if="surfaceId" title="Component Options" class="mt-6">
238
- <VisibilitySwitch v-model="surfaceVisibility" />
239
- <v-row class="mt-2 pa-0">
240
- <v-col class="pa-0">
241
- <ViewerOptionsColoringTypeSelector
242
- :id="modelId"
243
- :componentId="surfaceId"
244
- v-model:coloring_style_key="surfaceColorMode"
245
- v-model:color="surfaceColor"
246
- v-model:vertex_attribute_name="vertexAttributeName"
247
- v-model:vertex_attribute_range="vertexAttributeRange"
248
- v-model:vertex_attribute_color_map="vertexAttributeColorMap"
249
- v-model:polygon_attribute_name="polygonAttributeName"
250
- v-model:polygon_attribute_range="polygonAttributeRange"
251
- v-model:polygon_attribute_color_map="polygonAttributeColorMap"
252
- :capabilities="capabilities"
253
- :schemas="{ vertex: vertexSchema, polygon: polygonSchema }"
254
- :allowRandom="true"
255
- />
256
- </v-col>
257
- </v-row>
258
- </OptionsSection>
259
- </div>
213
+ <OptionsSection title="Surfaces Options" class="mt-4">
214
+ <VisibilitySwitch v-model="surfacesVisibility" />
215
+ <ViewerOptionsColoringTypeSelector
216
+ :id="modelId"
217
+ :componentId="targetSurfaceIds[0]"
218
+ v-model:coloring_style_key="surfacesColorMode"
219
+ v-model:color="surfacesColor"
220
+ v-model:vertex_attribute_name="surfacesVertexAttributeName"
221
+ v-model:vertex_attribute_range="surfacesVertexAttributeRange"
222
+ v-model:vertex_attribute_color_map="surfacesVertexAttributeColorMap"
223
+ v-model:polygon_attribute_name="surfacesPolygonAttributeName"
224
+ v-model:polygon_attribute_range="surfacesPolygonAttributeRange"
225
+ v-model:polygon_attribute_color_map="surfacesPolygonAttributeColorMap"
226
+ :capabilities="capabilities"
227
+ :schemas="{ vertex: vertexSchema, polygon: polygonSchema }"
228
+ :allowRandom="true"
229
+ />
230
+ </OptionsSection>
231
+
232
+ <OptionsSection v-if="surfaceId" title="Component Options" class="mt-4">
233
+ <VisibilitySwitch v-model="surfaceVisibility" />
234
+ <ViewerOptionsColoringTypeSelector
235
+ :id="modelId"
236
+ :componentId="surfaceId"
237
+ v-model:coloring_style_key="surfaceColorMode"
238
+ v-model:color="surfaceColor"
239
+ v-model:vertex_attribute_name="vertexAttributeName"
240
+ v-model:vertex_attribute_range="vertexAttributeRange"
241
+ v-model:vertex_attribute_color_map="vertexAttributeColorMap"
242
+ v-model:polygon_attribute_name="polygonAttributeName"
243
+ v-model:polygon_attribute_range="polygonAttributeRange"
244
+ v-model:polygon_attribute_color_map="polygonAttributeColorMap"
245
+ :capabilities="capabilities"
246
+ :schemas="{ vertex: vertexSchema, polygon: polygonSchema }"
247
+ :allowRandom="true"
248
+ />
249
+ </OptionsSection>
260
250
  </template>
@@ -11,8 +11,8 @@ const colorMap = defineModel("colorMap", { type: String });
11
11
  <template>
12
12
  <div class="attribute-colorbar mt-3">
13
13
  <ColorMapPicker v-model:selected-preset-name="colorMap" :min="minimum" :max="maximum" />
14
- <v-row dense align="center" class="mt-2">
15
- <v-col cols="5">
14
+ <v-row dense align="center" class="mt-2" no-gutters>
15
+ <v-col cols="5" class="pe-1">
16
16
  <v-text-field
17
17
  :model-value="minimum"
18
18
  @update:model-value="(value) => (minimum = Number(value))"
@@ -33,7 +33,7 @@ const colorMap = defineModel("colorMap", { type: String });
33
33
  v-tooltip="'Reset range'"
34
34
  />
35
35
  </v-col>
36
- <v-col cols="5">
36
+ <v-col cols="5" class="ps-1">
37
37
  <v-text-field
38
38
  :model-value="maximum"
39
39
  @update:model-value="(value) => (maximum = Number(value))"
@@ -109,6 +109,7 @@ watch(name, (newName, oldName) => {
109
109
  item-value="attribute_name"
110
110
  density="compact"
111
111
  label="Select an attribute"
112
+ hide-details
112
113
  />
113
114
  <ViewerOptionsAttributeColorBar
114
115
  v-if="name"
@@ -1,9 +1,7 @@
1
1
  <script setup>
2
- import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
3
- import { newInstance as vtkColorTransferFunction } from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction";
2
+ import GlassCard from "@ogw_front/components/GlassCard.vue";
3
+ import { drawCanvasForPreset } from "@ogw_front/utils/colormap";
4
4
 
5
- const LAST_POINT_OFFSET = 4;
6
- const THREE = 3;
7
5
  const CHUNK_SIZE = 5;
8
6
 
9
7
  const { presets, selectedPresetName } = defineProps({
@@ -46,43 +44,6 @@ const filteredPresets = computed(() => {
46
44
  return result;
47
45
  });
48
46
 
49
- function drawPresetCanvas(presetName, canvas) {
50
- if (!canvas) {
51
- return;
52
- }
53
- const rgbPoints = getRGBPointsFromPreset(presetName);
54
- if (!rgbPoints || rgbPoints.length === 0) {
55
- return;
56
- }
57
- const ctx = canvas.getContext("2d");
58
- const { height, width } = canvas;
59
- const lut = vtkColorTransferFunction();
60
- for (let pointIdx = 0; pointIdx < rgbPoints.length; pointIdx += 4) {
61
- lut.addRGBPoint(
62
- rgbPoints[pointIdx],
63
- rgbPoints[pointIdx + 1],
64
- rgbPoints[pointIdx + 2],
65
- rgbPoints[pointIdx + THREE],
66
- );
67
- }
68
- const table = lut.getUint8Table(rgbPoints[0], rgbPoints.at(-LAST_POINT_OFFSET), width, true);
69
- const imageData = ctx.createImageData(width, height);
70
- for (let xCoord = 0; xCoord < width; xCoord += 1) {
71
- const alpha = table[xCoord * 4 + THREE],
72
- blue = table[xCoord * 4 + 2],
73
- green = table[xCoord * 4 + 1],
74
- red = table[xCoord * 4];
75
- for (let yCoord = 0; yCoord < height; yCoord += 1) {
76
- const pixelIdx = (yCoord * width + xCoord) * 4;
77
- imageData.data[pixelIdx] = red;
78
- imageData.data[pixelIdx + 1] = green;
79
- imageData.data[pixelIdx + 2] = blue;
80
- imageData.data[pixelIdx + THREE] = alpha;
81
- }
82
- }
83
- ctx.putImageData(imageData, 0, 0);
84
- }
85
-
86
47
  function processChunk(entries, index, jobId) {
87
48
  if (jobId !== renderJobId.value || index >= entries.length) {
88
49
  if (jobId === renderJobId.value) {
@@ -94,7 +55,7 @@ function processChunk(entries, index, jobId) {
94
55
  const end = Math.min(index + CHUNK_SIZE, entries.length);
95
56
  for (let i = index; i < end; i += 1) {
96
57
  const [unusedKey, refValue] = entries[i];
97
- drawPresetCanvas(refValue.presetName, refValue.element);
58
+ drawCanvasForPreset(refValue.presetName, refValue.element);
98
59
  }
99
60
  const ZERO = 0;
100
61
  setTimeout(() => processChunk(entries, end, jobId), ZERO);
@@ -115,13 +76,7 @@ watch(filteredPresets, drawAllCanvases);
115
76
  </script>
116
77
 
117
78
  <template>
118
- <v-card
119
- width="320"
120
- class="pa-3 blur-card overflow-hidden"
121
- theme="dark"
122
- variant="outlined"
123
- rounded="lg"
124
- >
79
+ <GlassCard width="320" variant="panel" padding="pa-3" rounded="lg" class="overflow-hidden">
125
80
  <v-overlay
126
81
  v-model="loading"
127
82
  contained
@@ -199,17 +154,10 @@ watch(filteredPresets, drawAllCanvases);
199
154
  </v-list-item>
200
155
  </template>
201
156
  </v-list>
202
- </v-card>
157
+ </GlassCard>
203
158
  </template>
204
159
 
205
160
  <style scoped>
206
- .blur-card {
207
- background-color: rgba(35, 35, 35, 0.8) !important;
208
- backdrop-filter: blur(16px);
209
- -webkit-backdrop-filter: blur(16px);
210
- border-color: rgba(255, 255, 255, 0.1) !important;
211
- }
212
-
213
161
  .border-thin {
214
162
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
215
163
  }
@@ -1,10 +1,7 @@
1
1
  <script setup>
2
- import { colormaps, getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
2
+ import { drawCanvasForPreset, getPresetsWithCurrentAtTop } from "@ogw_front/utils/colormap";
3
3
  import ColorMapList from "./ColorMapList.vue";
4
- import { newInstance } from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction";
5
-
6
- const LAST_POINT_OFFSET = 4;
7
- const THREE = 3;
4
+ import GlassCard from "@ogw_front/components/GlassCard.vue";
8
5
 
9
6
  const { max, min } = defineProps({
10
7
  min: { type: Number, required: true },
@@ -16,58 +13,10 @@ const selectedPresetName = defineModel("selectedPresetName", { default: "batlow"
16
13
  const menuOpen = ref(false);
17
14
  const lutCanvas = ref();
18
15
 
19
- const presets = computed(() => {
20
- let currentPreset = undefined;
21
- for (const category of colormaps) {
22
- currentPreset = category.Children.find((preset) => preset.Name === selectedPresetName.value);
23
- if (currentPreset) {
24
- break;
25
- }
26
- }
27
- return [currentPreset, ...colormaps].filter(Boolean);
28
- });
16
+ const presets = computed(() => getPresetsWithCurrentAtTop(selectedPresetName.value));
29
17
 
30
18
  function drawLutCanvas() {
31
- if (!lutCanvas.value) {
32
- return;
33
- }
34
- const rgbPoints = getRGBPointsFromPreset(selectedPresetName.value);
35
- if (!rgbPoints || rgbPoints.length === 0) {
36
- return;
37
- }
38
-
39
- const canvas = lutCanvas.value;
40
- const ctx = canvas.getContext("2d");
41
- const { height, width } = canvas;
42
-
43
- const lut = newInstance();
44
-
45
- for (let pointIdx = 0; pointIdx < rgbPoints.length; pointIdx += 4) {
46
- lut.addRGBPoint(
47
- rgbPoints[pointIdx],
48
- rgbPoints[pointIdx + 1],
49
- rgbPoints[pointIdx + 2],
50
- rgbPoints[pointIdx + THREE],
51
- );
52
- }
53
-
54
- const table = lut.getUint8Table(rgbPoints[0], rgbPoints.at(-LAST_POINT_OFFSET), width, true);
55
- const imageData = ctx.createImageData(width, height);
56
-
57
- for (let xCoord = 0; xCoord < width; xCoord += 1) {
58
- const red = table[xCoord * 4];
59
- const green = table[xCoord * 4 + 1];
60
- const blue = table[xCoord * 4 + 2];
61
- const alpha = table[xCoord * 4 + THREE];
62
- for (let yCoord = 0; yCoord < height; yCoord += 1) {
63
- const pixelIdx = (yCoord * width + xCoord) * 4;
64
- imageData.data[pixelIdx] = red;
65
- imageData.data[pixelIdx + 1] = green;
66
- imageData.data[pixelIdx + 2] = blue;
67
- imageData.data[pixelIdx + THREE] = alpha;
68
- }
69
- }
70
- ctx.putImageData(imageData, 0, 0);
19
+ drawCanvasForPreset(selectedPresetName.value, lutCanvas.value);
71
20
  }
72
21
 
73
22
  function onSelectPreset(preset) {
@@ -82,19 +31,19 @@ watch([lutCanvas, selectedPresetName, () => min, () => max], drawLutCanvas);
82
31
  <template>
83
32
  <v-menu v-model="menuOpen" :close-on-content-click="false" location="bottom">
84
33
  <template #activator="{ props: menuProps }">
85
- <v-card
34
+ <GlassCard
86
35
  v-bind="menuProps"
87
- theme="dark"
88
- variant="outlined"
36
+ variant="ui"
37
+ padding="pa-2"
89
38
  rounded="sm"
90
- class="pa-2 blur-picker d-flex flex-column"
39
+ class="d-flex flex-column"
91
40
  style="gap: 4px; cursor: pointer"
92
41
  >
93
42
  <span class="text-caption text-white font-weight-medium">
94
43
  {{ selectedPresetName }}
95
44
  </span>
96
45
  <canvas ref="lutCanvas" width="200" height="18" class="w-100 rounded-xs border-thin" />
97
- </v-card>
46
+ </GlassCard>
98
47
  </template>
99
48
 
100
49
  <ColorMapList
@@ -106,18 +55,6 @@ watch([lutCanvas, selectedPresetName, () => min, () => max], drawLutCanvas);
106
55
  </template>
107
56
 
108
57
  <style scoped>
109
- .blur-picker {
110
- background-color: rgba(40, 40, 40, 0.7) !important;
111
- backdrop-filter: blur(12px);
112
- -webkit-backdrop-filter: blur(12px);
113
- border-color: rgba(255, 255, 255, 0.2) !important;
114
- transition: background-color 0.2s;
115
- }
116
-
117
- .blur-picker {
118
- background-color: rgba(60, 60, 60, 0.9) !important;
119
- }
120
-
121
58
  .border-thin {
122
59
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
123
60
  }
@@ -41,9 +41,25 @@ watch(pressed, (value) => {
41
41
  ref="colorPickerRef"
42
42
  v-model="vuetifyColor"
43
43
  flat
44
- canvas-height="100"
44
+ canvas-height="75"
45
45
  hide-inputs
46
- width="100%"
46
+ width="220"
47
47
  mode="rgba"
48
+ class="mx-auto"
48
49
  />
49
50
  </template>
51
+
52
+ <style scoped>
53
+ :deep(.v-color-picker__controls) {
54
+ padding: 8px !important;
55
+ }
56
+
57
+ :deep(.v-color-picker__dot) {
58
+ width: 18px !important;
59
+ height: 18px !important;
60
+ }
61
+
62
+ :deep(.v-color-picker__preview) {
63
+ margin-bottom: 0 !important;
64
+ }
65
+ </style>
@@ -161,85 +161,79 @@ watch(
161
161
  );
162
162
  </script>
163
163
  <template>
164
- <v-row justify="center" align="center">
165
- <v-divider />
164
+ <v-divider class="my-2 mx-2" />
165
+ <v-row justify="center" align="center" no-gutters class="px-2">
166
+ <v-col cols="auto" class="mr-2">
167
+ <v-icon size="18" icon="mdi-format-color-fill" v-tooltip:left="'Coloring'" />
168
+ </v-col>
166
169
  <v-col>
167
- <v-row justify="center" align="center">
168
- <v-col cols="auto">
169
- <v-icon size="30" icon="mdi-format-color-fill" v-tooltip:left="'Coloring'" />
170
- </v-col>
171
- <v-col>
172
- <v-select
173
- v-model="coloring_style_label"
174
- :items="coloring_styles.labels"
175
- label="Select a coloring style"
176
- density="compact"
177
- />
178
- </v-col>
179
- </v-row>
180
- <v-row>
181
- <v-spacer />
182
- <v-col cols="10">
183
- <template v-if="coloring_style_key === color_dict['value']">
184
- <ViewerOptionsColorPicker v-model="color" />
185
- </template>
186
- <template v-if="coloring_style_key === textures_dict['value']">
187
- <ViewerOptionsTexturesSelector v-model="textures" :id="id" />
188
- </template>
189
- <template v-if="coloring_style_key === vertex_dict['value'] && hasColorMap('vertex')">
190
- <ViewerOptionsAttributeSelector
191
- v-model:name="vertex_attribute_name"
192
- v-model:range="vertex_attribute_range"
193
- v-model:colorMap="vertex_attribute_color_map"
194
- :id="id"
195
- :componentId="componentId"
196
- :schema="vertexSchema"
197
- />
198
- </template>
199
- <template v-if="coloring_style_key === edge_dict['value'] && hasColorMap('edge')">
200
- <ViewerOptionsAttributeSelector
201
- v-model:name="edge_attribute_name"
202
- v-model:range="edge_attribute_range"
203
- v-model:colorMap="edge_attribute_color_map"
204
- :id="id"
205
- :componentId="componentId"
206
- :schema="edgeSchema"
207
- />
208
- </template>
209
- <template v-if="coloring_style_key === cell_dict['value'] && hasColorMap('cell')">
210
- <ViewerOptionsAttributeSelector
211
- v-model:name="cell_attribute_name"
212
- v-model:range="cell_attribute_range"
213
- v-model:colorMap="cell_attribute_color_map"
214
- :id="id"
215
- :componentId="componentId"
216
- :schema="cellSchema"
217
- />
218
- </template>
219
- <template v-if="coloring_style_key === polygon_dict['value'] && hasColorMap('polygon')">
220
- <ViewerOptionsAttributeSelector
221
- v-model:name="polygon_attribute_name"
222
- v-model:range="polygon_attribute_range"
223
- v-model:colorMap="polygon_attribute_color_map"
224
- :id="id"
225
- :componentId="componentId"
226
- :schema="polygonSchema"
227
- />
228
- </template>
229
- <template
230
- v-if="coloring_style_key === polyhedron_dict['value'] && hasColorMap('polyhedron')"
231
- >
232
- <ViewerOptionsAttributeSelector
233
- v-model:name="polyhedron_attribute_name"
234
- v-model:range="polyhedron_attribute_range"
235
- v-model:colorMap="polyhedron_attribute_color_map"
236
- :id="id"
237
- :componentId="componentId"
238
- :schema="polyhedronSchema"
239
- />
240
- </template>
241
- </v-col>
242
- </v-row>
170
+ <v-select
171
+ v-model="coloring_style_label"
172
+ :items="coloring_styles.labels"
173
+ label="Select a coloring style"
174
+ density="compact"
175
+ hide-details
176
+ />
177
+ </v-col>
178
+ </v-row>
179
+ <v-row class="mt-3 px-2" no-gutters>
180
+ <v-col cols="12" class="ps-7 pe-1">
181
+ <template v-if="coloring_style_key === color_dict['value']">
182
+ <ViewerOptionsColorPicker v-model="color" />
183
+ </template>
184
+ <template v-if="coloring_style_key === textures_dict['value']">
185
+ <ViewerOptionsTexturesSelector v-model="textures" :id="id" />
186
+ </template>
187
+ <template v-if="coloring_style_key === vertex_dict['value'] && hasColorMap('vertex')">
188
+ <ViewerOptionsAttributeSelector
189
+ v-model:name="vertex_attribute_name"
190
+ v-model:range="vertex_attribute_range"
191
+ v-model:colorMap="vertex_attribute_color_map"
192
+ :id="id"
193
+ :componentId="componentId"
194
+ :schema="vertexSchema"
195
+ />
196
+ </template>
197
+ <template v-if="coloring_style_key === edge_dict['value'] && hasColorMap('edge')">
198
+ <ViewerOptionsAttributeSelector
199
+ v-model:name="edge_attribute_name"
200
+ v-model:range="edge_attribute_range"
201
+ v-model:colorMap="edge_attribute_color_map"
202
+ :id="id"
203
+ :componentId="componentId"
204
+ :schema="edgeSchema"
205
+ />
206
+ </template>
207
+ <template v-if="coloring_style_key === cell_dict['value'] && hasColorMap('cell')">
208
+ <ViewerOptionsAttributeSelector
209
+ v-model:name="cell_attribute_name"
210
+ v-model:range="cell_attribute_range"
211
+ v-model:colorMap="cell_attribute_color_map"
212
+ :id="id"
213
+ :componentId="componentId"
214
+ :schema="cellSchema"
215
+ />
216
+ </template>
217
+ <template v-if="coloring_style_key === polygon_dict['value'] && hasColorMap('polygon')">
218
+ <ViewerOptionsAttributeSelector
219
+ v-model:name="polygon_attribute_name"
220
+ v-model:range="polygon_attribute_range"
221
+ v-model:colorMap="polygon_attribute_color_map"
222
+ :id="id"
223
+ :componentId="componentId"
224
+ :schema="polygonSchema"
225
+ />
226
+ </template>
227
+ <template v-if="coloring_style_key === polyhedron_dict['value'] && hasColorMap('polyhedron')">
228
+ <ViewerOptionsAttributeSelector
229
+ v-model:name="polyhedron_attribute_name"
230
+ v-model:range="polyhedron_attribute_range"
231
+ v-model:colorMap="polyhedron_attribute_color_map"
232
+ :id="id"
233
+ :componentId="componentId"
234
+ :schema="polyhedronSchema"
235
+ />
236
+ </template>
243
237
  </v-col>
244
238
  </v-row>
245
239
  </template>
@@ -0,0 +1,120 @@
1
+ <script setup>
2
+ import ColorMapList from "@ogw_front/components/Viewer/Options/ColorMapList.vue";
3
+ import { getPresetsWithCurrentAtTop } from "@ogw_front/utils/colormap";
4
+ import { useDataStyleStore } from "@ogw_front/stores/data_style";
5
+ import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
6
+
7
+ const { dataId, x, y } = defineProps({
8
+ dataId: { required: false, type: String },
9
+ x: { required: true, type: Number },
10
+ y: { required: true, type: Number },
11
+ });
12
+
13
+ const show = defineModel("show", { type: Boolean, default: false });
14
+
15
+ const dataStyleStore = useDataStyleStore();
16
+ const hybridViewerStore = useHybridViewerStore();
17
+
18
+ const componentNames = [
19
+ { getterKey: "meshPoints", setterKey: "MeshPoints", key: "points" },
20
+ { getterKey: "meshEdges", setterKey: "MeshEdges", key: "edges" },
21
+ { getterKey: "meshPolygons", setterKey: "MeshPolygons", key: "polygons" },
22
+ { getterKey: "meshCells", setterKey: "MeshCells", key: "cells" },
23
+ { getterKey: "meshPolyhedra", setterKey: "MeshPolyhedra", key: "polyhedra" },
24
+ ];
25
+
26
+ const current = computed(() => {
27
+ const targetId = dataId;
28
+ if (!targetId) {
29
+ return "batlow";
30
+ }
31
+
32
+ const style = dataStyleStore.getStyle(targetId);
33
+ if (!style) {
34
+ return "batlow";
35
+ }
36
+
37
+ for (const { key, getterKey } of componentNames) {
38
+ if (!style[key] || !style[key].coloring) {
39
+ continue;
40
+ }
41
+
42
+ const activeColoring = style[key].coloring.active;
43
+ if (!["vertex", "edge", "polygon", "cell", "polyhedron"].includes(activeColoring)) {
44
+ continue;
45
+ }
46
+
47
+ const attributeType = `${activeColoring.charAt(0).toUpperCase()}${activeColoring.slice(1)}Attribute`;
48
+ const getterName = `${getterKey}${attributeType}ColorMap`;
49
+ const getter = dataStyleStore[getterName];
50
+
51
+ if (!getter) {
52
+ continue;
53
+ }
54
+
55
+ const colorMap = getter(targetId);
56
+ if (colorMap) {
57
+ return colorMap;
58
+ }
59
+ }
60
+
61
+ return "batlow";
62
+ });
63
+
64
+ const quickColormapPresets = computed(() => getPresetsWithCurrentAtTop(current.value));
65
+
66
+ async function onQuickColormapSelect(preset) {
67
+ show.value = false;
68
+ const newMap = preset.Name;
69
+ const targetId = dataId;
70
+ if (!targetId) {
71
+ return;
72
+ }
73
+
74
+ const style = dataStyleStore.getStyle(targetId);
75
+ if (!style) {
76
+ return;
77
+ }
78
+
79
+ const promises = [];
80
+
81
+ for (const { key, setterKey } of componentNames) {
82
+ if (!style[key] || !style[key].coloring) {
83
+ continue;
84
+ }
85
+
86
+ const activeColoring = style[key].coloring.active;
87
+ if (!["vertex", "edge", "polygon", "cell", "polyhedron"].includes(activeColoring)) {
88
+ continue;
89
+ }
90
+
91
+ const attributeType = `${activeColoring.charAt(0).toUpperCase() + activeColoring.slice(1)}Attribute`;
92
+ const setterName = `set${setterKey}${attributeType}ColorMap`;
93
+ const setter = dataStyleStore[setterName];
94
+
95
+ if (setter) {
96
+ promises.push(setter(targetId, newMap));
97
+ }
98
+ }
99
+
100
+ await Promise.all(promises);
101
+
102
+ hybridViewerStore.remoteRender();
103
+ }
104
+ </script>
105
+
106
+ <template>
107
+ <v-menu
108
+ v-model="show"
109
+ :target="[x, y - 80]"
110
+ location="top center"
111
+ :close-on-content-click="false"
112
+ eager
113
+ >
114
+ <ColorMapList
115
+ :presets="quickColormapPresets"
116
+ :selected-preset-name="current"
117
+ @select="onQuickColormapSelect"
118
+ />
119
+ </v-menu>
120
+ </template>