@geode/opengeodeweb-front 10.2.1 → 10.3.0

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 (83) hide show
  1. package/.github/workflows/manual_release.yml +11 -0
  2. package/app/components/Step.vue +2 -2
  3. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +63 -19
  4. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +65 -18
  5. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +8 -15
  6. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +8 -9
  7. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +8 -8
  8. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
  9. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +2 -2
  10. package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
  11. package/app/components/Viewer/Options/AttributeColorBar.vue +58 -0
  12. package/app/components/Viewer/Options/CellAttributeSelector.vue +51 -19
  13. package/app/components/Viewer/Options/ColorMapList.vue +216 -0
  14. package/app/components/Viewer/Options/ColorMapPicker.vue +168 -0
  15. package/app/components/Viewer/Options/ColoringTypeSelector.vue +46 -24
  16. package/app/components/Viewer/Options/EdgeAttributeSelector.vue +53 -41
  17. package/app/components/Viewer/Options/PolygonAttributeSelector.vue +52 -19
  18. package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +57 -20
  19. package/app/components/Viewer/Options/VertexAttributeSelector.vue +47 -15
  20. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +38 -14
  21. package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +74 -18
  22. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +75 -17
  23. package/app/components/Viewer/TreeComponent.vue +26 -76
  24. package/app/stores/data_style.js +3 -3
  25. package/app/utils/colormap.js +5 -0
  26. package/app/utils/default_styles.js +36 -9
  27. package/internal/stores/data_style/mesh/cells/cell.js +153 -0
  28. package/internal/stores/data_style/mesh/cells/color.js +40 -0
  29. package/internal/stores/data_style/mesh/cells/common.js +23 -0
  30. package/internal/stores/data_style/mesh/cells/index.js +84 -0
  31. package/internal/stores/data_style/mesh/cells/textures.js +36 -0
  32. package/internal/stores/data_style/mesh/cells/vertex.js +153 -0
  33. package/internal/stores/data_style/mesh/cells/visibility.js +40 -0
  34. package/internal/stores/data_style/mesh/edges/color.js +40 -0
  35. package/internal/stores/data_style/mesh/edges/common.js +23 -0
  36. package/internal/stores/data_style/mesh/edges/edge.js +141 -0
  37. package/internal/stores/data_style/mesh/edges/index.js +88 -0
  38. package/internal/stores/data_style/mesh/edges/vertex.js +153 -0
  39. package/internal/stores/data_style/mesh/edges/visibility.js +40 -0
  40. package/internal/stores/data_style/mesh/edges/width.js +40 -0
  41. package/internal/stores/{mesh → data_style/mesh}/index.js +25 -23
  42. package/internal/stores/data_style/mesh/points/color.js +40 -0
  43. package/internal/stores/data_style/mesh/points/common.js +23 -0
  44. package/internal/stores/data_style/mesh/points/index.js +89 -0
  45. package/internal/stores/data_style/mesh/points/size.js +40 -0
  46. package/internal/stores/data_style/mesh/points/vertex.js +153 -0
  47. package/internal/stores/data_style/mesh/points/visibility.js +40 -0
  48. package/internal/stores/data_style/mesh/polygons/color.js +40 -0
  49. package/internal/stores/data_style/mesh/polygons/common.js +23 -0
  50. package/internal/stores/data_style/mesh/polygons/index.js +89 -0
  51. package/internal/stores/data_style/mesh/polygons/polygon.js +145 -0
  52. package/internal/stores/data_style/mesh/polygons/textures.js +40 -0
  53. package/internal/stores/data_style/mesh/polygons/vertex.js +153 -0
  54. package/internal/stores/data_style/mesh/polygons/visibility.js +40 -0
  55. package/internal/stores/data_style/mesh/polyhedra/color.js +40 -0
  56. package/internal/stores/data_style/mesh/polyhedra/common.js +23 -0
  57. package/internal/stores/data_style/mesh/polyhedra/index.js +83 -0
  58. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +139 -0
  59. package/internal/stores/data_style/mesh/polyhedra/vertex.js +153 -0
  60. package/internal/stores/data_style/mesh/polyhedra/visibility.js +41 -0
  61. package/internal/stores/{model → data_style/model}/blocks.js +1 -1
  62. package/internal/stores/{model → data_style/model}/corners.js +1 -1
  63. package/internal/stores/{model → data_style/model}/edges.js +1 -1
  64. package/internal/stores/{model → data_style/model}/index.js +3 -3
  65. package/internal/stores/{model → data_style/model}/lines.js +1 -1
  66. package/internal/stores/{model → data_style/model}/points.js +1 -1
  67. package/internal/stores/{model → data_style/model}/surfaces.js +1 -1
  68. package/internal/stores/{data_style_state.js → data_style/state.js} +6 -3
  69. package/package.json +1 -1
  70. package/tests/integration/microservices/back/requirements.txt +1 -1
  71. package/tests/integration/microservices/viewer/requirements.txt +1 -1
  72. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -18
  73. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +22 -16
  74. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +1 -1
  75. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +14 -12
  76. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +16 -19
  77. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +16 -19
  78. package/tests/vitest.config.js +3 -0
  79. package/internal/stores/mesh/cells.js +0 -175
  80. package/internal/stores/mesh/edges.js +0 -171
  81. package/internal/stores/mesh/points.js +0 -142
  82. package/internal/stores/mesh/polygons.js +0 -181
  83. package/internal/stores/mesh/polyhedra.js +0 -151
