@geode/opengeodeweb-front 10.44.0-rc.4 → 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.
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +12 -12
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +17 -24
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +12 -12
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +13 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +17 -24
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +12 -12
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +12 -0
- package/app/components/Viewer/Options/Sliders/Opacity.vue +22 -0
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +13 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +12 -12
- package/app/components/Viewer/Surface/PolygonsColoring.vue +17 -24
- package/app/composables/batch_style_model.ts +34 -0
- package/internal/stores/data_style/mesh/cells/color.ts +3 -1
- package/internal/stores/data_style/mesh/cells/index.ts +17 -1
- package/internal/stores/data_style/mesh/cells/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/edges/color.ts +3 -1
- package/internal/stores/data_style/mesh/edges/index.ts +17 -1
- package/internal/stores/data_style/mesh/edges/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/points/color.ts +3 -1
- package/internal/stores/data_style/mesh/points/index.ts +17 -1
- package/internal/stores/data_style/mesh/points/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/polygons/color.ts +3 -1
- package/internal/stores/data_style/mesh/polygons/index.ts +17 -1
- package/internal/stores/data_style/mesh/polygons/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/polyhedra/color.ts +3 -1
- package/internal/stores/data_style/mesh/polyhedra/index.ts +17 -1
- package/internal/stores/data_style/mesh/polyhedra/opacity.ts +54 -0
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "@ogw_front/composables/batch_style";
|
|
7
7
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
8
8
|
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
|
|
9
|
+
import { useBatchStyleModel } from "@ogw_front/composables/batch_style_model";
|
|
9
10
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
10
11
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
12
|
|
|
@@ -28,18 +29,16 @@ const coloring_style_key = computed<string>({
|
|
|
28
29
|
hybridViewerStore.remoteRender();
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
|
-
const color =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
});
|
|
32
|
+
const color = useBatchStyleModel<RGBAColor>(
|
|
33
|
+
() => id,
|
|
34
|
+
(targetId) => dataStyleStore.meshEdgesColor(targetId) as RGBAColor | undefined,
|
|
35
|
+
(targetId, value) => dataStyleStore.setMeshEdgesColor(targetId, value),
|
|
36
|
+
);
|
|
37
|
+
const opacity = useBatchStyleModel<number>(
|
|
38
|
+
() => id,
|
|
39
|
+
(targetId) => dataStyleStore.meshEdgesOpacity(targetId),
|
|
40
|
+
(targetId, value) => dataStyleStore.setMeshEdgesOpacity(targetId, value),
|
|
41
|
+
);
|
|
43
42
|
const vertex_attribute_name = computed<string | undefined>({
|
|
44
43
|
get: () => dataStyleStore.meshEdgesVertexAttributeName(id),
|
|
45
44
|
set: async (newValue) => {
|
|
@@ -191,6 +190,7 @@ async function setEdgeAttributeRangesPerData(ranges: RangesPerData): Promise<voi
|
|
|
191
190
|
:id="id"
|
|
192
191
|
v-model:coloring_style_key="coloring_style_key"
|
|
193
192
|
v-model:color="color"
|
|
193
|
+
v-model:opacity="opacity"
|
|
194
194
|
v-model:vertex_attribute_name="vertex_attribute_name"
|
|
195
195
|
v-model:vertex_attribute_item="vertex_attribute_item"
|
|
196
196
|
v-model:vertex_attribute_range="vertex_attribute_range"
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "@ogw_front/composables/batch_style";
|
|
7
7
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
8
8
|
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
|
|
9
|
+
import { useBatchStyleModel } from "@ogw_front/composables/batch_style_model";
|
|
9
10
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
10
11
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
12
|
|
|
@@ -33,30 +34,21 @@ const coloring_style_key = computed<string>({
|
|
|
33
34
|
hybridViewerStore.remoteRender();
|
|
34
35
|
},
|
|
35
36
|
});
|
|
36
|
-
const color =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (newValue === undefined) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
await applyBatchStyle(id, (targetId: string) =>
|
|
55
|
-
dataStyleStore.setMeshCellsTextures(targetId, newValue),
|
|
56
|
-
);
|
|
57
|
-
hybridViewerStore.remoteRender();
|
|
58
|
-
},
|
|
59
|
-
});
|
|
37
|
+
const color = useBatchStyleModel<RGBAColor>(
|
|
38
|
+
() => id,
|
|
39
|
+
(targetId) => dataStyleStore.meshCellsColor(targetId) as RGBAColor | undefined,
|
|
40
|
+
(targetId, value) => dataStyleStore.setMeshCellsColor(targetId, value),
|
|
41
|
+
);
|
|
42
|
+
const opacity = useBatchStyleModel<number>(
|
|
43
|
+
() => id,
|
|
44
|
+
(targetId) => dataStyleStore.meshCellsOpacity(targetId),
|
|
45
|
+
(targetId, value) => dataStyleStore.setMeshCellsOpacity(targetId, value),
|
|
46
|
+
);
|
|
47
|
+
const textures = useBatchStyleModel<Texture[]>(
|
|
48
|
+
() => id,
|
|
49
|
+
(targetId) => dataStyleStore.meshCellsTextures(targetId) as Texture[] | undefined,
|
|
50
|
+
(targetId, value) => dataStyleStore.setMeshCellsTextures(targetId, value),
|
|
51
|
+
);
|
|
60
52
|
|
|
61
53
|
const vertex_attribute_name = computed<string | undefined>({
|
|
62
54
|
get: () => dataStyleStore.meshCellsVertexAttributeName(id),
|
|
@@ -209,6 +201,7 @@ async function setCellAttributeRangesPerData(ranges: RangesPerData): Promise<voi
|
|
|
209
201
|
:id="id"
|
|
210
202
|
v-model:coloring_style_key="coloring_style_key"
|
|
211
203
|
v-model:color="color"
|
|
204
|
+
v-model:opacity="opacity"
|
|
212
205
|
v-model:textures="textures"
|
|
213
206
|
v-model:vertex_attribute_name="vertex_attribute_name"
|
|
214
207
|
v-model:vertex_attribute_item="vertex_attribute_item"
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "@ogw_front/composables/batch_style";
|
|
7
7
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
8
8
|
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
|
|
9
|
+
import { useBatchStyleModel } from "@ogw_front/composables/batch_style_model";
|
|
9
10
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
10
11
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
12
|
|
|
@@ -29,18 +30,16 @@ const coloring_style_key = computed<string>({
|
|
|
29
30
|
hybridViewerStore.remoteRender();
|
|
30
31
|
},
|
|
31
32
|
});
|
|
32
|
-
const color =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
});
|
|
33
|
+
const color = useBatchStyleModel<RGBAColor>(
|
|
34
|
+
() => id,
|
|
35
|
+
(targetId) => dataStyleStore.meshEdgesColor(targetId) as RGBAColor | undefined,
|
|
36
|
+
(targetId, value) => dataStyleStore.setMeshEdgesColor(targetId, value),
|
|
37
|
+
);
|
|
38
|
+
const opacity = useBatchStyleModel<number>(
|
|
39
|
+
() => id,
|
|
40
|
+
(targetId) => dataStyleStore.meshEdgesOpacity(targetId),
|
|
41
|
+
(targetId, value) => dataStyleStore.setMeshEdgesOpacity(targetId, value),
|
|
42
|
+
);
|
|
44
43
|
const vertex_attribute_name = computed<string | undefined>({
|
|
45
44
|
get: () => dataStyleStore.meshEdgesVertexAttributeName(id),
|
|
46
45
|
set: async (newValue) => {
|
|
@@ -192,6 +191,7 @@ async function setEdgeAttributeRangesPerData(ranges: RangesPerData): Promise<voi
|
|
|
192
191
|
:id="id"
|
|
193
192
|
v-model:coloring_style_key="coloring_style_key"
|
|
194
193
|
v-model:color="color"
|
|
194
|
+
v-model:opacity="opacity"
|
|
195
195
|
v-model:vertex_attribute_name="vertex_attribute_name"
|
|
196
196
|
v-model:vertex_attribute_item="vertex_attribute_item"
|
|
197
197
|
v-model:vertex_attribute_range="vertex_attribute_range"
|
|
@@ -67,6 +67,18 @@ const color = computed<RGBAColor | undefined>({
|
|
|
67
67
|
hybridViewerStore.remoteRender();
|
|
68
68
|
},
|
|
69
69
|
});
|
|
70
|
+
const opacity = computed<number | undefined>({
|
|
71
|
+
get: () => dataStyleStore.meshPointsOpacity(id.value),
|
|
72
|
+
set: async (newValue) => {
|
|
73
|
+
if (newValue === undefined) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
await applyBatchStyle(id.value, (targetId: string) =>
|
|
77
|
+
dataStyleStore.setMeshPointsOpacity(targetId, newValue),
|
|
78
|
+
);
|
|
79
|
+
hybridViewerStore.remoteRender();
|
|
80
|
+
},
|
|
81
|
+
});
|
|
70
82
|
const vertex_attribute_name = computed<string | undefined>({
|
|
71
83
|
get: () => dataStyleStore.meshPointsVertexAttributeName(id.value),
|
|
72
84
|
set: async (newValue) => {
|
|
@@ -165,6 +177,7 @@ async function setVertexAttributeRangesPerData(ranges: RangesPerData): Promise<v
|
|
|
165
177
|
:id="id"
|
|
166
178
|
v-model:coloring_style_key="coloring_style_key"
|
|
167
179
|
v-model:color="color"
|
|
180
|
+
v-model:opacity="opacity"
|
|
168
181
|
v-model:vertex_attribute_name="vertex_attribute_name"
|
|
169
182
|
v-model:vertex_attribute_item="vertex_attribute_item"
|
|
170
183
|
v-model:vertex_attribute_range="vertex_attribute_range"
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "@ogw_front/composables/batch_style";
|
|
7
7
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
8
8
|
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
|
|
9
|
+
import { useBatchStyleModel } from "@ogw_front/composables/batch_style_model";
|
|
9
10
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
10
11
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
12
|
|
|
@@ -34,30 +35,21 @@ const coloring_style_key = computed<string>({
|
|
|
34
35
|
hybridViewerStore.remoteRender();
|
|
35
36
|
},
|
|
36
37
|
});
|
|
37
|
-
const color =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (newValue === undefined) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
await applyBatchStyle(id, (targetId: string) =>
|
|
56
|
-
dataStyleStore.setMeshPolygonsTextures(targetId, newValue),
|
|
57
|
-
);
|
|
58
|
-
hybridViewerStore.remoteRender();
|
|
59
|
-
},
|
|
60
|
-
});
|
|
38
|
+
const color = useBatchStyleModel<RGBAColor>(
|
|
39
|
+
() => id,
|
|
40
|
+
(targetId) => dataStyleStore.meshPolygonsColor(targetId) as RGBAColor | undefined,
|
|
41
|
+
(targetId, value) => dataStyleStore.setMeshPolygonsColor(targetId, value),
|
|
42
|
+
);
|
|
43
|
+
const opacity = useBatchStyleModel<number>(
|
|
44
|
+
() => id,
|
|
45
|
+
(targetId) => dataStyleStore.meshPolygonsOpacity(targetId),
|
|
46
|
+
(targetId, value) => dataStyleStore.setMeshPolygonsOpacity(targetId, value),
|
|
47
|
+
);
|
|
48
|
+
const textures = useBatchStyleModel<Texture[]>(
|
|
49
|
+
() => id,
|
|
50
|
+
(targetId) => dataStyleStore.meshPolygonsTextures(targetId) as Texture[] | undefined,
|
|
51
|
+
(targetId, value) => dataStyleStore.setMeshPolygonsTextures(targetId, value),
|
|
52
|
+
);
|
|
61
53
|
|
|
62
54
|
const vertex_attribute_name = computed<string | undefined>({
|
|
63
55
|
get: () => dataStyleStore.meshPolygonsVertexAttributeName(id),
|
|
@@ -214,6 +206,7 @@ async function setPolygonAttributeRangesPerData(ranges: RangesPerData): Promise<
|
|
|
214
206
|
:id="id"
|
|
215
207
|
v-model:coloring_style_key="coloring_style_key"
|
|
216
208
|
v-model:color="color"
|
|
209
|
+
v-model:opacity="opacity"
|
|
217
210
|
v-model:textures="textures"
|
|
218
211
|
v-model:vertex_attribute_name="vertex_attribute_name"
|
|
219
212
|
v-model:vertex_attribute_item="vertex_attribute_item"
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "@ogw_front/composables/batch_style";
|
|
7
7
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
8
8
|
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
|
|
9
|
+
import { useBatchStyleModel } from "@ogw_front/composables/batch_style_model";
|
|
9
10
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
10
11
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
12
|
|
|
@@ -28,18 +29,16 @@ const coloring_style_key = computed<string>({
|
|
|
28
29
|
hybridViewerStore.remoteRender();
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
|
-
const color =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
});
|
|
32
|
+
const color = useBatchStyleModel<RGBAColor>(
|
|
33
|
+
() => id,
|
|
34
|
+
(targetId) => dataStyleStore.meshPolyhedraColor(targetId) as RGBAColor | undefined,
|
|
35
|
+
(targetId, value) => dataStyleStore.setMeshPolyhedraColor(targetId, value),
|
|
36
|
+
);
|
|
37
|
+
const opacity = useBatchStyleModel<number>(
|
|
38
|
+
() => id,
|
|
39
|
+
(targetId) => dataStyleStore.meshPolyhedraOpacity(targetId),
|
|
40
|
+
(targetId, value) => dataStyleStore.setMeshPolyhedraOpacity(targetId, value),
|
|
41
|
+
);
|
|
43
42
|
const vertex_attribute_name = computed<string | undefined>({
|
|
44
43
|
get: () => dataStyleStore.meshPolyhedraVertexAttributeName(id),
|
|
45
44
|
set: async (newValue) => {
|
|
@@ -199,6 +198,7 @@ async function setPolyhedronAttributeRangesPerData(ranges: RangesPerData): Promi
|
|
|
199
198
|
:id="id"
|
|
200
199
|
v-model:coloring_style_key="coloring_style_key"
|
|
201
200
|
v-model:color="color"
|
|
201
|
+
v-model:opacity="opacity"
|
|
202
202
|
v-model:vertex_attribute_name="vertex_attribute_name"
|
|
203
203
|
v-model:vertex_attribute_item="vertex_attribute_item"
|
|
204
204
|
v-model:vertex_attribute_range="vertex_attribute_range"
|
|
@@ -9,6 +9,7 @@ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
|
9
9
|
import type { RangesPerData } from "@ogw_front/composables/batch_style";
|
|
10
10
|
import ViewerOptionsAttributeSelector from "@ogw_front/components/Viewer/Options/AttributeSelector.vue";
|
|
11
11
|
import ViewerOptionsColorPicker from "@ogw_front/components/Viewer/Options/ColorPicker.vue";
|
|
12
|
+
import ViewerOptionsOpacitySlider from "@ogw_front/components/Viewer/Options/Sliders/Opacity.vue";
|
|
12
13
|
import ViewerOptionsTexturesSelector from "@ogw_front/components/Viewer/Options/TexturesSelector.vue";
|
|
13
14
|
|
|
14
15
|
interface Texture {
|
|
@@ -34,6 +35,7 @@ interface Emits {
|
|
|
34
35
|
const emit = defineEmits<Emits>();
|
|
35
36
|
|
|
36
37
|
const color = defineModel<RGBAColor>("color");
|
|
38
|
+
const opacity = defineModel<number>("opacity");
|
|
37
39
|
const textures = defineModel<Texture[]>("textures");
|
|
38
40
|
|
|
39
41
|
const vertex_attribute_name = defineModel<string>("vertex_attribute_name");
|
|
@@ -169,6 +171,11 @@ const active_key = computed<string | undefined>(() => {
|
|
|
169
171
|
return index === -1 ? coloring_style_key.value : coloring_styles.value.values[index];
|
|
170
172
|
});
|
|
171
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
|
+
|
|
172
179
|
watch(
|
|
173
180
|
[
|
|
174
181
|
coloring_style_label,
|
|
@@ -304,4 +311,9 @@ watch(
|
|
|
304
311
|
</template>
|
|
305
312
|
</v-col>
|
|
306
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>
|
|
307
319
|
</template>
|
|
@@ -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>
|
|
@@ -72,6 +72,18 @@ const color = computed<RGBAColor | undefined>({
|
|
|
72
72
|
hybridViewerStore.remoteRender();
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
|
+
const opacity = computed<number | undefined>({
|
|
76
|
+
get: () => dataStyleStore.meshPointsOpacity(id.value),
|
|
77
|
+
set: async (newValue) => {
|
|
78
|
+
if (newValue === undefined) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
await applyBatchStyle(id.value, (targetId: string) =>
|
|
82
|
+
dataStyleStore.setMeshPointsOpacity(targetId, newValue),
|
|
83
|
+
);
|
|
84
|
+
hybridViewerStore.remoteRender();
|
|
85
|
+
},
|
|
86
|
+
});
|
|
75
87
|
const vertex_attribute_name = computed({
|
|
76
88
|
get: () => dataStyleStore.meshPointsVertexAttributeName(id.value),
|
|
77
89
|
set: async (newValue) => {
|
|
@@ -165,6 +177,7 @@ async function setVertexAttributeRangesPerData(ranges: RangesPerData): Promise<v
|
|
|
165
177
|
:id="id"
|
|
166
178
|
v-model:coloring_style_key="coloring_style_key"
|
|
167
179
|
v-model:color="color"
|
|
180
|
+
v-model:opacity="opacity"
|
|
168
181
|
v-model:vertex_attribute_name="vertex_attribute_name"
|
|
169
182
|
v-model:vertex_attribute_item="vertex_attribute_item"
|
|
170
183
|
v-model:vertex_attribute_range="vertex_attribute_range"
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "@ogw_front/composables/batch_style";
|
|
7
7
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
8
8
|
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
|
|
9
|
+
import { useBatchStyleModel } from "@ogw_front/composables/batch_style_model";
|
|
9
10
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
10
11
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
12
|
|
|
@@ -28,18 +29,16 @@ const coloring_style_key = computed<string>({
|
|
|
28
29
|
hybridViewerStore.remoteRender();
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
|
-
const color =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
});
|
|
32
|
+
const color = useBatchStyleModel<RGBAColor>(
|
|
33
|
+
() => id,
|
|
34
|
+
(targetId) => dataStyleStore.meshPolyhedraColor(targetId) as RGBAColor | undefined,
|
|
35
|
+
(targetId, value) => dataStyleStore.setMeshPolyhedraColor(targetId, value),
|
|
36
|
+
);
|
|
37
|
+
const opacity = useBatchStyleModel<number>(
|
|
38
|
+
() => id,
|
|
39
|
+
(targetId) => dataStyleStore.meshPolyhedraOpacity(targetId),
|
|
40
|
+
(targetId, value) => dataStyleStore.setMeshPolyhedraOpacity(targetId, value),
|
|
41
|
+
);
|
|
43
42
|
const vertex_attribute_name = computed<string | undefined>({
|
|
44
43
|
get: () => dataStyleStore.meshPolyhedraVertexAttributeName(id),
|
|
45
44
|
set: async (newValue) => {
|
|
@@ -199,6 +198,7 @@ async function setPolyhedronAttributeRangesPerData(ranges: RangesPerData): Promi
|
|
|
199
198
|
:id="id"
|
|
200
199
|
v-model:coloring_style_key="coloring_style_key"
|
|
201
200
|
v-model:color="color"
|
|
201
|
+
v-model:opacity="opacity"
|
|
202
202
|
v-model:vertex_attribute_name="vertex_attribute_name"
|
|
203
203
|
v-model:vertex_attribute_item="vertex_attribute_item"
|
|
204
204
|
v-model:vertex_attribute_range="vertex_attribute_range"
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "@ogw_front/composables/batch_style";
|
|
7
7
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
8
8
|
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
|
|
9
|
+
import { useBatchStyleModel } from "@ogw_front/composables/batch_style_model";
|
|
9
10
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
10
11
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
12
|
|
|
@@ -33,30 +34,21 @@ const coloring_style_key = computed<string>({
|
|
|
33
34
|
hybridViewerStore.remoteRender();
|
|
34
35
|
},
|
|
35
36
|
});
|
|
36
|
-
const color =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (newValue === undefined) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
await applyBatchStyle(id, (targetId: string) =>
|
|
55
|
-
dataStyleStore.setMeshPolygonsTextures(targetId, newValue),
|
|
56
|
-
);
|
|
57
|
-
hybridViewerStore.remoteRender();
|
|
58
|
-
},
|
|
59
|
-
});
|
|
37
|
+
const color = useBatchStyleModel<RGBAColor>(
|
|
38
|
+
() => id,
|
|
39
|
+
(targetId) => dataStyleStore.meshPolygonsColor(targetId) as RGBAColor | undefined,
|
|
40
|
+
(targetId, value) => dataStyleStore.setMeshPolygonsColor(targetId, value),
|
|
41
|
+
);
|
|
42
|
+
const opacity = useBatchStyleModel<number>(
|
|
43
|
+
() => id,
|
|
44
|
+
(targetId) => dataStyleStore.meshPolygonsOpacity(targetId),
|
|
45
|
+
(targetId, value) => dataStyleStore.setMeshPolygonsOpacity(targetId, value),
|
|
46
|
+
);
|
|
47
|
+
const textures = useBatchStyleModel<Texture[]>(
|
|
48
|
+
() => id,
|
|
49
|
+
(targetId) => dataStyleStore.meshPolygonsTextures(targetId) as Texture[] | undefined,
|
|
50
|
+
(targetId, value) => dataStyleStore.setMeshPolygonsTextures(targetId, value),
|
|
51
|
+
);
|
|
60
52
|
const vertex_attribute_name = computed<string | undefined>({
|
|
61
53
|
get: () => dataStyleStore.meshPolygonsVertexAttributeName(id),
|
|
62
54
|
set: async (newValue) => {
|
|
@@ -212,6 +204,7 @@ async function setPolygonAttributeRangesPerData(ranges: RangesPerData): Promise<
|
|
|
212
204
|
:id="id"
|
|
213
205
|
v-model:coloring_style_key="coloring_style_key"
|
|
214
206
|
v-model:color="color"
|
|
207
|
+
v-model:opacity="opacity"
|
|
215
208
|
v-model:textures="textures"
|
|
216
209
|
v-model:vertex_attribute_name="vertex_attribute_name"
|
|
217
210
|
v-model:vertex_attribute_item="vertex_attribute_item"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type WritableComputedRef, computed, toValue } from "vue";
|
|
2
|
+
import { useBatchStyle } from "@ogw_front/composables/batch_style";
|
|
3
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
4
|
+
|
|
5
|
+
// A style model applied to the whole batch of the data, then rendered
|
|
6
|
+
function useBatchStyleModel<Value>(
|
|
7
|
+
id: MaybeRefOrGetter<string>,
|
|
8
|
+
getter: (id: string) => Value | undefined,
|
|
9
|
+
setter: (id: string, value: Value) => Promise<unknown>,
|
|
10
|
+
): WritableComputedRef<Value | undefined> {
|
|
11
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
12
|
+
const { applyBatchStyle } = useBatchStyle();
|
|
13
|
+
|
|
14
|
+
async function applyValue(value: Value): Promise<void> {
|
|
15
|
+
await applyBatchStyle(toValue(id), async (targetId: string) => {
|
|
16
|
+
await setter(targetId, value);
|
|
17
|
+
});
|
|
18
|
+
await hybridViewerStore.remoteRender();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return computed<Value | undefined>({
|
|
22
|
+
get: () => getter(toValue(id)),
|
|
23
|
+
// Vue's WritableComputedOptions setter is strictly `(v: T) => void`: the async write is delegated.
|
|
24
|
+
set: (newValue: Value | undefined): void => {
|
|
25
|
+
if (newValue === undefined) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
/* oxlint-disable-next-line promise/prefer-await-to-then -- setter cannot be async; see comment above. */
|
|
29
|
+
applyValue(newValue).catch(() => undefined);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { useBatchStyleModel };
|
|
@@ -4,12 +4,13 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed
|
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
6
|
import { useMeshCellsCommonStyle } from "./common";
|
|
7
|
+
import { useMeshCellsOpacityStyle } from "./opacity";
|
|
7
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
9
|
|
|
9
10
|
// Local constants
|
|
10
11
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.cells.color;
|
|
11
12
|
|
|
12
|
-
export function useMeshCellsColorStyle(): {
|
|
13
|
+
export function useMeshCellsColorStyle(): ReturnType<typeof useMeshCellsOpacityStyle> & {
|
|
13
14
|
meshCellsColor: (id: string) => RGBAColor | undefined;
|
|
14
15
|
setMeshCellsColor: (id: string, color: RGBAColor) => Promise<unknown>;
|
|
15
16
|
} {
|
|
@@ -42,5 +43,6 @@ export function useMeshCellsColorStyle(): {
|
|
|
42
43
|
return {
|
|
43
44
|
meshCellsColor,
|
|
44
45
|
setMeshCellsColor,
|
|
46
|
+
...useMeshCellsOpacityStyle(),
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -52,7 +52,7 @@ function handleMeshCellsCellColoring(
|
|
|
52
52
|
return cellAttributeStyle.setMeshCellsCellAttribute(id, cell_attribute);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
async function
|
|
55
|
+
async function applyMeshCellsActiveColoring(
|
|
56
56
|
id: string,
|
|
57
57
|
type: string | undefined,
|
|
58
58
|
deps: MeshCellsActiveColoringDeps,
|
|
@@ -87,6 +87,22 @@ async function setMeshCellsActiveColoring(
|
|
|
87
87
|
throw new Error(`Unknown mesh cells coloring type: ${type}`);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
async function setMeshCellsActiveColoring(
|
|
91
|
+
id: string,
|
|
92
|
+
type: string | undefined,
|
|
93
|
+
deps: MeshCellsActiveColoringDeps,
|
|
94
|
+
): Promise<unknown> {
|
|
95
|
+
const result = await applyMeshCellsActiveColoring(id, type, deps);
|
|
96
|
+
if (type !== "constant") {
|
|
97
|
+
// Attribute and textures colorings keep the actor opacity: restore the stored one
|
|
98
|
+
await whenDefined(deps.colorStyle.meshCellsOpacity(id), async (value) => {
|
|
99
|
+
const applied = await deps.colorStyle.setMeshCellsOpacity(id, value);
|
|
100
|
+
return applied;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
|
|
90
106
|
async function applyMeshCellsStyle(
|
|
91
107
|
id: string,
|
|
92
108
|
visibilityStyle: ReturnType<typeof useMeshCellsVisibilityStyle>,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
// Third party imports
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
|
+
|
|
5
|
+
// Local imports
|
|
6
|
+
import { useMeshCellsCommonStyle } from "./common";
|
|
7
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
|
+
|
|
9
|
+
// Local constants
|
|
10
|
+
const schema = viewer_schemas.opengeodeweb_viewer.mesh.cells.opacity;
|
|
11
|
+
|
|
12
|
+
// The opacity is the constant color alpha, the viewer applies it whatever the coloring
|
|
13
|
+
export function useMeshCellsOpacityStyle(): {
|
|
14
|
+
meshCellsOpacity: (id: string) => number | undefined;
|
|
15
|
+
setMeshCellsOpacity: (id: string, opacity: number) => Promise<unknown>;
|
|
16
|
+
} {
|
|
17
|
+
const viewerStore = useViewerStore();
|
|
18
|
+
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
19
|
+
|
|
20
|
+
function meshCellsConstantColor(id: string): RGBAColor | undefined {
|
|
21
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
22
|
+
return meshCellsCommonStyle.meshCellsColoring(id).constant as RGBAColor | undefined;
|
|
23
|
+
}
|
|
24
|
+
function meshCellsOpacity(id: string): number | undefined {
|
|
25
|
+
return meshCellsConstantColor(id)?.alpha;
|
|
26
|
+
}
|
|
27
|
+
async function setMeshCellsOpacity(id: string, opacity: number): Promise<unknown> {
|
|
28
|
+
const params = { id, opacity };
|
|
29
|
+
const result = await viewerStore.request(
|
|
30
|
+
{
|
|
31
|
+
schema,
|
|
32
|
+
params,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
response_function: async () => {
|
|
36
|
+
const color = meshCellsConstantColor(id);
|
|
37
|
+
if (color === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const mutateResult = await meshCellsCommonStyle.mutateMeshCellsColoring(id, {
|
|
41
|
+
constant: { ...color, alpha: opacity },
|
|
42
|
+
});
|
|
43
|
+
return mutateResult;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
meshCellsOpacity,
|
|
52
|
+
setMeshCellsOpacity,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -4,12 +4,13 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed
|
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
6
|
import { useMeshEdgesCommonStyle } from "./common";
|
|
7
|
+
import { useMeshEdgesOpacityStyle } from "./opacity";
|
|
7
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
9
|
|
|
9
10
|
// Local constants
|
|
10
11
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.edges.color;
|
|
11
12
|
|
|
12
|
-
export function useMeshEdgesColorStyle(): {
|
|
13
|
+
export function useMeshEdgesColorStyle(): ReturnType<typeof useMeshEdgesOpacityStyle> & {
|
|
13
14
|
meshEdgesColor: (id: string) => RGBAColor | undefined;
|
|
14
15
|
setMeshEdgesColor: (id: string, color: RGBAColor) => Promise<unknown>;
|
|
15
16
|
} {
|
|
@@ -42,5 +43,6 @@ export function useMeshEdgesColorStyle(): {
|
|
|
42
43
|
return {
|
|
43
44
|
meshEdgesColor,
|
|
44
45
|
setMeshEdgesColor,
|
|
46
|
+
...useMeshEdgesOpacityStyle(),
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -51,7 +51,7 @@ function handleMeshEdgesEdgeColoring(
|
|
|
51
51
|
return edgeAttributeStyle.setMeshEdgesEdgeAttribute(id, edge_attribute);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
async function
|
|
54
|
+
async function applyMeshEdgesActiveColoring(
|
|
55
55
|
id: string,
|
|
56
56
|
type: string | undefined,
|
|
57
57
|
deps: MeshEdgesActiveColoringDeps,
|
|
@@ -77,6 +77,22 @@ async function setMeshEdgesActiveColoring(
|
|
|
77
77
|
throw new Error(`Unknown mesh edges coloring type: ${type}`);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
async function setMeshEdgesActiveColoring(
|
|
81
|
+
id: string,
|
|
82
|
+
type: string | undefined,
|
|
83
|
+
deps: MeshEdgesActiveColoringDeps,
|
|
84
|
+
): Promise<unknown> {
|
|
85
|
+
const result = await applyMeshEdgesActiveColoring(id, type, deps);
|
|
86
|
+
if (type !== "constant") {
|
|
87
|
+
// Attribute and textures colorings keep the actor opacity: restore the stored one
|
|
88
|
+
await whenDefined(deps.colorStyle.meshEdgesOpacity(id), async (value) => {
|
|
89
|
+
const applied = await deps.colorStyle.setMeshEdgesOpacity(id, value);
|
|
90
|
+
return applied;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
|
|
80
96
|
async function applyMeshEdgesStyle(
|
|
81
97
|
id: string,
|
|
82
98
|
visibilityStyle: ReturnType<typeof useMeshEdgesVisibilityStyle>,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
// Third party imports
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
|
+
|
|
5
|
+
// Local imports
|
|
6
|
+
import { useMeshEdgesCommonStyle } from "./common";
|
|
7
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
|
+
|
|
9
|
+
// Local constants
|
|
10
|
+
const schema = viewer_schemas.opengeodeweb_viewer.mesh.edges.opacity;
|
|
11
|
+
|
|
12
|
+
// The opacity is the constant color alpha, the viewer applies it whatever the coloring
|
|
13
|
+
export function useMeshEdgesOpacityStyle(): {
|
|
14
|
+
meshEdgesOpacity: (id: string) => number | undefined;
|
|
15
|
+
setMeshEdgesOpacity: (id: string, opacity: number) => Promise<unknown>;
|
|
16
|
+
} {
|
|
17
|
+
const viewerStore = useViewerStore();
|
|
18
|
+
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
19
|
+
|
|
20
|
+
function meshEdgesConstantColor(id: string): RGBAColor | undefined {
|
|
21
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
22
|
+
return meshEdgesCommonStyle.meshEdgesColoring(id).constant as RGBAColor | undefined;
|
|
23
|
+
}
|
|
24
|
+
function meshEdgesOpacity(id: string): number | undefined {
|
|
25
|
+
return meshEdgesConstantColor(id)?.alpha;
|
|
26
|
+
}
|
|
27
|
+
async function setMeshEdgesOpacity(id: string, opacity: number): Promise<unknown> {
|
|
28
|
+
const params = { id, opacity };
|
|
29
|
+
const result = await viewerStore.request(
|
|
30
|
+
{
|
|
31
|
+
schema,
|
|
32
|
+
params,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
response_function: async () => {
|
|
36
|
+
const color = meshEdgesConstantColor(id);
|
|
37
|
+
if (color === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const mutateResult = await meshEdgesCommonStyle.mutateMeshEdgesColoring(id, {
|
|
41
|
+
constant: { ...color, alpha: opacity },
|
|
42
|
+
});
|
|
43
|
+
return mutateResult;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
meshEdgesOpacity,
|
|
52
|
+
setMeshEdgesOpacity,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -4,12 +4,13 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed
|
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
6
|
import { useMeshPointsCommonStyle } from "./common";
|
|
7
|
+
import { useMeshPointsOpacityStyle } from "./opacity";
|
|
7
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
9
|
|
|
9
10
|
// Local constants
|
|
10
11
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.points.color;
|
|
11
12
|
|
|
12
|
-
export function useMeshPointsColorStyle(): {
|
|
13
|
+
export function useMeshPointsColorStyle(): ReturnType<typeof useMeshPointsOpacityStyle> & {
|
|
13
14
|
meshPointsColor: (id: string) => RGBAColor | undefined;
|
|
14
15
|
setMeshPointsColor: (id: string, color: RGBAColor) => Promise<unknown>;
|
|
15
16
|
} {
|
|
@@ -42,5 +43,6 @@ export function useMeshPointsColorStyle(): {
|
|
|
42
43
|
return {
|
|
43
44
|
meshPointsColor,
|
|
44
45
|
setMeshPointsColor,
|
|
46
|
+
...useMeshPointsOpacityStyle(),
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -33,7 +33,7 @@ function handleMeshPointsVertexColoring(
|
|
|
33
33
|
return vertexAttributeStyle.setMeshPointsVertexAttribute(id, vertex_attribute);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
async function
|
|
36
|
+
async function applyMeshPointsActiveColoring(
|
|
37
37
|
id: string,
|
|
38
38
|
type: string | undefined,
|
|
39
39
|
deps: MeshPointsActiveColoringDeps,
|
|
@@ -55,6 +55,22 @@ async function setMeshPointsActiveColoring(
|
|
|
55
55
|
throw new Error(`Unknown mesh points coloring type: ${type}`);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
async function setMeshPointsActiveColoring(
|
|
59
|
+
id: string,
|
|
60
|
+
type: string | undefined,
|
|
61
|
+
deps: MeshPointsActiveColoringDeps,
|
|
62
|
+
): Promise<unknown> {
|
|
63
|
+
const result = await applyMeshPointsActiveColoring(id, type, deps);
|
|
64
|
+
if (type !== "constant") {
|
|
65
|
+
// Attribute and textures colorings keep the actor opacity: restore the stored one
|
|
66
|
+
await whenDefined(deps.colorStyle.meshPointsOpacity(id), async (value) => {
|
|
67
|
+
const applied = await deps.colorStyle.setMeshPointsOpacity(id, value);
|
|
68
|
+
return applied;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
async function applyMeshPointsStyle(
|
|
59
75
|
id: string,
|
|
60
76
|
visibilityStyle: ReturnType<typeof useMeshPointsVisibilityStyle>,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
// Third party imports
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
|
+
|
|
5
|
+
// Local imports
|
|
6
|
+
import { useMeshPointsCommonStyle } from "./common";
|
|
7
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
|
+
|
|
9
|
+
// Local constants
|
|
10
|
+
const schema = viewer_schemas.opengeodeweb_viewer.mesh.points.opacity;
|
|
11
|
+
|
|
12
|
+
// The opacity is the constant color alpha, the viewer applies it whatever the coloring
|
|
13
|
+
export function useMeshPointsOpacityStyle(): {
|
|
14
|
+
meshPointsOpacity: (id: string) => number | undefined;
|
|
15
|
+
setMeshPointsOpacity: (id: string, opacity: number) => Promise<unknown>;
|
|
16
|
+
} {
|
|
17
|
+
const viewerStore = useViewerStore();
|
|
18
|
+
const meshPointsCommonStyle = useMeshPointsCommonStyle();
|
|
19
|
+
|
|
20
|
+
function meshPointsConstantColor(id: string): RGBAColor | undefined {
|
|
21
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
22
|
+
return meshPointsCommonStyle.meshPointsColoring(id).constant as RGBAColor | undefined;
|
|
23
|
+
}
|
|
24
|
+
function meshPointsOpacity(id: string): number | undefined {
|
|
25
|
+
return meshPointsConstantColor(id)?.alpha;
|
|
26
|
+
}
|
|
27
|
+
async function setMeshPointsOpacity(id: string, opacity: number): Promise<unknown> {
|
|
28
|
+
const params = { id, opacity };
|
|
29
|
+
const result = await viewerStore.request(
|
|
30
|
+
{
|
|
31
|
+
schema,
|
|
32
|
+
params,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
response_function: async () => {
|
|
36
|
+
const color = meshPointsConstantColor(id);
|
|
37
|
+
if (color === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const mutateResult = await meshPointsCommonStyle.mutateMeshPointsColoring(id, {
|
|
41
|
+
constant: { ...color, alpha: opacity },
|
|
42
|
+
});
|
|
43
|
+
return mutateResult;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
meshPointsOpacity,
|
|
52
|
+
setMeshPointsOpacity,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -4,12 +4,13 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed
|
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
6
|
import { useMeshPolygonsCommonStyle } from "./common";
|
|
7
|
+
import { useMeshPolygonsOpacityStyle } from "./opacity";
|
|
7
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
9
|
|
|
9
10
|
// Local constants
|
|
10
11
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.polygons.color;
|
|
11
12
|
|
|
12
|
-
export function useMeshPolygonsColorStyle(): {
|
|
13
|
+
export function useMeshPolygonsColorStyle(): ReturnType<typeof useMeshPolygonsOpacityStyle> & {
|
|
13
14
|
meshPolygonsColor: (id: string) => RGBAColor | undefined;
|
|
14
15
|
setMeshPolygonsColor: (id: string, color: RGBAColor) => Promise<unknown>;
|
|
15
16
|
} {
|
|
@@ -42,5 +43,6 @@ export function useMeshPolygonsColorStyle(): {
|
|
|
42
43
|
return {
|
|
43
44
|
meshPolygonsColor,
|
|
44
45
|
setMeshPolygonsColor,
|
|
46
|
+
...useMeshPolygonsOpacityStyle(),
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -62,7 +62,7 @@ function handleMeshPolygonsPolygonColoring(
|
|
|
62
62
|
return polygonAttributeStyle.setMeshPolygonsPolygonAttribute(id, polygon_attribute);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
async function
|
|
65
|
+
async function applyMeshPolygonsActiveColoring(
|
|
66
66
|
id: string,
|
|
67
67
|
type: string | undefined,
|
|
68
68
|
deps: MeshPolygonsActiveColoringDeps,
|
|
@@ -97,6 +97,22 @@ async function setMeshPolygonsActiveColoring(
|
|
|
97
97
|
throw new Error(`Unknown mesh polygons coloring type: ${type}`);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
async function setMeshPolygonsActiveColoring(
|
|
101
|
+
id: string,
|
|
102
|
+
type: string | undefined,
|
|
103
|
+
deps: MeshPolygonsActiveColoringDeps,
|
|
104
|
+
): Promise<unknown> {
|
|
105
|
+
const result = await applyMeshPolygonsActiveColoring(id, type, deps);
|
|
106
|
+
if (type !== "constant") {
|
|
107
|
+
// Attribute and textures colorings keep the actor opacity: restore the stored one
|
|
108
|
+
await whenDefined(deps.colorStyle.meshPolygonsOpacity(id), async (value) => {
|
|
109
|
+
const applied = await deps.colorStyle.setMeshPolygonsOpacity(id, value);
|
|
110
|
+
return applied;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
|
|
100
116
|
async function applyMeshPolygonsStyle(
|
|
101
117
|
id: string,
|
|
102
118
|
visibilityStyle: ReturnType<typeof useMeshPolygonsVisibilityStyle>,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
// Third party imports
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
|
+
|
|
5
|
+
// Local imports
|
|
6
|
+
import { useMeshPolygonsCommonStyle } from "./common";
|
|
7
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
|
+
|
|
9
|
+
// Local constants
|
|
10
|
+
const schema = viewer_schemas.opengeodeweb_viewer.mesh.polygons.opacity;
|
|
11
|
+
|
|
12
|
+
// The opacity is the constant color alpha, the viewer applies it whatever the coloring
|
|
13
|
+
export function useMeshPolygonsOpacityStyle(): {
|
|
14
|
+
meshPolygonsOpacity: (id: string) => number | undefined;
|
|
15
|
+
setMeshPolygonsOpacity: (id: string, opacity: number) => Promise<unknown>;
|
|
16
|
+
} {
|
|
17
|
+
const viewerStore = useViewerStore();
|
|
18
|
+
const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
|
|
19
|
+
|
|
20
|
+
function meshPolygonsConstantColor(id: string): RGBAColor | undefined {
|
|
21
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
22
|
+
return meshPolygonsCommonStyle.meshPolygonsColoring(id).constant as RGBAColor | undefined;
|
|
23
|
+
}
|
|
24
|
+
function meshPolygonsOpacity(id: string): number | undefined {
|
|
25
|
+
return meshPolygonsConstantColor(id)?.alpha;
|
|
26
|
+
}
|
|
27
|
+
async function setMeshPolygonsOpacity(id: string, opacity: number): Promise<unknown> {
|
|
28
|
+
const params = { id, opacity };
|
|
29
|
+
const result = await viewerStore.request(
|
|
30
|
+
{
|
|
31
|
+
schema,
|
|
32
|
+
params,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
response_function: async () => {
|
|
36
|
+
const color = meshPolygonsConstantColor(id);
|
|
37
|
+
if (color === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const mutateResult = await meshPolygonsCommonStyle.mutateMeshPolygonsColoring(id, {
|
|
41
|
+
constant: { ...color, alpha: opacity },
|
|
42
|
+
});
|
|
43
|
+
return mutateResult;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
meshPolygonsOpacity,
|
|
52
|
+
setMeshPolygonsOpacity,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -4,12 +4,13 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed
|
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
6
|
import { useMeshPolyhedraCommonStyle } from "./common";
|
|
7
|
+
import { useMeshPolyhedraOpacityStyle } from "./opacity";
|
|
7
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
9
|
|
|
9
10
|
// Local constants
|
|
10
11
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.polyhedra.color;
|
|
11
12
|
|
|
12
|
-
export function useMeshPolyhedraColorStyle(): {
|
|
13
|
+
export function useMeshPolyhedraColorStyle(): ReturnType<typeof useMeshPolyhedraOpacityStyle> & {
|
|
13
14
|
meshPolyhedraColor: (id: string) => RGBAColor | undefined;
|
|
14
15
|
setMeshPolyhedraColor: (id: string, color: RGBAColor) => Promise<unknown>;
|
|
15
16
|
} {
|
|
@@ -42,5 +43,6 @@ export function useMeshPolyhedraColorStyle(): {
|
|
|
42
43
|
return {
|
|
43
44
|
meshPolyhedraColor,
|
|
44
45
|
setMeshPolyhedraColor,
|
|
46
|
+
...useMeshPolyhedraOpacityStyle(),
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -63,7 +63,7 @@ function handleMeshPolyhedraPolyhedronColoring(
|
|
|
63
63
|
return polyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttribute(id, polyhedron_attribute);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
async function
|
|
66
|
+
async function applyMeshPolyhedraActiveColoring(
|
|
67
67
|
id: string,
|
|
68
68
|
type: string | undefined,
|
|
69
69
|
deps: MeshPolyhedraActiveColoringDeps,
|
|
@@ -89,6 +89,22 @@ async function setMeshPolyhedraActiveColoring(
|
|
|
89
89
|
throw new Error(`Unknown mesh polyhedra coloring type: ${type}`);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
async function setMeshPolyhedraActiveColoring(
|
|
93
|
+
id: string,
|
|
94
|
+
type: string | undefined,
|
|
95
|
+
deps: MeshPolyhedraActiveColoringDeps,
|
|
96
|
+
): Promise<unknown> {
|
|
97
|
+
const result = await applyMeshPolyhedraActiveColoring(id, type, deps);
|
|
98
|
+
if (type !== "constant") {
|
|
99
|
+
// Attribute and textures colorings keep the actor opacity: restore the stored one
|
|
100
|
+
await whenDefined(deps.colorStyle.meshPolyhedraOpacity(id), async (value) => {
|
|
101
|
+
const applied = await deps.colorStyle.setMeshPolyhedraOpacity(id, value);
|
|
102
|
+
return applied;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
|
|
92
108
|
async function applyMeshPolyhedraStyle(
|
|
93
109
|
id: string,
|
|
94
110
|
visibilityStyle: ReturnType<typeof useMeshPolyhedraVisibilityStyle>,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
// Third party imports
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
|
+
|
|
5
|
+
// Local imports
|
|
6
|
+
import { useMeshPolyhedraCommonStyle } from "./common";
|
|
7
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
|
+
|
|
9
|
+
// Local constants
|
|
10
|
+
const schema = viewer_schemas.opengeodeweb_viewer.mesh.polyhedra.opacity;
|
|
11
|
+
|
|
12
|
+
// The opacity is the constant color alpha, the viewer applies it whatever the coloring
|
|
13
|
+
export function useMeshPolyhedraOpacityStyle(): {
|
|
14
|
+
meshPolyhedraOpacity: (id: string) => number | undefined;
|
|
15
|
+
setMeshPolyhedraOpacity: (id: string, opacity: number) => Promise<unknown>;
|
|
16
|
+
} {
|
|
17
|
+
const viewerStore = useViewerStore();
|
|
18
|
+
const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle();
|
|
19
|
+
|
|
20
|
+
function meshPolyhedraConstantColor(id: string): RGBAColor | undefined {
|
|
21
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
22
|
+
return meshPolyhedraCommonStyle.meshPolyhedraColoring(id).constant as RGBAColor | undefined;
|
|
23
|
+
}
|
|
24
|
+
function meshPolyhedraOpacity(id: string): number | undefined {
|
|
25
|
+
return meshPolyhedraConstantColor(id)?.alpha;
|
|
26
|
+
}
|
|
27
|
+
async function setMeshPolyhedraOpacity(id: string, opacity: number): Promise<unknown> {
|
|
28
|
+
const params = { id, opacity };
|
|
29
|
+
const result = await viewerStore.request(
|
|
30
|
+
{
|
|
31
|
+
schema,
|
|
32
|
+
params,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
response_function: async () => {
|
|
36
|
+
const color = meshPolyhedraConstantColor(id);
|
|
37
|
+
if (color === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const mutateResult = await meshPolyhedraCommonStyle.mutateMeshPolyhedraColoring(id, {
|
|
41
|
+
constant: { ...color, alpha: opacity },
|
|
42
|
+
});
|
|
43
|
+
return mutateResult;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
meshPolyhedraOpacity,
|
|
52
|
+
setMeshPolyhedraOpacity,
|
|
53
|
+
};
|
|
54
|
+
}
|
package/package.json
CHANGED