@geode/opengeodeweb-front 10.36.0 → 10.37.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 (93) hide show
  1. package/app/components/Screenshot.vue +6 -4
  2. package/app/components/ViewToolbar.vue +4 -2
  3. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +7 -4
  4. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +10 -4
  5. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +7 -4
  6. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +5 -2
  7. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +10 -6
  8. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +7 -6
  9. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +9 -18
  10. package/app/components/Viewer/Generic/Model/CornersOptions.vue +5 -10
  11. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +3 -0
  12. package/app/components/Viewer/Generic/Model/LinesOptions.vue +9 -17
  13. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +8 -18
  14. package/app/components/Viewer/ObjectTree/Views/ModelTree.vue +1 -5
  15. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +11 -2
  16. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +7 -6
  17. package/app/components/Viewer/Surface/PolygonsOptions.vue +10 -6
  18. package/app/composables/hover_highlight.ts +5 -4
  19. package/app/composables/project_manager.ts +1 -1
  20. package/app/composables/use_overlapping_picker.ts +4 -73
  21. package/app/composables/use_quick_colormap.ts +4 -14
  22. package/app/stores/back.ts +4 -10
  23. package/app/stores/camera_manager.ts +1 -1
  24. package/app/stores/data.ts +1 -1
  25. package/app/stores/viewer.ts +33 -19
  26. package/internal/stores/data_style/mesh/cells/cell.ts +26 -23
  27. package/internal/stores/data_style/mesh/cells/color.ts +8 -6
  28. package/internal/stores/data_style/mesh/cells/index.ts +13 -6
  29. package/internal/stores/data_style/mesh/cells/textures.ts +17 -6
  30. package/internal/stores/data_style/mesh/cells/vertex.ts +29 -23
  31. package/internal/stores/data_style/mesh/cells/visibility.ts +3 -6
  32. package/internal/stores/data_style/mesh/edges/color.ts +8 -6
  33. package/internal/stores/data_style/mesh/edges/edge.ts +26 -23
  34. package/internal/stores/data_style/mesh/edges/index.ts +13 -3
  35. package/internal/stores/data_style/mesh/edges/vertex.ts +29 -23
  36. package/internal/stores/data_style/mesh/edges/visibility.ts +3 -6
  37. package/internal/stores/data_style/mesh/edges/width.ts +3 -3
  38. package/internal/stores/data_style/mesh/index.ts +24 -11
  39. package/internal/stores/data_style/mesh/points/color.ts +8 -6
  40. package/internal/stores/data_style/mesh/points/index.ts +13 -6
  41. package/internal/stores/data_style/mesh/points/size.ts +3 -3
  42. package/internal/stores/data_style/mesh/points/vertex.ts +29 -23
  43. package/internal/stores/data_style/mesh/points/visibility.ts +5 -11
  44. package/internal/stores/data_style/mesh/polygons/color.ts +8 -6
  45. package/internal/stores/data_style/mesh/polygons/index.ts +13 -9
  46. package/internal/stores/data_style/mesh/polygons/polygon.ts +26 -23
  47. package/internal/stores/data_style/mesh/polygons/textures.ts +17 -6
  48. package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -23
  49. package/internal/stores/data_style/mesh/polygons/visibility.ts +3 -6
  50. package/internal/stores/data_style/mesh/polyhedra/color.ts +8 -6
  51. package/internal/stores/data_style/mesh/polyhedra/index.ts +9 -5
  52. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +28 -23
  53. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -23
  54. package/internal/stores/data_style/mesh/polyhedra/visibility.ts +3 -6
  55. package/internal/stores/data_style/model/blocks/color.ts +8 -6
  56. package/internal/stores/data_style/model/blocks/index.ts +9 -22
  57. package/internal/stores/data_style/model/blocks/polyhedron.ts +28 -23
  58. package/internal/stores/data_style/model/blocks/vertex.ts +26 -23
  59. package/internal/stores/data_style/model/blocks/visibility.ts +3 -3
  60. package/internal/stores/data_style/model/color.ts +10 -7
  61. package/internal/stores/data_style/model/common.ts +36 -20
  62. package/internal/stores/data_style/model/corners/color.ts +8 -6
  63. package/internal/stores/data_style/model/corners/index.ts +8 -14
  64. package/internal/stores/data_style/model/corners/vertex.ts +26 -23
  65. package/internal/stores/data_style/model/corners/visibility.ts +3 -3
  66. package/internal/stores/data_style/model/edges/visibility.ts +8 -8
  67. package/internal/stores/data_style/model/lines/color.ts +8 -6
  68. package/internal/stores/data_style/model/lines/edge.ts +26 -23
  69. package/internal/stores/data_style/model/lines/index.ts +9 -22
  70. package/internal/stores/data_style/model/lines/vertex.ts +26 -23
  71. package/internal/stores/data_style/model/lines/visibility.ts +3 -3
  72. package/internal/stores/data_style/model/points/index.ts +14 -4
  73. package/internal/stores/data_style/model/points/size.ts +3 -3
  74. package/internal/stores/data_style/model/points/visibility.ts +3 -6
  75. package/internal/stores/data_style/model/surfaces/color.ts +8 -6
  76. package/internal/stores/data_style/model/surfaces/index.ts +9 -22
  77. package/internal/stores/data_style/model/surfaces/polygon.ts +29 -23
  78. package/internal/stores/data_style/model/surfaces/vertex.ts +26 -23
  79. package/internal/stores/data_style/model/surfaces/visibility.ts +3 -3
  80. package/internal/stores/data_style/model/visibility.ts +1 -1
  81. package/internal/stores/data_style/when_defined.ts +13 -0
  82. package/internal/stores/hybrid_viewer/camera.ts +14 -15
  83. package/internal/stores/hybrid_viewer/core.ts +1 -1
  84. package/internal/stores/hybrid_viewer/filters.ts +12 -6
  85. package/internal/stores/hybrid_viewer/highlight.ts +9 -18
  86. package/internal/stores/hybrid_viewer/ruler.ts +10 -13
  87. package/internal/stores/hybrid_viewer/scene.ts +1 -1
  88. package/internal/utils/viewer_call.ts +1 -1
  89. package/package.json +1 -1
  90. package/server/utils/ws_client.ts +4 -4
  91. package/shared/utils/call_raw.ts +3 -3
  92. package/shared/utils/call_schema.ts +10 -8
  93. package/shared/utils/types.ts +6 -0