@@ -0,0 +1,216 @@
1
+ <script setup>
2
+ import vtkColorMaps from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps"
3
+ import vtkColorTransferFunction from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction"
4
+
5
+ const props = defineProps({
6
+ presets: { type: Array, required: true },
7
+ })
8
+
9
+ const emit = defineEmits(["select"])
10
+
11
+ const filterText = ref("")
12
+ const canvasRefs = ref({})
13
+ const loading = ref(true)
14
+ let renderJobId = 0
15
+
16
+ const setCanvasRef = (presetName, el, id) => {
17
+ if (el) {
18
+ canvasRefs.value[id] = { el, presetName }
19
+ } else {
20
+ delete canvasRefs.value[id]
21
+ }
22
+ }
23
+
24
+ const filteredPresets = computed(() => {
25
+ if (!filterText.value) return props.presets
26
+ const term = filterText.value.toLowerCase()
27
+
28
+ return props.presets.reduce((acc, item) => {
29
+ if (item.Children) {
30
+ const children = item.Children.filter((c) =>
31
+ c.Name.toLowerCase().includes(term),
32
+ )
33
+ if (children.length) acc.push({ ...item, Children: children })
34
+ } else if (item.Name.toLowerCase().includes(term)) {
35
+ acc.push(item)
36
+ }
37
+ return acc
38
+ }, [])
39
+ })
40
+
41
+ function drawPresetCanvas(presetName, canvas) {
42
+ if (!canvas) return
43
+ const preset = vtkColorMaps.getPresetByName(presetName)
44
+ if (!preset || !preset.RGBPoints) return
45
+
46
+ const ctx = canvas.getContext("2d")
47
+ const { width, height } = canvas
48
+ const lut = vtkColorTransferFunction.newInstance()
49
+ const rgbPoints = preset.RGBPoints
50
+
51
+ for (let i = 0; i < rgbPoints.length; i += 4) {
52
+ lut.addRGBPoint(
53
+ rgbPoints[i],
54
+ rgbPoints[i + 1],
55
+ rgbPoints[i + 2],
56
+ rgbPoints[i + 3],
57
+ )
58
+ }
59
+
60
+ const table = lut.getUint8Table(
61
+ rgbPoints[0],
62
+ rgbPoints[rgbPoints.length - 4],
63
+ width,
64
+ true,
65
+ )
66
+ const imageData = ctx.createImageData(width, height)
67
+
68
+ for (let x = 0; x < width; x++) {
69
+ const r = table[x * 4],
70
+ g = table[x * 4 + 1],
71
+ b = table[x * 4 + 2],
72
+ a = table[x * 4 + 3]
73
+ for (let y = 0; y < height; y++) {
74
+ const idx = (y * width + x) * 4
75
+ imageData.data[idx] = r
76
+ imageData.data[idx + 1] = g
77
+ imageData.data[idx + 2] = b
78
+ imageData.data[idx + 3] = a
79
+ }
80
+ }
81
+ ctx.putImageData(imageData, 0, 0)
82
+ }
83
+
84
+ async function drawAllCanvases() {
85
+ renderJobId++
86
+ const currentJobId = renderJobId
87
+ loading.value = true
88
+ await nextTick()
89
+ await new Promise((r) => setTimeout(r, 50))
90
+
91
+ const entries = Object.entries(canvasRefs.value)
92
+ for (let i = 0; i < entries.length; i += 5) {
93
+ if (currentJobId !== renderJobId) return
94
+ entries
95
+ .slice(i, i + 5)
96
+ .forEach(([_, { presetName, el }]) => drawPresetCanvas(presetName, el))
97
+ await new Promise((r) => setTimeout(r, 0))
98
+ }
99
+ if (currentJobId === renderJobId) loading.value = false
100
+ }
101
+
102
+ onMounted(drawAllCanvases)
103
+ watch(filteredPresets, drawAllCanvases)
104
+ </script>
105
+
106
+ <template>
107
+ <v-card
108
+ width="320"
109
+ class="pa-3 blur-card overflow-hidden"
110
+ theme="dark"
111
+ variant="outlined"
112
+ rounded="lg"
113
+ >
114
+ <v-overlay
115
+ v-model="loading"
116
+ contained
117
+ persistent
118
+ class="align-center justify-center"
119
+ scrim="#1e1e1e"
120
+ opacity="0.6"
121
+ >
122
+ <v-progress-circular indeterminate color="primary" />
123
+ </v-overlay>
124
+
125
+ <v-text-field
126
+ v-model="filterText"
127
+ placeholder="Search presets..."
128
+ density="compact"
129
+ hide-details
130
+ prepend-inner-icon="mdi-magnify"
131
+ variant="solo-filled"
132
+ flat
133
+ class="mb-3"
134
+ base-color="white"
135
+ color="white"
136
+ />
137
+
138
+ <v-list
139
+ density="compact"
140
+ max-height="350"
141
+ bg-color="transparent"
142
+ class="pa-0"
143
+ :style="{ opacity: loading ? '0.3' : '1', transition: 'opacity 0.2s' }"
144
+ >
145
+ <template v-for="(item, index) in filteredPresets" :key="index">
146
+ <v-list-group v-if="item.Children" :value="item.Name">
147
+ <template #activator="{ props: gProps }">
148
+ <v-list-item
149
+ v-bind="gProps"
150
+ :title="item.Name"
151
+ class="text-white font-weight-bold"
152
+ />
153
+ </template>
154
+
155
+ <v-list-item
156
+ v-for="(child, cIdx) in item.Children"
157
+ :key="cIdx"
158
+ @click="$emit('select', child)"
159
+ class="px-2 mb-1"
160
+ rounded="md"
161
+ >
162
+ <div class="d-flex flex-column py-1">
163
+ <span class="text-caption text-grey-lighten-1 mb-1">{{
164
+ child.Name
165
+ }}</span>
166
+ <canvas
167
+ :ref="
168
+ (el) => setCanvasRef(child.Name, el, `g-${index}-${cIdx}`)
169
+ "
170
+ width="200"
171
+ height="18"
172
+ class="w-100 rounded-xs border-thin"
173
+ />
174
+ </div>
175
+ </v-list-item>
176
+ </v-list-group>
177
+
178
+ <v-list-item
179
+ v-else
180
+ @click="$emit('select', item)"
181
+ class="px-2 mb-1"
182
+ rounded="md"
183
+ >
184
+ <div class="d-flex flex-column py-1">
185
+ <span class="text-caption text-grey-lighten-1 mb-1">{{
186
+ item.Name
187
+ }}</span>
188
+ <canvas
189
+ :ref="(el) => setCanvasRef(item.Name, el, `s-${index}`)"
190
+ width="200"
191
+ height="18"
192
+ class="w-100 rounded-xs border-thin"
193
+ />
194
+ </div>
195
+ </v-list-item>
196
+ </template>
197
+ </v-list>
198
+ </v-card>
199
+ </template>
200
+
201
+ <style scoped>
202
+ .blur-card {
203
+ background-color: rgba(35, 35, 35, 0.8) !important;
204
+ backdrop-filter: blur(16px);
205
+ -webkit-backdrop-filter: blur(16px);
206
+ border-color: rgba(255, 255, 255, 0.1) !important;
207
+ }
208
+
209
+ .border-thin {
210
+ border: 1px solid rgba(255, 255, 255, 0.15) !important;
211
+ }
212
+
213
+ .v-list-item {
214
+ background-color: rgba(255, 255, 255, 0.1) !important;
215
+ }
216
+ </style>
@@ -0,0 +1,168 @@
1
+ <script setup>
2
+ import vtkColorMaps from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps"
3
+ import vtkColorTransferFunction from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction"
4
+ import ColorMapList from "./ColorMapList.vue"
5
+
6
+ const props = defineProps({
7
+ modelValue: { type: String, default: "Cool to Warm" },
8
+ min: { type: Number, required: true },
9
+ max: { type: Number, required: true },
10
+ })
11
+
12
+ const emit = defineEmits(["update:modelValue"])
13
+
14
+ const menuOpen = ref(false)
15
+ const lutCanvas = ref(null)
16
+ const selectedPresetName = ref(props.modelValue)
17
+
18
+ const presets = computed(() => {
19
+ const allPresets = vtkColorMaps.rgbPresetNames.map((name) =>
20
+ vtkColorMaps.getPresetByName(name),
21
+ )
22
+
23
+ const defaultPreset = vtkColorMaps.getPresetByName("Cool to Warm")
24
+
25
+ const paraviewNames = [
26
+ "Cool to Warm",
27
+ "Warm to Cool",
28
+ "rainbow",
29
+ "Grayscale",
30
+ "X Ray",
31
+ "Black-Body Radiation",
32
+ "erdc_rainbow_bright",
33
+ ]
34
+ const matplotlibNames = [
35
+ "Viridis (matplotlib)",
36
+ "Plasma (matplotlib)",
37
+ "Inferno (matplotlib)",
38
+ "Magma (matplotlib)",
39
+ ]
40
+
41
+ const paraviewPresets = paraviewNames
42
+ .map((name) => vtkColorMaps.getPresetByName(name))
43
+ .filter(Boolean)
44
+ const matplotlibPresets = matplotlibNames
45
+ .map((name) => vtkColorMaps.getPresetByName(name))
46
+ .filter(Boolean)
47
+ const otherPresets = allPresets.filter(
48
+ (preset) =>
49
+ !paraviewNames.includes(preset.Name) &&
50
+ !matplotlibNames.includes(preset.Name),
51
+ )
52
+
53
+ return [
54
+ defaultPreset,
55
+ { Name: "ParaView", Children: paraviewPresets },
56
+ { Name: "Matplotlib", Children: matplotlibPresets },
57
+ { Name: "Others", Children: otherPresets },
58
+ ]
59
+ })
60
+
61
+ function drawLutCanvas() {
62
+ if (!lutCanvas.value) return
63
+ const preset = vtkColorMaps.getPresetByName(selectedPresetName.value)
64
+ if (!preset || !preset.RGBPoints) return
65
+
66
+ const canvas = lutCanvas.value
67
+ const ctx = canvas.getContext("2d")
68
+ const { width, height } = canvas
69
+
70
+ const lut = vtkColorTransferFunction.newInstance()
71
+ const rgbPoints = preset.RGBPoints
72
+
73
+ for (let i = 0; i < rgbPoints.length; i += 4) {
74
+ lut.addRGBPoint(
75
+ rgbPoints[i],
76
+ rgbPoints[i + 1],
77
+ rgbPoints[i + 2],
78
+ rgbPoints[i + 3],
79
+ )
80
+ }
81
+
82
+ const table = lut.getUint8Table(
83
+ rgbPoints[0],
84
+ rgbPoints[rgbPoints.length - 4],
85
+ width,
86
+ true,
87
+ )
88
+ const imageData = ctx.createImageData(width, height)
89
+
90
+ for (let x = 0; x < width; x++) {
91
+ const r = table[x * 4],
92
+ g = table[x * 4 + 1],
93
+ b = table[x * 4 + 2],
94
+ a = table[x * 4 + 3]
95
+ for (let y = 0; y < height; y++) {
96
+ const idx = (y * width + x) * 4
97
+ imageData.data[idx] = r
98
+ imageData.data[idx + 1] = g
99
+ imageData.data[idx + 2] = b
100
+ imageData.data[idx + 3] = a
101
+ }
102
+ }
103
+ ctx.putImageData(imageData, 0, 0)
104
+ }
105
+
106
+ function onSelectPreset(preset) {
107
+ selectedPresetName.value = preset.Name
108
+ emit("update:modelValue", preset.Name)
109
+ menuOpen.value = false
110
+ }
111
+
112
+ onMounted(() => nextTick(drawLutCanvas))
113
+ watch(
114
+ [lutCanvas, selectedPresetName, () => props.min, () => props.max],
115
+ drawLutCanvas,
116
+ )
117
+ watch(
118
+ () => props.modelValue,
119
+ (nv) => {
120
+ if (nv !== selectedPresetName.value) selectedPresetName.value = nv
121
+ },
122
+ )
123
+ </script>
124
+
125
+ <template>
126
+ <v-menu v-model="menuOpen" :close-on-content-click="false" location="bottom">
127
+ <template #activator="{ props: menuProps }">
128
+ <v-card
129
+ v-bind="menuProps"
130
+ theme="dark"
131
+ variant="outlined"
132
+ rounded="sm"
133
+ class="pa-2 blur-picker d-flex flex-column"
134
+ style="gap: 4px; cursor: pointer"
135
+ >
136
+ <span class="text-caption text-white font-weight-medium">
137
+ {{ selectedPresetName }}
138
+ </span>
139
+ <canvas
140
+ ref="lutCanvas"
141
+ width="200"
142
+ height="18"
143
+ class="w-100 rounded-xs border-thin"
144
+ />
145
+ </v-card>
146
+ </template>
147
+
148
+ <ColorMapList :presets="presets" @select="onSelectPreset" />
149
+ </v-menu>
150
+ </template>
151
+
152
+ <style scoped>
153
+ .blur-picker {
154
+ background-color: rgba(40, 40, 40, 0.7) !important;
155
+ backdrop-filter: blur(12px);
156
+ -webkit-backdrop-filter: blur(12px);
157
+ border-color: rgba(255, 255, 255, 0.2) !important;
158
+ transition: background-color 0.2s;
159
+ }
160
+
161
+ .blur-picker {
162
+ background-color: rgba(60, 60, 60, 0.9) !important;
163
+ }
164
+
165
+ .border-thin {
166
+ border: 1px solid rgba(255, 255, 255, 0.15) !important;
167
+ }
168
+ </style>
@@ -11,11 +11,28 @@
11
11
 
