@geode/opengeodeweb-front 10.7.0 → 10.8.0-rc.2

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 (89) hide show
  1. package/app/components/ObjectSelector.vue +0 -2
  2. package/app/components/Viewer/BreadCrumb.vue +6 -1
  3. package/app/components/Viewer/TreeComponent.vue +8 -9
  4. package/app/stores/app.js +1 -0
  5. package/app/stores/data.js +16 -3
  6. package/app/stores/data_style.js +28 -25
  7. package/app/stores/hybrid_viewer.js +0 -1
  8. package/app/utils/extension.js +1 -1
  9. package/app/utils/file_import_workflow.js +1 -0
  10. package/app/utils/local/cleanup.js +5 -1
  11. package/app/utils/local/microservices.js +1 -13
  12. package/app/utils/local/path.js +20 -1
  13. package/internal/database/base_database.js +22 -0
  14. package/internal/database/database.js +5 -20
  15. package/internal/database/extended_database.js +3 -10
  16. package/internal/database/tables/data_style.js +4 -0
  17. package/internal/database/tables/model_component_datastyle.js +4 -0
  18. package/internal/stores/data_style/mesh/cells/cell.js +12 -39
  19. package/internal/stores/data_style/mesh/cells/color.js +4 -4
  20. package/internal/stores/data_style/mesh/cells/common.js +19 -3
  21. package/internal/stores/data_style/mesh/cells/index.js +16 -10
  22. package/internal/stores/data_style/mesh/cells/textures.js +4 -4
  23. package/internal/stores/data_style/mesh/cells/vertex.js +35 -42
  24. package/internal/stores/data_style/mesh/cells/visibility.js +1 -4
  25. package/internal/stores/data_style/mesh/edges/color.js +4 -4
  26. package/internal/stores/data_style/mesh/edges/common.js +12 -3
  27. package/internal/stores/data_style/mesh/edges/edge.js +40 -40
  28. package/internal/stores/data_style/mesh/edges/index.js +18 -19
  29. package/internal/stores/data_style/mesh/edges/vertex.js +37 -44
  30. package/internal/stores/data_style/mesh/edges/visibility.js +1 -5
  31. package/internal/stores/data_style/mesh/edges/width.js +1 -5
  32. package/internal/stores/data_style/mesh/index.js +32 -5
  33. package/internal/stores/data_style/mesh/points/color.js +4 -4
  34. package/internal/stores/data_style/mesh/points/common.js +12 -3
  35. package/internal/stores/data_style/mesh/points/index.js +34 -32
  36. package/internal/stores/data_style/mesh/points/size.js +1 -4
  37. package/internal/stores/data_style/mesh/points/vertex.js +79 -65
  38. package/internal/stores/data_style/mesh/points/visibility.js +1 -4
  39. package/internal/stores/data_style/mesh/polygons/color.js +4 -4
  40. package/internal/stores/data_style/mesh/polygons/common.js +12 -3
  41. package/internal/stores/data_style/mesh/polygons/index.js +35 -24
  42. package/internal/stores/data_style/mesh/polygons/polygon.js +40 -34
  43. package/internal/stores/data_style/mesh/polygons/textures.js +4 -4
  44. package/internal/stores/data_style/mesh/polygons/vertex.js +35 -42
  45. package/internal/stores/data_style/mesh/polygons/visibility.js +4 -4
  46. package/internal/stores/data_style/mesh/polyhedra/color.js +4 -4
  47. package/internal/stores/data_style/mesh/polyhedra/common.js +12 -3
  48. package/internal/stores/data_style/mesh/polyhedra/index.js +21 -11
  49. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +80 -60
  50. package/internal/stores/data_style/mesh/polyhedra/vertex.js +79 -65
  51. package/internal/stores/data_style/mesh/polyhedra/visibility.js +4 -4
  52. package/internal/stores/data_style/model/blocks/color.js +17 -29
  53. package/internal/stores/data_style/model/blocks/common.js +14 -4
  54. package/internal/stores/data_style/model/blocks/index.js +38 -8
  55. package/internal/stores/data_style/model/blocks/visibility.js +19 -30
  56. package/internal/stores/data_style/model/corners/color.js +16 -29
  57. package/internal/stores/data_style/model/corners/common.js +14 -4
  58. package/internal/stores/data_style/model/corners/index.js +42 -8
  59. package/internal/stores/data_style/model/corners/visibility.js +16 -29
  60. package/internal/stores/data_style/model/edges/common.js +8 -1
  61. package/internal/stores/data_style/model/edges/index.js +2 -5
  62. package/internal/stores/data_style/model/edges/visibility.js +7 -5
  63. package/internal/stores/data_style/model/index.js +102 -133
  64. package/internal/stores/data_style/model/lines/color.js +20 -29
  65. package/internal/stores/data_style/model/lines/common.js +14 -4
  66. package/internal/stores/data_style/model/lines/index.js +35 -6
  67. package/internal/stores/data_style/model/lines/visibility.js +19 -29
  68. package/internal/stores/data_style/model/points/common.js +7 -0
  69. package/internal/stores/data_style/model/points/size.js +1 -4
  70. package/internal/stores/data_style/model/points/visibility.js +4 -4
  71. package/internal/stores/data_style/model/surfaces/color.js +16 -29
  72. package/internal/stores/data_style/model/surfaces/common.js +14 -4
  73. package/internal/stores/data_style/model/surfaces/index.js +37 -6
  74. package/internal/stores/data_style/model/surfaces/visibility.js +17 -29
  75. package/internal/stores/data_style/state.js +126 -5
  76. package/internal/utils/viewer_call.js +1 -1
  77. package/package.json +3 -3
  78. package/server/api/extensions/run.post.js +8 -1
  79. package/tests/integration/microservices/back/requirements.txt +7 -0
  80. package/tests/integration/microservices/viewer/requirements.txt +7 -0
  81. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +3 -1
  82. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -0
  83. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -0
  84. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -0
  85. package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -0
  86. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -0
  87. package/tests/integration/stores/data_style/model/points.nuxt.test.js +10 -0
  88. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -0
  89. package/tests/unit/plugins/project_load.nuxt.test.js +13 -6
