@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,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 meshEdgesWidthSchemas =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.edges.width
11
+
12
+ export function useMeshEdgesWidthStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshEdgesCommonStyle = useMeshEdgesCommonStyle()
15
+
16
+ function meshEdgesWidth(id) {
17
+ return meshEdgesCommonStyle.meshEdgesStyle(id).width
18
+ }
19
+ function setMeshEdgesWidth(id, width) {
20
+ return viewerStore.request(
21
+ meshEdgesWidthSchemas,
22
+ { id, width },
23
+ {
24
+ response_function: () => {
25
+ meshEdgesCommonStyle.meshEdgesStyle(id).width = width
26
+ console.log(
27
+ setMeshEdgesWidth.name,
28
+ { id },
29
+ JSON.stringify(meshEdgesWidth(id)),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshEdgesWidth,
38
+ setMeshEdgesWidth,
39
+ }
40
+ }
@@ -3,8 +3,9 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
3
3
 
4
4
  // Local imports
5
5
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer"
6
- import { useDataStyleStateStore } from "../data_style_state"
7
6
  import { useViewerStore } from "@ogw_front/stores/viewer"
7
+
8
+ import { useDataStyleStateStore } from "../state"
8
9
  import { useMeshPointsStyle } from "./points"
9
10
  import { useMeshEdgesStyle } from "./edges"
10
11
  import { useMeshCellsStyle } from "./cells"
@@ -12,29 +13,29 @@ import { useMeshPolygonsStyle } from "./polygons"
12
13
  import { useMeshPolyhedraStyle } from "./polyhedra"
13
14
 
14
15
  // Local constants
15
- const mesh_schemas = viewer_schemas.opengeodeweb_viewer.mesh
16
+ const meshSchemas = viewer_schemas.opengeodeweb_viewer.mesh
16
17
 
17
18
  export default function useMeshStyle() {
18
- const dataStyleStateStore = useDataStyleStateStore()
19
- const meshCellsStyleStore = useMeshCellsStyle()
20
- const meshEdgesStyleStore = useMeshEdgesStyle()
21
- const meshPointsStyleStore = useMeshPointsStyle()
22
- const meshPolygonsStyleStore = useMeshPolygonsStyle()
23
- const meshPolyhedraStyleStore = useMeshPolyhedraStyle()
24
- const viewerStore = useViewerStore()
25
19
  const hybridViewerStore = useHybridViewerStore()
20
+ const viewerStore = useViewerStore()
21
+ const dataStyleState = useDataStyleStateStore()
22
+ const meshPointsStyle = useMeshPointsStyle()
23
+ const meshEdgesStyle = useMeshEdgesStyle()
24
+ const meshCellsStyle = useMeshCellsStyle()
25
+ const meshPolygonsStyle = useMeshPolygonsStyle()
26
+ const meshPolyhedraStyle = useMeshPolyhedraStyle()
26
27
 
27
28
  function meshVisibility(id) {
28
- return dataStyleStateStore.getStyle(id).visibility
29
+ return dataStyleState.getStyle(id).visibility
29
30
  }
30
31
  function setMeshVisibility(id, visibility) {
31
32
  return viewerStore.request(
32
- mesh_schemas.visibility,
33
+ meshSchemas.visibility,
33
34
  { id, visibility },
34
35
  {
35
36
  response_function: () => {
36
37
  hybridViewerStore.setVisibility(id, visibility)
37
- dataStyleStateStore.getStyle(id).visibility = visibility
38
+ dataStyleState.getStyle(id).visibility = visibility
38
39
  console.log(setMeshVisibility.name, { id }, meshVisibility(id))
39
40
  },
40
41
  },
@@ -42,21 +43,22 @@ export default function useMeshStyle() {
42
43
  }
43
44
 
44
45
  function applyMeshStyle(id) {
45
- const style = dataStyleStateStore.getStyle(id)
46
+ const style = dataStyleState.getStyle(id)
46
47
  const promise_array = []
47
48
  for (const [key, value] of Object.entries(style)) {
48
49
  if (key === "visibility") {
49
50
  promise_array.push(setMeshVisibility(id, value))
50
51
  } else if (key === "points") {
51
- promise_array.push(meshPointsStyleStore.applyMeshPointsStyle(id))
52
+ promise_array.push(meshPointsStyle.applyMeshPointsStyle(id))
52
53
  } else if (key === "edges") {
53
- promise_array.push(meshEdgesStyleStore.applyMeshEdgesStyle(id))
54
+ promise_array.push(meshEdgesStyle.applyMeshEdgesStyle(id))
54
55
  } else if (key === "cells") {
55
- promise_array.push(meshCellsStyleStore.applyMeshCellsStyle(id))
56
+ promise_array.push(meshCellsStyle.applyMeshCellsStyle(id))
56
57
  } else if (key === "polygons") {
57
- promise_array.push(meshPolygonsStyleStore.applyMeshPolygonsStyle(id))
58
+ promise_array.push(meshPolygonsStyle.applyMeshPolygonsStyle(id))
58
59
  } else if (key === "polyhedra") {
59
- promise_array.push(meshPolyhedraStyleStore.applyMeshPolyhedraStyle(id))
60
+ promise_array.push(meshPolyhedraStyle.applyMeshPolyhedraStyle(id))
61
+ } else if (key === "attributes") {
60
62
  } else {
61
63
  throw new Error("Unknown mesh key: " + key)
62
64
  }
@@ -68,10 +70,10 @@ export default function useMeshStyle() {
68
70
  meshVisibility,
69
71
  setMeshVisibility,
70
72
  applyMeshStyle,
71
- ...useMeshPointsStyle(),
72
- ...useMeshEdgesStyle(),
73
- ...useMeshCellsStyle(),
74
- ...useMeshPolygonsStyle(),
75
- ...useMeshPolyhedraStyle(),
73
+ ...meshPointsStyle,
74
+ ...meshEdgesStyle,
75
+ ...meshCellsStyle,
76
+ ...meshPolygonsStyle,
77
+ ...meshPolyhedraStyle,
76
78
  }
77
79
  }
@@ -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 { useMeshPointsCommonStyle } from "./common"
7
+
8
+ // Local constants
9
+ const meshPointsColorSchemas =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.points.color
11
+
12
+ export function useMeshPointsColorStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshPointsCommonStyle = useMeshPointsCommonStyle()
15
+
16
+ function meshPointsColor(id) {
17
+ return meshPointsCommonStyle.meshPointsColoring(id).color
18
+ }
19
+ function setMeshPointsColor(id, color) {
20
+ return viewerStore.request(
21
+ meshPointsColorSchemas,
22
+ { id, color },
23
+ {
24
+ response_function: () => {
25
+ meshPointsCommonStyle.meshPointsColoring(id).color = color
26
+ console.log(
27
+ setMeshPointsColor.name,
28
+ { id },
29
+ JSON.stringify(meshPointsColor(id)),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshPointsColor,
38
+ setMeshPointsColor,
39
+ }
40
+ }
@@ -0,0 +1,23 @@
1
+ import { useDataStyleStateStore } from "../../state"
2
+
3
+ export function useMeshPointsCommonStyle() {
4
+ const dataStyleStateStore = useDataStyleStateStore()
5
+
6
+ function meshPointsStyle(id) {
7
+ return dataStyleStateStore.getStyle(id).points
8
+ }
9
+
10
+ function meshPointsColoring(id) {
11
+ return meshPointsStyle(id).coloring
12
+ }
13
+
14
+ function meshPointsActiveColoring(id) {
15
+ return meshPointsColoring(id).active
16
+ }
17
+
18
+ return {
19
+ meshPointsStyle,
20
+ meshPointsColoring,
21
+ meshPointsActiveColoring,
22
+ }
23
+ }
@@ -0,0 +1,89 @@
1
+ // Third party imports
2
+
3
+ // Local imports
4
+ import { useMeshPointsCommonStyle } from "./common"
5
+ import { useMeshPointsVisibilityStyle } from "./visibility"
6
+ import { useMeshPointsColorStyle } from "./color"
7
+ import { useMeshPointsSizeStyle } from "./size"
8
+ import { useMeshPointsVertexAttributeStyle } from "./vertex"
9
+
10
+ // Local constants
11
+
12
+ export function useMeshPointsStyle() {
13
+ const meshPointsCommonStyle = useMeshPointsCommonStyle()
14
+ const meshPointsVisibility = useMeshPointsVisibilityStyle()
15
+ const meshPointsColorStyle = useMeshPointsColorStyle()
16
+ const meshPointsSizeStyle = useMeshPointsSizeStyle()
17
+ const meshPointsVertexAttributeStyle = useMeshPointsVertexAttributeStyle()
18
+
19
+ async function setMeshPointsActiveColoring(id, type) {
20
+ const coloring = meshPointsCommonStyle.meshPointsColoring(id)
21
+ coloring.active = type
22
+ console.log(
23
+ setMeshPointsActiveColoring.name,
24
+ { id },
25
+ meshPointsCommonStyle.meshPointsActiveColoring(id),
26
+ )
27
+ if (type === "color") {
28
+ return meshPointsColorStyle.setMeshPointsColor(
29
+ id,
30
+ meshPointsColorStyle.meshPointsColor(id),
31
+ )
32
+ } else if (type === "textures") {
33
+ const textures = meshPointsTexturesStore.meshPointsTextures(id)
34
+ if (textures === null) {
35
+ return Promise.resolve()
36
+ }
37
+ return meshPointsTexturesStore.setMeshPointsTextures(id, textures)
38
+ } else if (type === "vertex") {
39
+ const name =
40
+ meshPointsVertexAttributeStyle.meshPointsVertexAttributeName(id)
41
+ if (name === null) {
42
+ return Promise.resolve()
43
+ }
44
+ return meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeName(
45
+ id,
46
+ name,
47
+ )
48
+ } else if (type === "polygon") {
49
+ const name =
50
+ meshPointsPolygonAttributeStyleStore.meshPointsPolygonAttributeName(id)
51
+ if (name === null) {
52
+ return Promise.resolve()
53
+ }
54
+ await meshPointsPolygonAttributeStyleStore.setMeshPointsPolygonAttributeName(
55
+ id,
56
+ name,
57
+ )
58
+ } else {
59
+ throw new Error("Unknown mesh points coloring type: " + type)
60
+ }
61
+ }
62
+
63
+ function applyMeshPointsStyle(id) {
64
+ return Promise.all([
65
+ meshPointsVisibility.setMeshPointsVisibility(
66
+ id,
67
+ meshPointsVisibility.meshPointsVisibility(id),
68
+ ),
69
+ meshPointsSizeStyle.setMeshPointsSize(
70
+ id,
71
+ meshPointsSizeStyle.meshPointsSize(id),
72
+ ),
73
+ setMeshPointsActiveColoring(
74
+ id,
75
+ meshPointsCommonStyle.meshPointsActiveColoring(id),
76
+ ),
77
+ ])
78
+ }
79
+
80
+ return {
81
+ setMeshPointsActiveColoring,
82
+ applyMeshPointsStyle,
83
+ ...meshPointsCommonStyle,
84
+ ...meshPointsVisibility,
85
+ ...meshPointsColorStyle,
86
+ ...meshPointsSizeStyle,
87
+ ...meshPointsVertexAttributeStyle,
88
+ }
89
+ }
@@ -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 { useMeshPointsCommonStyle } from "./common"
7
+
8
+ // Local constants
9
+ const meshPointsSizeSchemas =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.points.size
11
+
12
+ export function useMeshPointsSizeStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshPointsCommonStyle = useMeshPointsCommonStyle()
15
+
16
+ function meshPointsSize(id) {
17
+ return meshPointsCommonStyle.meshPointsStyle(id).size
18
+ }
19
+ function setMeshPointsSize(id, size) {
20
+ return viewerStore.request(
21
+ meshPointsSizeSchemas,
22
+ { id, size },
23
+ {
24
+ response_function: () => {
25
+ meshPointsCommonStyle.meshPointsStyle(id).size = size
26
+ console.log(
27
+ setMeshPointsSize.name,
28
+ { id },
29
+ JSON.stringify(meshPointsSize(id)),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshPointsSize,
38
+ setMeshPointsSize,
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 { useMeshPointsCommonStyle } from "./common"
8
+
9
+ // Local constants
10
+ const meshPointsVertexAttributeSchemas =
11
+ viewer_schemas.opengeodeweb_viewer.mesh.points.attribute.vertex
12
+
13
+ export function useMeshPointsVertexAttributeStyle() {
14
+ const viewerStore = useViewerStore()
15
+ const meshPointsCommonStyle = useMeshPointsCommonStyle()
16
+
17
+ function meshPointsVertexAttribute(id) {
18
+ return meshPointsCommonStyle.meshPointsColoring(id).vertex
19
+ }
20
+
21
+ async function updateMeshPointsVertexAttribute(id) {
22
+ const name = meshPointsVertexAttributeName(id)
23
+ const storedConfig = meshPointsVertexAttributeStoredConfig(id, name)
24
+ await meshPointsVertexAttributeRange(
25
+ id,
26
+ storedConfig.minimum,
27
+ storedConfig.maximum,
28
+ )
29
+ await meshPointsVertexAttributeColorMap(id, storedConfig.colorMap)
30
+ }
31
+
32
+ function meshPointsVertexAttributeStoredConfig(id, name) {
33
+ const storedConfigs = meshPointsVertexAttribute(id).storedConfigs
34
+ if (name in storedConfigs) {
35
+ return storedConfigs[name]
36
+ }
37
+ return setMeshPointsVertexAttributeStoredConfig(id, name, {
38
+ minimum: 0,
39
+ maximum: 1,
40
+ colorMap: "Cool to Warm",
41
+ })
42
+ }
43
+
44
+ function setMeshPointsVertexAttributeStoredConfig(
45
+ id,
46
+ name,
47
+ { minimum, maximum, colorMap },
48
+ ) {
49
+ const storedConfigs = meshPointsVertexAttribute(id).storedConfigs
50
+ storedConfigs[name] = { minimum, maximum, colorMap }
51
+ return storedConfigs[name]
52
+ }
53
+
54
+ function meshPointsVertexAttributeName(id) {
55
+ console.log(
56
+ meshPointsVertexAttributeName.name,
57
+ { id },
58
+ meshPointsVertexAttribute(id),
59
+ )
60
+ return meshPointsVertexAttribute(id).name
61
+ }
62
+ function setMeshPointsVertexAttributeName(id, name) {
63
+ console.log(setMeshPointsVertexAttributeName.name, { id, name })
64
+ return viewerStore.request(
65
+ meshPointsVertexAttributeSchemas.name,
66
+ { id, name },
67
+ {
68
+ response_function: async () => {
69
+ meshPointsVertexAttribute(id).name = name
70
+ const { minimum, maximum, colorMap } =
71
+ meshPointsVertexAttributeStoredConfig(id, name)
72
+ await setMeshPointsVertexAttributeRange(id, minimum, maximum)
73
+ await setMeshPointsVertexAttributeColorMap(id, colorMap)
74
+ console.log(
75
+ setMeshPointsVertexAttributeName.name,
76
+ { id },
77
+ meshPointsVertexAttributeName(id),
78
+ )
79
+ },
80
+ },
81
+ )
82
+ }
83
+
84
+ function meshPointsVertexAttributeRange(id) {
85
+ const name = meshPointsVertexAttributeName(id)
86
+ const storedConfig = meshPointsVertexAttributeStoredConfig(id, name)
87
+ const { minimum, maximum } = storedConfig
88
+ return [minimum, maximum]
89
+ }
90
+ function setMeshPointsVertexAttributeRange(id, minimum, maximum) {
91
+ const name = meshPointsVertexAttributeName(id)
92
+ const storedConfig = meshPointsVertexAttributeStoredConfig(id, name)
93
+ return viewerStore.request(
94
+ meshPointsVertexAttributeSchemas.scalar_range,
95
+ { id, minimum, maximum },
96
+ {
97
+ response_function: () => {
98
+ storedConfig.minimum = minimum
99
+ storedConfig.maximum = maximum
100
+ console.log(
101
+ setMeshPointsVertexAttributeRange.name,
102
+ { id },
103
+ meshPointsVertexAttributeRange(id),
104
+ )
105
+ },
106
+ },
107
+ )
108
+ }
109
+
110
+ function meshPointsVertexAttributeColorMap(id) {
111
+ const name = meshPointsVertexAttributeName(id)
112
+ const storedConfig = meshPointsVertexAttributeStoredConfig(id, name)
113
+ const { colorMap } = storedConfig
114
+ return colorMap
115
+ }
116
+ function setMeshPointsVertexAttributeColorMap(id, colorMap) {
117
+ const name = meshPointsVertexAttributeName(id)
118
+ const storedConfig = meshPointsVertexAttributeStoredConfig(id, name)
119
+ const points = getRGBPointsFromPreset(colorMap)
120
+ const { minimum, maximum } = storedConfig
121
+
122
+ console.log(setMeshPointsVertexAttributeColorMap.name, {
123
+ id,
124
+ minimum,
125
+ maximum,
126
+ colorMap,
127
+ })
128
+ return viewerStore.request(
129
+ meshPointsVertexAttributeSchemas.color_map,
130
+ { id, points, minimum, maximum },
131
+ {
132
+ response_function: () => {
133
+ storedConfig.colorMap = colorMap
134
+ console.log(
135
+ setMeshPointsVertexAttributeColorMap.name,
136
+ { id },
137
+ meshPointsVertexAttributeColorMap(id),
138
+ )
139
+ },
140
+ },
141
+ )
142
+ }
143
+
144
+ return {
145
+ meshPointsVertexAttributeName,
146
+ meshPointsVertexAttributeRange,
147
+ meshPointsVertexAttributeColorMap,
148
+ setMeshPointsVertexAttributeName,
149
+ setMeshPointsVertexAttributeRange,
150
+ setMeshPointsVertexAttributeColorMap,
151
+ updateMeshPointsVertexAttribute,
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 { useMeshPointsCommonStyle } from "./common"
7
+
8
+ // Local constants
9
+ const meshPointsVisibilitySchema =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.points.visibility
11
+
12
+ export function useMeshPointsVisibilityStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshPointsCommonStyle = useMeshPointsCommonStyle()
15
+
16
+ function meshPointsVisibility(id) {
17
+ return meshPointsCommonStyle.meshPointsStyle(id).visibility
18
+ }
19
+ function setMeshPointsVisibility(id, visibility) {
20
+ return viewerStore.request(
21
+ meshPointsVisibilitySchema,
22
+ { id, visibility },
23
+ {
24
+ response_function: () => {
25
+ meshPointsCommonStyle.meshPointsStyle(id).visibility = visibility
26
+ console.log(
27
+ setMeshPointsVisibility.name,
28
+ { id },
29
+ meshPointsVisibility(id),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshPointsVisibility,
38
+ setMeshPointsVisibility,
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 { useMeshPolygonsCommonStyle } from "./common"
7
+
8
+ // Local constants
9
+ const meshPolygonsColorSchemas =
10
+ viewer_schemas.opengeodeweb_viewer.mesh.polygons.color
11
+
12
+ export function useMeshPolygonsColorStyle() {
13
+ const viewerStore = useViewerStore()
14
+ const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle()
15
+
16
+ function meshPolygonsColor(id) {
17
+ return meshPolygonsCommonStyle.meshPolygonsColoring(id).color
18
+ }
19
+ function setMeshPolygonsColor(id, color) {
20
+ return viewerStore.request(
21
+ meshPolygonsColorSchemas,
22
+ { id, color },
23
+ {
24
+ response_function: () => {
25
+ meshPolygonsCommonStyle.meshPolygonsColoring(id).color = color
26
+ console.log(
27
+ setMeshPolygonsColor.name,
28
+ { id },
29
+ JSON.stringify(meshPolygonsColor(id)),
30
+ )
31
+ },
32
+ },
33
+ )
34
+ }
35
+
36
+ return {
37
+ meshPolygonsColor,
38
+ setMeshPolygonsColor,
39
+ }
40
+ }
@@ -0,0 +1,23 @@
1
+ import { useDataStyleStateStore } from "../../state"
2
+
3
+ export function useMeshPolygonsCommonStyle() {
4
+ const dataStyleStateStore = useDataStyleStateStore()
5
+
6
+ function meshPolygonsStyle(id) {
7
+ return dataStyleStateStore.getStyle(id).polygons
8
+ }
9
+
10
+ function meshPolygonsColoring(id) {
11
+ return meshPolygonsStyle(id).coloring
12
+ }
13
+
14
+ function meshPolygonsActiveColoring(id) {
15
+ return meshPolygonsColoring(id).active
16
+ }
17
+
18
+ return {
19
+ meshPolygonsStyle,
20
+ meshPolygonsColoring,
21
+ meshPolygonsActiveColoring,
22
+ }
23
+ }
@@ -0,0 +1,89 @@
1
+ // Third party imports
2
+
3
+ // Local imports
4
+ import { useMeshPolygonsCommonStyle } from "./common"
5
+ import { useMeshPolygonsVisibilityStyle } from "./visibility"
6
+ import { useMeshPolygonsColorStyle } from "./color"
7
+ import { useMeshPolygonsTexturesStyle } from "./textures"
8
+ import { useMeshPolygonsVertexAttributeStyle } from "./vertex"
9
+ import { useMeshPolygonsPolygonAttributeStyle } from "./polygon"
10
+
11
+ // Local constants
12
+
13
+ export function useMeshPolygonsStyle() {
14
+ const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle()
15
+ const meshPolygonsVisibility = useMeshPolygonsVisibilityStyle()
16
+ const meshPolygonsColorStyle = useMeshPolygonsColorStyle()
17
+ const meshPolygonsTexturesStyle = useMeshPolygonsTexturesStyle()
18
+ const meshPolygonsVertexAttributeStyle = useMeshPolygonsVertexAttributeStyle()
19
+ const meshPolygonsPolygonAttributeStyle =
20
+ useMeshPolygonsPolygonAttributeStyle()
21
+
22
+ async function setMeshPolygonsActiveColoring(id, type) {
23
+ const coloring = meshPolygonsCommonStyle.meshPolygonsColoring(id)
24
+ coloring.active = type
25
+ console.log(
26
+ setMeshPolygonsActiveColoring.name,
27
+ { id },
28
+ meshPolygonsCommonStyle.meshPolygonsActiveColoring(id),
29
+ )
30
+ if (type === "color") {
31
+ return meshPolygonsColorStyle.setMeshPolygonsColor(
32
+ id,
33
+ meshPolygonsColorStyle.meshPolygonsColor(id),
34
+ )
35
+ } else if (type === "textures") {
36
+ const textures = meshPolygonsTexturesStyle.meshPolygonsTextures(id)
37
+ if (textures === null) {
38
+ return Promise.resolve()
39
+ }
40
+ return meshPolygonsTexturesStyle.setMeshPolygonsTextures(id, textures)
41
+ } else if (type === "vertex") {
42
+ const name =
43
+ meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeName(id)
44
+ if (name === null) {
45
+ return Promise.resolve()
46
+ }
47
+ return meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeName(
48
+ id,
49
+ name,
50
+ )
51
+ } else if (type === "polygon") {
52
+ const name =
53
+ meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeName(id)
54
+ if (name === null) {
55
+ return Promise.resolve()
56
+ }
57
+ await meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeName(
58
+ id,
59
+ name,
60
+ )
61
+ } else {
62
+ throw new Error("Unknown mesh polygons coloring type: " + type)
63
+ }
64
+ }
65
+
66
+ function applyMeshPolygonsStyle(id) {
67
+ return Promise.all([
68
+ meshPolygonsVisibility.setMeshPolygonsVisibility(
69
+ id,
70
+ meshPolygonsVisibility.meshPolygonsVisibility(id),
71
+ ),
72
+ setMeshPolygonsActiveColoring(
73
+ id,
74
+ meshPolygonsCommonStyle.meshPolygonsActiveColoring(id),
75
+ ),
76
+ ])
77
+ }
78
+
79
+ return {
80
+ setMeshPolygonsActiveColoring,
81
+ applyMeshPolygonsStyle,
82
+ ...meshPolygonsCommonStyle,
83
+ ...meshPolygonsVisibility,
84
+ ...meshPolygonsColorStyle,
85
+ ...meshPolygonsTexturesStyle,
86
+ ...meshPolygonsVertexAttributeStyle,
87
+ ...meshPolygonsPolygonAttributeStyle,
88
+ }
89
+ }