@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,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 meshCellsVertexAttributeSchemas =
11
+ viewer_schemas.opengeodeweb_viewer.mesh.cells.attribute.vertex
12
+
13
+ export function useMeshCellsVertexAttributeStyle() {
14
+ const viewerStore = useViewerStore()
15
+ const meshCellsCommonStyle = useMeshCellsCommonStyle()
16
+
17
+ function meshCellsVertexAttribute(id) {
18
+ return meshCellsCommonStyle.meshCellsColoring(id).vertex
19
+ }
20
+
21
+ async function updateMeshCellsVertexAttribute(id) {
22
+ const name = meshCellsVertexAttributeName(id)
23
+ const storedConfig = meshCellsVertexAttributeStoredConfig(id, name)
24
+ await meshCellsVertexAttributeRange(
25
+ id,
26
+ storedConfig.minimum,
27
+ storedConfig.maximum,
28
+ )
29
+ await meshCellsVertexAttributeColorMap(id, storedConfig.colorMap)
30
+ }
31
+
32
+ function meshCellsVertexAttributeStoredConfig(id, name) {
33
+ const storedConfigs = meshCellsVertexAttribute(id).storedConfigs
34
+ if (name in storedConfigs) {
35
+ return storedConfigs[name]
36
+ }
37
+ return setMeshCellsVertexAttributeStoredConfig(id, name, {
38
+ minimum: 0,
39
+ maximum: 1,
40
+ colorMap: "Cool to Warm",
41
+ })
42
+ }
43
+
44
+ function setMeshCellsVertexAttributeStoredConfig(
45
+ id,
46
+ name,
47
+ { minimum, maximum, colorMap },
48
+ ) {
49
+ const storedConfigs = meshCellsVertexAttribute(id).storedConfigs
50
+ storedConfigs[name] = { minimum, maximum, colorMap }
51
+ return storedConfigs[name]
52
+ }
53
+
54
+ function meshCellsVertexAttributeName(id) {
55
+ console.log(
56
+ meshCellsVertexAttributeName.name,
57
+ { id },
58
+ meshCellsVertexAttribute(id),
59
+ )
60
+ return meshCellsVertexAttribute(id).name
61
+ }
62
+ function setMeshCellsVertexAttributeName(id, name) {
63
+ console.log(setMeshCellsVertexAttributeName.name, { id, name })
64
+ return viewerStore.request(
65
+ meshCellsVertexAttributeSchemas.name,
66
+ { id, name },
67
+ {
68
+ response_function: async () => {
69
+ meshCellsVertexAttribute(id).name = name
70
+ const { minimum, maximum, colorMap } =
71
+ meshCellsVertexAttributeStoredConfig(id, name)
72
+ await setMeshCellsVertexAttributeRange(id, minimum, maximum)
73
+ await setMeshCellsVertexAttributeColorMap(id, colorMap)
74
+ console.log(
75
+ setMeshCellsVertexAttributeName.name,
76
+ { id },
77
+ meshCellsVertexAttributeName(id),
78
+ )
79
+ },
80
+ },
81
+ )
82
+ }
83
+
84
+ function meshCellsVertexAttributeRange(id) {
85
+ const name = meshCellsVertexAttributeName(id)
86
+ const storedConfig = meshCellsVertexAttributeStoredConfig(id, name)
87
+ const { minimum, maximum } = storedConfig
88
+ return [minimum, maximum]
89
+ }
90
+ function setMeshCellsVertexAttributeRange(id, minimum, maximum) {
91
+ const name = meshCellsVertexAttributeName(id)
92
+ const storedConfig = meshCellsVertexAttributeStoredConfig(id, name)
93
+ return viewerStore.request(
94
+ meshCellsVertexAttributeSchemas.scalar_range,
95
+ { id, minimum, maximum },
96
+ {
97
+ response_function: () => {
98
+ storedConfig.minimum = minimum
99
+ storedConfig.maximum = maximum
100
+ console.log(
101
+ setMeshCellsVertexAttributeRange.name,
102
+ { id },
103
+ meshCellsVertexAttributeRange(id),
104
+ )
105
+ },
106
+ },
107
+ )
108
+ }
109
+
110
+ function meshCellsVertexAttributeColorMap(id) {
111
+ const name = meshCellsVertexAttributeName(id)
112
+ const storedConfig = meshCellsVertexAttributeStoredConfig(id, name)
113
+ const { colorMap } = storedConfig
114
+ return colorMap
115
+ }
116
+ function setMeshCellsVertexAttributeColorMap(id, colorMap) {
117
+ const name = meshCellsVertexAttributeName(id)
118
+ const storedConfig = meshCellsVertexAttributeStoredConfig(id, name)
119
+ const points = getRGBPointsFromPreset(colorMap)
120
+ const { minimum, maximum } = storedConfig
121
+
122
+ console.log(setMeshCellsVertexAttributeColorMap.name, {
123
+ id,
124
+ minimum,
125
+ maximum,
126
+ colorMap,
127
+ })
128
+ return viewerStore.request(
129
+ meshCellsVertexAttributeSchemas.color_map,
130
+ { id, points, minimum, maximum },
131
+ {
132
+ response_function: () => {
133
+ storedConfig.colorMap = colorMap
134
+ console.log(
135
+ setMeshCellsVertexAttributeColorMap.name,
136
+ { id },
137
+ meshCellsVertexAttributeColorMap(id),
138
+ )
139
+ },
140
+ },
141
+ )
142
+ }
143
+
144
+ return {
145
+ meshCellsVertexAttributeName,
146
+ meshCellsVertexAttributeRange,
147
+ meshCellsVertexAttributeColorMap,
148
+ setMeshCellsVertexAttributeName,
149
+ setMeshCellsVertexAttributeRange,
150
+ setMeshCellsVertexAttributeColorMap,
151
+ updateMeshCellsVertexAttribute,
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 meshCellsVisibilitySchema =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.cells.visibility
11
+
12
+ export function useMeshCellsVisibilityStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshCellsCommonStyle = useMeshCellsCommonStyle()
15
+
16
+ function meshCellsVisibility(id) {
17
+ return meshCellsCommonStyle.meshCellsStyle(id).visibility
18
+ }
19
+ function setMeshCellsVisibility(id, visibility) {
20
+ return viewerStore.request(
21
+ meshCellsVisibilitySchema,
22
+ { id, visibility },
23
+ {
24
+ response_function: () => {
25
+ meshCellsCommonStyle.meshCellsStyle(id).visibility = visibility
26
+ console.log(
27
+ setMeshCellsVisibility.name,
28
+ { id },
29
+ meshCellsVisibility(id),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshCellsVisibility,
38
+ setMeshCellsVisibility,
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 { useMeshEdgesCommonStyle } from "./common"
7
+
8
+ // Local constants
9
+ const meshEdgesColorSchemas =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.edges.color
11
+
12
+ export function useMeshEdgesColorStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshEdgesCommonStyle = useMeshEdgesCommonStyle()
15
+
16
+ function meshEdgesColor(id) {
17
+ return meshEdgesCommonStyle.meshEdgesColoring(id).color
18
+ }
19
+ function setMeshEdgesColor(id, color) {
20
+ return viewerStore.request(
21
+ meshEdgesColorSchemas,
22
+ { id, color },
23
+ {
24
+ response_function: () => {
25
+ meshEdgesCommonStyle.meshEdgesColoring(id).color = color
26
+ console.log(
27
+ setMeshEdgesColor.name,
28
+ { id },
29
+ JSON.stringify(meshEdgesColor(id)),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshEdgesColor,
38
+ setMeshEdgesColor,
39
+ }
40
+ }
@@ -0,0 +1,23 @@
1
+ import { useDataStyleStateStore } from "../../state"
2
+
3
+ export function useMeshEdgesCommonStyle() {
4
+ const dataStyleStateStore = useDataStyleStateStore()
5
+
6
+ function meshEdgesStyle(id) {
7
+ return dataStyleStateStore.getStyle(id).edges
8
+ }
9
+
10
+ function meshEdgesColoring(id) {
11
+ return meshEdgesStyle(id).coloring
12
+ }
13
+
14
+ function meshEdgesActiveColoring(id) {
15
+ return meshEdgesColoring(id).active
16
+ }
17
+
18
+ return {
19
+ meshEdgesStyle,
20
+ meshEdgesColoring,
21
+ meshEdgesActiveColoring,
22
+ }
23
+ }
@@ -0,0 +1,141 @@
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 { useMeshEdgesCommonStyle } from "./common"
8
+
9
+ // Local constants
10
+ const meshEdgesEdgeAttributeSchemas =
11
+ viewer_schemas.opengeodeweb_viewer.mesh.edges.attribute.edge
12
+
13
+ export function useMeshEdgesEdgeAttributeStyle() {
14
+ const viewerStore = useViewerStore()
15
+ const meshEdgesCommonStyle = useMeshEdgesCommonStyle()
16
+
17
+ function meshEdgesEdgeAttribute(id) {
18
+ return meshEdgesCommonStyle.meshEdgesColoring(id).edge
19
+ }
20
+
21
+ function meshEdgesEdgeAttributeStoredConfig(id, name) {
22
+ const storedConfigs = meshEdgesEdgeAttribute(id).storedConfigs
23
+ if (name in storedConfigs) {
24
+ return storedConfigs[name]
25
+ }
26
+ return setMeshEdgesEdgeAttributeStoredConfig(id, name, {
27
+ minimum: 0,
28
+ maximum: 1,
29
+ colorMap: "Cool to Warm",
30
+ })
31
+ }
32
+
33
+ function setMeshEdgesEdgeAttributeStoredConfig(
34
+ id,
35
+ name,
36
+ { minimum, maximum, colorMap },
37
+ ) {
38
+ const storedConfigs = meshEdgesEdgeAttribute(id).storedConfigs
39
+ storedConfigs[name] = { minimum, maximum, colorMap }
40
+ return storedConfigs[name]
41
+ }
42
+
43
+ function meshEdgesEdgeAttributeName(id) {
44
+ console.log(
45
+ meshEdgesEdgeAttributeName.name,
46
+ { id },
47
+ meshEdgesEdgeAttribute(id),
48
+ )
49
+ return meshEdgesEdgeAttribute(id).name
50
+ }
51
+ function setMeshEdgesEdgeAttributeName(id, name) {
52
+ console.log(setMeshEdgesEdgeAttributeName.name, { id, name })
53
+ return viewerStore.request(
54
+ meshEdgesEdgeAttributeSchemas.name,
55
+ { id, name },
56
+ {
57
+ response_function: async () => {
58
+ meshEdgesEdgeAttribute(id).name = name
59
+ // const { minimum, maximum, colorMap } =
60
+ // meshEdgesEdgeAttributeStoredConfig(id, name)
61
+ // await setMeshEdgesEdgeAttributeRange(id, minimum, maximum)
62
+ // await setMeshEdgesEdgeAttributeColorMap(id, colorMap)
63
+ console.log(
64
+ setMeshEdgesEdgeAttributeName.name,
65
+ { id },
66
+ meshEdgesEdgeAttributeName(id),
67
+ )
68
+ },
69
+ },
70
+ )
71
+ }
72
+
73
+ // function meshEdgesEdgeAttributeRange(id) {
74
+ // const name = meshEdgesEdgeAttributeName(id)
75
+ // const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name)
76
+ // const { minimum, maximum } = storedConfig
77
+ // return [minimum, maximum]
78
+ // }
79
+ // function setMeshEdgesEdgeAttributeRange(id, minimum, maximum) {
80
+ // const name = meshEdgesEdgeAttributeName(id)
81
+ // const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name)
82
+ // return viewerStore.request(
83
+ // meshEdgesEdgeAttributeSchemas.scalar_range,
84
+ // { id, minimum, maximum },
85
+ // {
86
+ // response_function: () => {
87
+ // storedConfig.minimum = minimum
88
+ // storedConfig.maximum = maximum
89
+ // console.log(
90
+ // setMeshEdgesEdgeAttributeRange.name,
91
+ // { id },
92
+ // meshEdgesEdgeAttributeRange(id),
93
+ // )
94
+ // },
95
+ // },
96
+ // )
97
+ // }
98
+
99
+ // function meshEdgesEdgeAttributeColorMap(id) {
100
+ // const name = meshEdgesEdgeAttributeName(id)
101
+ // const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name)
102
+ // const { colorMap } = storedConfig
103
+ // return colorMap
104
+ // }
105
+ // function setMeshEdgesEdgeAttributeColorMap(id, colorMap) {
106
+ // const name = meshEdgesEdgeAttributeName(id)
107
+ // const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name)
108
+ // const points = getRGBPointsFromPreset(colorMap)
109
+ // const { minimum, maximum } = storedConfig
110
+
111
+ // console.log(setMeshEdgesEdgeAttributeColorMap.name, {
112
+ // id,
113
+ // minimum,
114
+ // maximum,
115
+ // colorMap,
116
+ // })
117
+ // return viewerStore.request(
118
+ // meshEdgesEdgeAttributeSchemas.color_map,
119
+ // { id, points, minimum, maximum },
120
+ // {
121
+ // response_function: () => {
122
+ // storedConfig.colorMap = colorMap
123
+ // console.log(
124
+ // setMeshEdgesEdgeAttributeColorMap.name,
125
+ // { id },
126
+ // meshEdgesEdgeAttributeColorMap(id),
127
+ // )
128
+ // },
129
+ // },
130
+ // )
131
+ // }
132
+
133
+ return {
134
+ meshEdgesEdgeAttributeName,
135
+ // meshEdgesEdgeAttributeRange,
136
+ // meshEdgesEdgeAttributeColorMap,
137
+ setMeshEdgesEdgeAttributeName,
138
+ // setMeshEdgesEdgeAttributeRange,
139
+ // setMeshEdgesEdgeAttributeColorMap,
140
+ }
141
+ }
@@ -0,0 +1,88 @@
1
+ // Third party imports
2
+
3
+ // Local imports
4
+ import { useMeshEdgesCommonStyle } from "./common"
5
+ import { useMeshEdgesVisibilityStyle } from "./visibility"
6
+ import { useMeshEdgesColorStyle } from "./color"
7
+ import { useMeshEdgesWidthStyle } from "./width"
8
+ import { useMeshEdgesVertexAttributeStyle } from "./vertex"
9
+ import { useMeshEdgesEdgeAttributeStyle } from "./edge"
10
+
11
+ // Local constants
12
+
13
+ export function useMeshEdgesStyle() {
14
+ const meshEdgesCommonStyle = useMeshEdgesCommonStyle()
15
+ const meshEdgesVisibility = useMeshEdgesVisibilityStyle()
16
+ const meshEdgesColorStyle = useMeshEdgesColorStyle()
17
+ const meshEdgesWidthStyle = useMeshEdgesWidthStyle()
18
+ const meshEdgesVertexAttributeStyle = useMeshEdgesVertexAttributeStyle()
19
+ const meshEdgesEdgeAttributeStyle = useMeshEdgesEdgeAttributeStyle()
20
+
21
+ async function setMeshEdgesActiveColoring(id, type) {
22
+ const coloring = meshEdgesCommonStyle.meshEdgesColoring(id)
23
+ coloring.active = type
24
+ console.log(
25
+ setMeshEdgesActiveColoring.name,
26
+ { id },
27
+ meshEdgesCommonStyle.meshEdgesActiveColoring(id),
28
+ )
29
+ if (type === "color") {
30
+ return meshEdgesColorStyle.setMeshEdgesColor(
31
+ id,
32
+ meshEdgesColorStyle.meshEdgesColor(id),
33
+ )
34
+ } else if (type === "textures") {
35
+ const textures = meshEdgesTexturesStore.meshEdgesTextures(id)
36
+ if (textures === null) {
37
+ return Promise.resolve()
38
+ }
39
+ return meshEdgesTexturesStore.setMeshEdgesTextures(id, textures)
40
+ } else if (type === "vertex") {
41
+ const name =
42
+ meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeName(id)
43
+ if (name === null) {
44
+ return Promise.resolve()
45
+ }
46
+ return meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(
47
+ id,
48
+ name,
49
+ )
50
+ } else if (type === "edge") {
51
+ const name = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeName(id)
52
+ if (name === null) {
53
+ return Promise.resolve()
54
+ }
55
+ return meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name)
56
+ } else {
57
+ throw new Error("Unknown mesh edges coloring type: " + type)
58
+ }
59
+ }
60
+
61
+ function applyMeshEdgesStyle(id) {
62
+ return Promise.all([
63
+ meshEdgesVisibility.setMeshEdgesVisibility(
64
+ id,
65
+ meshEdgesVisibility.meshEdgesVisibility(id),
66
+ ),
67
+ meshEdgesWidthStyle.setMeshEdgesWidth(
68
+ id,
69
+ meshEdgesWidthStyle.meshEdgesWidth(id),
70
+ ),
71
+ setMeshEdgesActiveColoring(
72
+ id,
73
+ meshEdgesCommonStyle.meshEdgesActiveColoring(id),
74
+ ),
75
+ ])
76
+ }
77
+
78
+ return {
79
+ setMeshEdgesActiveColoring,
80
+ applyMeshEdgesStyle,
81
+ ...meshEdgesCommonStyle,
82
+ ...meshEdgesVisibility,
83
+ ...meshEdgesColorStyle,
84
+ ...meshEdgesWidthStyle,
85
+ ...meshEdgesVertexAttributeStyle,
86
+ ...meshEdgesEdgeAttributeStyle,
87
+ }
88
+ }
@@ -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 { useMeshEdgesCommonStyle } from "./common"
8
+
9
+ // Local constants
10
+ const meshEdgesVertexAttributeSchemas =
11
+ viewer_schemas.opengeodeweb_viewer.mesh.edges.attribute.vertex
12
+
13
+ export function useMeshEdgesVertexAttributeStyle() {
14
+ const viewerStore = useViewerStore()
15
+ const meshEdgesCommonStyle = useMeshEdgesCommonStyle()
16
+
17
+ function meshEdgesVertexAttribute(id) {
18
+ return meshEdgesCommonStyle.meshEdgesColoring(id).vertex
19
+ }
20
+
21
+ async function updateMeshEdgesVertexAttribute(id) {
22
+ const name = meshEdgesVertexAttributeName(id)
23
+ const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name)
24
+ await meshEdgesVertexAttributeRange(
25
+ id,
26
+ storedConfig.minimum,
27
+ storedConfig.maximum,
28
+ )
29
+ await meshEdgesVertexAttributeColorMap(id, storedConfig.colorMap)
30
+ }
31
+
32
+ function meshEdgesVertexAttributeStoredConfig(id, name) {
33
+ const storedConfigs = meshEdgesVertexAttribute(id).storedConfigs
34
+ if (name in storedConfigs) {
35
+ return storedConfigs[name]
36
+ }
37
+ return setMeshEdgesVertexAttributeStoredConfig(id, name, {
38
+ minimum: 0,
39
+ maximum: 1,
40
+ colorMap: "Cool to Warm",
41
+ })
42
+ }
43
+
44
+ function setMeshEdgesVertexAttributeStoredConfig(
45
+ id,
46
+ name,
47
+ { minimum, maximum, colorMap },
48
+ ) {
49
+ const storedConfigs = meshEdgesVertexAttribute(id).storedConfigs
50
+ storedConfigs[name] = { minimum, maximum, colorMap }
51
+ return storedConfigs[name]
52
+ }
53
+
54
+ function meshEdgesVertexAttributeName(id) {
55
+ console.log(
56
+ meshEdgesVertexAttributeName.name,
57
+ { id },
58
+ meshEdgesVertexAttribute(id),
59
+ )
60
+ return meshEdgesVertexAttribute(id).name
61
+ }
62
+ function setMeshEdgesVertexAttributeName(id, name) {
63
+ console.log(setMeshEdgesVertexAttributeName.name, { id, name })
64
+ return viewerStore.request(
65
+ meshEdgesVertexAttributeSchemas.name,
66
+ { id, name },
67
+ {
68
+ response_function: async () => {
69
+ meshEdgesVertexAttribute(id).name = name
70
+ const { minimum, maximum, colorMap } =
71
+ meshEdgesVertexAttributeStoredConfig(id, name)
72
+ await setMeshEdgesVertexAttributeRange(id, minimum, maximum)
73
+ await setMeshEdgesVertexAttributeColorMap(id, colorMap)
74
+ console.log(
75
+ setMeshEdgesVertexAttributeName.name,
76
+ { id },
77
+ meshEdgesVertexAttributeName(id),
78
+ )
79
+ },
80
+ },
81
+ )
82
+ }
83
+
84
+ function meshEdgesVertexAttributeRange(id) {
85
+ const name = meshEdgesVertexAttributeName(id)
86
+ const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name)
87
+ const { minimum, maximum } = storedConfig
88
+ return [minimum, maximum]
89
+ }
90
+ function setMeshEdgesVertexAttributeRange(id, minimum, maximum) {
91
+ const name = meshEdgesVertexAttributeName(id)
92
+ const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name)
93
+ return viewerStore.request(
94
+ meshEdgesVertexAttributeSchemas.scalar_range,
95
+ { id, minimum, maximum },
96
+ {
97
+ response_function: () => {
98
+ storedConfig.minimum = minimum
99
+ storedConfig.maximum = maximum
100
+ console.log(
101
+ setMeshEdgesVertexAttributeRange.name,
102
+ { id },
103
+ meshEdgesVertexAttributeRange(id),
104
+ )
105
+ },
106
+ },
107
+ )
108
+ }
109
+
110
+ function meshEdgesVertexAttributeColorMap(id) {
111
+ const name = meshEdgesVertexAttributeName(id)
112
+ const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name)
113
+ const { colorMap } = storedConfig
114
+ return colorMap
115
+ }
116
+ function setMeshEdgesVertexAttributeColorMap(id, colorMap) {
117
+ const name = meshEdgesVertexAttributeName(id)
118
+ const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name)
119
+ const points = getRGBPointsFromPreset(colorMap)
120
+ const { minimum, maximum } = storedConfig
121
+
122
+ console.log(setMeshEdgesVertexAttributeColorMap.name, {
123
+ id,
124
+ minimum,
125
+ maximum,
126
+ colorMap,
127
+ })
128
+ return viewerStore.request(
129
+ meshEdgesVertexAttributeSchemas.color_map,
130
+ { id, points, minimum, maximum },
131
+ {
132
+ response_function: () => {
133
+ storedConfig.colorMap = colorMap
134
+ console.log(
135
+ setMeshEdgesVertexAttributeColorMap.name,
136
+ { id },
137
+ meshEdgesVertexAttributeColorMap(id),
138
+ )
139
+ },
140
+ },
141
+ )
142
+ }
143
+
144
+ return {
145
+ meshEdgesVertexAttributeName,
146
+ meshEdgesVertexAttributeRange,
147
+ meshEdgesVertexAttributeColorMap,
148
+ setMeshEdgesVertexAttributeName,
149
+ setMeshEdgesVertexAttributeRange,
150
+ setMeshEdgesVertexAttributeColorMap,
151
+ updateMeshEdgesVertexAttribute,
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 { useMeshEdgesCommonStyle } from "./common"
7
+
8
+ // Local constants
9
+ const meshEdgesVisibilitySchema =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.edges.visibility
11
+
12
+ export function useMeshEdgesVisibilityStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshEdgesCommonStyle = useMeshEdgesCommonStyle()
15
+
16
+ function meshEdgesVisibility(id) {
17
+ return meshEdgesCommonStyle.meshEdgesStyle(id).visibility
18
+ }
19
+ function setMeshEdgesVisibility(id, visibility) {
20
+ return viewerStore.request(
21
+ meshEdgesVisibilitySchema,
22
+ { id, visibility },
23
+ {
24
+ response_function: () => {
25
+ meshEdgesCommonStyle.meshEdgesStyle(id).visibility = visibility
26
+ console.log(
27
+ setMeshEdgesVisibility.name,
28
+ { id },
29
+ meshEdgesVisibility(id),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshEdgesVisibility,
38
+ setMeshEdgesVisibility,
39
+ }
40
+ }