@@ -1,5 +1,5 @@
1
1
  // Third party imports
2
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
2
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
3
3
 
4
4
  // Local imports
5
5
  import { useMeshPointsCommonStyle } from "./common";
@@ -10,7 +10,7 @@ const schema = viewer_schemas.opengeodeweb_viewer.mesh.points.visibility;
10
10
 
11
11
  export function useMeshPointsVisibilityStyle(): {
12
12
  meshPointsVisibility: (id: string) => boolean | undefined;
13
- setMeshPointsVisibility: (id: string, visibility: boolean | undefined) => Promise<unknown>;
13
+ setMeshPointsVisibility: (id: string, visibility: boolean) => Promise<unknown>;
14
14
  } {
15
15
  const viewerStore = useViewerStore();
16
16
  const meshPointsCommonStyle = useMeshPointsCommonStyle();
@@ -19,10 +19,7 @@ export function useMeshPointsVisibilityStyle(): {
19
19
  // oxlint-disable-next-line no-unsafe-type-assertion -- visibility is defined as boolean in the data style schema.
20
20
  return meshPointsCommonStyle.meshPointsStyle(id).visibility as boolean | undefined;
21
21
  }
22
- async function setMeshPointsVisibility(
23
- id: string,
24
- visibility: boolean | undefined,
25
- ): Promise<unknown> {
22
+ async function setMeshPointsVisibility(id: string, visibility: boolean): Promise<unknown> {
26
23
  const params = { id, visibility };
27
24
  const result = await viewerStore.request(
28
25
  {
@@ -30,11 +27,8 @@ export function useMeshPointsVisibilityStyle(): {
30
27
  params,
31
28
  },
32
29
  {
33
- response_function: async (response: unknown) => {
34
- // oxlint-disable-next-line no-unsafe-type-assertion -- response shape is defined by the viewer schema.
35
- const typedResponse = response as { id: string; visibility: boolean };
36
- const mutateResult =
37
- await meshPointsCommonStyle.mutateMeshPointsVisibility(typedResponse);
30
+ response_function: async (response) => {
31
+ const mutateResult = await meshPointsCommonStyle.mutateMeshPointsVisibility(response);
38
32
  return mutateResult;
39
33
  },
40
34
  },
@@ -1,5 +1,6 @@
1
+ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
1
2
  // Third party imports
2
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
3
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
3
4
 
4
5
  // Local imports
5
6
  import { useMeshPolygonsCommonStyle } from "./common";
@@ -9,16 +10,17 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
9
10
  const schema = viewer_schemas.opengeodeweb_viewer.mesh.polygons.color;
10
11
 
11
12
  export function useMeshPolygonsColorStyle(): {
12
- meshPolygonsColor: (id: string) => unknown;
13
- setMeshPolygonsColor: (id: string, color: unknown) => Promise<unknown>;
13
+ meshPolygonsColor: (id: string) => RGBAColor | undefined;
14
+ setMeshPolygonsColor: (id: string, color: RGBAColor) => Promise<unknown>;
14
15
  } {
15
16
  const viewerStore = useViewerStore();
16
17
  const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
17
18
 
18
- function meshPolygonsColor(id: string): unknown {
19
- return meshPolygonsCommonStyle.meshPolygonsColoring(id).constant;
19
+ function meshPolygonsColor(id: string): RGBAColor | undefined {
20
+ // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
21
+ return meshPolygonsCommonStyle.meshPolygonsColoring(id).constant as RGBAColor | undefined;
20
22
  }
21
- async function setMeshPolygonsColor(id: string, color: unknown): Promise<unknown> {
23
+ async function setMeshPolygonsColor(id: string, color: RGBAColor): Promise<unknown> {
22
24
  const params = { id, color };
23
25
  const result = await viewerStore.request(
24
26
  {
@@ -11,6 +11,7 @@ import { useMeshPolygonsColorStyle } from "./color";
11
11
  import { useMeshPolygonsCommonStyle } from "./common";
12
12
  import { useMeshPolygonsTexturesStyle } from "./textures";
13
13
  import { useMeshPolygonsVisibilityStyle } from "./visibility";
14
+ import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
14
15
 
15
16
  // Local constants
16
17
 
@@ -61,17 +62,17 @@ async function setMeshPolygonsActiveColoring(
61
62
  coloring: { active: type },
62
63
  });
63
64
  if (type === "constant") {
64
- const result = await deps.colorStyle.setMeshPolygonsColor(
65
- id,
66
- deps.colorStyle.meshPolygonsColor(id),
67
- );
65
+ const result = await whenDefined(deps.colorStyle.meshPolygonsColor(id), async (value) => {
66
+ const applied = await deps.colorStyle.setMeshPolygonsColor(id, value);
67
+ return applied;
68
+ });
68
69
  return result;
69
70
  }
70
71
  if (type === "textures") {
71
- const result = await deps.texturesStyle.setMeshPolygonsTextures(
72
- id,
73
- deps.texturesStyle.meshPolygonsTextures(id),
74
- );
72
+ const result = await whenDefined(deps.texturesStyle.meshPolygonsTextures(id), async (value) => {
73
+ const applied = await deps.texturesStyle.setMeshPolygonsTextures(id, value);
74
+ return applied;
75
+ });
75
76
  return result;
76
77
  }
77
78
  if (type === "vertex") {
@@ -92,7 +93,10 @@ async function applyMeshPolygonsStyle(
92
93
  deps: MeshPolygonsActiveColoringDeps,
93
94
  ): Promise<unknown[]> {
94
95
  const result = await Promise.all([
95
- visibilityStyle.setMeshPolygonsVisibility(id, visibilityStyle.meshPolygonsVisibility(id)),
96
+ whenDefined(visibilityStyle.meshPolygonsVisibility(id), async (value) => {
97
+ const applied = await visibilityStyle.setMeshPolygonsVisibility(id, value);
98
+ return applied;
99
+ }),
96
100
  setMeshPolygonsActiveColoring(id, activeColoringType, deps),
97
101
  ]);
98
102
  return result;
@@ -1,6 +1,6 @@
1
- import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
1
+ import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
2
  // Third party imports
3
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
3
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
4
4
 
5
5
  // Local imports
6
6
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
@@ -15,7 +15,7 @@ interface AttributeStoredConfig {
15
15
  minimum: number | undefined;
16
16
  maximum: number | undefined;
17
17
  colorMap: string | undefined;
18
- no_data_color: unknown;
18
+ no_data_color: RGBAColor;
19
19
  }
20
20
 
21
21
  interface AttributeState {
@@ -30,22 +30,25 @@ interface AttributeInput {
30
30
  minimum: number | undefined;
31
31
  maximum: number | undefined;
32
32
  colorMap: string | undefined;
33
- no_data_color?: unknown;
33
+ no_data_color?: RGBAColor;
34
34
  }
35
35
 
36
- function isMeshPolygonsPolygonAttributeValid({
37
- name,
38
- item,
39
- minimum,
40
- maximum,
41
- colorMap,
42
- }: AttributeInput): boolean {
36
+ interface ValidAttributeInput {
37
+ name: string;
38
+ item: number;
39
+ minimum: number;
40
+ maximum: number;
41
+ colorMap: string;
42
+ no_data_color?: RGBAColor;
43
+ }
44
+
45
+ function isMeshPolygonsPolygonAttributeValid(input: AttributeInput): input is ValidAttributeInput {
43
46
  return (
44
- name !== undefined &&
45
- item !== undefined &&
46
- minimum !== undefined &&
47
- maximum !== undefined &&
48
- colorMap !== undefined
47
+ input.name !== undefined &&
48
+ input.item !== undefined &&
49
+ input.minimum !== undefined &&
50
+ input.maximum !== undefined &&
51
+ input.colorMap !== undefined
49
52
  );
50
53
  }
51
54
 
@@ -60,7 +63,7 @@ function useMeshPolygonsPolygonAttributeStyle(): {
60
63
  name: string | undefined,
61
64
  item: number | undefined,
62
65
  ) => AttributeStoredConfig;
63
- setMeshPolygonsPolygonAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
66
+ setMeshPolygonsPolygonAttribute: (id: string, input: ValidAttributeInput) => Promise<unknown>;
64
67
  setMeshPolygonsPolygonAttributeName: (id: string, name: string) => Promise<unknown>;
65
68
  setMeshPolygonsPolygonAttributeItem: (id: string, item: number) => Promise<unknown>;
66
69
  setMeshPolygonsPolygonAttributeRange: (
@@ -72,10 +75,10 @@ function useMeshPolygonsPolygonAttributeStyle(): {
72
75
  id: string,
73
76
  colorMap: string | undefined,
74
77
  ) => Promise<unknown>;
75
- meshPolygonsPolygonAttributeNoDataColor: (id: string) => unknown;
78
+ meshPolygonsPolygonAttributeNoDataColor: (id: string) => RGBAColor;
76
79
  setMeshPolygonsPolygonAttributeNoDataColor: (
77
80
  id: string,
78
- no_data_color: unknown,
81
+ no_data_color: RGBAColor,
79
82
  ) => Promise<unknown>;
80
83
  } {
81
84
  const viewerStore = useViewerStore();
@@ -149,7 +152,7 @@ function useMeshPolygonsPolygonAttributeStyle(): {
149
152
  maximum,
150
153
  colorMap,
151
154
  no_data_color = DEFAULT_NO_DATA_COLOR,
152
- }: AttributeInput,
155
+ }: ValidAttributeInput,
153
156
  ): Promise<unknown> {
154
157
  await mutateMeshPolygonsPolygonStyle(id, {
155
158
  name,
@@ -161,7 +164,7 @@ function useMeshPolygonsPolygonAttributeStyle(): {
161
164
  colorMap,
162
165
  no_data_color,
163
166
  });
164
- const points = getRGBPointsFromPreset(colorMap ?? "");
167
+ const points = [...getRGBPointsFromPreset(colorMap)];
165
168
  const schema = meshPolygonsPolygonAttributeSchemas.attribute;
166
169
  const params = {
167
170
  id,
@@ -245,7 +248,7 @@ function useMeshPolygonsPolygonAttributeStyle(): {
245
248
  });
246
249
  return applyPolygonAttribute(id);
247
250
  }
248
- function meshPolygonsPolygonAttributeNoDataColor(id: string): unknown {
251
+ function meshPolygonsPolygonAttributeNoDataColor(id: string): RGBAColor {
249
252
  const name = meshPolygonsPolygonAttributeName(id);
250
253
  const item = meshPolygonsPolygonAttributeItem(id);
251
254
  const storedConfig = meshPolygonsPolygonAttributeStoredConfig(id, name, item);
@@ -253,7 +256,7 @@ function useMeshPolygonsPolygonAttributeStyle(): {
253
256
  }
254
257
  async function setMeshPolygonsPolygonAttributeNoDataColor(
255
258
  id: string,
256
- no_data_color: unknown,
259
+ no_data_color: RGBAColor,
257
260
  ): Promise<unknown> {
258
261
  const name = meshPolygonsPolygonAttributeName(id);
259
262
  const item = meshPolygonsPolygonAttributeItem(id);
@@ -1,5 +1,7 @@
1
1
  // Third party imports
2
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
2
+ import viewer_schemas, {
3
+ type MeshApplyTexturesParams,
4
+ } from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
3
5
 
4
6
  // Local imports
5
7
  import { useMeshPolygonsCommonStyle } from "./common";
@@ -9,16 +11,25 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
9
11
  const schema = viewer_schemas.opengeodeweb_viewer.mesh.apply_textures;
10
12
 
11
13
  export function useMeshPolygonsTexturesStyle(): {
12
- meshPolygonsTextures: (id: string) => unknown;
13
- setMeshPolygonsTextures: (id: string, textures: unknown) => Promise<unknown>;
14
+ meshPolygonsTextures: (id: string) => MeshApplyTexturesParams["textures"] | undefined;
15
+ setMeshPolygonsTextures: (
16
+ id: string,
17
+ textures: MeshApplyTexturesParams["textures"],
18
+ ) => Promise<unknown>;
14
19
  } {
15
20
  const viewerStore = useViewerStore();
16
21
  const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
17
22
 
18
- function meshPolygonsTextures(id: string): unknown {
19
- return meshPolygonsCommonStyle.meshPolygonsColoring(id).textures;
23
+ function meshPolygonsTextures(id: string): MeshApplyTexturesParams["textures"] | undefined {
24
+ // oxlint-disable-next-line no-unsafe-type-assertion -- textures shape is defined by the data style schema.
25
+ return meshPolygonsCommonStyle.meshPolygonsColoring(id).textures as
26
+ | MeshApplyTexturesParams["textures"]
27
+ | undefined;
20
28
  }
21
- async function setMeshPolygonsTextures(id: string, textures: unknown): Promise<unknown> {
29
+ async function setMeshPolygonsTextures(
30
+ id: string,
31
+ textures: MeshApplyTexturesParams["textures"],
32
+ ): Promise<unknown> {
22
33
  const params = { id, textures };
23
34
  const result = await viewerStore.request(
24
35
  {
@@ -1,6 +1,6 @@
1
- import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
1
+ import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
2
  // Third party imports
3
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
3
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
4
4
 
5
5
  // Local imports
6
6
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
@@ -15,7 +15,7 @@ interface AttributeStoredConfig {
15
15
  minimum: number | undefined;
16
16
  maximum: number | undefined;
17
17
  colorMap: string | undefined;
18
- no_data_color: unknown;
18
+ no_data_color: RGBAColor;
19
19
  }
20
20
 
21
21
  interface AttributeState {
@@ -30,22 +30,25 @@ interface AttributeInput {
30
30
  minimum: number | undefined;
31
31
  maximum: number | undefined;
32
32
  colorMap: string | undefined;
33
- no_data_color?: unknown;
33
+ no_data_color?: RGBAColor;
34
34
  }
35
35
 
36
- function isMeshPolygonsVertexAttributeValid({
37
- name,
38
- item,
39
- minimum,
40
- maximum,
41
- colorMap,
42
- }: AttributeInput): boolean {
36
+ interface ValidAttributeInput {
37
+ name: string;
38
+ item: number;
39
+ minimum: number;
40
+ maximum: number;
41
+ colorMap: string;
42
+ no_data_color?: RGBAColor;
43
+ }
44
+
45
+ function isMeshPolygonsVertexAttributeValid(input: AttributeInput): input is ValidAttributeInput {
43
46
  return (
44
- name !== undefined &&
45
- item !== undefined &&
46
- minimum !== undefined &&
47
- maximum !== undefined &&
48
- colorMap !== undefined
47
+ input.name !== undefined &&
48
+ input.item !== undefined &&
49
+ input.minimum !== undefined &&
50
+ input.maximum !== undefined &&
51
+ input.colorMap !== undefined
49
52
  );
50
53
  }
51
54
 
@@ -59,7 +62,7 @@ interface UseMeshPolygonsVertexAttributeStyleReturn {
59
62
  name: string | undefined,
60
63
  item: number | undefined,
61
64
  ) => AttributeStoredConfig;
62
- setMeshPolygonsVertexAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
65
+ setMeshPolygonsVertexAttribute: (id: string, input: ValidAttributeInput) => Promise<unknown>;
63
66
  setMeshPolygonsVertexAttributeName: (id: string, name: string) => Promise<unknown>;
64
67
  setMeshPolygonsVertexAttributeItem: (id: string, item: number) => Promise<unknown>;
65
68
  setMeshPolygonsVertexAttributeRange: (
@@ -71,10 +74,10 @@ interface UseMeshPolygonsVertexAttributeStyleReturn {
71
74
  id: string,
72
75
  colorMap: string | undefined,
73
76
  ) => Promise<unknown>;
74
- meshPolygonsVertexAttributeNoDataColor: (id: string) => unknown;
77
+ meshPolygonsVertexAttributeNoDataColor: (id: string) => RGBAColor;
75
78
  setMeshPolygonsVertexAttributeNoDataColor: (
76
79
  id: string,
77
- no_data_color: unknown,
80
+ no_data_color: RGBAColor,
78
81
  ) => Promise<unknown>;
79
82
  }
80
83
 
@@ -155,7 +158,7 @@ function useMeshPolygonsVertexAttributeStyle(): UseMeshPolygonsVertexAttributeSt
155
158
  maximum,
156
159
  colorMap,
157
160
  no_data_color = DEFAULT_NO_DATA_COLOR,
158
- }: AttributeInput,
161
+ }: ValidAttributeInput,
159
162
  ): Promise<unknown> {
160
163
  await mutateMeshPolygonsVertexStyle(id, {
161
164
  name,
@@ -167,7 +170,7 @@ function useMeshPolygonsVertexAttributeStyle(): UseMeshPolygonsVertexAttributeSt
167
170
  colorMap,
168
171
  no_data_color,
169
172
  });
170
- const points = getRGBPointsFromPreset(colorMap ?? "");
173
+ const points = [...getRGBPointsFromPreset(colorMap)];
171
174
  const schema = meshPolygonsVertexAttributeSchemas.attribute;
172
175
  const params = {
173
176
  id,
@@ -251,7 +254,7 @@ function useMeshPolygonsVertexAttributeStyle(): UseMeshPolygonsVertexAttributeSt
251
254
  });
252
255
  return applyVertexAttribute(id);
253
256
  }
254
- function meshPolygonsVertexAttributeNoDataColor(id: string): unknown {
257
+ function meshPolygonsVertexAttributeNoDataColor(id: string): RGBAColor {
255
258
  const name = meshPolygonsVertexAttributeName(id);
256
259
  const item = meshPolygonsVertexAttributeItem(id);
257
260
  const storedConfig = meshPolygonsVertexAttributeStoredConfig(id, name, item);
@@ -259,7 +262,7 @@ function useMeshPolygonsVertexAttributeStyle(): UseMeshPolygonsVertexAttributeSt
259
262
  }
260
263
  async function setMeshPolygonsVertexAttributeNoDataColor(
261
264
  id: string,
262
- no_data_color: unknown,
265
+ no_data_color: RGBAColor,
263
266
  ): Promise<unknown> {
264
267
  const name = meshPolygonsVertexAttributeName(id);
265
268
  const item = meshPolygonsVertexAttributeItem(id);
@@ -1,5 +1,5 @@
1
1
  // Third party imports
2
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
2
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
3
3
 
4
4
  // Local imports
5
5
  import { useMeshPolygonsCommonStyle } from "./common";
@@ -10,7 +10,7 @@ const schema = viewer_schemas.opengeodeweb_viewer.mesh.polygons.visibility;
10
10
 
11
11
  export function useMeshPolygonsVisibilityStyle(): {
12
12
  meshPolygonsVisibility: (id: string) => boolean | undefined;
13
- setMeshPolygonsVisibility: (id: string, visibility: boolean | undefined) => Promise<unknown>;
13
+ setMeshPolygonsVisibility: (id: string, visibility: boolean) => Promise<unknown>;
14
14
  } {
15
15
  const viewerStore = useViewerStore();
16
16
  const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
@@ -19,10 +19,7 @@ export function useMeshPolygonsVisibilityStyle(): {
19
19
  // oxlint-disable-next-line no-unsafe-type-assertion -- visibility is defined as boolean in the data style schema.
20
20
  return meshPolygonsCommonStyle.meshPolygonsStyle(id).visibility as boolean | undefined;
21
21
  }
22
- async function setMeshPolygonsVisibility(
23
- id: string,
24
- visibility: boolean | undefined,
25
- ): Promise<unknown> {
22
+ async function setMeshPolygonsVisibility(id: string, visibility: boolean): Promise<unknown> {
26
23
  const params = { id, visibility };
27
24
  const result = await viewerStore.request(
28
25
  {
@@ -1,5 +1,6 @@
1
+ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
1
2
  // Third party imports
2
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
3
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
3
4
 
4
5
  // Local imports
5
6
  import { useMeshPolyhedraCommonStyle } from "./common";
@@ -9,16 +10,17 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
9
10
  const schema = viewer_schemas.opengeodeweb_viewer.mesh.polyhedra.color;
10
11
 
11
12
  export function useMeshPolyhedraColorStyle(): {
12
- meshPolyhedraColor: (id: string) => unknown;
13
- setMeshPolyhedraColor: (id: string, color: unknown) => Promise<unknown>;
13
+ meshPolyhedraColor: (id: string) => RGBAColor | undefined;
14
+ setMeshPolyhedraColor: (id: string, color: RGBAColor) => Promise<unknown>;
14
15
  } {
15
16
  const viewerStore = useViewerStore();
16
17
  const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle();
17
18
 
18
- function meshPolyhedraColor(id: string): unknown {
19
- return meshPolyhedraCommonStyle.meshPolyhedraColoring(id).constant;
19
+ function meshPolyhedraColor(id: string): RGBAColor | undefined {
20
+ // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
21
+ return meshPolyhedraCommonStyle.meshPolyhedraColoring(id).constant as RGBAColor | undefined;
20
22
  }
21
- async function setMeshPolyhedraColor(id: string, color: unknown): Promise<unknown> {
23
+ async function setMeshPolyhedraColor(id: string, color: RGBAColor): Promise<unknown> {
22
24
  const params = { id, color };
23
25
  const result = await viewerStore.request(
24
26
  {
@@ -13,6 +13,7 @@ import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
13
13
  import { useMeshPolyhedraColorStyle } from "./color";
14
14
  import { useMeshPolyhedraCommonStyle } from "./common";
15
15
  import { useMeshPolyhedraVisibilityStyle } from "./visibility";
16
+ import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
16
17
 
17
18
  // Local constants
18
19
 
@@ -62,10 +63,10 @@ async function setMeshPolyhedraActiveColoring(
62
63
  coloring: { active: type },
63
64
  });
64
65
  if (type === "constant") {
65
- const result = await deps.colorStyle.setMeshPolyhedraColor(
66
- id,
67
- deps.colorStyle.meshPolyhedraColor(id),
68
- );
66
+ const result = await whenDefined(deps.colorStyle.meshPolyhedraColor(id), async (value) => {
67
+ const applied = await deps.colorStyle.setMeshPolyhedraColor(id, value);
68
+ return applied;
69
+ });
69
70
  return result;
70
71
  }
71
72
  if (type === "vertex") {
@@ -86,7 +87,10 @@ async function applyMeshPolyhedraStyle(
86
87
  deps: MeshPolyhedraActiveColoringDeps,
87
88
  ): Promise<unknown[]> {
88
89
  const result = await Promise.all([
89
- visibilityStyle.setMeshPolyhedraVisibility(id, visibilityStyle.meshPolyhedraVisibility(id)),
90
+ whenDefined(visibilityStyle.meshPolyhedraVisibility(id), async (value) => {
91
+ const applied = await visibilityStyle.setMeshPolyhedraVisibility(id, value);
92
+ return applied;
93
+ }),
90
94
  setMeshPolyhedraActiveColoring(id, activeColoringType, deps),
91
95
  ]);
92
96
  return result;
@@ -1,6 +1,6 @@
1
- import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
1
+ import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
2
  // Third party imports
3
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
3
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
4
4
 
5
5
  // Local imports
6
6
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
@@ -15,7 +15,7 @@ interface AttributeStoredConfig {
15
15
  minimum: number | undefined;
16
16
  maximum: number | undefined;
17
17
  colorMap: string | undefined;
18
- no_data_color: unknown;
18
+ no_data_color: RGBAColor;
19
19
  }
20
20
 
21
21
  interface AttributeState {
@@ -30,22 +30,27 @@ interface AttributeInput {
30
30
  minimum: number | undefined;
31
31
  maximum: number | undefined;
32
32
  colorMap: string | undefined;
33
- no_data_color?: unknown;
33
+ no_data_color?: RGBAColor;
34
34
  }
35
35
 
36
- function isMeshPolyhedraPolyhedronAttributeValid({
37
- name,
38
- item,
39
- minimum,
40
- maximum,
41
- colorMap,
42
- }: AttributeInput): boolean {
36
+ interface ValidAttributeInput {
37
+ name: string;
38
+ item: number;
39
+ minimum: number;
40
+ maximum: number;
41
+ colorMap: string;
42
+ no_data_color?: RGBAColor;
43
+ }
44
+
45
+ function isMeshPolyhedraPolyhedronAttributeValid(
46
+ input: AttributeInput,
47
+ ): input is ValidAttributeInput {
43
48
  return (
44
- name !== undefined &&
45
- item !== undefined &&
46
- minimum !== undefined &&
47
- maximum !== undefined &&
48
- colorMap !== undefined
49
+ input.name !== undefined &&
50
+ input.item !== undefined &&
51
+ input.minimum !== undefined &&
52
+ input.maximum !== undefined &&
53
+ input.colorMap !== undefined
49
54
  );
50
55
  }
51
56
 
@@ -60,7 +65,7 @@ function useMeshPolyhedraPolyhedronAttributeStyle(): {
60
65
  name: string | undefined,
61
66
  item: number | undefined,
62
67
  ) => AttributeStoredConfig;
63
- setMeshPolyhedraPolyhedronAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
68
+ setMeshPolyhedraPolyhedronAttribute: (id: string, input: ValidAttributeInput) => Promise<unknown>;
64
69
  setMeshPolyhedraPolyhedronAttributeName: (id: string, name: string) => Promise<unknown>;
65
70
  setMeshPolyhedraPolyhedronAttributeItem: (id: string, item: number) => Promise<unknown>;
66
71
  setMeshPolyhedraPolyhedronAttributeRange: (
@@ -72,10 +77,10 @@ function useMeshPolyhedraPolyhedronAttributeStyle(): {
72
77
  id: string,
73
78
  colorMap: string | undefined,
74
79
  ) => Promise<unknown>;
75
- meshPolyhedraPolyhedronAttributeNoDataColor: (id: string) => unknown;
80
+ meshPolyhedraPolyhedronAttributeNoDataColor: (id: string) => RGBAColor;
76
81
  setMeshPolyhedraPolyhedronAttributeNoDataColor: (
77
82
  id: string,
78
- no_data_color: unknown,
83
+ no_data_color: RGBAColor,
79
84
  ) => Promise<unknown>;
80
85
  } {
81
86
  const viewerStore = useViewerStore();
@@ -153,7 +158,7 @@ function useMeshPolyhedraPolyhedronAttributeStyle(): {
153
158
  maximum,
154
159
  colorMap,
155
160
  no_data_color = DEFAULT_NO_DATA_COLOR,
156
- }: AttributeInput,
161
+ }: ValidAttributeInput,
157
162
  ): Promise<unknown> {
158
163
  await mutateMeshPolyhedraPolyhedronStyle(id, {
159
164
  name,
@@ -165,7 +170,7 @@ function useMeshPolyhedraPolyhedronAttributeStyle(): {
165
170
  colorMap,
166
171
  no_data_color,
167
172
  });
168
- const points = getRGBPointsFromPreset(colorMap ?? "");
173
+ const points = [...getRGBPointsFromPreset(colorMap)];
169
174
  const schema = meshPolyhedraPolyhedronAttributeSchemas.attribute;
170
175
  const params = {
171
176
  id,
@@ -257,7 +262,7 @@ function useMeshPolyhedraPolyhedronAttributeStyle(): {
257
262
  });
258
263
  return applyPolyhedronAttribute(id);
259
264
  }
260
- function meshPolyhedraPolyhedronAttributeNoDataColor(id: string): unknown {
265
+ function meshPolyhedraPolyhedronAttributeNoDataColor(id: string): RGBAColor {
261
266
  const name = meshPolyhedraPolyhedronAttributeName(id);
262
267
  const item = meshPolyhedraPolyhedronAttributeItem(id);
263
268
  const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name, item);
@@ -265,7 +270,7 @@ function useMeshPolyhedraPolyhedronAttributeStyle(): {
265
270
  }
266
271
  async function setMeshPolyhedraPolyhedronAttributeNoDataColor(
267
272
  id: string,
268
- no_data_color: unknown,
273
+ no_data_color: RGBAColor,
269
274
  ): Promise<unknown> {
270
275
  const name = meshPolyhedraPolyhedronAttributeName(id);
271
276
  const item = meshPolyhedraPolyhedronAttributeItem(id);