@geode/opengeodeweb-front 10.2.1 → 10.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/.github/workflows/manual_release.yml +11 -0
  2. package/app/components/Step.vue +2 -2
  3. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +63 -19
  4. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +65 -18
  5. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +8 -15
  6. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +8 -9
  7. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +8 -8
  8. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
  9. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +2 -2
  10. package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
  11. package/app/components/Viewer/Options/AttributeColorBar.vue +58 -0
  12. package/app/components/Viewer/Options/CellAttributeSelector.vue +51 -19
  13. package/app/components/Viewer/Options/ColorMapList.vue +216 -0
  14. package/app/components/Viewer/Options/ColorMapPicker.vue +168 -0
  15. package/app/components/Viewer/Options/ColoringTypeSelector.vue +46 -24
  16. package/app/components/Viewer/Options/EdgeAttributeSelector.vue +53 -41
  17. package/app/components/Viewer/Options/PolygonAttributeSelector.vue +52 -19
  18. package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +57 -20
  19. package/app/components/Viewer/Options/VertexAttributeSelector.vue +47 -15
  20. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +38 -14
  21. package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +74 -18
  22. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +75 -17
  23. package/app/components/Viewer/TreeComponent.vue +26 -76
  24. package/app/stores/data_style.js +3 -3
  25. package/app/utils/colormap.js +5 -0
  26. package/app/utils/default_styles.js +36 -9
  27. package/internal/stores/data_style/mesh/cells/cell.js +153 -0
  28. package/internal/stores/data_style/mesh/cells/color.js +40 -0
  29. package/internal/stores/data_style/mesh/cells/common.js +23 -0
  30. package/internal/stores/data_style/mesh/cells/index.js +84 -0
  31. package/internal/stores/data_style/mesh/cells/textures.js +36 -0
  32. package/internal/stores/data_style/mesh/cells/vertex.js +153 -0
  33. package/internal/stores/data_style/mesh/cells/visibility.js +40 -0
  34. package/internal/stores/data_style/mesh/edges/color.js +40 -0
  35. package/internal/stores/data_style/mesh/edges/common.js +23 -0
  36. package/internal/stores/data_style/mesh/edges/edge.js +141 -0
  37. package/internal/stores/data_style/mesh/edges/index.js +88 -0
  38. package/internal/stores/data_style/mesh/edges/vertex.js +153 -0
  39. package/internal/stores/data_style/mesh/edges/visibility.js +40 -0
  40. package/internal/stores/data_style/mesh/edges/width.js +40 -0
  41. package/internal/stores/{mesh → data_style/mesh}/index.js +25 -23
  42. package/internal/stores/data_style/mesh/points/color.js +40 -0
  43. package/internal/stores/data_style/mesh/points/common.js +23 -0
  44. package/internal/stores/data_style/mesh/points/index.js +89 -0
  45. package/internal/stores/data_style/mesh/points/size.js +40 -0
  46. package/internal/stores/data_style/mesh/points/vertex.js +153 -0
  47. package/internal/stores/data_style/mesh/points/visibility.js +40 -0
  48. package/internal/stores/data_style/mesh/polygons/color.js +40 -0
  49. package/internal/stores/data_style/mesh/polygons/common.js +23 -0
  50. package/internal/stores/data_style/mesh/polygons/index.js +89 -0
  51. package/internal/stores/data_style/mesh/polygons/polygon.js +145 -0
  52. package/internal/stores/data_style/mesh/polygons/textures.js +40 -0
  53. package/internal/stores/data_style/mesh/polygons/vertex.js +153 -0
  54. package/internal/stores/data_style/mesh/polygons/visibility.js +40 -0
  55. package/internal/stores/data_style/mesh/polyhedra/color.js +40 -0
  56. package/internal/stores/data_style/mesh/polyhedra/common.js +23 -0
  57. package/internal/stores/data_style/mesh/polyhedra/index.js +83 -0
  58. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +139 -0
  59. package/internal/stores/data_style/mesh/polyhedra/vertex.js +153 -0
  60. package/internal/stores/data_style/mesh/polyhedra/visibility.js +41 -0
  61. package/internal/stores/{model → data_style/model}/blocks.js +1 -1
  62. package/internal/stores/{model → data_style/model}/corners.js +1 -1
  63. package/internal/stores/{model → data_style/model}/edges.js +1 -1
  64. package/internal/stores/{model → data_style/model}/index.js +3 -3
  65. package/internal/stores/{model → data_style/model}/lines.js +1 -1
  66. package/internal/stores/{model → data_style/model}/points.js +1 -1
  67. package/internal/stores/{model → data_style/model}/surfaces.js +1 -1
  68. package/internal/stores/{data_style_state.js → data_style/state.js} +6 -3
  69. package/package.json +1 -1
  70. package/tests/integration/microservices/back/requirements.txt +1 -1
  71. package/tests/integration/microservices/viewer/requirements.txt +1 -1
  72. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -18
  73. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +22 -16
  74. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +1 -1
  75. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +14 -12
  76. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +16 -19
  77. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +16 -19
  78. package/tests/vitest.config.js +3 -0
  79. package/internal/stores/mesh/cells.js +0 -175
  80. package/internal/stores/mesh/edges.js +0 -171
  81. package/internal/stores/mesh/points.js +0 -142
  82. package/internal/stores/mesh/polygons.js +0 -181
  83. package/internal/stores/mesh/polyhedra.js +0 -151