12
12
  const color = defineModel("color")
13
13
  const textures = defineModel("textures")
14
- const vertex_attribute = defineModel("vertex_attribute")
15
- const edge_attribute = defineModel("edge_attribute")
16
- const cell_attribute = defineModel("cell_attribute")
17
- const polygon_attribute = defineModel("polygon_attribute")
18
- const polyhedron_attribute = defineModel("polyhedron_attribute")
14
+
15
+ const vertex_attribute_name = defineModel("vertex_attribute_name")
16
+ const vertex_attribute_range = defineModel("vertex_attribute_range")
17
+ const vertex_attribute_color_map = defineModel("vertex_attribute_color_map")
18
+
19
+ const edge_attribute_name = defineModel("edge_attribute_name")
20
+ const edge_attribute_range = defineModel("edge_attribute_range")
21
+ const edge_attribute_color_map = defineModel("edge_attribute_color_map")
22
+
23
+ const cell_attribute_name = defineModel("cell_attribute_name")
24
+ const cell_attribute_range = defineModel("cell_attribute_range")
25
+ const cell_attribute_color_map = defineModel("cell_attribute_color_map")
26
+
27
+ const polygon_attribute_name = defineModel("polygon_attribute_name")
28
+ const polygon_attribute_range = defineModel("polygon_attribute_range")
29
+ const polygon_attribute_color_map = defineModel("polygon_attribute_color_map")
30
+
31
+ const polyhedron_attribute_name = defineModel("polyhedron_attribute_name")
32
+ const polyhedron_attribute_range = defineModel("polyhedron_attribute_range")
33
+ const polyhedron_attribute_color_map = defineModel(
34
+ "polyhedron_attribute_color_map",
35
+ )
19
36
 
