@geode/opengeodeweb-front 10.41.0 → 10.41.1-rc.1
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/Generic/Mesh/EdgesOptions.vue +8 -1
- package/app/components/Viewer/Generic/Model/ComponentEdgesOptions.vue +223 -0
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +2 -27
- package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +159 -0
- package/app/components/Viewer/Grid/2D/EdgesOptions.vue +5 -1
- package/app/components/Viewer/Grid/3D/EdgesOptions.vue +5 -1
- package/app/components/Viewer/Solid/EdgesOptions.vue +5 -1
- package/app/components/Viewer/Surface/EdgesOptions.vue +5 -1
- package/internal/stores/data_style/model/blocks/edges.ts +51 -0
- package/internal/stores/data_style/model/blocks/index.ts +4 -0
- package/internal/stores/data_style/model/component_style.ts +27 -0
- package/internal/stores/data_style/model/edges/component.ts +406 -0
- package/internal/stores/data_style/model/edges/index.ts +5 -1
- package/internal/stores/data_style/model/edges/visibility.ts +24 -3
- package/internal/stores/data_style/model/edges/width.ts +56 -0
- package/internal/stores/data_style/model/index.ts +3 -1
- package/internal/stores/data_style/model/points/component.ts +5 -23
- package/internal/stores/data_style/model/surfaces/edges.ts +51 -0
- package/internal/stores/data_style/model/surfaces/index.ts +4 -0
- package/package.json +4 -4
|
@@ -18,13 +18,19 @@ const dataStyleStore = useDataStyleStore();
|
|
|
18
18
|
const hybridViewerStore = useHybridViewerStore();
|
|
19
19
|
const { applyBatchStyle } = useBatchStyle();
|
|
20
20
|
|
|
21
|
+
interface CapabilityConfig {
|
|
22
|
+
available?: boolean;
|
|
23
|
+
hasColorMap?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
interface Props {
|
|
22
27
|
itemProps: ItemProps & { index?: number };
|
|
23
28
|
btnImage: string;
|
|
24
29
|
tooltip?: string;
|
|
30
|
+
capabilities?: Record<string, CapabilityConfig>;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
|
-
const { itemProps, btnImage, tooltip = "Edges options" } = defineProps<Props>();
|
|
33
|
+
const { itemProps, btnImage, tooltip = "Edges options", capabilities = {} } = defineProps<Props>();
|
|
28
34
|
|
|
29
35
|
const id = toRef(() => itemProps.id);
|
|
30
36
|
|
|
@@ -251,6 +257,7 @@ async function setEdgeAttributeRangesPerData(ranges: RangesPerData): Promise<voi
|
|
|
251
257
|
v-model:edge_attribute_color_map="edge_attribute_color_map"
|
|
252
258
|
v-model:edge_attribute_no_data_color="edge_attribute_no_data_color"
|
|
253
259
|
v-model:edge_attribute_time_step="edge_attribute_time_step"
|
|
260
|
+
:capabilities="capabilities"
|
|
254
261
|
/>
|
|
255
262
|
</template>
|
|
256
263
|
</template>
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
3
|
+
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
|
|
4
|
+
import ViewerOptionsWidthSlider from "@ogw_front/components/Viewer/Options/Sliders/Width.vue";
|
|
5
|
+
import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
|
|
6
|
+
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
7
|
+
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
8
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
9
|
+
|
|
10
|
+
interface EdgesTarget {
|
|
11
|
+
componentType: "Surface" | "Block";
|
|
12
|
+
componentIds: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
modelId: string;
|
|
17
|
+
targets: EdgesTarget[];
|
|
18
|
+
referenceComponentId?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { modelId, targets, referenceComponentId = undefined } = defineProps<Props>();
|
|
22
|
+
|
|
23
|
+
const dataStyleStore = useDataStyleStore();
|
|
24
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
25
|
+
|
|
26
|
+
// Each component type exposes its own edges functions in the data style store
|
|
27
|
+
const EDGES_STYLES = {
|
|
28
|
+
Surface: {
|
|
29
|
+
visibility: dataStyleStore.modelSurfaceEdgesVisibility,
|
|
30
|
+
width: dataStyleStore.modelSurfaceEdgesWidth,
|
|
31
|
+
color: dataStyleStore.modelSurfaceEdgesColor,
|
|
32
|
+
activeColoring: dataStyleStore.modelSurfaceEdgesActiveColoring,
|
|
33
|
+
vertexAttributeName: dataStyleStore.modelSurfaceEdgesVertexAttributeName,
|
|
34
|
+
vertexAttributeItem: dataStyleStore.modelSurfaceEdgesVertexAttributeItem,
|
|
35
|
+
vertexAttributeRange: dataStyleStore.modelSurfaceEdgesVertexAttributeRange,
|
|
36
|
+
vertexAttributeColorMap: dataStyleStore.modelSurfaceEdgesVertexAttributeColorMap,
|
|
37
|
+
vertexAttributeNoDataColor: dataStyleStore.modelSurfaceEdgesVertexAttributeNoDataColor,
|
|
38
|
+
setVisibility: dataStyleStore.setModelSurfacesEdgesVisibility,
|
|
39
|
+
setWidth: dataStyleStore.setModelSurfacesEdgesWidth,
|
|
40
|
+
setColor: dataStyleStore.setModelSurfacesEdgesColor,
|
|
41
|
+
setActiveColoring: dataStyleStore.setModelSurfacesEdgesActiveColoring,
|
|
42
|
+
setVertexAttributeName: dataStyleStore.setModelSurfacesEdgesVertexAttributeName,
|
|
43
|
+
setVertexAttributeItem: dataStyleStore.setModelSurfacesEdgesVertexAttributeItem,
|
|
44
|
+
setVertexAttributeRange: dataStyleStore.setModelSurfacesEdgesVertexAttributeRange,
|
|
45
|
+
setVertexAttributeColorMap: dataStyleStore.setModelSurfacesEdgesVertexAttributeColorMap,
|
|
46
|
+
setVertexAttributeNoDataColor: dataStyleStore.setModelSurfacesEdgesVertexAttributeNoDataColor,
|
|
47
|
+
},
|
|
48
|
+
Block: {
|
|
49
|
+
visibility: dataStyleStore.modelBlockEdgesVisibility,
|
|
50
|
+
width: dataStyleStore.modelBlockEdgesWidth,
|
|
51
|
+
color: dataStyleStore.modelBlockEdgesColor,
|
|
52
|
+
activeColoring: dataStyleStore.modelBlockEdgesActiveColoring,
|
|
53
|
+
vertexAttributeName: dataStyleStore.modelBlockEdgesVertexAttributeName,
|
|
54
|
+
vertexAttributeItem: dataStyleStore.modelBlockEdgesVertexAttributeItem,
|
|
55
|
+
vertexAttributeRange: dataStyleStore.modelBlockEdgesVertexAttributeRange,
|
|
56
|
+
vertexAttributeColorMap: dataStyleStore.modelBlockEdgesVertexAttributeColorMap,
|
|
57
|
+
vertexAttributeNoDataColor: dataStyleStore.modelBlockEdgesVertexAttributeNoDataColor,
|
|
58
|
+
setVisibility: dataStyleStore.setModelBlocksEdgesVisibility,
|
|
59
|
+
setWidth: dataStyleStore.setModelBlocksEdgesWidth,
|
|
60
|
+
setColor: dataStyleStore.setModelBlocksEdgesColor,
|
|
61
|
+
setActiveColoring: dataStyleStore.setModelBlocksEdgesActiveColoring,
|
|
62
|
+
setVertexAttributeName: dataStyleStore.setModelBlocksEdgesVertexAttributeName,
|
|
63
|
+
setVertexAttributeItem: dataStyleStore.setModelBlocksEdgesVertexAttributeItem,
|
|
64
|
+
setVertexAttributeRange: dataStyleStore.setModelBlocksEdgesVertexAttributeRange,
|
|
65
|
+
setVertexAttributeColorMap: dataStyleStore.setModelBlocksEdgesVertexAttributeColorMap,
|
|
66
|
+
setVertexAttributeNoDataColor: dataStyleStore.setModelBlocksEdgesVertexAttributeNoDataColor,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
type EdgesStyle = (typeof EDGES_STYLES)[EdgesTarget["componentType"]];
|
|
70
|
+
|
|
71
|
+
// Values are read from the first target, changes are applied to every target
|
|
72
|
+
const edgesStyle = computed<EdgesStyle | undefined>(() => {
|
|
73
|
+
const [reference] = targets;
|
|
74
|
+
return reference === undefined ? undefined : EDGES_STYLES[reference.componentType];
|
|
75
|
+
});
|
|
76
|
+
const allComponentIds = computed<string[]>(() => targets.flatMap((target) => target.componentIds));
|
|
77
|
+
|
|
78
|
+
async function applyEdgesStyle(
|
|
79
|
+
setter: (style: EdgesStyle, componentIds: string[]) => Promise<unknown>,
|
|
80
|
+
): Promise<void> {
|
|
81
|
+
await Promise.all(
|
|
82
|
+
targets.map(async (target) => {
|
|
83
|
+
await setter(EDGES_STYLES[target.componentType], target.componentIds);
|
|
84
|
+
}),
|
|
85
|
+
);
|
|
86
|
+
hybridViewerStore.remoteRender();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const visibility = computed<boolean | undefined>({
|
|
90
|
+
get: () => edgesStyle.value?.visibility(modelId, referenceComponentId),
|
|
91
|
+
set: async (newValue) => {
|
|
92
|
+
if (newValue === undefined) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
await applyEdgesStyle((style, ids) => style.setVisibility(modelId, ids, newValue));
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const width = computed<number | undefined>({
|
|
100
|
+
get: () => edgesStyle.value?.width(modelId, referenceComponentId),
|
|
101
|
+
set: async (newValue) => {
|
|
102
|
+
if (newValue === undefined) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
await applyEdgesStyle((style, ids) => style.setWidth(modelId, ids, newValue));
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const activeColoring = computed<string | undefined>({
|
|
110
|
+
get: () => edgesStyle.value?.activeColoring(modelId, referenceComponentId),
|
|
111
|
+
set: async (newValue) => {
|
|
112
|
+
if (newValue === undefined) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
await applyEdgesStyle((style, ids) => style.setActiveColoring(modelId, ids, newValue));
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const color = computed<RGBAColor | undefined>({
|
|
120
|
+
get: () => edgesStyle.value?.color(modelId, referenceComponentId),
|
|
121
|
+
set: async (newValue) => {
|
|
122
|
+
if (newValue === undefined) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
await applyEdgesStyle((style, ids) => style.setColor(modelId, ids, newValue));
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const vertexAttributeName = computed<string | undefined>({
|
|
130
|
+
get: () => edgesStyle.value?.vertexAttributeName(modelId, referenceComponentId),
|
|
131
|
+
set: async (newValue) => {
|
|
132
|
+
if (newValue === undefined) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
await applyEdgesStyle((style, ids) => style.setVertexAttributeName(modelId, ids, newValue));
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const vertexAttributeItem = computed<number | undefined>({
|
|
140
|
+
get: () => edgesStyle.value?.vertexAttributeItem(modelId, referenceComponentId),
|
|
141
|
+
set: async (newValue) => {
|
|
142
|
+
if (newValue === undefined) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
await applyEdgesStyle((style, ids) => style.setVertexAttributeItem(modelId, ids, newValue));
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const vertexAttributeRange = computed<(number | undefined)[] | undefined>({
|
|
150
|
+
get: () => edgesStyle.value?.vertexAttributeRange(modelId, referenceComponentId),
|
|
151
|
+
set: async (newValue) => {
|
|
152
|
+
if (newValue === undefined) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const [minimum, maximum] = newValue;
|
|
156
|
+
if (minimum === undefined || maximum === undefined) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
await applyEdgesStyle((style, ids) =>
|
|
160
|
+
style.setVertexAttributeRange(modelId, ids, minimum, maximum),
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const vertexAttributeColorMap = computed<string | undefined>({
|
|
166
|
+
get: () => edgesStyle.value?.vertexAttributeColorMap(modelId, referenceComponentId),
|
|
167
|
+
set: async (newValue) => {
|
|
168
|
+
await applyEdgesStyle((style, ids) => style.setVertexAttributeColorMap(modelId, ids, newValue));
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const vertexAttributeNoDataColor = computed<RGBAColor | undefined>({
|
|
173
|
+
get: () => edgesStyle.value?.vertexAttributeNoDataColor(modelId, referenceComponentId),
|
|
174
|
+
set: async (newValue) => {
|
|
175
|
+
if (newValue === undefined) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
await applyEdgesStyle((style, ids) =>
|
|
179
|
+
style.setVertexAttributeNoDataColor(modelId, ids, newValue),
|
|
180
|
+
);
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const capabilities = {
|
|
185
|
+
color: { available: true },
|
|
186
|
+
textures: { available: false },
|
|
187
|
+
vertex: { available: true },
|
|
188
|
+
edge: { available: false },
|
|
189
|
+
cell: { available: false },
|
|
190
|
+
polygon: { available: false },
|
|
191
|
+
polyhedron: { available: false },
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const backSchemas = back_schemas.opengeodeweb_back;
|
|
195
|
+
const attributeSchemas = {
|
|
196
|
+
vertex: {
|
|
197
|
+
names: backSchemas.model_component_vertex_attribute_names,
|
|
198
|
+
range: backSchemas.model_component_vertex_attribute_range,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
</script>
|
|
202
|
+
|
|
203
|
+
<template>
|
|
204
|
+
<div class="mt-2" data-testid="modelComponentEdgesOptions">
|
|
205
|
+
<VisibilitySwitch data-testid="modelComponentEdgesVisibilitySwitch" v-model="visibility" />
|
|
206
|
+
<template v-if="visibility">
|
|
207
|
+
<ViewerOptionsWidthSlider data-testid="modelComponentEdgesWidthSlider" v-model="width" />
|
|
208
|
+
<ViewerOptionsColoringTypeSelector
|
|
209
|
+
:id="modelId"
|
|
210
|
+
:componentIds="allComponentIds"
|
|
211
|
+
v-model:coloring_style_key="activeColoring"
|
|
212
|
+
v-model:color="color"
|
|
213
|
+
v-model:vertex_attribute_name="vertexAttributeName"
|
|
214
|
+
v-model:vertex_attribute_item="vertexAttributeItem"
|
|
215
|
+
v-model:vertex_attribute_range="vertexAttributeRange"
|
|
216
|
+
v-model:vertex_attribute_color_map="vertexAttributeColorMap"
|
|
217
|
+
v-model:vertex_attribute_no_data_color="vertexAttributeNoDataColor"
|
|
218
|
+
:capabilities="capabilities"
|
|
219
|
+
:schemas="attributeSchemas"
|
|
220
|
+
/>
|
|
221
|
+
</template>
|
|
222
|
+
</div>
|
|
223
|
+
</template>
|
|
@@ -2,36 +2,14 @@
|
|
|
2
2
|
import ViewerContextMenuItem, {
|
|
3
3
|
type ItemProps,
|
|
4
4
|
} from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
|
|
5
|
+
import ModelEdgesCard from "./ModelEdgesCard.vue";
|
|
5
6
|
import SurfaceEdges from "@ogw_front/assets/viewer_svgs/surface_edges.svg";
|
|
6
|
-
import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
|
|
7
|
-
import { useBatchStyle } from "@ogw_front/composables/batch_style";
|
|
8
|
-
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
9
|
-
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
10
|
-
|
|
11
|
-
const dataStyleStore = useDataStyleStore();
|
|
12
|
-
const hybridViewerStore = useHybridViewerStore();
|
|
13
|
-
const { applyBatchStyle } = useBatchStyle();
|
|
14
7
|
|
|
15
8
|
interface Props {
|
|
16
9
|
itemProps: ItemProps & { index: number };
|
|
17
10
|
}
|
|
18
11
|
|
|
19
12
|
const { itemProps } = defineProps<Props>();
|
|
20
|
-
|
|
21
|
-
const id = computed(() => (itemProps.meta_data.modelId as string | undefined) || itemProps.id);
|
|
22
|
-
|
|
23
|
-
const visibility = computed({
|
|
24
|
-
get: () => dataStyleStore.modelEdgesVisibility(id.value),
|
|
25
|
-
set: async (newValue) => {
|
|
26
|
-
if (newValue === undefined) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
await applyBatchStyle(id.value, (targetId: string) =>
|
|
30
|
-
dataStyleStore.setModelEdgesVisibility(targetId, newValue),
|
|
31
|
-
);
|
|
32
|
-
hybridViewerStore.remoteRender();
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
13
|
</script>
|
|
36
14
|
|
|
37
15
|
<template>
|
|
@@ -43,10 +21,7 @@ const visibility = computed({
|
|
|
43
21
|
:btnImage="SurfaceEdges"
|
|
44
22
|
>
|
|
45
23
|
<template #options>
|
|
46
|
-
<
|
|
47
|
-
data-testid="modelEdgesVisibilitySwitch"
|
|
48
|
-
v-model="visibility"
|
|
49
|
-
/>
|
|
24
|
+
<ModelEdgesCard :itemProps="itemProps" />
|
|
50
25
|
</template>
|
|
51
26
|
</ViewerContextMenuItem>
|
|
52
27
|
</template>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
type ModelMenuItemProps,
|
|
4
|
+
useModelMenuContext,
|
|
5
|
+
} from "@ogw_front/composables/model_menu_context";
|
|
6
|
+
import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
|
|
7
|
+
import ViewerGenericModelComponentEdgesOptions from "@ogw_front/components/Viewer/Generic/Model/ComponentEdgesOptions.vue";
|
|
8
|
+
import ViewerOptionsWidthSlider from "@ogw_front/components/Viewer/Options/Sliders/Width.vue";
|
|
9
|
+
import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
|
|
10
|
+
import { useBatchStyle } from "@ogw_front/composables/batch_style";
|
|
11
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
12
|
+
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
13
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
14
|
+
|
|
15
|
+
// Lines are edges themselves and corners have none: no edges options for them
|
|
16
|
+
const EDGES_TYPE_TITLES = {
|
|
17
|
+
Surface: "Surfaces Edges Options",
|
|
18
|
+
Block: "Blocks Edges Options",
|
|
19
|
+
} as const;
|
|
20
|
+
type EdgesComponentType = keyof typeof EDGES_TYPE_TITLES;
|
|
21
|
+
const EDGES_COMPONENT_TYPES: EdgesComponentType[] = ["Surface", "Block"];
|
|
22
|
+
|
|
23
|
+
function isEdgesComponentType(type: string | undefined): type is EdgesComponentType {
|
|
24
|
+
return type !== undefined && type in EDGES_TYPE_TITLES;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
itemProps: ModelMenuItemProps;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { itemProps } = defineProps<Props>();
|
|
32
|
+
|
|
33
|
+
const dataStore = useDataStore();
|
|
34
|
+
const dataStyleStore = useDataStyleStore();
|
|
35
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
36
|
+
const { applyBatchStyle } = useBatchStyle();
|
|
37
|
+
|
|
38
|
+
const { modelId, componentId, componentType, collections, targetComponentIds } =
|
|
39
|
+
useModelMenuContext(() => itemProps);
|
|
40
|
+
|
|
41
|
+
const modelEdgesVisibility = computed<boolean | undefined>({
|
|
42
|
+
get: () => dataStyleStore.modelEdgesVisibility(modelId.value),
|
|
43
|
+
set: async (newValue) => {
|
|
44
|
+
if (newValue === undefined) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
await applyBatchStyle(modelId.value, (targetId: string) =>
|
|
48
|
+
dataStyleStore.setModelEdgesVisibility(targetId, newValue),
|
|
49
|
+
);
|
|
50
|
+
hybridViewerStore.remoteRender();
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const modelEdgesWidth = computed<number | undefined>({
|
|
55
|
+
get: () => dataStyleStore.modelEdgesWidth(modelId.value),
|
|
56
|
+
set: async (newValue) => {
|
|
57
|
+
if (newValue === undefined) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
await applyBatchStyle(modelId.value, (targetId: string) =>
|
|
61
|
+
dataStyleStore.setModelEdgesWidth(targetId, newValue),
|
|
62
|
+
);
|
|
63
|
+
hybridViewerStore.remoteRender();
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const edgesComponentType = computed<EdgesComponentType | undefined>(() =>
|
|
68
|
+
isEdgesComponentType(componentType.value) ? componentType.value : undefined,
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const allComponentsTargets = ref<{ componentType: EdgesComponentType; componentIds: string[] }[]>(
|
|
72
|
+
[],
|
|
73
|
+
);
|
|
74
|
+
watch(
|
|
75
|
+
modelId,
|
|
76
|
+
async (currentModelId) => {
|
|
77
|
+
const targets = await Promise.all(
|
|
78
|
+
EDGES_COMPONENT_TYPES.map(async (type) => ({
|
|
79
|
+
componentType: type,
|
|
80
|
+
componentIds: await dataStore.getMeshComponentGeodeIds(currentModelId, type),
|
|
81
|
+
})),
|
|
82
|
+
);
|
|
83
|
+
if (modelId.value === currentModelId) {
|
|
84
|
+
allComponentsTargets.value = targets.filter((target) => target.componentIds.length > 0);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{ immediate: true },
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const typeTargets = computed(() =>
|
|
91
|
+
edgesComponentType.value === undefined
|
|
92
|
+
? []
|
|
93
|
+
: [{ componentType: edgesComponentType.value, componentIds: targetComponentIds.value }],
|
|
94
|
+
);
|
|
95
|
+
const typeReferenceId = computed<string | undefined>(() =>
|
|
96
|
+
collections.value ? targetComponentIds.value[0] : undefined,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const componentTargets = computed(() =>
|
|
100
|
+
edgesComponentType.value === undefined || componentId.value === undefined
|
|
101
|
+
? []
|
|
102
|
+
: [{ componentType: edgesComponentType.value, componentIds: [componentId.value] }],
|
|
103
|
+
);
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<template>
|
|
107
|
+
<v-sheet class="model-edges-card" color="transparent">
|
|
108
|
+
<OptionsSection title="Model Edges Options">
|
|
109
|
+
<VisibilitySwitch data-testid="modelEdgesVisibilitySwitch" v-model="modelEdgesVisibility" />
|
|
110
|
+
<ViewerOptionsWidthSlider
|
|
111
|
+
v-if="modelEdgesVisibility"
|
|
112
|
+
data-testid="modelEdgesWidthSlider"
|
|
113
|
+
v-model="modelEdgesWidth"
|
|
114
|
+
/>
|
|
115
|
+
</OptionsSection>
|
|
116
|
+
|
|
117
|
+
<OptionsSection
|
|
118
|
+
v-if="!componentType && !componentId && allComponentsTargets.length > 0"
|
|
119
|
+
title="Components Edges Options"
|
|
120
|
+
data-testid="modelEdgesComponentsOptions"
|
|
121
|
+
class="mt-4"
|
|
122
|
+
>
|
|
123
|
+
<ViewerGenericModelComponentEdgesOptions :modelId="modelId" :targets="allComponentsTargets" />
|
|
124
|
+
</OptionsSection>
|
|
125
|
+
|
|
126
|
+
<OptionsSection
|
|
127
|
+
v-if="edgesComponentType"
|
|
128
|
+
:title="EDGES_TYPE_TITLES[edgesComponentType]"
|
|
129
|
+
data-testid="modelEdgesComponentTypeOptions"
|
|
130
|
+
class="mt-4"
|
|
131
|
+
>
|
|
132
|
+
<ViewerGenericModelComponentEdgesOptions
|
|
133
|
+
:modelId="modelId"
|
|
134
|
+
:targets="typeTargets"
|
|
135
|
+
:referenceComponentId="typeReferenceId"
|
|
136
|
+
/>
|
|
137
|
+
</OptionsSection>
|
|
138
|
+
|
|
139
|
+
<OptionsSection
|
|
140
|
+
v-if="edgesComponentType && componentId"
|
|
141
|
+
title="Component Edges Options"
|
|
142
|
+
data-testid="modelEdgesComponentOptions"
|
|
143
|
+
class="mt-4"
|
|
144
|
+
>
|
|
145
|
+
<ViewerGenericModelComponentEdgesOptions
|
|
146
|
+
:modelId="modelId"
|
|
147
|
+
:targets="componentTargets"
|
|
148
|
+
:referenceComponentId="componentId"
|
|
149
|
+
/>
|
|
150
|
+
</OptionsSection>
|
|
151
|
+
</v-sheet>
|
|
152
|
+
</template>
|
|
153
|
+
|
|
154
|
+
<style scoped>
|
|
155
|
+
.model-edges-card {
|
|
156
|
+
padding-top: 12px;
|
|
157
|
+
overflow-x: hidden;
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -11,5 +11,9 @@ const { itemProps } = defineProps<Props>();
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<template>
|
|
14
|
-
<ViewerGenericMeshEdgesOptions
|
|
14
|
+
<ViewerGenericMeshEdgesOptions
|
|
15
|
+
:itemProps="itemProps"
|
|
16
|
+
:btnImage="Grid2D_Edges"
|
|
17
|
+
:capabilities="{ edge: { available: false } }"
|
|
18
|
+
/>
|
|
15
19
|
</template>
|
|
@@ -11,5 +11,9 @@ const { itemProps } = defineProps<Props>();
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<template>
|
|
14
|
-
<ViewerGenericMeshEdgesOptions
|
|
14
|
+
<ViewerGenericMeshEdgesOptions
|
|
15
|
+
:itemProps="itemProps"
|
|
16
|
+
:btnImage="Grid3D_Edges"
|
|
17
|
+
:capabilities="{ edge: { available: false } }"
|
|
18
|
+
/>
|
|
15
19
|
</template>
|
|
@@ -11,5 +11,9 @@ const { itemProps } = defineProps<Props>();
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<template>
|
|
14
|
-
<ViewerGenericMeshEdgesOptions
|
|
14
|
+
<ViewerGenericMeshEdgesOptions
|
|
15
|
+
:itemProps="itemProps"
|
|
16
|
+
:btnImage="SolidEdges"
|
|
17
|
+
:capabilities="{ edge: { available: false } }"
|
|
18
|
+
/>
|
|
15
19
|
</template>
|
|
@@ -11,5 +11,9 @@ const { itemProps } = defineProps<Props>();
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<template>
|
|
14
|
-
<ViewerGenericMeshEdgesOptions
|
|
14
|
+
<ViewerGenericMeshEdgesOptions
|
|
15
|
+
:itemProps="itemProps"
|
|
16
|
+
:btnImage="SurfaceEdges"
|
|
17
|
+
:capabilities="{ edge: { available: false } }"
|
|
18
|
+
/>
|
|
15
19
|
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ModelComponentEdgesStyle,
|
|
3
|
+
useModelComponentEdgesStyle,
|
|
4
|
+
} from "@ogw_internal/stores/data_style/model/edges/component";
|
|
5
|
+
|
|
6
|
+
interface UseModelBlocksEdgesStyleReturn {
|
|
7
|
+
modelBlockEdgesVisibility: ModelComponentEdgesStyle["visibility"];
|
|
8
|
+
modelBlockEdgesWidth: ModelComponentEdgesStyle["width"];
|
|
9
|
+
modelBlockEdgesColor: ModelComponentEdgesStyle["color"];
|
|
10
|
+
modelBlockEdgesActiveColoring: ModelComponentEdgesStyle["activeColoring"];
|
|
11
|
+
modelBlockEdgesVertexAttributeName: ModelComponentEdgesStyle["vertexAttributeName"];
|
|
12
|
+
modelBlockEdgesVertexAttributeItem: ModelComponentEdgesStyle["vertexAttributeItem"];
|
|
13
|
+
modelBlockEdgesVertexAttributeRange: ModelComponentEdgesStyle["vertexAttributeRange"];
|
|
14
|
+
modelBlockEdgesVertexAttributeColorMap: ModelComponentEdgesStyle["vertexAttributeColorMap"];
|
|
15
|
+
modelBlockEdgesVertexAttributeNoDataColor: ModelComponentEdgesStyle["vertexAttributeNoDataColor"];
|
|
16
|
+
setModelBlocksEdgesVisibility: ModelComponentEdgesStyle["setVisibility"];
|
|
17
|
+
setModelBlocksEdgesWidth: ModelComponentEdgesStyle["setWidth"];
|
|
18
|
+
setModelBlocksEdgesColor: ModelComponentEdgesStyle["setColor"];
|
|
19
|
+
setModelBlocksEdgesActiveColoring: ModelComponentEdgesStyle["setActiveColoring"];
|
|
20
|
+
setModelBlocksEdgesVertexAttributeName: ModelComponentEdgesStyle["setVertexAttributeName"];
|
|
21
|
+
setModelBlocksEdgesVertexAttributeItem: ModelComponentEdgesStyle["setVertexAttributeItem"];
|
|
22
|
+
setModelBlocksEdgesVertexAttributeRange: ModelComponentEdgesStyle["setVertexAttributeRange"];
|
|
23
|
+
setModelBlocksEdgesVertexAttributeColorMap: ModelComponentEdgesStyle["setVertexAttributeColorMap"];
|
|
24
|
+
setModelBlocksEdgesVertexAttributeNoDataColor: ModelComponentEdgesStyle["setVertexAttributeNoDataColor"];
|
|
25
|
+
applyModelBlocksEdgesStyle: ModelComponentEdgesStyle["applyEdgesStyle"];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useModelBlocksEdgesStyle(): UseModelBlocksEdgesStyleReturn {
|
|
29
|
+
const edges = useModelComponentEdgesStyle("Block");
|
|
30
|
+
return {
|
|
31
|
+
modelBlockEdgesVisibility: edges.visibility,
|
|
32
|
+
modelBlockEdgesWidth: edges.width,
|
|
33
|
+
modelBlockEdgesColor: edges.color,
|
|
34
|
+
modelBlockEdgesActiveColoring: edges.activeColoring,
|
|
35
|
+
modelBlockEdgesVertexAttributeName: edges.vertexAttributeName,
|
|
36
|
+
modelBlockEdgesVertexAttributeItem: edges.vertexAttributeItem,
|
|
37
|
+
modelBlockEdgesVertexAttributeRange: edges.vertexAttributeRange,
|
|
38
|
+
modelBlockEdgesVertexAttributeColorMap: edges.vertexAttributeColorMap,
|
|
39
|
+
modelBlockEdgesVertexAttributeNoDataColor: edges.vertexAttributeNoDataColor,
|
|
40
|
+
setModelBlocksEdgesVisibility: edges.setVisibility,
|
|
41
|
+
setModelBlocksEdgesWidth: edges.setWidth,
|
|
42
|
+
setModelBlocksEdgesColor: edges.setColor,
|
|
43
|
+
setModelBlocksEdgesActiveColoring: edges.setActiveColoring,
|
|
44
|
+
setModelBlocksEdgesVertexAttributeName: edges.setVertexAttributeName,
|
|
45
|
+
setModelBlocksEdgesVertexAttributeItem: edges.setVertexAttributeItem,
|
|
46
|
+
setModelBlocksEdgesVertexAttributeRange: edges.setVertexAttributeRange,
|
|
47
|
+
setModelBlocksEdgesVertexAttributeColorMap: edges.setVertexAttributeColorMap,
|
|
48
|
+
setModelBlocksEdgesVertexAttributeNoDataColor: edges.setVertexAttributeNoDataColor,
|
|
49
|
+
applyModelBlocksEdgesStyle: edges.applyEdgesStyle,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -7,6 +7,7 @@ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
|
7
7
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
8
8
|
import { useModelBlocksColor } from "./color";
|
|
9
9
|
import { useModelBlocksCommonStyle } from "./common";
|
|
10
|
+
import { useModelBlocksEdgesStyle } from "./edges";
|
|
10
11
|
import { useModelBlocksPointsStyle } from "./points";
|
|
11
12
|
import { useModelBlocksVisibility } from "./visibility";
|
|
12
13
|
|
|
@@ -36,6 +37,7 @@ type UseModelBlocksStyleReturn = {
|
|
|
36
37
|
ReturnType<typeof useModelBlocksVisibility> &
|
|
37
38
|
ReturnType<typeof useModelBlocksColor> &
|
|
38
39
|
ReturnType<typeof useModelBlocksPointsStyle> &
|
|
40
|
+
ReturnType<typeof useModelBlocksEdgesStyle> &
|
|
39
41
|
ReturnType<typeof useModelBlocksVertexAttribute> &
|
|
40
42
|
ReturnType<typeof useModelBlocksPolyhedronAttribute>;
|
|
41
43
|
|
|
@@ -48,6 +50,7 @@ export function useModelBlocksStyle(): UseModelBlocksStyleReturn {
|
|
|
48
50
|
const modelBlocksVertexAttribute = useModelBlocksVertexAttribute();
|
|
49
51
|
const modelBlocksPolyhedronAttribute = useModelBlocksPolyhedronAttribute();
|
|
50
52
|
const modelBlocksPointsStyle = useModelBlocksPointsStyle();
|
|
53
|
+
const modelBlocksEdgesStyle = useModelBlocksEdgesStyle();
|
|
51
54
|
|
|
52
55
|
async function applyModelBlocksVisibilityStyle(
|
|
53
56
|
modelId: string,
|
|
@@ -249,5 +252,6 @@ export function useModelBlocksStyle(): UseModelBlocksStyleReturn {
|
|
|
249
252
|
...modelBlocksVertexAttribute,
|
|
250
253
|
...modelBlocksPolyhedronAttribute,
|
|
251
254
|
...modelBlocksPointsStyle,
|
|
255
|
+
...modelBlocksEdgesStyle,
|
|
252
256
|
};
|
|
253
257
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
|
|
3
|
+
function groupBy(componentIds: string[], key: (componentId: string) => string): string[][] {
|
|
4
|
+
const groups: Record<string, string[]> = {};
|
|
5
|
+
for (const componentId of componentIds) {
|
|
6
|
+
const groupKey = key(componentId);
|
|
7
|
+
groups[groupKey] ??= [];
|
|
8
|
+
groups[groupKey].push(componentId);
|
|
9
|
+
}
|
|
10
|
+
return Object.values(groups);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface AttributeStoredConfig {
|
|
14
|
+
minimum: number | undefined;
|
|
15
|
+
maximum: number | undefined;
|
|
16
|
+
colorMap: string | undefined;
|
|
17
|
+
no_data_color: RGBAColor;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface AttributeState {
|
|
21
|
+
name?: string;
|
|
22
|
+
item?: number;
|
|
23
|
+
storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { groupBy };
|
|
27
|
+
export type { AttributeState, AttributeStoredConfig };
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
// oxlint-disable eslint/max-lines
|
|
2
|
+
import {
|
|
3
|
+
type AttributeState,
|
|
4
|
+
type AttributeStoredConfig,
|
|
5
|
+
groupBy,
|
|
6
|
+
} from "@ogw_internal/stores/data_style/model/component_style";
|
|
7
|
+
import {
|
|
8
|
+
DEFAULT_NO_DATA_COLOR,
|
|
9
|
+
EDGES_DEFAULT_COLOR,
|
|
10
|
+
EDGES_DEFAULT_VISIBILITY,
|
|
11
|
+
EDGES_DEFAULT_WIDTH,
|
|
12
|
+
type RGBAColor,
|
|
13
|
+
} from "@ogw_front/utils/default_styles/constants";
|
|
14
|
+
import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
|
|
15
|
+
import merge from "lodash/merge";
|
|
16
|
+
import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
|
|
17
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
18
|
+
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
19
|
+
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
20
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
21
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
22
|
+
|
|
23
|
+
// Lines are edges themselves and corners have none, so only these components get their own edges style
|
|
24
|
+
const EDGES_COMPONENT_TYPES = ["Surface", "Block"] as const;
|
|
25
|
+
type EdgesComponentType = (typeof EDGES_COMPONENT_TYPES)[number];
|
|
26
|
+
|
|
27
|
+
const modelSchemas = viewer_schemas.opengeodeweb_viewer.model;
|
|
28
|
+
const COMPONENT_TYPE_KEYS = {
|
|
29
|
+
Surface: "surfaces",
|
|
30
|
+
Block: "blocks",
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
type EdgesSchemas =
|
|
34
|
+
(typeof modelSchemas)[(typeof COMPONENT_TYPE_KEYS)[EdgesComponentType]]["edges"];
|
|
35
|
+
type EdgesRequestSchema =
|
|
36
|
+
| EdgesSchemas["visibility"]
|
|
37
|
+
| EdgesSchemas["width"]
|
|
38
|
+
| EdgesSchemas["color"]
|
|
39
|
+
| EdgesSchemas["attribute"]["vertex"]["attribute"];
|
|
40
|
+
|
|
41
|
+
interface EdgesStyle {
|
|
42
|
+
visibility?: boolean;
|
|
43
|
+
width?: number;
|
|
44
|
+
coloring?: {
|
|
45
|
+
active?: string;
|
|
46
|
+
constant?: RGBAColor;
|
|
47
|
+
vertex?: AttributeState;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Return type is inferred, see ModelComponentEdgesStyle: signatures live on the functions only
|
|
52
|
+
// oxlint-disable-next-line max-lines-per-function, max-statements, typescript/explicit-function-return-type, typescript/explicit-module-boundary-types
|
|
53
|
+
function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
54
|
+
const dataStore = useDataStore();
|
|
55
|
+
const dataStyleState = useDataStyleState();
|
|
56
|
+
const modelCommonStyle = useModelCommonStyle();
|
|
57
|
+
const viewerStore = useViewerStore();
|
|
58
|
+
const { seriesArrayName } = useAttributeTimeStepStyle();
|
|
59
|
+
const schemas = modelSchemas[COMPONENT_TYPE_KEYS[type]].edges;
|
|
60
|
+
|
|
61
|
+
// Without an explicit edges style, components follow the model edges style
|
|
62
|
+
function edgesStyle(modelId: string, componentId?: string): EdgesStyle {
|
|
63
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- edges shape is defined by the data style schema.
|
|
64
|
+
const modelEdges = (dataStyleState.getStyle(modelId).edges ?? {}) as EdgesStyle;
|
|
65
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- edges shape is defined by the data style schema.
|
|
66
|
+
const typeEdges = dataStyleState.getModelComponentTypeStyle(modelId, type).edges as
|
|
67
|
+
| EdgesStyle
|
|
68
|
+
| undefined;
|
|
69
|
+
const componentEdges =
|
|
70
|
+
componentId === undefined
|
|
71
|
+
? undefined
|
|
72
|
+
: // oxlint-disable-next-line no-unsafe-type-assertion -- edges shape is defined by the data style schema.
|
|
73
|
+
(dataStyleState.getComponentStyle(modelId, componentId).edges as EdgesStyle | undefined);
|
|
74
|
+
return merge(
|
|
75
|
+
{
|
|
76
|
+
visibility: modelEdges.visibility ?? EDGES_DEFAULT_VISIBILITY,
|
|
77
|
+
width: modelEdges.width ?? EDGES_DEFAULT_WIDTH,
|
|
78
|
+
coloring: { active: "constant", constant: EDGES_DEFAULT_COLOR },
|
|
79
|
+
},
|
|
80
|
+
typeEdges,
|
|
81
|
+
componentEdges,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function vertexAttribute(modelId: string, componentId?: string): AttributeState {
|
|
86
|
+
return edgesStyle(modelId, componentId).coloring?.vertex ?? {};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function edgesVisibility(modelId: string, componentId?: string): boolean {
|
|
90
|
+
return edgesStyle(modelId, componentId).visibility ?? EDGES_DEFAULT_VISIBILITY;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function edgesWidth(modelId: string, componentId?: string): number {
|
|
94
|
+
return edgesStyle(modelId, componentId).width ?? EDGES_DEFAULT_WIDTH;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function edgesColor(modelId: string, componentId?: string): RGBAColor {
|
|
98
|
+
return edgesStyle(modelId, componentId).coloring?.constant ?? EDGES_DEFAULT_COLOR;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function activeColoring(modelId: string, componentId?: string): string {
|
|
102
|
+
return edgesStyle(modelId, componentId).coloring?.active ?? "constant";
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function vertexAttributeName(modelId: string, componentId?: string): string | undefined {
|
|
106
|
+
return vertexAttribute(modelId, componentId).name;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function lastItem(modelId: string, componentId: string | undefined, name?: string): number {
|
|
110
|
+
const { storedConfigs } = vertexAttribute(modelId, componentId);
|
|
111
|
+
return name === undefined ? 0 : (storedConfigs?.[name]?.lastItem ?? 0);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function vertexAttributeItem(modelId: string, componentId?: string): number {
|
|
115
|
+
const { name, item } = vertexAttribute(modelId, componentId);
|
|
116
|
+
return item ?? lastItem(modelId, componentId, name);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function storedConfig(modelId: string, componentId: string | undefined): AttributeStoredConfig {
|
|
120
|
+
const { name, storedConfigs } = vertexAttribute(modelId, componentId);
|
|
121
|
+
const item = vertexAttributeItem(modelId, componentId);
|
|
122
|
+
const config = name === undefined ? undefined : storedConfigs?.[name]?.[item];
|
|
123
|
+
// A stored config may be partial, missing fields fall back to the defaults
|
|
124
|
+
return {
|
|
125
|
+
minimum: undefined,
|
|
126
|
+
maximum: undefined,
|
|
127
|
+
colorMap: undefined,
|
|
128
|
+
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
129
|
+
...config,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function vertexAttributeRange(
|
|
134
|
+
modelId: string,
|
|
135
|
+
componentId?: string,
|
|
136
|
+
): [number | undefined, number | undefined] {
|
|
137
|
+
const { minimum, maximum } = storedConfig(modelId, componentId);
|
|
138
|
+
return [minimum, maximum];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function vertexAttributeColorMap(modelId: string, componentId?: string): string | undefined {
|
|
142
|
+
return storedConfig(modelId, componentId).colorMap;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function vertexAttributeNoDataColor(modelId: string, componentId?: string): RGBAColor {
|
|
146
|
+
return storedConfig(modelId, componentId).no_data_color;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// The type style is updated too when every component of the type is targeted
|
|
150
|
+
async function mutateEdges(
|
|
151
|
+
modelId: string,
|
|
152
|
+
componentIds: string[],
|
|
153
|
+
values: EdgesStyle,
|
|
154
|
+
): Promise<void> {
|
|
155
|
+
const tasks = [
|
|
156
|
+
modelCommonStyle.mutateComponentStyles(modelId, componentIds, { edges: values }),
|
|
157
|
+
];
|
|
158
|
+
const totalIds = await dataStore.getMeshComponentGeodeIds(modelId, type);
|
|
159
|
+
if (componentIds.length === totalIds.length) {
|
|
160
|
+
tasks.push(modelCommonStyle.mutateModelComponentTypeStyle(modelId, type, { edges: values }));
|
|
161
|
+
}
|
|
162
|
+
await Promise.all(tasks);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async function requestEdges(
|
|
166
|
+
modelId: string,
|
|
167
|
+
componentIds: string[],
|
|
168
|
+
schema: EdgesRequestSchema,
|
|
169
|
+
values: Record<string, unknown> & { style: EdgesStyle },
|
|
170
|
+
): Promise<unknown> {
|
|
171
|
+
if (componentIds.length === 0) {
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
const block_ids = await dataStore.getMeshComponentsViewerIds(modelId, componentIds);
|
|
175
|
+
if (!block_ids?.length) {
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
const { style, ...params } = values;
|
|
179
|
+
const result = await viewerStore.request(
|
|
180
|
+
// oxlint-disable-next-line no-unsafe-type-assertion, no-unnecessary-type-assertion -- params match the edges schema of every component type.
|
|
181
|
+
{ schema, params: { id: modelId, block_ids, ...params } } as Parameters<
|
|
182
|
+
typeof viewerStore.request
|
|
183
|
+
>[0],
|
|
184
|
+
{
|
|
185
|
+
response_function: async () => {
|
|
186
|
+
await mutateEdges(modelId, componentIds, style);
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
);
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
async function setVisibility(
|
|
194
|
+
modelId: string,
|
|
195
|
+
componentIds: string[],
|
|
196
|
+
visibility: boolean,
|
|
197
|
+
): Promise<unknown> {
|
|
198
|
+
const result = await requestEdges(modelId, componentIds, schemas.visibility, {
|
|
199
|
+
visibility,
|
|
200
|
+
style: { visibility },
|
|
201
|
+
});
|
|
202
|
+
return result;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async function setWidth(
|
|
206
|
+
modelId: string,
|
|
207
|
+
componentIds: string[],
|
|
208
|
+
width: number,
|
|
209
|
+
): Promise<unknown> {
|
|
210
|
+
const result = await requestEdges(modelId, componentIds, schemas.width, {
|
|
211
|
+
width,
|
|
212
|
+
style: { width },
|
|
213
|
+
});
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async function setColor(
|
|
218
|
+
modelId: string,
|
|
219
|
+
componentIds: string[],
|
|
220
|
+
color: RGBAColor,
|
|
221
|
+
): Promise<unknown> {
|
|
222
|
+
const result = await requestEdges(modelId, componentIds, schemas.color, {
|
|
223
|
+
color,
|
|
224
|
+
style: { coloring: { active: "constant", constant: color } },
|
|
225
|
+
});
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
async function applyVertexAttribute(modelId: string, componentIds: string[]): Promise<unknown> {
|
|
230
|
+
const [referenceId] = componentIds;
|
|
231
|
+
const name = vertexAttributeName(modelId, referenceId);
|
|
232
|
+
const item = vertexAttributeItem(modelId, referenceId);
|
|
233
|
+
const { minimum, maximum, colorMap, no_data_color } = storedConfig(modelId, referenceId);
|
|
234
|
+
if (
|
|
235
|
+
name === undefined ||
|
|
236
|
+
minimum === undefined ||
|
|
237
|
+
maximum === undefined ||
|
|
238
|
+
colorMap === undefined
|
|
239
|
+
) {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
const schema = schemas.attribute.vertex.attribute;
|
|
243
|
+
const result = await requestEdges(modelId, componentIds, schema, {
|
|
244
|
+
name: seriesArrayName(modelId, schema.$id, name),
|
|
245
|
+
item,
|
|
246
|
+
points: [...getRGBPointsFromPreset(colorMap)],
|
|
247
|
+
minimum,
|
|
248
|
+
maximum,
|
|
249
|
+
no_data_color,
|
|
250
|
+
style: { coloring: { active: "vertex" } },
|
|
251
|
+
});
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
async function mutateVertexAttribute(
|
|
256
|
+
modelId: string,
|
|
257
|
+
componentIds: string[],
|
|
258
|
+
values: AttributeState,
|
|
259
|
+
): Promise<void> {
|
|
260
|
+
await mutateEdges(modelId, componentIds, { coloring: { vertex: values } });
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async function mutateStoredConfig(
|
|
264
|
+
modelId: string,
|
|
265
|
+
componentIds: string[],
|
|
266
|
+
config: Partial<AttributeStoredConfig>,
|
|
267
|
+
): Promise<void> {
|
|
268
|
+
const name = vertexAttributeName(modelId, componentIds[0]);
|
|
269
|
+
const item = vertexAttributeItem(modelId, componentIds[0]);
|
|
270
|
+
const itemConfigs = { lastItem: item, [item]: config };
|
|
271
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- partial stored config is merged into the existing one.
|
|
272
|
+
const storedConfigs = { [name ?? ""]: itemConfigs } as AttributeState["storedConfigs"];
|
|
273
|
+
await mutateVertexAttribute(modelId, componentIds, { storedConfigs });
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
async function setActiveColoring(
|
|
277
|
+
modelId: string,
|
|
278
|
+
componentIds: string[],
|
|
279
|
+
activeColoringType: string,
|
|
280
|
+
): Promise<unknown> {
|
|
281
|
+
await mutateEdges(modelId, componentIds, { coloring: { active: activeColoringType } });
|
|
282
|
+
if (activeColoringType === "vertex") {
|
|
283
|
+
const result = await applyVertexAttribute(modelId, componentIds);
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
286
|
+
const result = await setColor(modelId, componentIds, edgesColor(modelId, componentIds[0]));
|
|
287
|
+
return result;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
async function setVertexAttributeName(
|
|
291
|
+
modelId: string,
|
|
292
|
+
componentIds: string[],
|
|
293
|
+
name: string,
|
|
294
|
+
): Promise<unknown> {
|
|
295
|
+
const item = lastItem(modelId, componentIds[0], name);
|
|
296
|
+
await mutateVertexAttribute(modelId, componentIds, { name, item });
|
|
297
|
+
const result = await applyVertexAttribute(modelId, componentIds);
|
|
298
|
+
return result;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
async function setVertexAttributeItem(
|
|
302
|
+
modelId: string,
|
|
303
|
+
componentIds: string[],
|
|
304
|
+
item: number,
|
|
305
|
+
): Promise<unknown> {
|
|
306
|
+
await mutateVertexAttribute(modelId, componentIds, { item });
|
|
307
|
+
const result = await applyVertexAttribute(modelId, componentIds);
|
|
308
|
+
return result;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async function setVertexAttributeRange(
|
|
312
|
+
modelId: string,
|
|
313
|
+
componentIds: string[],
|
|
314
|
+
minimum: number,
|
|
315
|
+
maximum: number,
|
|
316
|
+
): Promise<unknown> {
|
|
317
|
+
await mutateStoredConfig(modelId, componentIds, { minimum, maximum });
|
|
318
|
+
const result = await applyVertexAttribute(modelId, componentIds);
|
|
319
|
+
return result;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
async function setVertexAttributeColorMap(
|
|
323
|
+
modelId: string,
|
|
324
|
+
componentIds: string[],
|
|
325
|
+
colorMap: string | undefined,
|
|
326
|
+
): Promise<unknown> {
|
|
327
|
+
await mutateStoredConfig(modelId, componentIds, { colorMap });
|
|
328
|
+
const result = await applyVertexAttribute(modelId, componentIds);
|
|
329
|
+
return result;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
async function setVertexAttributeNoDataColor(
|
|
333
|
+
modelId: string,
|
|
334
|
+
componentIds: string[],
|
|
335
|
+
no_data_color: RGBAColor,
|
|
336
|
+
): Promise<unknown> {
|
|
337
|
+
await mutateStoredConfig(modelId, componentIds, { no_data_color });
|
|
338
|
+
const result = await applyVertexAttribute(modelId, componentIds);
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
async function styledComponentIds(modelId: string): Promise<string[]> {
|
|
343
|
+
const componentIds = await dataStore.getMeshComponentGeodeIds(modelId, type);
|
|
344
|
+
if (dataStyleState.getModelComponentTypeStyle(modelId, type).edges !== undefined) {
|
|
345
|
+
return componentIds;
|
|
346
|
+
}
|
|
347
|
+
return componentIds.filter(
|
|
348
|
+
(componentId) => dataStyleState.getComponentStyle(modelId, componentId).edges !== undefined,
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// The model edges routes override every component, so the explicit edges styles follow
|
|
353
|
+
async function mutateStyledEdges(modelId: string, values: EdgesStyle): Promise<void> {
|
|
354
|
+
const componentIds = await styledComponentIds(modelId);
|
|
355
|
+
if (componentIds.length > 0) {
|
|
356
|
+
await mutateEdges(modelId, componentIds, values);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// Only components with an explicit edges style are sent, the others follow the model edges
|
|
361
|
+
async function applyEdgesStyle(modelId: string): Promise<void> {
|
|
362
|
+
const componentIds = await styledComponentIds(modelId);
|
|
363
|
+
function style(componentId?: string): EdgesStyle {
|
|
364
|
+
return edgesStyle(modelId, componentId);
|
|
365
|
+
}
|
|
366
|
+
await Promise.all([
|
|
367
|
+
...groupBy(componentIds, (id) => String(style(id).visibility)).map(async (ids) => {
|
|
368
|
+
await setVisibility(modelId, ids, edgesVisibility(modelId, ids[0]));
|
|
369
|
+
}),
|
|
370
|
+
...groupBy(componentIds, (id) => String(style(id).width)).map(async (ids) => {
|
|
371
|
+
await setWidth(modelId, ids, edgesWidth(modelId, ids[0]));
|
|
372
|
+
}),
|
|
373
|
+
...groupBy(componentIds, (id) => JSON.stringify(style(id).coloring)).map(async (ids) => {
|
|
374
|
+
await setActiveColoring(modelId, ids, activeColoring(modelId, ids[0]));
|
|
375
|
+
}),
|
|
376
|
+
]);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return {
|
|
380
|
+
visibility: edgesVisibility,
|
|
381
|
+
width: edgesWidth,
|
|
382
|
+
color: edgesColor,
|
|
383
|
+
activeColoring,
|
|
384
|
+
vertexAttributeName,
|
|
385
|
+
vertexAttributeItem,
|
|
386
|
+
vertexAttributeRange,
|
|
387
|
+
vertexAttributeColorMap,
|
|
388
|
+
vertexAttributeNoDataColor,
|
|
389
|
+
setVisibility,
|
|
390
|
+
setWidth,
|
|
391
|
+
setColor,
|
|
392
|
+
setActiveColoring,
|
|
393
|
+
setVertexAttributeName,
|
|
394
|
+
setVertexAttributeItem,
|
|
395
|
+
setVertexAttributeRange,
|
|
396
|
+
setVertexAttributeColorMap,
|
|
397
|
+
setVertexAttributeNoDataColor,
|
|
398
|
+
mutateStyledEdges,
|
|
399
|
+
applyEdgesStyle,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
type ModelComponentEdgesStyle = ReturnType<typeof useModelComponentEdgesStyle>;
|
|
404
|
+
|
|
405
|
+
export { EDGES_COMPONENT_TYPES, useModelComponentEdgesStyle };
|
|
406
|
+
export type { ModelComponentEdgesStyle };
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { useModelEdgesCommonStyle } from "./common";
|
|
2
2
|
import { useModelEdgesVisibilityStyle } from "./visibility";
|
|
3
|
+
import { useModelEdgesWidthStyle } from "./width";
|
|
3
4
|
|
|
4
5
|
export function useModelEdgesStyle(): ReturnType<typeof useModelEdgesCommonStyle> &
|
|
5
|
-
ReturnType<typeof useModelEdgesVisibilityStyle>
|
|
6
|
+
ReturnType<typeof useModelEdgesVisibilityStyle> &
|
|
7
|
+
ReturnType<typeof useModelEdgesWidthStyle> {
|
|
6
8
|
const modelEdgesCommonStyle = useModelEdgesCommonStyle();
|
|
7
9
|
const modelEdgesVisibilityStyle = useModelEdgesVisibilityStyle();
|
|
10
|
+
const modelEdgesWidthStyle = useModelEdgesWidthStyle();
|
|
8
11
|
|
|
9
12
|
return {
|
|
10
13
|
...modelEdgesCommonStyle,
|
|
11
14
|
...modelEdgesVisibilityStyle,
|
|
15
|
+
...modelEdgesWidthStyle,
|
|
12
16
|
};
|
|
13
17
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// Third party imports
|
|
2
2
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
EDGES_COMPONENT_TYPES,
|
|
6
|
+
useModelComponentEdgesStyle,
|
|
7
|
+
} from "@ogw_internal/stores/data_style/model/edges/component";
|
|
4
8
|
import { useModelEdgesCommonStyle } from "./common";
|
|
9
|
+
import { useModelEdgesWidthStyle } from "./width";
|
|
5
10
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
6
11
|
import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
|
|
7
12
|
|
|
@@ -17,6 +22,10 @@ interface ModelEdgesVisibilityStyleApi {
|
|
|
17
22
|
export function useModelEdgesVisibilityStyle(): ModelEdgesVisibilityStyleApi {
|
|
18
23
|
const viewerStore = useViewerStore();
|
|
19
24
|
const modelEdgesCommonStyle = useModelEdgesCommonStyle();
|
|
25
|
+
const modelEdgesWidthStyle = useModelEdgesWidthStyle();
|
|
26
|
+
const componentsEdgesStyles = EDGES_COMPONENT_TYPES.map((type) =>
|
|
27
|
+
useModelComponentEdgesStyle(type),
|
|
28
|
+
);
|
|
20
29
|
|
|
21
30
|
function modelEdgesVisibility(id: string): boolean | undefined {
|
|
22
31
|
const { visibility } = modelEdgesCommonStyle.modelEdgesStyle(id);
|
|
@@ -32,7 +41,12 @@ export function useModelEdgesVisibilityStyle(): ModelEdgesVisibilityStyleApi {
|
|
|
32
41
|
{ schema, params },
|
|
33
42
|
{
|
|
34
43
|
response_function: async () => {
|
|
35
|
-
await
|
|
44
|
+
await Promise.all([
|
|
45
|
+
modelEdgesCommonStyle.mutateModelEdgesStyle(id, { visibility }),
|
|
46
|
+
...componentsEdgesStyles.map(async (edgesStyle) => {
|
|
47
|
+
await edgesStyle.mutateStyledEdges(id, { visibility });
|
|
48
|
+
}),
|
|
49
|
+
]);
|
|
36
50
|
},
|
|
37
51
|
},
|
|
38
52
|
);
|
|
@@ -40,11 +54,18 @@ export function useModelEdgesVisibilityStyle(): ModelEdgesVisibilityStyleApi {
|
|
|
40
54
|
}
|
|
41
55
|
|
|
42
56
|
async function applyModelEdgesStyle(id: string): Promise<unknown[]> {
|
|
43
|
-
const
|
|
57
|
+
const visibilityResult = await whenDefined(modelEdgesVisibility(id), async (visibility) => {
|
|
44
58
|
const applied = await setModelEdgesVisibility(id, visibility);
|
|
45
59
|
return applied;
|
|
46
60
|
});
|
|
47
|
-
|
|
61
|
+
const widthResult = await whenDefined(
|
|
62
|
+
modelEdgesWidthStyle.modelEdgesWidth(id),
|
|
63
|
+
async (width) => {
|
|
64
|
+
const applied = await modelEdgesWidthStyle.setModelEdgesWidth(id, width);
|
|
65
|
+
return applied;
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
return [visibilityResult, widthResult];
|
|
48
69
|
}
|
|
49
70
|
|
|
50
71
|
return {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Third party imports
|
|
2
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
3
|
+
|
|
4
|
+
// Local imports
|
|
5
|
+
import {
|
|
6
|
+
EDGES_COMPONENT_TYPES,
|
|
7
|
+
useModelComponentEdgesStyle,
|
|
8
|
+
} from "@ogw_internal/stores/data_style/model/edges/component";
|
|
9
|
+
import { useModelEdgesCommonStyle } from "./common";
|
|
10
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
11
|
+
|
|
12
|
+
// Local constants
|
|
13
|
+
const schema = viewer_schemas.opengeodeweb_viewer.model.edges.width;
|
|
14
|
+
|
|
15
|
+
export function useModelEdgesWidthStyle(): {
|
|
16
|
+
modelEdgesWidth: (id: string) => number | undefined;
|
|
17
|
+
setModelEdgesWidth: (id: string, width: number) => Promise<unknown>;
|
|
18
|
+
} {
|
|
19
|
+
const viewerStore = useViewerStore();
|
|
20
|
+
const modelEdgesCommonStyle = useModelEdgesCommonStyle();
|
|
21
|
+
const componentsEdgesStyles = EDGES_COMPONENT_TYPES.map((type) =>
|
|
22
|
+
useModelComponentEdgesStyle(type),
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
function modelEdgesWidth(id: string): number | undefined {
|
|
26
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- edges style values are dynamically typed at runtime.
|
|
27
|
+
return modelEdgesCommonStyle.modelEdgesStyle(id).width as number | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function setModelEdgesWidth(id: string, width: number): Promise<unknown> {
|
|
31
|
+
const params = { id, width };
|
|
32
|
+
const result = await viewerStore.request(
|
|
33
|
+
{
|
|
34
|
+
schema,
|
|
35
|
+
params,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
response_function: async () => {
|
|
39
|
+
const [mutateResult] = await Promise.all([
|
|
40
|
+
modelEdgesCommonStyle.mutateModelEdgesStyle(id, { width }),
|
|
41
|
+
...componentsEdgesStyles.map(async (edgesStyle) => {
|
|
42
|
+
await edgesStyle.mutateStyledEdges(id, { width });
|
|
43
|
+
}),
|
|
44
|
+
]);
|
|
45
|
+
return mutateResult;
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
modelEdgesWidth,
|
|
54
|
+
setModelEdgesWidth,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -61,11 +61,13 @@ function useModelStyle(): UseModelStyleReturn {
|
|
|
61
61
|
modelPointsStyle.applyModelPointsStyle(modelId),
|
|
62
62
|
modelEdgesStyle.applyModelEdgesStyle(modelId),
|
|
63
63
|
]);
|
|
64
|
-
// Components points come after the model
|
|
64
|
+
// Components points and edges come after the model ones, which override every component
|
|
65
65
|
await Promise.all([
|
|
66
66
|
modelSurfacesStyle.applyModelSurfacesPointsStyle(modelId),
|
|
67
67
|
modelLinesStyle.applyModelLinesPointsStyle(modelId),
|
|
68
68
|
modelBlocksStyle.applyModelBlocksPointsStyle(modelId),
|
|
69
|
+
modelSurfacesStyle.applyModelSurfacesEdgesStyle(modelId),
|
|
70
|
+
modelBlocksStyle.applyModelBlocksEdgesStyle(modelId),
|
|
69
71
|
]);
|
|
70
72
|
return results;
|
|
71
73
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
// oxlint-disable eslint/max-lines
|
|
2
|
+
import {
|
|
3
|
+
type AttributeState,
|
|
4
|
+
type AttributeStoredConfig,
|
|
5
|
+
groupBy,
|
|
6
|
+
} from "@ogw_internal/stores/data_style/model/component_style";
|
|
2
7
|
import {
|
|
3
8
|
DEFAULT_NO_DATA_COLOR,
|
|
4
9
|
POINTS_DEFAULT_COLOR,
|
|
@@ -34,29 +39,6 @@ type PointsRequestSchema =
|
|
|
34
39
|
| PointsSchemas["color"]
|
|
35
40
|
| PointsSchemas["attribute"]["vertex"]["attribute"];
|
|
36
41
|
|
|
37
|
-
function groupBy(componentIds: string[], key: (componentId: string) => string): string[][] {
|
|
38
|
-
const groups: Record<string, string[]> = {};
|
|
39
|
-
for (const componentId of componentIds) {
|
|
40
|
-
const groupKey = key(componentId);
|
|
41
|
-
groups[groupKey] ??= [];
|
|
42
|
-
groups[groupKey].push(componentId);
|
|
43
|
-
}
|
|
44
|
-
return Object.values(groups);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface AttributeStoredConfig {
|
|
48
|
-
minimum: number | undefined;
|
|
49
|
-
maximum: number | undefined;
|
|
50
|
-
colorMap: string | undefined;
|
|
51
|
-
no_data_color: RGBAColor;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
interface AttributeState {
|
|
55
|
-
name?: string;
|
|
56
|
-
item?: number;
|
|
57
|
-
storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
42
|
interface PointsStyle {
|
|
61
43
|
visibility?: boolean;
|
|
62
44
|
size?: number;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ModelComponentEdgesStyle,
|
|
3
|
+
useModelComponentEdgesStyle,
|
|
4
|
+
} from "@ogw_internal/stores/data_style/model/edges/component";
|
|
5
|
+
|
|
6
|
+
interface UseModelSurfacesEdgesStyleReturn {
|
|
7
|
+
modelSurfaceEdgesVisibility: ModelComponentEdgesStyle["visibility"];
|
|
8
|
+
modelSurfaceEdgesWidth: ModelComponentEdgesStyle["width"];
|
|
9
|
+
modelSurfaceEdgesColor: ModelComponentEdgesStyle["color"];
|
|
10
|
+
modelSurfaceEdgesActiveColoring: ModelComponentEdgesStyle["activeColoring"];
|
|
11
|
+
modelSurfaceEdgesVertexAttributeName: ModelComponentEdgesStyle["vertexAttributeName"];
|
|
12
|
+
modelSurfaceEdgesVertexAttributeItem: ModelComponentEdgesStyle["vertexAttributeItem"];
|
|
13
|
+
modelSurfaceEdgesVertexAttributeRange: ModelComponentEdgesStyle["vertexAttributeRange"];
|
|
14
|
+
modelSurfaceEdgesVertexAttributeColorMap: ModelComponentEdgesStyle["vertexAttributeColorMap"];
|
|
15
|
+
modelSurfaceEdgesVertexAttributeNoDataColor: ModelComponentEdgesStyle["vertexAttributeNoDataColor"];
|
|
16
|
+
setModelSurfacesEdgesVisibility: ModelComponentEdgesStyle["setVisibility"];
|
|
17
|
+
setModelSurfacesEdgesWidth: ModelComponentEdgesStyle["setWidth"];
|
|
18
|
+
setModelSurfacesEdgesColor: ModelComponentEdgesStyle["setColor"];
|
|
19
|
+
setModelSurfacesEdgesActiveColoring: ModelComponentEdgesStyle["setActiveColoring"];
|
|
20
|
+
setModelSurfacesEdgesVertexAttributeName: ModelComponentEdgesStyle["setVertexAttributeName"];
|
|
21
|
+
setModelSurfacesEdgesVertexAttributeItem: ModelComponentEdgesStyle["setVertexAttributeItem"];
|
|
22
|
+
setModelSurfacesEdgesVertexAttributeRange: ModelComponentEdgesStyle["setVertexAttributeRange"];
|
|
23
|
+
setModelSurfacesEdgesVertexAttributeColorMap: ModelComponentEdgesStyle["setVertexAttributeColorMap"];
|
|
24
|
+
setModelSurfacesEdgesVertexAttributeNoDataColor: ModelComponentEdgesStyle["setVertexAttributeNoDataColor"];
|
|
25
|
+
applyModelSurfacesEdgesStyle: ModelComponentEdgesStyle["applyEdgesStyle"];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useModelSurfacesEdgesStyle(): UseModelSurfacesEdgesStyleReturn {
|
|
29
|
+
const edges = useModelComponentEdgesStyle("Surface");
|
|
30
|
+
return {
|
|
31
|
+
modelSurfaceEdgesVisibility: edges.visibility,
|
|
32
|
+
modelSurfaceEdgesWidth: edges.width,
|
|
33
|
+
modelSurfaceEdgesColor: edges.color,
|
|
34
|
+
modelSurfaceEdgesActiveColoring: edges.activeColoring,
|
|
35
|
+
modelSurfaceEdgesVertexAttributeName: edges.vertexAttributeName,
|
|
36
|
+
modelSurfaceEdgesVertexAttributeItem: edges.vertexAttributeItem,
|
|
37
|
+
modelSurfaceEdgesVertexAttributeRange: edges.vertexAttributeRange,
|
|
38
|
+
modelSurfaceEdgesVertexAttributeColorMap: edges.vertexAttributeColorMap,
|
|
39
|
+
modelSurfaceEdgesVertexAttributeNoDataColor: edges.vertexAttributeNoDataColor,
|
|
40
|
+
setModelSurfacesEdgesVisibility: edges.setVisibility,
|
|
41
|
+
setModelSurfacesEdgesWidth: edges.setWidth,
|
|
42
|
+
setModelSurfacesEdgesColor: edges.setColor,
|
|
43
|
+
setModelSurfacesEdgesActiveColoring: edges.setActiveColoring,
|
|
44
|
+
setModelSurfacesEdgesVertexAttributeName: edges.setVertexAttributeName,
|
|
45
|
+
setModelSurfacesEdgesVertexAttributeItem: edges.setVertexAttributeItem,
|
|
46
|
+
setModelSurfacesEdgesVertexAttributeRange: edges.setVertexAttributeRange,
|
|
47
|
+
setModelSurfacesEdgesVertexAttributeColorMap: edges.setVertexAttributeColorMap,
|
|
48
|
+
setModelSurfacesEdgesVertexAttributeNoDataColor: edges.setVertexAttributeNoDataColor,
|
|
49
|
+
applyModelSurfacesEdgesStyle: edges.applyEdgesStyle,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -4,6 +4,7 @@ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
|
4
4
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
5
5
|
import { useModelSurfacesColor } from "./color";
|
|
6
6
|
import { useModelSurfacesCommonStyle } from "./common";
|
|
7
|
+
import { useModelSurfacesEdgesStyle } from "./edges";
|
|
7
8
|
import { useModelSurfacesPointsStyle } from "./points";
|
|
8
9
|
import { useModelSurfacesVisibility } from "./visibility";
|
|
9
10
|
|
|
@@ -30,6 +31,7 @@ type UseModelSurfacesStyleReturn = ReturnType<typeof useModelSurfacesCommonStyle
|
|
|
30
31
|
ReturnType<typeof useModelSurfacesVisibility> &
|
|
31
32
|
ReturnType<typeof useModelSurfacesColor> &
|
|
32
33
|
ReturnType<typeof useModelSurfacesPointsStyle> &
|
|
34
|
+
ReturnType<typeof useModelSurfacesEdgesStyle> &
|
|
33
35
|
ReturnType<typeof useModelSurfacesVertexAttribute> &
|
|
34
36
|
ReturnType<typeof useModelSurfacesPolygonAttribute> & {
|
|
35
37
|
applyModelSurfacesStyle: (modelId: string) => Promise<void>;
|
|
@@ -45,6 +47,7 @@ export function useModelSurfacesStyle(): UseModelSurfacesStyleReturn {
|
|
|
45
47
|
const modelSurfacesVertexAttribute = useModelSurfacesVertexAttribute();
|
|
46
48
|
const modelSurfacesPolygonAttribute = useModelSurfacesPolygonAttribute();
|
|
47
49
|
const modelSurfacesPointsStyle = useModelSurfacesPointsStyle();
|
|
50
|
+
const modelSurfacesEdgesStyle = useModelSurfacesEdgesStyle();
|
|
48
51
|
|
|
49
52
|
async function applyModelSurfacesVisibilityStyle(
|
|
50
53
|
modelId: string,
|
|
@@ -268,5 +271,6 @@ export function useModelSurfacesStyle(): UseModelSurfacesStyleReturn {
|
|
|
268
271
|
...modelSurfacesVertexAttribute,
|
|
269
272
|
...modelSurfacesPolygonAttribute,
|
|
270
273
|
...modelSurfacesPointsStyle,
|
|
274
|
+
...modelSurfacesEdgesStyle,
|
|
271
275
|
};
|
|
272
276
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geode/opengeodeweb-front",
|
|
3
|
-
"version": "10.41.
|
|
3
|
+
"version": "10.41.1-rc.1",
|
|
4
4
|
"description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
|
|
5
5
|
"homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
|
|
6
6
|
"bugs": {
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"prepublishOnly": "npm run build"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@geode/cloud-api": "
|
|
68
|
-
"@geode/opengeodeweb-back": "
|
|
69
|
-
"@geode/opengeodeweb-viewer": "
|
|
67
|
+
"@geode/cloud-api": "next",
|
|
68
|
+
"@geode/opengeodeweb-back": "next",
|
|
69
|
+
"@geode/opengeodeweb-viewer": "next",
|
|
70
70
|
"@kitware/vtk.js": "33.3.0",
|
|
71
71
|
"@mdi/font": "7.4.47",
|
|
72
72
|
"@msgpack/msgpack": "2.8.0",
|