@@ -0,0 +1,145 @@
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 { useMeshPolygonsCommonStyle } from "./common"
8
+
9
+ // Local constants
10
+ const meshPolygonsPolygonAttributeSchemas =
11
+ viewer_schemas.opengeodeweb_viewer.mesh.polygons.attribute.polygon
12
+
13
+ export function useMeshPolygonsPolygonAttributeStyle() {
14
+ const viewerStore = useViewerStore()
15
+ const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle()
16
+
17
+ function meshPolygonsPolygonAttribute(id) {
18
+ return meshPolygonsCommonStyle.meshPolygonsColoring(id).polygon
19
+ }
20
+
21
+ async function updateMeshPolygonsPolygonAttribute(id) {
22
+ const name = meshPolygonsPolygonAttributeName(id)
23
+ const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name)
24
+ await meshPolygonsPolygonAttributeRange(
25
+ id,
26
+ storedConfig.minimum,
27
+ storedConfig.maximum,
28
+ )
29
+ await meshPolygonsPolygonAttributeColorMap(id, storedConfig.colorMap)
30
+ }
31
+
32
+ function meshPolygonsPolygonAttributeStoredConfig(id, name) {
33
+ const storedConfigs = meshPolygonsPolygonAttribute(id).storedConfigs
34
+ if (name in storedConfigs) {
35
+ return storedConfigs[name]
36
+ }
37
+ return setMeshPolygonsPolygonAttributeStoredConfig(id, name, {
38
+ minimum: 0,
39
+ maximum: 1,
40
+ colorMap: "Cool to Warm",
41
+ })
42
+ }
43
+
44
+ function setMeshPolygonsPolygonAttributeStoredConfig(
45
+ id,
46
+ name,
47
+ { minimum, maximum, colorMap },
48
+ ) {
49
+ const storedConfigs = meshPolygonsPolygonAttribute(id).storedConfigs
50
+ storedConfigs[name] = { minimum, maximum, colorMap }
51
+ return storedConfigs[name]
52
+ }
53
+
54
+ function meshPolygonsPolygonAttributeName(id) {
55
+ return meshPolygonsPolygonAttribute(id).name
56
+ }
57
+ function setMeshPolygonsPolygonAttributeName(id, name) {
58
+ return viewerStore.request(
59
+ meshPolygonsPolygonAttributeSchemas.name,
60
+ { id, name },
61
+ {
62
+ response_function: () => {
63
+ meshPolygonsPolygonAttribute(id).name = name
64
+ console.log(
65
+ setMeshPolygonsPolygonAttributeName.name,
66
+ { id },
67
+ meshPolygonsPolygonAttributeName(id),
68
+ )
69
+ },
70
+ },
71
+ )
72
+ }
73
+ function meshPolygonsPolygonAttributeRange(id) {
74
+ const name = meshPolygonsPolygonAttributeName(id)
75
+ const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name)
76
+ const { minimum, maximum } = storedConfig
77
+ console.log(
78
+ meshPolygonsPolygonAttributeRange.name,
79
+ { id },
80
+ { minimum, maximum },
81
+ )
82
+ return [minimum, maximum]
83
+ }
84
+ async function setMeshPolygonsPolygonAttributeRange(id, minimum, maximum) {
85
+ console.log(setMeshPolygonsPolygonAttributeRange.name, {
86
+ id,
87
+ minimum,
88
+ maximum,
89
+ })
90
+ const name = meshPolygonsPolygonAttributeName(id)
91
+ const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name)
92
+ return viewerStore.request(
93
+ meshPolygonsPolygonAttributeSchemas.scalar_range,
94
+ { id, minimum, maximum },
95
+ {
96
+ response_function: () => {
97
+ storedConfig.minimum = minimum
98
+ storedConfig.maximum = maximum
99
+ console.log(
100
+ setMeshPolygonsPolygonAttributeRange.name,
101
+ { id },
102
+ meshPolygonsPolygonAttributeRange(id),
103
+ )
104
+ },
105
+ },
106
+ )
107
+ }
108
+
109
+ function meshPolygonsPolygonAttributeColorMap(id) {
110
+ const name = meshPolygonsPolygonAttributeName(id)
111
+ const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name)
112
+ const { colorMap } = storedConfig
113
+ return colorMap
114
+ }
115
+ function setMeshPolygonsPolygonAttributeColorMap(id, colorMap) {
116
+ const name = meshPolygonsPolygonAttributeName(id)
117
+ const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name)
118
+ const points = getRGBPointsFromPreset(colorMap)
119
+ const { minimum, maximum } = storedConfig
120
+ return viewerStore.request(
121
+ meshPolygonsPolygonAttributeSchemas.color_map,
122
+ { id, points, minimum, maximum },
123
+ {
124
+ response_function: () => {
125
+ storedConfig.colorMap = colorMap
126
+ console.log(
127
+ setMeshPolygonsPolygonAttributeColorMap.name,
128
+ { id },
129
+ meshPolygonsPolygonAttributeColorMap(id),
130
+ )
131
+ },
132
+ },
133
+ )
134
+ }
135
+
136
+ return {
137
+ meshPolygonsPolygonAttributeName,
138
+ meshPolygonsPolygonAttributeRange,
139
+ meshPolygonsPolygonAttributeColorMap,
140
+ setMeshPolygonsPolygonAttributeName,
141
+ setMeshPolygonsPolygonAttributeRange,
142
+ setMeshPolygonsPolygonAttributeColorMap,
143
+ updateMeshPolygonsPolygonAttribute,
144
+ }
145
+ }
@@ -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 { useMeshPolygonsCommonStyle } from "./common"
7
+
8
+ // Local constants
9
+ const meshPolygonsTexturesSchemas =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.polygons.apply_textures
11
+
12
+ export function useMeshPolygonsTexturesStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle()
15
+
16
+ function meshPolygonsTextures(id) {
17
+ return meshPolygonsCommonStyle.meshPolygonsColoring(id).textures
18
+ }
19
+ function setMeshPolygonsTextures(id, textures) {
20
+ return viewerStore.request(
21
+ meshPolygonsTexturesSchemas,
22
+ { id, textures },
23
+ {
24
+ response_function: () => {
25
+ meshPolygonsCommonStyle.meshPolygonsColoring(id).textures = textures
26
+ console.log(
27
+ setMeshPolygonsTextures.name,
28
+ { id },
29
+ meshPolygonsTextures(id),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshPolygonsTextures,
38
+ setMeshPolygonsTextures,
39
+ }
40
+ }
@@ -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 { useMeshPolygonsCommonStyle } from "./common"
8
+
9
+ // Local constants
10
+ const meshPolygonsVertexAttributeSchemas =
11
+ viewer_schemas.opengeodeweb_viewer.mesh.polygons.attribute.vertex
12
+
13
+ export function useMeshPolygonsVertexAttributeStyle() {
14
+ const viewerStore = useViewerStore()
15
+ const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle()
16
+
17
+ function meshPolygonsVertexAttribute(id) {
18
+ return meshPolygonsCommonStyle.meshPolygonsColoring(id).vertex
19
+ }
20
+
21
+ async function updateMeshPolygonsVertexAttribute(id) {
22
+ const name = meshPolygonsVertexAttributeName(id)
23
+ const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name)
24
+ await meshPolygonsVertexAttributeRange(
25
+ id,
26
+ storedConfig.minimum,
27
+ storedConfig.maximum,
28
+ )
29
+ await meshPolygonsVertexAttributeColorMap(id, storedConfig.colorMap)
30
+ }
31
+
32
+ function meshPolygonsVertexAttributeStoredConfig(id, name) {
33
+ const storedConfigs = meshPolygonsVertexAttribute(id).storedConfigs
34
+ if (name in storedConfigs) {
35
+ return storedConfigs[name]
36
+ }
37
+ return setMeshPolygonsVertexAttributeStoredConfig(id, name, {
38
+ minimum: 0,
39
+ maximum: 1,
40
+ colorMap: "Cool to Warm",
41
+ })
42
+ }
43
+
44
+ function setMeshPolygonsVertexAttributeStoredConfig(
45
+ id,
46
+ name,
47
+ { minimum, maximum, colorMap },
48
+ ) {
49
+ const storedConfigs = meshPolygonsVertexAttribute(id).storedConfigs
50
+ storedConfigs[name] = { minimum, maximum, colorMap }
51
+ return storedConfigs[name]
52
+ }
53
+
54
+ function meshPolygonsVertexAttributeName(id) {
55
+ console.log(
56
+ meshPolygonsVertexAttributeName.name,
57
+ { id },
58
+ meshPolygonsVertexAttribute(id),
59
+ )
60
+ return meshPolygonsVertexAttribute(id).name
61
+ }
62
+ function setMeshPolygonsVertexAttributeName(id, name) {
63
+ console.log(setMeshPolygonsVertexAttributeName.name, { id, name })
64
+ return viewerStore.request(
65
+ meshPolygonsVertexAttributeSchemas.name,
66
+ { id, name },
67
+ {
68
+ response_function: async () => {
69
+ meshPolygonsVertexAttribute(id).name = name
70
+ const { minimum, maximum, colorMap } =
71
+ meshPolygonsVertexAttributeStoredConfig(id, name)
72
+ await setMeshPolygonsVertexAttributeRange(id, minimum, maximum)
73
+ await setMeshPolygonsVertexAttributeColorMap(id, colorMap)
74
+ console.log(
75
+ setMeshPolygonsVertexAttributeName.name,
76
+ { id },
77
+ meshPolygonsVertexAttributeName(id),
78
+ )
79
+ },
80
+ },
81
+ )
82
+ }
83
+
84
+ function meshPolygonsVertexAttributeRange(id) {
85
+ const name = meshPolygonsVertexAttributeName(id)
86
+ const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name)
87
+ const { minimum, maximum } = storedConfig
88
+ return [minimum, maximum]
89
+ }
90
+ function setMeshPolygonsVertexAttributeRange(id, minimum, maximum) {
91
+ const name = meshPolygonsVertexAttributeName(id)
92
+ const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name)
93
+ return viewerStore.request(
94
+ meshPolygonsVertexAttributeSchemas.scalar_range,
95
+ { id, minimum, maximum },
96
+ {
97
+ response_function: () => {
98
+ storedConfig.minimum = minimum
99
+ storedConfig.maximum = maximum
100
+ console.log(
101
+ setMeshPolygonsVertexAttributeRange.name,
102
+ { id },
103
+ meshPolygonsVertexAttributeRange(id),
104
+ )
105
+ },
106
+ },
107
+ )
108
+ }
109
+
110
+ function meshPolygonsVertexAttributeColorMap(id) {
111
+ const name = meshPolygonsVertexAttributeName(id)
112
+ const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name)
113
+ const { colorMap } = storedConfig
114
+ return colorMap
115
+ }
116
+ function setMeshPolygonsVertexAttributeColorMap(id, colorMap) {
117
+ const name = meshPolygonsVertexAttributeName(id)
118
+ const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name)
119
+ const points = getRGBPointsFromPreset(colorMap)
120
+ const { minimum, maximum } = storedConfig
121
+
122
+ console.log(setMeshPolygonsVertexAttributeColorMap.name, {
123
+ id,
124
+ minimum,
125
+ maximum,
126
+ colorMap,
127
+ })
128
+ return viewerStore.request(
129
+ meshPolygonsVertexAttributeSchemas.color_map,
130
+ { id, points, minimum, maximum },
131
+ {
132
+ response_function: () => {
133
+ storedConfig.colorMap = colorMap
134
+ console.log(
135
+ setMeshPolygonsVertexAttributeColorMap.name,
136
+ { id },
137
+ meshPolygonsVertexAttributeColorMap(id),
138
+ )
139
+ },
140
+ },
141
+ )
142
+ }
143
+
144
+ return {
145
+ meshPolygonsVertexAttributeName,
146
+ meshPolygonsVertexAttributeRange,
147
+ meshPolygonsVertexAttributeColorMap,
148
+ setMeshPolygonsVertexAttributeName,
149
+ setMeshPolygonsVertexAttributeRange,
150
+ setMeshPolygonsVertexAttributeColorMap,
151
+ updateMeshPolygonsVertexAttribute,
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 { useMeshPolygonsCommonStyle } from "./common"
7
+
8
+ // Local constants
9
+ const meshPolygonsVisibilitySchema =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.polygons.visibility
11
+
12
+ export function useMeshPolygonsVisibilityStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle()
15
+
16
+ function meshPolygonsVisibility(id) {
17
+ return meshPolygonsCommonStyle.meshPolygonsStyle(id).visibility
18
+ }
19
+ function setMeshPolygonsVisibility(id, visibility) {
20
+ return viewerStore.request(
21
+ meshPolygonsVisibilitySchema,
22
+ { id, visibility },
23
+ {
24
+ response_function: () => {
25
+ meshPolygonsCommonStyle.meshPolygonsStyle(id).visibility = visibility
26
+ console.log(
27
+ setMeshPolygonsVisibility.name,
28
+ { id },
29
+ meshPolygonsVisibility(id),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshPolygonsVisibility,
38
+ setMeshPolygonsVisibility,
39
+ }
40
+ }
@@ -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 { useMeshPolyhedraCommonStyle } from "./common"
7
+
8
+ // Local constants
9
+ const meshPolyhedraColorSchemas =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.polyhedra.color
11
+
12
+ export function useMeshPolyhedraColorStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle()
15
+
16
+ function meshPolyhedraColor(id) {
17
+ return meshPolyhedraCommonStyle.meshPolyhedraColoring(id).color
18
+ }
19
+ function setMeshPolyhedraColor(id, color) {
20
+ return viewerStore.request(
21
+ meshPolyhedraColorSchemas,
22
+ { id, color },
23
+ {
24
+ response_function: () => {
25
+ meshPolyhedraCommonStyle.meshPolyhedraColoring(id).color = color
26
+ console.log(
27
+ setMeshPolyhedraColor.name,
28
+ { id },
29
+ JSON.stringify(meshPolyhedraColor(id)),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshPolyhedraColor,
38
+ setMeshPolyhedraColor,
39
+ }
40
+ }
@@ -0,0 +1,23 @@
1
+ import { useDataStyleStateStore } from "../../state"
2
+
3
+ export function useMeshPolyhedraCommonStyle() {
4
+ const dataStyleStateStore = useDataStyleStateStore()
5
+
6
+ function meshPolyhedraStyle(id) {
7
+ return dataStyleStateStore.getStyle(id).polyhedra
8
+ }
9
+
10
+ function meshPolyhedraColoring(id) {
11
+ return meshPolyhedraStyle(id).coloring
12
+ }
13
+
14
+ function meshPolyhedraActiveColoring(id) {
15
+ return meshPolyhedraColoring(id).active
16
+ }
17
+
18
+ return {
19
+ meshPolyhedraStyle,
20
+ meshPolyhedraColoring,
21
+ meshPolyhedraActiveColoring,
22
+ }
23
+ }
@@ -0,0 +1,83 @@
1
+ // Third party imports
2
+
3
+ // Local imports
4
+ import { useMeshPolyhedraCommonStyle } from "./common"
5
+ import { useMeshPolyhedraVisibilityStyle } from "./visibility"
6
+ import { useMeshPolyhedraColorStyle } from "./color"
7
+ import { useMeshPolyhedraVertexAttributeStyle } from "./vertex"
8
+ import { useMeshPolyhedraPolyhedronAttributeStyle } from "./polyhedron"
9
+
10
+ // Local constants
11
+
12
+ export function useMeshPolyhedraStyle() {
13
+ const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle()
14
+ const meshPolyhedraVisibility = useMeshPolyhedraVisibilityStyle()
15
+ const meshPolyhedraColorStyle = useMeshPolyhedraColorStyle()
16
+ const meshPolyhedraVertexAttributeStyle =
17
+ useMeshPolyhedraVertexAttributeStyle()
18
+ const meshPolyhedraPolyhedronAttributeStyle =
19
+ useMeshPolyhedraPolyhedronAttributeStyle()
20
+
21
+ async function setMeshPolyhedraActiveColoring(id, type) {
22
+ const coloring = meshPolyhedraCommonStyle.meshPolyhedraColoring(id)
23
+ coloring.active = type
24
+ console.log(
25
+ setMeshPolyhedraActiveColoring.name,
26
+ { id },
27
+ meshPolyhedraCommonStyle.meshPolyhedraActiveColoring(id),
28
+ )
29
+ if (type === "color") {
30
+ return meshPolyhedraColorStyle.setMeshPolyhedraColor(
31
+ id,
32
+ meshPolyhedraColorStyle.meshPolyhedraColor(id),
33
+ )
34
+ } else if (type === "vertex") {
35
+ const name =
36
+ meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeName(id)
37
+ if (name === null) {
38
+ return Promise.resolve()
39
+ }
40
+ return meshPolyhedraVertexAttributeStyle.setMeshPolyhedraVertexAttributeName(
41
+ id,
42
+ name,
43
+ )
44
+ } else if (type === "polyhedron") {
45
+ const name =
46
+ meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeName(
47
+ id,
48
+ )
49
+ if (name === null) {
50
+ return Promise.resolve()
51
+ }
52
+ await meshPolyhedraPolyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttributeName(
53
+ id,
54
+ name,
55
+ )
56
+ } else {
57
+ throw new Error("Unknown mesh polyhedra coloring type: " + type)
58
+ }
59
+ }
60
+
61
+ function applyMeshPolyhedraStyle(id) {
62
+ return Promise.all([
63
+ meshPolyhedraVisibility.setMeshPolyhedraVisibility(
64
+ id,
65
+ meshPolyhedraVisibility.meshPolyhedraVisibility(id),
66
+ ),
67
+ setMeshPolyhedraActiveColoring(
68
+ id,
69
+ meshPolyhedraCommonStyle.meshPolyhedraActiveColoring(id),
70
+ ),
71
+ ])
72
+ }
73
+
74
+ return {
75
+ setMeshPolyhedraActiveColoring,
76
+ applyMeshPolyhedraStyle,
77
+ ...meshPolyhedraCommonStyle,
78
+ ...meshPolyhedraVisibility,
79
+ ...meshPolyhedraColorStyle,
80
+ ...meshPolyhedraVertexAttributeStyle,
81
+ ...meshPolyhedraPolyhedronAttributeStyle,
82
+ }
83
+ }
@@ -0,0 +1,139 @@
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 { useMeshPolyhedraCommonStyle } from "./common"
8
+
9
+ // Local constants
10
+ const meshPolyhedraPolyhedronAttributeSchemas =
11
+ viewer_schemas.opengeodeweb_viewer.mesh.polyhedra.attribute.polyhedron
12
+
13
+ export function useMeshPolyhedraPolyhedronAttributeStyle() {
14
+ const viewerStore = useViewerStore()
15
+ const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle()
16
+
17
+ function meshPolyhedraPolyhedronAttribute(id) {
18
+ return meshPolyhedraCommonStyle.meshPolyhedraColoring(id).polyhedron
19
+ }
20
+
21
+ async function updateMeshPolyhedraPolyhedronAttribute(id) {
22
+ const name = meshPolyhedraPolyhedronAttributeName(id)
23
+ const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name)
24
+ await meshPolyhedraPolyhedronAttributeRange(
25
+ id,
26
+ storedConfig.minimum,
27
+ storedConfig.maximum,
28
+ )
29
+ await meshPolyhedraPolyhedronAttributeColorMap(id, storedConfig.colorMap)
30
+ }
31
+
32
+ function meshPolyhedraPolyhedronAttributeStoredConfig(id, name) {
33
+ const storedConfigs = meshPolyhedraPolyhedronAttribute(id).storedConfigs
34
+ if (name in storedConfigs) {
35
+ return storedConfigs[name]
36
+ }
37
+ return setMeshPolyhedraPolyhedronAttributeStoredConfig(id, name, {
38
+ minimum: 0,
39
+ maximum: 1,
40
+ colorMap: "Cool to Warm",
41
+ })
42
+ }
43
+
44
+ function setMeshPolyhedraPolyhedronAttributeStoredConfig(
45
+ id,
46
+ name,
47
+ { minimum, maximum, colorMap },
48
+ ) {
49
+ const storedConfigs = meshPolyhedraPolyhedronAttribute(id).storedConfigs
50
+ storedConfigs[name] = { minimum, maximum, colorMap }
51
+ return storedConfigs[name]
52
+ }
53
+
54
+ function meshPolyhedraPolyhedronAttributeName(id) {
55
+ return meshPolyhedraPolyhedronAttribute(id).name
56
+ }
57
+ function setMeshPolyhedraPolyhedronAttributeName(id, name) {
58
+ return viewerStore.request(
59
+ meshPolyhedraPolyhedronAttributeSchemas.name,
60
+ { id, name },
61
+ {
62
+ response_function: async () => {
63
+ meshPolyhedraPolyhedronAttribute(id).name = name
64
+ const { minimum, maximum, colorMap } =
65
+ meshPolyhedraPolyhedronAttributeStoredConfig(id, name)
66
+ await setMeshPolyhedraPolyhedronAttributeRange(id, minimum, maximum)
67
+ await setMeshPolyhedraPolyhedronAttributeColorMap(id, colorMap)
68
+ console.log(
69
+ setMeshPolyhedraPolyhedronAttributeName.name,
70
+ { id },
71
+ meshPolyhedraPolyhedronAttributeName(id),
72
+ )
73
+ },
74
+ },
75
+ )
76
+ }
77
+ function meshPolyhedraPolyhedronAttributeRange(id) {
78
+ const name = meshPolyhedraPolyhedronAttributeName(id)
79
+ const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name)
80
+ const { minimum, maximum } = storedConfig
81
+ return [minimum, maximum]
82
+ }
83
+ function setMeshPolyhedraPolyhedronAttributeRange(id, minimum, maximum) {
84
+ const name = meshPolyhedraPolyhedronAttributeName(id)
85
+ const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name)
86
+ return viewerStore.request(
87
+ meshPolyhedraPolyhedronAttributeSchemas.scalar_range,
88
+ { id, minimum, maximum },
89
+ {
90
+ response_function: () => {
91
+ storedConfig.minimum = minimum
92
+ storedConfig.maximum = maximum
93
+ console.log(
94
+ setMeshPolyhedraPolyhedronAttributeRange.name,
95
+ { id },
96
+ meshPolyhedraPolyhedronAttributeRange(id),
97
+ )
98
+ },
99
+ },
100
+ )
101
+ }
102
+
103
+ function meshPolyhedraPolyhedronAttributeColorMap(id) {
104
+ const name = meshPolyhedraPolyhedronAttributeName(id)
105
+ const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name)
106
+ const { colorMap } = storedConfig
107
+ return colorMap
108
+ }
109
+ function setMeshPolyhedraPolyhedronAttributeColorMap(id, colorMap) {
110
+ const name = meshPolyhedraPolyhedronAttributeName(id)
111
+ const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name)
112
+ const points = getRGBPointsFromPreset(colorMap)
113
+ const { minimum, maximum } = storedConfig
114
+ return viewerStore.request(
115
+ meshPolyhedraPolyhedronAttributeSchemas.color_map,
116
+ { id, points, minimum, maximum },
117
+ {
118
+ response_function: () => {
119
+ storedConfig.colorMap = colorMap
120
+ console.log(
121
+ setMeshPolyhedraPolyhedronAttributeColorMap.name,
122
+ { id },
123
+ meshPolyhedraPolyhedronAttributeColorMap(id),
124
+ )
125
+ },
126
+ },
127
+ )
128
+ }
129
+
130
+ return {
131
+ meshPolyhedraPolyhedronAttributeName,
132
+ meshPolyhedraPolyhedronAttributeRange,
133
+ meshPolyhedraPolyhedronAttributeColorMap,
134
+ setMeshPolyhedraPolyhedronAttributeName,
135
+ setMeshPolyhedraPolyhedronAttributeRange,
136
+ setMeshPolyhedraPolyhedronAttributeColorMap,
137
+ updateMeshPolyhedraPolyhedronAttribute,
138
+ }
139
+ }