20
37
  const props = defineProps({
21
38
  id: { type: String, required: true },
@@ -25,20 +42,14 @@
25
42
  const has_textures = computed(() =>
26
43
  textures.value !== undefined ? true : false,
27
44
  )
28
- const has_vertex = computed(() =>
29
- vertex_attribute.value !== undefined ? true : false,
30
- )
31
- const has_edge = computed(() =>
32
- edge_attribute.value !== undefined ? true : false,
33
- )
34
- const has_cells = computed(() =>
35
- cell_attribute.value !== undefined ? true : false,
45
+ const has_vertex = computed(() => vertex_attribute_range.value !== undefined)
46
+ const has_edge = computed(() => edge_attribute_range.value !== undefined)
47
+ const has_cells = computed(() => cell_attribute_range.value !== undefined)
48
+ const has_polygons = computed(
49
+ () => polygon_attribute_range.value !== undefined,
36
50
  )
37
- const has_polygons = computed(() =>
38
- polygon_attribute.value !== undefined ? true : false,
39
- )
40
- const has_polyhedra = computed(() =>
41
- polyhedron_attribute.value !== undefined ? true : false,
51
+ const has_polyhedra = computed(
52
+ () => polyhedron_attribute_range.value !== undefined,
42
53
  )
43
54
 
44
55
  const color_dict = { name: "Color", value: "color" }
@@ -82,7 +93,6 @@
82
93
  coloring_styles.value.values[coloring_styles.value.labels.indexOf(value)]
83
94
  })
84
95
  </script>
85
-
86
96
  <template>
87
97
  <v-row justify="center" align="center">
88
98
  <v-divider />
@@ -115,31 +125,43 @@
115
125
  </template>
116
126
  <template v-if="coloring_style_key === vertex_dict['value']">
117
127
  <ViewerOptionsVertexAttributeSelector
118
- v-model="vertex_attribute"
128
+ v-model:vertex_attribute_name="vertex_attribute_name"
129
+ v-model:vertex_attribute_range="vertex_attribute_range"
130
+ v-model:vertex_attribute_color_map="vertex_attribute_color_map"
119
131
  :id="id"
120
132
  />
121
133
  </template>
122
134
  <template v-if="coloring_style_key === edge_dict['value']">
123
135
  <ViewerOptionsEdgeAttributeSelector
124
- v-model="edge_attribute"
136
+ v-model:edge_attribute_name="edge_attribute_name"
137
+ v-model:edge_attribute_range="edge_attribute_range"
138
+ v-model:edge_attribute_color_map="edge_attribute_color_map"
125
139
  :id="id"
126
140
  />
127
141
  </template>
128
142
  <template v-if="coloring_style_key === cell_dict['value']">
129
143
  <ViewerOptionsCellAttributeSelector
130
- v-model="cell_attribute"
144
+ v-model:cell_attribute_name="cell_attribute_name"
145
+ v-model:cell_attribute_range="cell_attribute_range"
146
+ v-model:cell_attribute_color_map="cell_attribute_color_map"
131
147
  :id="id"
132
148
  />
133
149
  </template>
134
150
  <template v-if="coloring_style_key === polygon_dict['value']">
135
151
  <ViewerOptionsPolygonAttributeSelector
136
- v-model="polygon_attribute"
152
+ v-model:polygon_attribute_name="polygon_attribute_name"
153
+ v-model:polygon_attribute_range="polygon_attribute_range"
154
+ v-model:polygon_attribute_color_map="polygon_attribute_color_map"
137
155
  :id="id"
138
156
  />
139
157
  </template>
140
158
  <template v-if="coloring_style_key === polyhedron_dict['value']">
141
159
  <ViewerOptionsPolyhedronAttributeSelector
142
- v-model="polyhedron_attribute"
160
+ v-model:polyhedron_attribute_name="polyhedron_attribute_name"
161
+ v-model:polyhedron_attribute_range="polyhedron_attribute_range"
162
+ v-model:polyhedron_attribute_color_map="
163
+ polyhedron_attribute_color_map
164
+ "
143
165
  :id="id"
144
166
  />
145
167
  </template>
@@ -1,72 +1,84 @@
1
1
  <script setup>
2
2
  import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
3
3
  import { useGeodeStore } from "@ogw_front/stores/geode"
4
+ import ViewerOptionsAttributeColorBar from "@ogw_front/components/Viewer/Options/AttributeColorBar"
4
5
 
5
6
  const geodeStore = useGeodeStore()
6
7
 
7
- const model = defineModel()
8
+ const edge_attribute_name = defineModel("edge_attribute_name", {
9
+ type: String,
10
+ })
11
+ const edge_attribute_range = defineModel("edge_attribute_range", {
12
+ type: Array,
13
+ })
14
+ const edge_attribute_color_map = defineModel("edge_attribute_color_map", {
15
+ type: String,
16
+ })
17
+ const edge_attributes = ref([])
8
18
 
9
19
  const props = defineProps({
10
20
  id: { type: String, required: true },
11
21
  })
12
22
 
13
- const edge_attribute_name = ref("")
14
- const edge_attribute_names = ref([])
15
-
16
- onMounted(() => {
17
- if (model.value != null) {
18
- edge_attribute_name.value = model.value.name
19
- }
23
+ const rangeMin = computed({
24
+ get: () => edge_attribute_range.value[0],
25
+ set: (val) => {
26
+ edge_attribute_range.value = [val, edge_attribute_range.value[1]]
27
+ },
28
+ })
29
+ const rangeMax = computed({
30
+ get: () => edge_attribute_range.value[1],
31
+ set: (val) => {
32
+ edge_attribute_range.value = [edge_attribute_range.value[0], val]
33
+ },
20
34
  })
21
35
 
22
- const edge_attribute = reactive({ name: edge_attribute_name.value })
23
-
24
- watch(edge_attribute_name, (value) => {
25
- edge_attribute.name = value
26
- model.value = edge_attribute
36
+ onMounted(() => {
37
+ getEdgeAttributes()
27
38
  })
28
39
 
29
- function get_edge_attribute_names() {
40
+ function getEdgeAttributes() {
30
41
  geodeStore.request(
31
42
  back_schemas.opengeodeweb_back.edge_attribute_names,
32
43
  { id: props.id },
33
44
  {
34
45
  response_function: (response) => {
35
- edge_attribute_names.value = response.edge_attribute_names
46
+ edge_attributes.value = response.attributes
36
47
  },
37
48
  },
38
49
  )
39
50
  }
40
51
 
41
- onMounted(() => {
42
- get_edge_attribute_names()
52
+ const currentAttribute = computed(() => {
53
+ return edge_attributes.value.find(
54
+ (attr) => attr.attribute_name === edge_attribute_name.value,
55
+ )
43
56
  })
44
57
 
45
- watch(
46
- () => props.id,
47
- () => {
48
- get_edge_attribute_names()
49
- },
50
- )
58
+ function resetRange() {
59
+ if (currentAttribute.value) {
60
+ edge_attribute_range.value = [
61
+ currentAttribute.value.min_value,
62
+ currentAttribute.value.max_value,
63
+ ]
64
+ }
65
+ }
51
66
  </script>
52
67
 
53
68
  <template>
54
- <v-row justify="center" align="center">
55
- <v-col cols="auto">
56
- <v-icon
57
- size="30"
58
- icon="mdi-ray-end-arrow"
59
- v-tooltip:left="'Edge Attribute'"
60
- />
61
- </v-col>
62
- <v-col>
63
- <v-select
64
- v-model="edge_attribute_name"
65
- :items="edge_attribute_names"
66
- label="Select an edge attribute"
67
- density="compact"
68
- hide-details
69
- />
70
- </v-col>
71
- </v-row>
69
+ <v-select
70
+ v-model="edge_attribute_name"
71
+ :items="edge_attributes.map((attribute) => attribute.attribute_name)"
72
+ item-title="attribute_name"
73
+ item-value="attribute_name"
74
+ label="Select an attribute"
75
+ density="compact"
76
+ />
77
+ <ViewerOptionsAttributeColorBar
78
+ v-if="edge_attribute_name"
79
+ v-model:minimum="rangeMin"
80
+ v-model:maximum="rangeMax"
81
+ v-model:colorMap="edge_attribute_color_map"
82
+ @reset="resetRange"
83
+ />
72
84
  </template>