@geode/opengeodeweb-front 10.2.1 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/manual_release.yml +11 -0
- package/app/components/Step.vue +2 -2
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +63 -19
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +65 -18
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +8 -15
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +8 -9
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +8 -8
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +2 -2
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
- package/app/components/Viewer/Options/AttributeColorBar.vue +58 -0
- package/app/components/Viewer/Options/CellAttributeSelector.vue +51 -19
- package/app/components/Viewer/Options/ColorMapList.vue +216 -0
- package/app/components/Viewer/Options/ColorMapPicker.vue +168 -0
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +46 -24
- package/app/components/Viewer/Options/EdgeAttributeSelector.vue +53 -41
- package/app/components/Viewer/Options/PolygonAttributeSelector.vue +52 -19
- package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +57 -20
- package/app/components/Viewer/Options/VertexAttributeSelector.vue +47 -15
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +38 -14
- package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +74 -18
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +75 -17
- package/app/components/Viewer/TreeComponent.vue +26 -76
- package/app/stores/data_style.js +3 -3
- package/app/utils/colormap.js +5 -0
- package/app/utils/default_styles.js +36 -9
- package/internal/stores/data_style/mesh/cells/cell.js +153 -0
- package/internal/stores/data_style/mesh/cells/color.js +40 -0
- package/internal/stores/data_style/mesh/cells/common.js +23 -0
- package/internal/stores/data_style/mesh/cells/index.js +84 -0
- package/internal/stores/data_style/mesh/cells/textures.js +36 -0
- package/internal/stores/data_style/mesh/cells/vertex.js +153 -0
- package/internal/stores/data_style/mesh/cells/visibility.js +40 -0
- package/internal/stores/data_style/mesh/edges/color.js +40 -0
- package/internal/stores/data_style/mesh/edges/common.js +23 -0
- package/internal/stores/data_style/mesh/edges/edge.js +141 -0
- package/internal/stores/data_style/mesh/edges/index.js +88 -0
- package/internal/stores/data_style/mesh/edges/vertex.js +153 -0
- package/internal/stores/data_style/mesh/edges/visibility.js +40 -0
- package/internal/stores/data_style/mesh/edges/width.js +40 -0
- package/internal/stores/{mesh → data_style/mesh}/index.js +25 -23
- package/internal/stores/data_style/mesh/points/color.js +40 -0
- package/internal/stores/data_style/mesh/points/common.js +23 -0
- package/internal/stores/data_style/mesh/points/index.js +89 -0
- package/internal/stores/data_style/mesh/points/size.js +40 -0
- package/internal/stores/data_style/mesh/points/vertex.js +153 -0
- package/internal/stores/data_style/mesh/points/visibility.js +40 -0
- package/internal/stores/data_style/mesh/polygons/color.js +40 -0
- package/internal/stores/data_style/mesh/polygons/common.js +23 -0
- package/internal/stores/data_style/mesh/polygons/index.js +89 -0
- package/internal/stores/data_style/mesh/polygons/polygon.js +145 -0
- package/internal/stores/data_style/mesh/polygons/textures.js +40 -0
- package/internal/stores/data_style/mesh/polygons/vertex.js +153 -0
- package/internal/stores/data_style/mesh/polygons/visibility.js +40 -0
- package/internal/stores/data_style/mesh/polyhedra/color.js +40 -0
- package/internal/stores/data_style/mesh/polyhedra/common.js +23 -0
- package/internal/stores/data_style/mesh/polyhedra/index.js +83 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +139 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +153 -0
- package/internal/stores/data_style/mesh/polyhedra/visibility.js +41 -0
- package/internal/stores/{model → data_style/model}/blocks.js +1 -1
- package/internal/stores/{model → data_style/model}/corners.js +1 -1
- package/internal/stores/{model → data_style/model}/edges.js +1 -1
- package/internal/stores/{model → data_style/model}/index.js +3 -3
- package/internal/stores/{model → data_style/model}/lines.js +1 -1
- package/internal/stores/{model → data_style/model}/points.js +1 -1
- package/internal/stores/{model → data_style/model}/surfaces.js +1 -1
- package/internal/stores/{data_style_state.js → data_style/state.js} +6 -3
- package/package.json +1 -1
- package/tests/integration/microservices/back/requirements.txt +1 -1
- package/tests/integration/microservices/viewer/requirements.txt +1 -1
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -18
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +22 -16
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +1 -1
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +14 -12
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +16 -19
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +16 -19
- package/tests/vitest.config.js +3 -0
- package/internal/stores/mesh/cells.js +0 -175
- package/internal/stores/mesh/edges.js +0 -171
- package/internal/stores/mesh/points.js +0 -142
- package/internal/stores/mesh/polygons.js +0 -181
- package/internal/stores/mesh/polyhedra.js +0 -151
|
@@ -13,90 +13,40 @@
|
|
|
13
13
|
|
|
14
14
|
const emit = defineEmits(["show-menu"])
|
|
15
15
|
|
|
16
|
-
const items =
|
|
17
|
-
const mesh_components_selection =
|
|
18
|
-
|
|
16
|
+
const items = ref([])
|
|
17
|
+
const mesh_components_selection = dataStyleStore.visibleMeshComponents(
|
|
18
|
+
props.id,
|
|
19
19
|
)
|
|
20
20
|
|
|
21
|
+
watchEffect(async () => {
|
|
22
|
+
items.value = await dataStore.formatedMeshComponents(props.id)
|
|
23
|
+
})
|
|
24
|
+
|
|
21
25
|
watch(
|
|
22
26
|
mesh_components_selection,
|
|
23
|
-
(current, previous) => {
|
|
24
|
-
if (!previous)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
async (current, previous) => {
|
|
28
|
+
if (!previous) return
|
|
29
|
+
|
|
30
|
+
const { added, removed } = compareSelections(current, previous)
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
if (added_lines.length > 0) {
|
|
44
|
-
dataStyleStore.setModelLinesVisibility(props.id, added_lines, true)
|
|
45
|
-
}
|
|
46
|
-
if (added_surfaces.length > 0) {
|
|
47
|
-
dataStyleStore.setModelSurfacesVisibility(
|
|
48
|
-
props.id,
|
|
49
|
-
added_surfaces,
|
|
50
|
-
true,
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
if (added_blocks.length > 0) {
|
|
54
|
-
dataStyleStore.setModelBlocksVisibility(props.id, added_blocks, true)
|
|
55
|
-
}
|
|
56
|
-
if (removed_corners.length > 0) {
|
|
57
|
-
dataStyleStore.setModelCornersVisibility(
|
|
58
|
-
props.id,
|
|
59
|
-
removed_corners,
|
|
60
|
-
false,
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
if (removed_lines.length > 0) {
|
|
64
|
-
dataStyleStore.setModelLinesVisibility(props.id, removed_lines, false)
|
|
65
|
-
}
|
|
66
|
-
if (removed_surfaces.length > 0) {
|
|
67
|
-
dataStyleStore.setModelSurfacesVisibility(
|
|
68
|
-
props.id,
|
|
69
|
-
removed_surfaces,
|
|
70
|
-
false,
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
if (removed_blocks.length > 0) {
|
|
74
|
-
dataStyleStore.setModelBlocksVisibility(
|
|
75
|
-
props.id,
|
|
76
|
-
removed_blocks,
|
|
77
|
-
false,
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
hybridViewerStore.remoteRender()
|
|
32
|
+
if (added.length > 0) {
|
|
33
|
+
await dataStyleStore.setModelMeshComponentsVisibility(
|
|
34
|
+
props.id,
|
|
35
|
+
added,
|
|
36
|
+
true,
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
if (removed.length > 0) {
|
|
40
|
+
await dataStyleStore.setModelMeshComponentsVisibility(
|
|
41
|
+
props.id,
|
|
42
|
+
removed,
|
|
43
|
+
false,
|
|
44
|
+
)
|
|
81
45
|
}
|
|
46
|
+
hybridViewerStore.remoteRender()
|
|
82
47
|
},
|
|
83
|
-
{
|
|
48
|
+
{ deep: true },
|
|
84
49
|
)
|
|
85
|
-
|
|
86
|
-
function sortMeshComponents(items) {
|
|
87
|
-
var corner_ids = [],
|
|
88
|
-
line_ids = [],
|
|
89
|
-
surface_ids = [],
|
|
90
|
-
block_ids = []
|
|
91
|
-
for (const item of items) {
|
|
92
|
-
const item_type = dataStore.meshComponentType(props.id, item)
|
|
93
|
-
if (item_type === "corner") corner_ids.push(item)
|
|
94
|
-
else if (item_type === "line") line_ids.push(item)
|
|
95
|
-
else if (item_type === "surface") surface_ids.push(item)
|
|
96
|
-
else if (item_type === "block") block_ids.push(item)
|
|
97
|
-
}
|
|
98
|
-
return [corner_ids, line_ids, surface_ids, block_ids]
|
|
99
|
-
}
|
|
100
50
|
</script>
|
|
101
51
|
|
|
102
52
|
<template>
|
package/app/stores/data_style.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getDefaultStyle } from "@ogw_front/utils/default_styles"
|
|
2
2
|
import { useDataStore } from "@ogw_front/stores/data"
|
|
3
|
-
import { useDataStyleStateStore } from "../../internal/stores/
|
|
4
|
-
import useMeshStyle from "../../internal/stores/mesh/index"
|
|
5
|
-
import useModelStyle from "../../internal/stores/model/index"
|
|
3
|
+
import { useDataStyleStateStore } from "../../internal/stores/data_style/state"
|
|
4
|
+
import useMeshStyle from "../../internal/stores/data_style/mesh/index"
|
|
5
|
+
import useModelStyle from "../../internal/stores/data_style/model/index"
|
|
6
6
|
|
|
7
7
|
export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
8
8
|
const dataStyleState = useDataStyleStateStore()
|
|
@@ -32,7 +32,10 @@ const meshPointsDefaultStyle = (
|
|
|
32
32
|
coloring: {
|
|
33
33
|
active: "color",
|
|
34
34
|
color,
|
|
35
|
-
vertex:
|
|
35
|
+
vertex: {
|
|
36
|
+
name: null,
|
|
37
|
+
storedConfigs: {},
|
|
38
|
+
},
|
|
36
39
|
},
|
|
37
40
|
size,
|
|
38
41
|
}
|
|
@@ -48,8 +51,14 @@ const meshEdgesDefaultStyle = (
|
|
|
48
51
|
coloring: {
|
|
49
52
|
active: "color",
|
|
50
53
|
color,
|
|
51
|
-
edge:
|
|
52
|
-
|
|
54
|
+
edge: {
|
|
55
|
+
name: null,
|
|
56
|
+
storedConfigs: {},
|
|
57
|
+
},
|
|
58
|
+
vertex: {
|
|
59
|
+
name: null,
|
|
60
|
+
storedConfigs: {},
|
|
61
|
+
},
|
|
53
62
|
},
|
|
54
63
|
width,
|
|
55
64
|
}
|
|
@@ -63,10 +72,16 @@ const meshCellsDefaultStyle = (
|
|
|
63
72
|
visibility,
|
|
64
73
|
coloring: {
|
|
65
74
|
active: "color",
|
|
66
|
-
cell:
|
|
75
|
+
cell: {
|
|
76
|
+
name: null,
|
|
77
|
+
storedConfigs: {},
|
|
78
|
+
},
|
|
67
79
|
color,
|
|
68
80
|
textures: null,
|
|
69
|
-
vertex:
|
|
81
|
+
vertex: {
|
|
82
|
+
name: null,
|
|
83
|
+
storedConfigs: {},
|
|
84
|
+
},
|
|
70
85
|
},
|
|
71
86
|
}
|
|
72
87
|
}
|
|
@@ -81,8 +96,14 @@ const meshPolygonsDefaultStyle = (
|
|
|
81
96
|
active: "color",
|
|
82
97
|
color,
|
|
83
98
|
textures: null,
|
|
84
|
-
polygon:
|
|
85
|
-
|
|
99
|
+
polygon: {
|
|
100
|
+
name: null,
|
|
101
|
+
storedConfigs: {},
|
|
102
|
+
},
|
|
103
|
+
vertex: {
|
|
104
|
+
name: null,
|
|
105
|
+
storedConfigs: {},
|
|
106
|
+
},
|
|
86
107
|
},
|
|
87
108
|
}
|
|
88
109
|
}
|
|
@@ -96,8 +117,14 @@ const meshPolyhedraDefaultStyle = (
|
|
|
96
117
|
coloring: {
|
|
97
118
|
active: "color",
|
|
98
119
|
color,
|
|
99
|
-
polyhedron:
|
|
100
|
-
|
|
120
|
+
polyhedron: {
|
|
121
|
+
name: null,
|
|
122
|
+
storedConfigs: {},
|
|
123
|
+
},
|
|
124
|
+
vertex: {
|
|
125
|
+
name: null,
|
|
126
|
+
storedConfigs: {},
|
|
127
|
+
},
|
|
101
128
|
},
|
|
102
129
|
}
|
|
103
130
|
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// Third party imports
|
|
2
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
3
|
+
|
|
4
|
+
// Local imports
|
|
5
|
+
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
6
|
+
import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap"
|
|
7
|
+
import { useMeshCellsCommonStyle } from "./common"
|
|
8
|
+
|
|
9
|
+
// Local constants
|
|
10
|
+
const meshCellsCellAttributeSchemas =
|
|
11
|
+
viewer_schemas.opengeodeweb_viewer.mesh.cells.attribute.cell
|
|
12
|
+
|
|
13
|
+
export function useMeshCellsCellAttributeStyle() {
|
|
14
|
+
const viewerStore = useViewerStore()
|
|
15
|
+
const meshCellsCommonStyle = useMeshCellsCommonStyle()
|
|
16
|
+
|
|
17
|
+
function meshCellsCellAttribute(id) {
|
|
18
|
+
return meshCellsCommonStyle.meshCellsColoring(id).cell
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function updateMeshCellsCellAttribute(id) {
|
|
22
|
+
const name = meshCellsCellAttributeName(id)
|
|
23
|
+
const storedConfig = meshCellsCellAttributeStoredConfig(id, name)
|
|
24
|
+
await meshCellsCellAttributeRange(
|
|
25
|
+
id,
|
|
26
|
+
storedConfig.minimum,
|
|
27
|
+
storedConfig.maximum,
|
|
28
|
+
)
|
|
29
|
+
await meshCellsCellAttributeColorMap(id, storedConfig.colorMap)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function meshCellsCellAttributeStoredConfig(id, name) {
|
|
33
|
+
const storedConfigs = meshCellsCellAttribute(id).storedConfigs
|
|
34
|
+
if (name in storedConfigs) {
|
|
35
|
+
return storedConfigs[name]
|
|
36
|
+
}
|
|
37
|
+
return setMeshCellsCellAttributeStoredConfig(id, name, {
|
|
38
|
+
minimum: 0,
|
|
39
|
+
maximum: 1,
|
|
40
|
+
colorMap: "Cool to Warm",
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function setMeshCellsCellAttributeStoredConfig(
|
|
45
|
+
id,
|
|
46
|
+
name,
|
|
47
|
+
{ minimum, maximum, colorMap },
|
|
48
|
+
) {
|
|
49
|
+
const storedConfigs = meshCellsCellAttribute(id).storedConfigs
|
|
50
|
+
storedConfigs[name] = { minimum, maximum, colorMap }
|
|
51
|
+
return storedConfigs[name]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function meshCellsCellAttributeName(id) {
|
|
55
|
+
console.log(
|
|
56
|
+
meshCellsCellAttributeName.name,
|
|
57
|
+
{ id },
|
|
58
|
+
meshCellsCellAttribute(id),
|
|
59
|
+
)
|
|
60
|
+
return meshCellsCellAttribute(id).name
|
|
61
|
+
}
|
|
62
|
+
function setMeshCellsCellAttributeName(id, name) {
|
|
63
|
+
console.log(setMeshCellsCellAttributeName.name, { id, name })
|
|
64
|
+
return viewerStore.request(
|
|
65
|
+
meshCellsCellAttributeSchemas.name,
|
|
66
|
+
{ id, name },
|
|
67
|
+
{
|
|
68
|
+
response_function: async () => {
|
|
69
|
+
meshCellsCellAttribute(id).name = name
|
|
70
|
+
const { minimum, maximum, colorMap } =
|
|
71
|
+
meshCellsCellAttributeStoredConfig(id, name)
|
|
72
|
+
await setMeshCellsCellAttributeRange(id, minimum, maximum)
|
|
73
|
+
await setMeshCellsCellAttributeColorMap(id, colorMap)
|
|
74
|
+
console.log(
|
|
75
|
+
setMeshCellsCellAttributeName.name,
|
|
76
|
+
{ id },
|
|
77
|
+
meshCellsCellAttributeName(id),
|
|
78
|
+
)
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function meshCellsCellAttributeRange(id) {
|
|
85
|
+
const name = meshCellsCellAttributeName(id)
|
|
86
|
+
const storedConfig = meshCellsCellAttributeStoredConfig(id, name)
|
|
87
|
+
const { minimum, maximum } = storedConfig
|
|
88
|
+
return [minimum, maximum]
|
|
89
|
+
}
|
|
90
|
+
function setMeshCellsCellAttributeRange(id, minimum, maximum) {
|
|
91
|
+
const name = meshCellsCellAttributeName(id)
|
|
92
|
+
const storedConfig = meshCellsCellAttributeStoredConfig(id, name)
|
|
93
|
+
return viewerStore.request(
|
|
94
|
+
meshCellsCellAttributeSchemas.scalar_range,
|
|
95
|
+
{ id, minimum, maximum },
|
|
96
|
+
{
|
|
97
|
+
response_function: () => {
|
|
98
|
+
storedConfig.minimum = minimum
|
|
99
|
+
storedConfig.maximum = maximum
|
|
100
|
+
console.log(
|
|
101
|
+
setMeshCellsCellAttributeRange.name,
|
|
102
|
+
{ id },
|
|
103
|
+
meshCellsCellAttributeRange(id),
|
|
104
|
+
)
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function meshCellsCellAttributeColorMap(id) {
|
|
111
|
+
const name = meshCellsCellAttributeName(id)
|
|
112
|
+
const storedConfig = meshCellsCellAttributeStoredConfig(id, name)
|
|
113
|
+
const { colorMap } = storedConfig
|
|
114
|
+
return colorMap
|
|
115
|
+
}
|
|
116
|
+
function setMeshCellsCellAttributeColorMap(id, colorMap) {
|
|
117
|
+
const name = meshCellsCellAttributeName(id)
|
|
118
|
+
const storedConfig = meshCellsCellAttributeStoredConfig(id, name)
|
|
119
|
+
const points = getRGBPointsFromPreset(colorMap)
|
|
120
|
+
const { minimum, maximum } = storedConfig
|
|
121
|
+
|
|
122
|
+
console.log(setMeshCellsCellAttributeColorMap.name, {
|
|
123
|
+
id,
|
|
124
|
+
minimum,
|
|
125
|
+
maximum,
|
|
126
|
+
colorMap,
|
|
127
|
+
})
|
|
128
|
+
return viewerStore.request(
|
|
129
|
+
meshCellsCellAttributeSchemas.color_map,
|
|
130
|
+
{ id, points, minimum, maximum },
|
|
131
|
+
{
|
|
132
|
+
response_function: () => {
|
|
133
|
+
storedConfig.colorMap = colorMap
|
|
134
|
+
console.log(
|
|
135
|
+
setMeshCellsCellAttributeColorMap.name,
|
|
136
|
+
{ id },
|
|
137
|
+
meshCellsCellAttributeColorMap(id),
|
|
138
|
+
)
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
meshCellsCellAttributeName,
|
|
146
|
+
meshCellsCellAttributeRange,
|
|
147
|
+
meshCellsCellAttributeColorMap,
|
|
148
|
+
setMeshCellsCellAttributeName,
|
|
149
|
+
setMeshCellsCellAttributeRange,
|
|
150
|
+
setMeshCellsCellAttributeColorMap,
|
|
151
|
+
updateMeshCellsCellAttribute,
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Third party imports
|
|
2
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
3
|
+
|
|
4
|
+
// Local imports
|
|
5
|
+
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
6
|
+
import { useMeshCellsCommonStyle } from "./common"
|
|
7
|
+
|
|
8
|
+
// Local constants
|
|
9
|
+
const meshCellsColorSchemas =
|
|
10
|
+
viewer_schemas.opengeodeweb_viewer.mesh.cells.color
|
|
11
|
+
|
|
12
|
+
export function useMeshCellsColorStyle() {
|
|
13
|
+
const viewerStore = useViewerStore()
|
|
14
|
+
const meshCellsCommonStyle = useMeshCellsCommonStyle()
|
|
15
|
+
|
|
16
|
+
function meshCellsColor(id) {
|
|
17
|
+
return meshCellsCommonStyle.meshCellsColoring(id).color
|
|
18
|
+
}
|
|
19
|
+
function setMeshCellsColor(id, color) {
|
|
20
|
+
return viewerStore.request(
|
|
21
|
+
meshCellsColorSchemas,
|
|
22
|
+
{ id, color },
|
|
23
|
+
{
|
|
24
|
+
response_function: () => {
|
|
25
|
+
meshCellsCommonStyle.meshCellsColoring(id).color = color
|
|
26
|
+
console.log(
|
|
27
|
+
setMeshCellsColor.name,
|
|
28
|
+
{ id },
|
|
29
|
+
JSON.stringify(meshCellsColor(id)),
|
|
30
|
+
)
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
meshCellsColor,
|
|
38
|
+
setMeshCellsColor,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useDataStyleStateStore } from "../../state"
|
|
2
|
+
|
|
3
|
+
export function useMeshCellsCommonStyle() {
|
|
4
|
+
const dataStyleStateStore = useDataStyleStateStore()
|
|
5
|
+
|
|
6
|
+
function meshCellsStyle(id) {
|
|
7
|
+
return dataStyleStateStore.getStyle(id).cells
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function meshCellsColoring(id) {
|
|
11
|
+
return meshCellsStyle(id).coloring
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function meshCellsActiveColoring(id) {
|
|
15
|
+
return meshCellsColoring(id).active
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
meshCellsStyle,
|
|
20
|
+
meshCellsColoring,
|
|
21
|
+
meshCellsActiveColoring,
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Third party imports
|
|
2
|
+
|
|
3
|
+
// Local imports
|
|
4
|
+
import { useMeshCellsCommonStyle } from "./common"
|
|
5
|
+
import { useMeshCellsVisibilityStyle } from "./visibility"
|
|
6
|
+
import { useMeshCellsColorStyle } from "./color"
|
|
7
|
+
import { useMeshCellsTexturesStyle } from "./textures"
|
|
8
|
+
import { useMeshCellsVertexAttributeStyle } from "./vertex"
|
|
9
|
+
import { useMeshCellsCellAttributeStyle } from "./cell"
|
|
10
|
+
|
|
11
|
+
// Local constants
|
|
12
|
+
|
|
13
|
+
export function useMeshCellsStyle() {
|
|
14
|
+
const meshCellsCommonStyle = useMeshCellsCommonStyle()
|
|
15
|
+
const meshCellsVisibility = useMeshCellsVisibilityStyle()
|
|
16
|
+
const meshCellsColorStyle = useMeshCellsColorStyle()
|
|
17
|
+
const meshCellsTexturesStore = useMeshCellsTexturesStyle()
|
|
18
|
+
const meshCellsVertexAttributeStyle = useMeshCellsVertexAttributeStyle()
|
|
19
|
+
const meshCellsCellAttributeStyle = useMeshCellsCellAttributeStyle()
|
|
20
|
+
|
|
21
|
+
async function setMeshCellsActiveColoring(id, type) {
|
|
22
|
+
const coloring = meshCellsCommonStyle.meshCellsColoring(id)
|
|
23
|
+
coloring.active = type
|
|
24
|
+
console.log(
|
|
25
|
+
setMeshCellsActiveColoring.name,
|
|
26
|
+
{ id },
|
|
27
|
+
meshCellsCommonStyle.meshCellsActiveColoring(id),
|
|
28
|
+
)
|
|
29
|
+
if (type === "color") {
|
|
30
|
+
return meshCellsColorStyle.setMeshCellsColor(
|
|
31
|
+
id,
|
|
32
|
+
meshCellsColorStyle.meshCellsColor(id),
|
|
33
|
+
)
|
|
34
|
+
} else if (type === "textures") {
|
|
35
|
+
const textures = meshCellsTexturesStore.meshCellsTextures(id)
|
|
36
|
+
if (textures === null) {
|
|
37
|
+
return Promise.resolve()
|
|
38
|
+
}
|
|
39
|
+
return meshCellsTexturesStore.setMeshCellsTextures(id, textures)
|
|
40
|
+
} else if (type === "vertex") {
|
|
41
|
+
const name =
|
|
42
|
+
meshCellsVertexAttributeStyle.meshCellsVertexAttributeName(id)
|
|
43
|
+
if (name === null) {
|
|
44
|
+
return Promise.resolve()
|
|
45
|
+
}
|
|
46
|
+
return meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeName(
|
|
47
|
+
id,
|
|
48
|
+
name,
|
|
49
|
+
)
|
|
50
|
+
} else if (type === "cell") {
|
|
51
|
+
const name = meshCellsCellAttributeStyle.meshCellsCellAttributeName(id)
|
|
52
|
+
if (name === null) {
|
|
53
|
+
return Promise.resolve()
|
|
54
|
+
}
|
|
55
|
+
await meshCellsCellAttributeStyle.setMeshCellsCellAttributeName(id, name)
|
|
56
|
+
} else {
|
|
57
|
+
throw new Error("Unknown mesh cells coloring type: " + type)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function applyMeshCellsStyle(id) {
|
|
62
|
+
return Promise.all([
|
|
63
|
+
meshCellsVisibility.setMeshCellsVisibility(
|
|
64
|
+
id,
|
|
65
|
+
meshCellsVisibility.meshCellsVisibility(id),
|
|
66
|
+
),
|
|
67
|
+
setMeshCellsActiveColoring(
|
|
68
|
+
id,
|
|
69
|
+
meshCellsCommonStyle.meshCellsActiveColoring(id),
|
|
70
|
+
),
|
|
71
|
+
])
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
...meshCellsCommonStyle,
|
|
76
|
+
setMeshCellsActiveColoring,
|
|
77
|
+
applyMeshCellsStyle,
|
|
78
|
+
...meshCellsVisibility,
|
|
79
|
+
...meshCellsColorStyle,
|
|
80
|
+
...meshCellsTexturesStore,
|
|
81
|
+
...meshCellsVertexAttributeStyle,
|
|
82
|
+
...meshCellsCellAttributeStyle,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Third party imports
|
|
2
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
3
|
+
|
|
4
|
+
// Local imports
|
|
5
|
+
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
6
|
+
import { useMeshCellsCommonStyle } from "./common"
|
|
7
|
+
|
|
8
|
+
// Local constants
|
|
9
|
+
const meshCellsTexturesSchemas =
|
|
10
|
+
viewer_schemas.opengeodeweb_viewer.mesh.cells.apply_textures
|
|
11
|
+
|
|
12
|
+
export function useMeshCellsTexturesStyle() {
|
|
13
|
+
const viewerStore = useViewerStore()
|
|
14
|
+
const meshCellsCommonStyle = useMeshCellsCommonStyle()
|
|
15
|
+
|
|
16
|
+
function meshCellsTextures(id) {
|
|
17
|
+
return meshCellsCommonStyle.meshCellsColoring(id).textures
|
|
18
|
+
}
|
|
19
|
+
function setMeshCellsTextures(id, textures) {
|
|
20
|
+
return viewerStore.request(
|
|
21
|
+
meshCellsTexturesSchemas,
|
|
22
|
+
{ id, textures },
|
|
23
|
+
{
|
|
24
|
+
response_function: () => {
|
|
25
|
+
meshCellsCommonStyle.meshCellsColoring(id).textures = textures
|
|
26
|
+
console.log(setMeshCellsTextures.name, { id }, meshCellsTextures(id))
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
meshCellsTextures,
|
|
34
|
+
setMeshCellsTextures,
|
|
35
|
+
}
|
|
36
|
+
}
|