@@ -30,31 +30,44 @@ export function useMeshCellsVertexAttributeStyle() {
30
30
  });
31
31
  }
32
32
 
33
- function setMeshCellsVertexAttributeStoredConfig(id, name, { minimum, maximum, colorMap }) {
34
- const { storedConfigs } = meshCellsVertexAttribute(id);
35
- storedConfigs[name] = { minimum, maximum, colorMap };
36
- return storedConfigs[name];
33
+ function mutateMeshCellsVertexStyle(id, values) {
34
+ return meshCellsCommonStyle.mutateMeshCellsStyle(id, {
35
+ coloring: {
36
+ vertex: values,
37
+ },
38
+ });
39
+ }
40
+
41
+ function setMeshCellsVertexAttributeStoredConfig(id, name, config) {
42
+ return mutateMeshCellsVertexStyle(id, {
43
+ storedConfigs: {
44
+ [name]: config,
45
+ },
46
+ });
37
47
  }
38
48
 
39
49
  function meshCellsVertexAttributeName(id) {
40
- console.log(meshCellsVertexAttributeName.name, { id }, meshCellsVertexAttribute(id));
41
50
  return meshCellsVertexAttribute(id).name;
42
51
  }
52
+
43
53
  function setMeshCellsVertexAttributeName(id, name) {
44
- console.log(setMeshCellsVertexAttributeName.name, { id, name });
45
54
  return viewerStore.request(
46
55
  meshCellsVertexAttributeSchemas.name,
47
56
  { id, name },
48
57
  {
49
- response_function: async () => {
50
- meshCellsVertexAttribute(id).name = name;
51
- const { minimum, maximum } = meshCellsVertexAttributeStoredConfig(id, name);
52
- await setMeshCellsVertexAttributeRange(id, minimum, maximum);
53
- console.log(
54
- setMeshCellsVertexAttributeName.name,
55
- { id },
56
- meshCellsVertexAttributeName(id),
57
- );
58
+ response_function: () => {
59
+ const updates = { name };
60
+ const vertex = meshCellsVertexAttribute(id);
61
+ if (!(name in vertex.storedConfigs)) {
62
+ updates.storedConfigs = {
63
+ [name]: {
64
+ minimum: undefined,
65
+ maximum: undefined,
66
+ colorMap: undefined,
67
+ },
68
+ };
69
+ }
70
+ return mutateMeshCellsVertexStyle(id, updates);
58
71
  },
59
72
  },
60
73
  );
@@ -66,12 +79,13 @@ export function useMeshCellsVertexAttributeStyle() {
66
79
  const { minimum, maximum } = storedConfig;
67
80
  return [minimum, maximum];
68
81
  }
82
+
69
83
  function setMeshCellsVertexAttributeRange(id, minimum, maximum) {
70
84
  const name = meshCellsVertexAttributeName(id);
71
- const storedConfig = meshCellsVertexAttributeStoredConfig(id, name);
72
- storedConfig.minimum = minimum;
73
- storedConfig.maximum = maximum;
74
- return setMeshCellsVertexAttributeColorMap(id, storedConfig.colorMap);
85
+ return setMeshCellsVertexAttributeStoredConfig(id, name, {
86
+ minimum,
87
+ maximum,
88
+ });
75
89
  }
76
90
 
77
91
  function meshCellsVertexAttributeColorMap(id) {
@@ -80,38 +94,17 @@ export function useMeshCellsVertexAttributeStyle() {
80
94
  const { colorMap } = storedConfig;
81
95
  return colorMap;
82
96
  }
97
+
83
98
  function setMeshCellsVertexAttributeColorMap(id, colorMap) {
84
99
  const name = meshCellsVertexAttributeName(id);
85
100
  const storedConfig = meshCellsVertexAttributeStoredConfig(id, name);
86
- if (
87
- storedConfig.minimum === undefined ||
88
- storedConfig.maximum === undefined ||
89
- colorMap === undefined
90
- ) {
91
- storedConfig.colorMap = colorMap;
92
- return;
93
- }
94
101
  const points = getRGBPointsFromPreset(colorMap);
95
102
  const { minimum, maximum } = storedConfig;
96
-
97
- console.log(setMeshCellsVertexAttributeColorMap.name, {
98
- id,
99
- minimum,
100
- maximum,
101
- colorMap,
102
- });
103
103
  return viewerStore.request(
104
104
  meshCellsVertexAttributeSchemas.color_map,
105
105
  { id, points, minimum, maximum },
106
106
  {
107
- response_function: () => {
108
- storedConfig.colorMap = colorMap;
109
- console.log(
110
- setMeshCellsVertexAttributeColorMap.name,
111
- { id },
112
- meshCellsVertexAttributeColorMap(id),
113
- );
114
- },
107
+ response_function: () => setMeshCellsVertexAttributeStoredConfig(id, name, { colorMap }),
115
108
  },
116
109
  );
117
110
  }
@@ -20,10 +20,7 @@ export function useMeshCellsVisibilityStyle() {
20
20
  meshCellsVisibilitySchema,
21
21
  { id, visibility },
22
22
  {
23
- response_function: () => {
24
- meshCellsCommonStyle.meshCellsStyle(id).visibility = visibility;
25
- console.log(setMeshCellsVisibility.name, { id }, meshCellsVisibility(id));
26
- },
23
+ response_function: () => meshCellsCommonStyle.mutateMeshCellsStyle(id, { visibility }),
27
24
  },
28
25
  );
29
26
  }
@@ -20,10 +20,10 @@ export function useMeshEdgesColorStyle() {
20
20
  meshEdgesColorSchemas,
21
21
  { id, color },
22
22
  {
23
- response_function: () => {
24
- meshEdgesCommonStyle.meshEdgesColoring(id).color = color;
25
- console.log(setMeshEdgesColor.name, { id }, JSON.stringify(meshEdgesColor(id)));
26
- },
23
+ response_function: () =>
24
+ meshEdgesCommonStyle.mutateMeshEdgesColoring(id, {
25
+ color,
26
+ }),
27
27
  },
28
28
  );
29
29
  }
@@ -3,6 +3,12 @@ import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state";
3
3
  export function useMeshEdgesCommonStyle() {
4
4
  const dataStyleStateStore = useDataStyleStateStore();
5
5
 
6
+ function mutateMeshEdgesStyle(id, values) {
7
+ return dataStyleStateStore.mutateStyle(id, {
8
+ edges: values,
9
+ });
10
+ }
11
+
6
12
  function meshEdgesStyle(id) {
7
13
  return dataStyleStateStore.getStyle(id).edges;
8
14
  }
@@ -11,13 +17,16 @@ export function useMeshEdgesCommonStyle() {
11
17
  return meshEdgesStyle(id).coloring;
12
18
  }
13
19
 
14
- function meshEdgesActiveColoring(id) {
15
- return meshEdgesColoring(id).active;
20
+ function mutateMeshEdgesColoring(id, values) {
21
+ return mutateMeshEdgesStyle(id, {
22
+ coloring: values,
23
+ });
16
24
  }
17
25
 
18
26
  return {
19
27
  meshEdgesStyle,
20
28
  meshEdgesColoring,
21
- meshEdgesActiveColoring,
29
+ mutateMeshEdgesStyle,
30
+ mutateMeshEdgesColoring,
22
31
  };
23
32
  }
@@ -2,7 +2,6 @@
2
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
3
3
 
4
4
  // Local imports
5
- import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
6
5
  import { useMeshEdgesCommonStyle } from "./common";
7
6
  import { useViewerStore } from "@ogw_front/stores/viewer";
8
7
 
@@ -13,8 +12,12 @@ export function useMeshEdgesEdgeAttributeStyle() {
13
12
  const viewerStore = useViewerStore();
14
13
  const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
15
14
 
15
+ function meshEdgesColoring(id) {
16
+ return meshEdgesCommonStyle.meshEdgesStyle(id).coloring;
17
+ }
18
+
16
19
  function meshEdgesEdgeAttribute(id) {
17
- return meshEdgesCommonStyle.meshEdgesColoring(id).edge;
20
+ return meshEdgesColoring(id).edge;
18
21
  }
19
22
 
20
23
  function meshEdgesEdgeAttributeStoredConfig(id, name) {
@@ -29,27 +32,44 @@ export function useMeshEdgesEdgeAttributeStyle() {
29
32
  });
30
33
  }
31
34
 
32
- function setMeshEdgesEdgeAttributeStoredConfig(id, name, { minimum, maximum, colorMap }) {
33
- const { storedConfigs } = meshEdgesEdgeAttribute(id);
34
- storedConfigs[name] = { minimum, maximum, colorMap };
35
- return storedConfigs[name];
35
+ function mutateMeshEdgesEdgeStyle(id, values) {
36
+ return meshEdgesCommonStyle.mutateMeshEdgesStyle(id, {
37
+ coloring: {
38
+ edge: values,
39
+ },
40
+ });
41
+ }
42
+
43
+ function setMeshEdgesEdgeAttributeStoredConfig(id, name, config) {
44
+ return mutateMeshEdgesEdgeStyle(id, {
45
+ storedConfigs: {
46
+ [name]: config,
47
+ },
48
+ });
36
49
  }
37
50
 
38
51
  function meshEdgesEdgeAttributeName(id) {
39
- console.log(meshEdgesEdgeAttributeName.name, { id }, meshEdgesEdgeAttribute(id));
40
52
  return meshEdgesEdgeAttribute(id).name;
41
53
  }
54
+
42
55
  function setMeshEdgesEdgeAttributeName(id, name) {
43
- console.log(setMeshEdgesEdgeAttributeName.name, { id, name });
44
56
  return viewerStore.request(
45
57
  meshEdgesEdgeAttributeSchemas.name,
46
58
  { id, name },
47
59
  {
48
- response_function: async () => {
49
- meshEdgesEdgeAttribute(id).name = name;
50
- const { minimum, maximum } = meshEdgesEdgeAttributeStoredConfig(id, name);
51
- await setMeshEdgesEdgeAttributeRange(id, minimum, maximum);
52
- console.log(setMeshEdgesEdgeAttributeName.name, { id }, meshEdgesEdgeAttributeName(id));
60
+ response_function: () => {
61
+ const updates = { name };
62
+ const edge = meshEdgesEdgeAttribute(id);
63
+ if (!(name in edge.storedConfigs)) {
64
+ updates.storedConfigs = {
65
+ [name]: {
66
+ minimum: undefined,
67
+ maximum: undefined,
68
+ colorMap: undefined,
69
+ },
70
+ };
71
+ }
72
+ return mutateMeshEdgesEdgeStyle(id, updates);
53
73
  },
54
74
  },
55
75
  );
@@ -61,12 +81,13 @@ export function useMeshEdgesEdgeAttributeStyle() {
61
81
  const { minimum, maximum } = storedConfig;
62
82
  return [minimum, maximum];
63
83
  }
84
+
64
85
  function setMeshEdgesEdgeAttributeRange(id, minimum, maximum) {
65
86
  const name = meshEdgesEdgeAttributeName(id);
66
- const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name);
67
- storedConfig.minimum = minimum;
68
- storedConfig.maximum = maximum;
69
- return setMeshEdgesEdgeAttributeColorMap(id, storedConfig.colorMap);
87
+ return setMeshEdgesEdgeAttributeStoredConfig(id, name, {
88
+ minimum,
89
+ maximum,
90
+ });
70
91
  }
71
92
 
72
93
  function meshEdgesEdgeAttributeColorMap(id) {
@@ -75,38 +96,17 @@ export function useMeshEdgesEdgeAttributeStyle() {
75
96
  const { colorMap } = storedConfig;
76
97
  return colorMap;
77
98
  }
99
+
78
100
  function setMeshEdgesEdgeAttributeColorMap(id, colorMap) {
79
101
  const name = meshEdgesEdgeAttributeName(id);
80
102
  const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name);
81
- if (
82
- storedConfig.minimum === undefined ||
83
- storedConfig.maximum === undefined ||
84
- colorMap === undefined
85
- ) {
86
- storedConfig.colorMap = colorMap;
87
- return;
88
- }
89
103
  const points = getRGBPointsFromPreset(colorMap);
90
104
  const { minimum, maximum } = storedConfig;
91
-
92
- console.log(setMeshEdgesEdgeAttributeColorMap.name, {
93
- id,
94
- minimum,
95
- maximum,
96
- colorMap,
97
- });
98
105
  return viewerStore.request(
99
106
  meshEdgesEdgeAttributeSchemas.color_map,
100
107
  { id, points, minimum, maximum },
101
108
  {
102
- response_function: () => {
103
- storedConfig.colorMap = colorMap;
104
- console.log(
105
- setMeshEdgesEdgeAttributeColorMap.name,
106
- { id },
107
- meshEdgesEdgeAttributeColorMap(id),
108
- );
109
- },
109
+ response_function: () => setMeshEdgesEdgeAttributeStoredConfig(id, name, { colorMap }),
110
110
  },
111
111
  );
112
112
  }
@@ -11,42 +11,39 @@ import { useMeshEdgesWidthStyle } from "./width";
11
11
  // Local constants
12
12
 
13
13
  export function useMeshEdgesStyle() {
14
- const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
15
14
  const meshEdgesVisibility = useMeshEdgesVisibilityStyle();
16
15
  const meshEdgesColorStyle = useMeshEdgesColorStyle();
16
+
17
+ function meshEdgesColoring(id) {
18
+ return meshEdgesCommonStyle.meshEdgesColoring(id);
19
+ }
17
20
  const meshEdgesWidthStyle = useMeshEdgesWidthStyle();
18
21
  const meshEdgesVertexAttributeStyle = useMeshEdgesVertexAttributeStyle();
19
22
  const meshEdgesEdgeAttributeStyle = useMeshEdgesEdgeAttributeStyle();
23
+ const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
20
24
 
21
- 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
- );
25
+ function meshEdgesActiveColoring(id) {
26
+ return meshEdgesColoring(id).active;
27
+ }
28
+
29
+ async function setMeshEdgesActiveColoring(id, type) {
30
+ await meshEdgesCommonStyle.mutateMeshEdgesStyle(id, {
31
+ coloring: { active: type },
32
+ });
29
33
  if (type === "color") {
30
34
  return meshEdgesColorStyle.setMeshEdgesColor(id, meshEdgesColorStyle.meshEdgesColor(id));
31
35
  }
32
- if (type === "textures") {
33
- const textures = meshEdgesTexturesStore.meshEdgesTextures(id);
34
- if (textures === undefined) {
35
- return Promise.resolve();
36
- }
37
- return meshEdgesTexturesStore.setMeshEdgesTextures(id, textures);
38
- }
39
36
  if (type === "vertex") {
40
37
  const name = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeName(id);
41
38
  if (name === undefined) {
42
- return Promise.resolve();
39
+ return;
43
40
  }
44
41
  return meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(id, name);
45
42
  }
46
43
  if (type === "edge") {
47
44
  const name = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeName(id);
48
45
  if (name === undefined) {
49
- return Promise.resolve();
46
+ return;
50
47
  }
51
48
  return meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name);
52
49
  }
@@ -57,11 +54,13 @@ export function useMeshEdgesStyle() {
57
54
  return Promise.all([
58
55
  meshEdgesVisibility.setMeshEdgesVisibility(id, meshEdgesVisibility.meshEdgesVisibility(id)),
59
56
  meshEdgesWidthStyle.setMeshEdgesWidth(id, meshEdgesWidthStyle.meshEdgesWidth(id)),
60
- setMeshEdgesActiveColoring(id, meshEdgesCommonStyle.meshEdgesActiveColoring(id)),
57
+ setMeshEdgesActiveColoring(id, meshEdgesActiveColoring(id)),
61
58
  ]);
62
59
  }
63
60
 
64
61
  return {
62
+ meshEdgesColoring,
63
+ meshEdgesActiveColoring,
65
64
  setMeshEdgesActiveColoring,
66
65
  applyMeshEdgesStyle,
67
66
  ...meshEdgesCommonStyle,
@@ -2,7 +2,6 @@
2
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
3
3
 
4
4
  // Local imports
5
- import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
6
5
  import { useMeshEdgesCommonStyle } from "./common";
7
6
  import { useViewerStore } from "@ogw_front/stores/viewer";
8
7
 
@@ -14,8 +13,12 @@ export function useMeshEdgesVertexAttributeStyle() {
14
13
  const viewerStore = useViewerStore();
15
14
  const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
16
15
 
16
+ function meshEdgesColoring(id) {
17
+ return meshEdgesCommonStyle.meshEdgesStyle(id).coloring;
18
+ }
19
+
17
20
  function meshEdgesVertexAttribute(id) {
18
- return meshEdgesCommonStyle.meshEdgesColoring(id).vertex;
21
+ return meshEdgesColoring(id).vertex;
19
22
  }
20
23
 
21
24
  function meshEdgesVertexAttributeStoredConfig(id, name) {
@@ -30,31 +33,43 @@ export function useMeshEdgesVertexAttributeStyle() {
30
33
  });
31
34
  }
32
35
 
33
- function setMeshEdgesVertexAttributeStoredConfig(id, name, { minimum, maximum, colorMap }) {
34
- const { storedConfigs } = meshEdgesVertexAttribute(id);
35
- storedConfigs[name] = { minimum, maximum, colorMap };
36
- return storedConfigs[name];
36
+ function mutateMeshEdgesVertexStyle(id, values) {
37
+ return meshEdgesCommonStyle.mutateMeshEdgesStyle(id, {
38
+ coloring: {
39
+ vertex: values,
40
+ },
41
+ });
42
+ }
43
+
44
+ function setMeshEdgesVertexAttributeStoredConfig(id, name, config) {
45
+ return mutateMeshEdgesVertexStyle(id, {
46
+ storedConfigs: {
47
+ [name]: config,
48
+ },
49
+ }).then(() => config);
37
50
  }
38
51
 
39
52
  function meshEdgesVertexAttributeName(id) {
40
- console.log(meshEdgesVertexAttributeName.name, { id }, meshEdgesVertexAttribute(id));
41
53
  return meshEdgesVertexAttribute(id).name;
42
54
  }
43
55
  function setMeshEdgesVertexAttributeName(id, name) {
44
- console.log(setMeshEdgesVertexAttributeName.name, { id, name });
45
56
  return viewerStore.request(
46
57
  meshEdgesVertexAttributeSchemas.name,
47
58
  { id, name },
48
59
  {
49
- response_function: async () => {
50
- meshEdgesVertexAttribute(id).name = name;
51
- const { minimum, maximum } = meshEdgesVertexAttributeStoredConfig(id, name);
52
- await setMeshEdgesVertexAttributeRange(id, minimum, maximum);
53
- console.log(
54
- setMeshEdgesVertexAttributeName.name,
55
- { id },
56
- meshEdgesVertexAttributeName(id),
57
- );
60
+ response_function: () => {
61
+ const updates = { name };
62
+ const vertex = meshEdgesVertexAttribute(id);
63
+ if (!(name in vertex.storedConfigs)) {
64
+ updates.storedConfigs = {
65
+ [name]: {
66
+ minimum: undefined,
67
+ maximum: undefined,
68
+ colorMap: undefined,
69
+ },
70
+ };
71
+ }
72
+ return mutateMeshEdgesVertexStyle(id, updates);
58
73
  },
59
74
  },
60
75
  );
@@ -68,10 +83,10 @@ export function useMeshEdgesVertexAttributeStyle() {
68
83
  }
69
84
  function setMeshEdgesVertexAttributeRange(id, minimum, maximum) {
70
85
  const name = meshEdgesVertexAttributeName(id);
71
- const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name);
72
- storedConfig.minimum = minimum;
73
- storedConfig.maximum = maximum;
74
- return setMeshEdgesVertexAttributeColorMap(id, storedConfig.colorMap);
86
+ return setMeshEdgesVertexAttributeStoredConfig(id, name, {
87
+ minimum,
88
+ maximum,
89
+ });
75
90
  }
76
91
 
77
92
  function meshEdgesVertexAttributeColorMap(id) {
@@ -83,35 +98,13 @@ export function useMeshEdgesVertexAttributeStyle() {
83
98
  function setMeshEdgesVertexAttributeColorMap(id, colorMap) {
84
99
  const name = meshEdgesVertexAttributeName(id);
85
100
  const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name);
86
- if (
87
- storedConfig.minimum === undefined ||
88
- storedConfig.maximum === undefined ||
89
- colorMap === undefined
90
- ) {
91
- storedConfig.colorMap = colorMap;
92
- return;
93
- }
94
101
  const points = getRGBPointsFromPreset(colorMap);
95
102
  const { minimum, maximum } = storedConfig;
96
-
97
- console.log(setMeshEdgesVertexAttributeColorMap.name, {
98
- id,
99
- minimum,
100
- maximum,
101
- colorMap,
102
- });
103
103
  return viewerStore.request(
104
104
  meshEdgesVertexAttributeSchemas.color_map,
105
105
  { id, points, minimum, maximum },
106
106
  {
107
- response_function: () => {
108
- storedConfig.colorMap = colorMap;
109
- console.log(
110
- setMeshEdgesVertexAttributeColorMap.name,
111
- { id },
112
- meshEdgesVertexAttributeColorMap(id),
113
- );
114
- },
107
+ response_function: () => setMeshEdgesVertexAttributeStoredConfig(id, name, { colorMap }),
115
108
  },
116
109
  );
117
110
  }
@@ -1,7 +1,6 @@
1
1
  // Third party imports
2
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
3
3
 
4
- // Local imports
5
4
  import { useMeshEdgesCommonStyle } from "./common";
6
5
  import { useViewerStore } from "@ogw_front/stores/viewer";
7
6
 
@@ -20,10 +19,7 @@ export function useMeshEdgesVisibilityStyle() {
20
19
  meshEdgesVisibilitySchema,
21
20
  { id, visibility },
22
21
  {
23
- response_function: () => {
24
- meshEdgesCommonStyle.meshEdgesStyle(id).visibility = visibility;
25
- console.log(setMeshEdgesVisibility.name, { id }, meshEdgesVisibility(id));
26
- },
22
+ response_function: () => meshEdgesCommonStyle.mutateMeshEdgesStyle(id, { visibility }),
27
23
  },
28
24
  );
29
25
  }
@@ -1,7 +1,6 @@
1
1
  // Third party imports
2
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
3
3
 
4
- // Local imports
5
4
  import { useMeshEdgesCommonStyle } from "./common";
6
5
  import { useViewerStore } from "@ogw_front/stores/viewer";
7
6
 
@@ -20,10 +19,7 @@ export function useMeshEdgesWidthStyle() {
20
19
  meshEdgesWidthSchemas,
21
20
  { id, width },
22
21
  {
23
- response_function: () => {
24
- meshEdgesCommonStyle.meshEdgesStyle(id).width = width;
25
- console.log(setMeshEdgesWidth.name, { id }, JSON.stringify(meshEdgesWidth(id)));
26
- },
22
+ response_function: () => meshEdgesCommonStyle.mutateMeshEdgesStyle(id, { width }),
27
23
  },
28
24
  );
29
25
  }
@@ -33,21 +33,36 @@ export function useMeshStyle() {
33
33
  meshSchemas.visibility,
34
34
  { id, visibility },
35
35
  {
36
- response_function: () => {
37
- hybridViewerStore.setVisibility(id, visibility);
38
- dataStyleState.getStyle(id).visibility = visibility;
39
- console.log(setMeshVisibility.name, { id }, meshVisibility(id));
36
+ response_function: async () => {
37
+ await hybridViewerStore.setVisibility(id, visibility);
38
+ return dataStyleState.mutateStyle(id, { visibility });
40
39
  },
41
40
  },
42
41
  );
43
42
  }
44
43
 
44
+ function meshColor(id) {
45
+ return dataStyleState.getStyle(id).color;
46
+ }
47
+
48
+ function setMeshColor(id, color) {
49
+ return viewerStore.request(
50
+ meshSchemas.color,
51
+ { id, color },
52
+ {
53
+ response_function: () => dataStyleState.mutateStyle(id, { color }),
54
+ },
55
+ );
56
+ }
57
+
45
58
  function applyMeshStyle(id) {
46
59
  const style = dataStyleState.getStyle(id);
47
60
  const promise_array = [];
48
61
  for (const [key, value] of Object.entries(style)) {
49
62
  if (key === "visibility") {
50
63
  promise_array.push(setMeshVisibility(id, value));
64
+ } else if (key === "color") {
65
+ promise_array.push(setMeshColor(id, value));
51
66
  } else if (key === "points") {
52
67
  promise_array.push(meshPointsStyle.applyMeshPointsStyle(id));
53
68
  } else if (key === "edges") {
@@ -58,7 +73,17 @@ export function useMeshStyle() {
58
73
  promise_array.push(meshPolygonsStyle.applyMeshPolygonsStyle(id));
59
74
  } else if (key === "polyhedra") {
60
75
  promise_array.push(meshPolyhedraStyle.applyMeshPolyhedraStyle(id));
61
- } else if (key !== "attributes") {
76
+ } else if (
77
+ key === "corners" ||
78
+ key === "lines" ||
79
+ key === "surfaces" ||
80
+ key === "blocks" ||
81
+ key === "attributes" ||
82
+ key === "id"
83
+ ) {
84
+ // These keys are either handled elsewhere or not applicable to mesh objects
85
+ continue;
86
+ } else {
62
87
  throw new Error(`Unknown mesh key: ${key}`);
63
88
  }
64
89
  }
@@ -68,6 +93,8 @@ export function useMeshStyle() {
68
93
  return {
69
94
  meshVisibility,
70
95
  setMeshVisibility,
96
+ meshColor,
97
+ setMeshColor,
71
98
  applyMeshStyle,
72
99
  ...meshPointsStyle,
73
100
  ...meshEdgesStyle,
@@ -20,10 +20,10 @@ export function useMeshPointsColorStyle() {
20
20
  meshPointsColorSchemas,
21
21
  { id, color },
22
22
  {
23
- response_function: () => {
24
- meshPointsCommonStyle.meshPointsColoring(id).color = color;
25
- console.log(setMeshPointsColor.name, { id }, JSON.stringify(meshPointsColor(id)));
26
- },
23
+ response_function: () =>
24
+ meshPointsCommonStyle.mutateMeshPointsColoring(id, {
25
+ color,
26
+ }),
27
27
  },
28
28
  );
29
29
  }
@@ -3,6 +3,12 @@ import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state";
3
3
  export function useMeshPointsCommonStyle() {
4
4
  const dataStyleStateStore = useDataStyleStateStore();
5
5
 
6
+ function mutateMeshPointsStyle(id, values) {
7
+ return dataStyleStateStore.mutateStyle(id, {
8
+ points: values,
9
+ });
10
+ }
11
+
6
12
  function meshPointsStyle(id) {
7
13
  return dataStyleStateStore.getStyle(id).points;
8
14
  }
@@ -11,13 +17,16 @@ export function useMeshPointsCommonStyle() {
11
17
  return meshPointsStyle(id).coloring;
12
18
  }
13
19
 
14
- function meshPointsActiveColoring(id) {
15
- return meshPointsColoring(id).active;
20
+ function mutateMeshPointsColoring(id, values) {
21
+ return mutateMeshPointsStyle(id, {
22
+ coloring: values,
23
+ });
16
24
  }
17
25
 
18
26
  return {
19
27
  meshPointsStyle,
20
28
  meshPointsColoring,
21
- meshPointsActiveColoring,
29
+ mutateMeshPointsStyle,
30
+ mutateMeshPointsColoring,
22
31
  };
23
32
  }