@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 { useMeshCellsCommonStyle } from "./common";
@@ -10,7 +10,7 @@ const schema = viewer_schemas.opengeodeweb_viewer.mesh.cells.visibility;
10
10
 
11
11
  export function useMeshCellsVisibilityStyle(): {
12
12
  meshCellsVisibility: (id: string) => boolean | undefined;
13
- setMeshCellsVisibility: (id: string, visibility: boolean | undefined) => Promise<unknown>;
13
+ setMeshCellsVisibility: (id: string, visibility: boolean) => Promise<unknown>;
14
14
  } {
15
15
  const viewerStore = useViewerStore();
16
16
  const meshCellsCommonStyle = useMeshCellsCommonStyle();
@@ -19,10 +19,7 @@ export function useMeshCellsVisibilityStyle(): {
19
19
  // oxlint-disable-next-line no-unsafe-type-assertion -- visibility is defined as boolean in the data style schema.
20
20
  return meshCellsCommonStyle.meshCellsStyle(id).visibility as boolean | undefined;
21
21
  }
22
- async function setMeshCellsVisibility(
23
- id: string,
24
- visibility: boolean | undefined,
25
- ): Promise<unknown> {
22
+ async function setMeshCellsVisibility(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 { useMeshEdgesCommonStyle } from "./common";
@@ -9,16 +10,17 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
9
10
  const schema = viewer_schemas.opengeodeweb_viewer.mesh.edges.color;
10
11
 
11
12
  export function useMeshEdgesColorStyle(): {
12
- meshEdgesColor: (id: string) => unknown;
13
- setMeshEdgesColor: (id: string, color: unknown) => Promise<unknown>;
13
+ meshEdgesColor: (id: string) => RGBAColor | undefined;
14
+ setMeshEdgesColor: (id: string, color: RGBAColor) => Promise<unknown>;
14
15
  } {
15
16
  const viewerStore = useViewerStore();
16
17
  const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
17
18
 
18
- function meshEdgesColor(id: string): unknown {
19
- return meshEdgesCommonStyle.meshEdgesColoring(id).constant;
19
+ function meshEdgesColor(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 meshEdgesCommonStyle.meshEdgesColoring(id).constant as RGBAColor | undefined;
20
22
  }
21
- async function setMeshEdgesColor(id: string, color: unknown): Promise<unknown> {
23
+ async function setMeshEdgesColor(id: string, color: RGBAColor): Promise<unknown> {
22
24
  const params = { id, color };
23
25
  const result = await viewerStore.request(
24
26
  {
@@ -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";
@@ -14,7 +14,7 @@ interface AttributeStoredConfig {
14
14
  minimum: number | undefined;
15
15
  maximum: number | undefined;
16
16
  colorMap: string | undefined;
17
- no_data_color: unknown;
17
+ no_data_color: RGBAColor;
18
18
  }
19
19
 
20
20
  interface AttributeState {
@@ -29,22 +29,25 @@ interface AttributeInput {
29
29
  minimum: number | undefined;
30
30
  maximum: number | undefined;
31
31
  colorMap: string | undefined;
32
- no_data_color?: unknown;
32
+ no_data_color?: RGBAColor;
33
33
  }
34
34
 
35
- function isMeshEdgesEdgeAttributeValid({
36
- name,
37
- item,
38
- minimum,
39
- maximum,
40
- colorMap,
41
- }: AttributeInput): boolean {
35
+ interface ValidAttributeInput {
36
+ name: string;
37
+ item: number;
38
+ minimum: number;
39
+ maximum: number;
40
+ colorMap: string;
41
+ no_data_color?: RGBAColor;
42
+ }
43
+
44
+ function isMeshEdgesEdgeAttributeValid(input: AttributeInput): input is ValidAttributeInput {
42
45
  return (
43
- name !== undefined &&
44
- item !== undefined &&
45
- minimum !== undefined &&
46
- maximum !== undefined &&
47
- colorMap !== undefined
46
+ input.name !== undefined &&
47
+ input.item !== undefined &&
48
+ input.minimum !== undefined &&
49
+ input.maximum !== undefined &&
50
+ input.colorMap !== undefined
48
51
  );
49
52
  }
50
53
 
@@ -59,7 +62,7 @@ function useMeshEdgesEdgeAttributeStyle(): {
59
62
  name: string | undefined,
60
63
  item: number | undefined,
61
64
  ) => AttributeStoredConfig;
62
- setMeshEdgesEdgeAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
65
+ setMeshEdgesEdgeAttribute: (id: string, input: ValidAttributeInput) => Promise<unknown>;
63
66
  setMeshEdgesEdgeAttributeName: (id: string, name: string) => Promise<unknown>;
64
67
  setMeshEdgesEdgeAttributeItem: (id: string, item: number) => Promise<unknown>;
65
68
  setMeshEdgesEdgeAttributeRange: (
@@ -68,8 +71,8 @@ function useMeshEdgesEdgeAttributeStyle(): {
68
71
  maximum: number,
69
72
  ) => Promise<unknown>;
70
73
  setMeshEdgesEdgeAttributeColorMap: (id: string, colorMap: string | undefined) => Promise<unknown>;
71
- meshEdgesEdgeAttributeNoDataColor: (id: string) => unknown;
72
- setMeshEdgesEdgeAttributeNoDataColor: (id: string, no_data_color: unknown) => Promise<unknown>;
74
+ meshEdgesEdgeAttributeNoDataColor: (id: string) => RGBAColor;
75
+ setMeshEdgesEdgeAttributeNoDataColor: (id: string, no_data_color: RGBAColor) => Promise<unknown>;
73
76
  } {
74
77
  const viewerStore = useViewerStore();
75
78
  const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
@@ -146,7 +149,7 @@ function useMeshEdgesEdgeAttributeStyle(): {
146
149
  maximum,
147
150
  colorMap,
148
151
  no_data_color = DEFAULT_NO_DATA_COLOR,
149
- }: AttributeInput,
152
+ }: ValidAttributeInput,
150
153
  ): Promise<unknown> {
151
154
  await mutateMeshEdgesEdgeStyle(id, {
152
155
  name,
@@ -158,7 +161,7 @@ function useMeshEdgesEdgeAttributeStyle(): {
158
161
  colorMap,
159
162
  no_data_color,
160
163
  });
161
- const points = getRGBPointsFromPreset(colorMap ?? "");
164
+ const points = [...getRGBPointsFromPreset(colorMap)];
162
165
  const schema = meshEdgesEdgeAttributeSchemas.attribute;
163
166
  const params = {
164
167
  id,
@@ -242,7 +245,7 @@ function useMeshEdgesEdgeAttributeStyle(): {
242
245
  });
243
246
  return applyEdgeAttribute(id);
244
247
  }
245
- function meshEdgesEdgeAttributeNoDataColor(id: string): unknown {
248
+ function meshEdgesEdgeAttributeNoDataColor(id: string): RGBAColor {
246
249
  const name = meshEdgesEdgeAttributeName(id);
247
250
  const item = meshEdgesEdgeAttributeItem(id);
248
251
  const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
@@ -250,7 +253,7 @@ function useMeshEdgesEdgeAttributeStyle(): {
250
253
  }
251
254
  async function setMeshEdgesEdgeAttributeNoDataColor(
252
255
  id: string,
253
- no_data_color: unknown,
256
+ no_data_color: RGBAColor,
254
257
  ): Promise<unknown> {
255
258
  const name = meshEdgesEdgeAttributeName(id);
256
259
  const item = meshEdgesEdgeAttributeItem(id);
@@ -8,6 +8,7 @@ import { useMeshEdgesColorStyle } from "./color";
8
8
  import { useMeshEdgesCommonStyle } from "./common";
9
9
  import { useMeshEdgesVisibilityStyle } from "./visibility";
10
10
  import { useMeshEdgesWidthStyle } from "./width";
11
+ import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
11
12
 
12
13
  // Local constants
13
14
 
@@ -57,7 +58,10 @@ async function setMeshEdgesActiveColoring(
57
58
  coloring: { active: type },
58
59
  });
59
60
  if (type === "constant") {
60
- const result = await deps.colorStyle.setMeshEdgesColor(id, deps.colorStyle.meshEdgesColor(id));
61
+ const result = await whenDefined(deps.colorStyle.meshEdgesColor(id), async (value) => {
62
+ const applied = await deps.colorStyle.setMeshEdgesColor(id, value);
63
+ return applied;
64
+ });
61
65
  return result;
62
66
  }
63
67
  if (type === "vertex") {
@@ -79,8 +83,14 @@ async function applyMeshEdgesStyle(
79
83
  deps: MeshEdgesActiveColoringDeps,
80
84
  ): Promise<unknown[]> {
81
85
  const result = await Promise.all([
82
- visibilityStyle.setMeshEdgesVisibility(id, visibilityStyle.meshEdgesVisibility(id)),
83
- widthStyle.setMeshEdgesWidth(id, widthStyle.meshEdgesWidth(id)),
86
+ whenDefined(visibilityStyle.meshEdgesVisibility(id), async (value) => {
87
+ const applied = await visibilityStyle.setMeshEdgesVisibility(id, value);
88
+ return applied;
89
+ }),
90
+ whenDefined(widthStyle.meshEdgesWidth(id), async (value) => {
91
+ const applied = await widthStyle.setMeshEdgesWidth(id, value);
92
+ return applied;
93
+ }),
84
94
  setMeshEdgesActiveColoring(id, activeColoringType, deps),
85
95
  ]);
86
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,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 isMeshEdgesVertexAttributeValid({
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 isMeshEdgesVertexAttributeValid(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 UseMeshEdgesVertexAttributeStyleReturn {
59
62
  name: string | undefined,
60
63
  item: number | undefined,
61
64
  ) => AttributeStoredConfig;
62
- setMeshEdgesVertexAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
65
+ setMeshEdgesVertexAttribute: (id: string, input: ValidAttributeInput) => Promise<unknown>;
63
66
  setMeshEdgesVertexAttributeName: (id: string, name: string) => Promise<unknown>;
64
67
  setMeshEdgesVertexAttributeItem: (id: string, item: number) => Promise<unknown>;
65
68
  setMeshEdgesVertexAttributeRange: (
@@ -71,8 +74,11 @@ interface UseMeshEdgesVertexAttributeStyleReturn {
71
74
  id: string,
72
75
  colorMap: string | undefined,
73
76
  ) => Promise<unknown>;
74
- meshEdgesVertexAttributeNoDataColor: (id: string) => unknown;
75
- setMeshEdgesVertexAttributeNoDataColor: (id: string, no_data_color: unknown) => Promise<unknown>;
77
+ meshEdgesVertexAttributeNoDataColor: (id: string) => RGBAColor;
78
+ setMeshEdgesVertexAttributeNoDataColor: (
79
+ id: string,
80
+ no_data_color: RGBAColor,
81
+ ) => Promise<unknown>;
76
82
  }
77
83
 
78
84
  // oxlint-disable-next-line max-lines-per-function
@@ -152,7 +158,7 @@ function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleRet
152
158
  maximum,
153
159
  colorMap,
154
160
  no_data_color = DEFAULT_NO_DATA_COLOR,
155
- }: AttributeInput,
161
+ }: ValidAttributeInput,
156
162
  ): Promise<unknown> {
157
163
  await mutateMeshEdgesVertexStyle(id, {
158
164
  name,
@@ -164,7 +170,7 @@ function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleRet
164
170
  colorMap,
165
171
  no_data_color,
166
172
  });
167
- const points = getRGBPointsFromPreset(colorMap ?? "");
173
+ const points = [...getRGBPointsFromPreset(colorMap)];
168
174
  const schema = meshEdgesVertexAttributeSchemas.attribute;
169
175
  const params = {
170
176
  id,
@@ -248,7 +254,7 @@ function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleRet
248
254
  });
249
255
  return applyVertexAttribute(id);
250
256
  }
251
- function meshEdgesVertexAttributeNoDataColor(id: string): unknown {
257
+ function meshEdgesVertexAttributeNoDataColor(id: string): RGBAColor {
252
258
  const name = meshEdgesVertexAttributeName(id);
253
259
  const item = meshEdgesVertexAttributeItem(id);
254
260
  const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
@@ -256,7 +262,7 @@ function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleRet
256
262
  }
257
263
  async function setMeshEdgesVertexAttributeNoDataColor(
258
264
  id: string,
259
- no_data_color: unknown,
265
+ no_data_color: RGBAColor,
260
266
  ): Promise<unknown> {
261
267
  const name = meshEdgesVertexAttributeName(id);
262
268
  const item = meshEdgesVertexAttributeItem(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
  import { useMeshEdgesCommonStyle } from "./common";
5
5
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -9,7 +9,7 @@ const schema = viewer_schemas.opengeodeweb_viewer.mesh.edges.visibility;
9
9
 
10
10
  export function useMeshEdgesVisibilityStyle(): {
11
11
  meshEdgesVisibility: (id: string) => boolean | undefined;
12
- setMeshEdgesVisibility: (id: string, visibility: boolean | undefined) => Promise<unknown>;
12
+ setMeshEdgesVisibility: (id: string, visibility: boolean) => Promise<unknown>;
13
13
  } {
14
14
  const viewerStore = useViewerStore();
15
15
  const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
@@ -18,10 +18,7 @@ export function useMeshEdgesVisibilityStyle(): {
18
18
  // oxlint-disable-next-line no-unsafe-type-assertion -- visibility is defined as boolean in the data style schema.
19
19
  return meshEdgesCommonStyle.meshEdgesStyle(id).visibility as boolean | undefined;
20
20
  }
21
- async function setMeshEdgesVisibility(
22
- id: string,
23
- visibility: boolean | undefined,
24
- ): Promise<unknown> {
21
+ async function setMeshEdgesVisibility(id: string, visibility: boolean): Promise<unknown> {
25
22
  const params = { id, visibility };
26
23
  const result = await viewerStore.request(
27
24
  {
@@ -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
  import { useMeshEdgesCommonStyle } from "./common";
5
5
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -9,7 +9,7 @@ const schema = viewer_schemas.opengeodeweb_viewer.mesh.edges.width;
9
9
 
10
10
  export function useMeshEdgesWidthStyle(): {
11
11
  meshEdgesWidth: (id: string) => number | undefined;
12
- setMeshEdgesWidth: (id: string, width: number | undefined) => Promise<unknown>;
12
+ setMeshEdgesWidth: (id: string, width: number) => Promise<unknown>;
13
13
  } {
14
14
  const viewerStore = useViewerStore();
15
15
  const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
@@ -18,7 +18,7 @@ export function useMeshEdgesWidthStyle(): {
18
18
  // oxlint-disable-next-line no-unsafe-type-assertion -- width is defined as number in the data style schema.
19
19
  return meshEdgesCommonStyle.meshEdgesStyle(id).width as number | undefined;
20
20
  }
21
- async function setMeshEdgesWidth(id: string, width: number | undefined): Promise<unknown> {
21
+ async function setMeshEdgesWidth(id: string, width: number): Promise<unknown> {
22
22
  const params = { id, width };
23
23
  const result = await viewerStore.request(
24
24
  {
@@ -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 { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
@@ -11,6 +12,7 @@ import { useMeshEdgesStyle } from "./edges";
11
12
  import { useMeshPointsStyle } from "./points";
12
13
  import { useMeshPolygonsStyle } from "./polygons";
13
14
  import { useMeshPolyhedraStyle } from "./polyhedra";
15
+ import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
14
16
 
15
17
  // Local constants
16
18
  const meshSchemas = viewer_schemas.opengeodeweb_viewer.mesh;
@@ -18,9 +20,9 @@ const meshSchemas = viewer_schemas.opengeodeweb_viewer.mesh;
18
20
  // oxlint-disable-next-line max-lines-per-function
19
21
  export function useMeshStyle(): {
20
22
  meshVisibility: (id: string) => boolean | undefined;
21
- setMeshVisibility: (id: string, visibility: boolean | undefined) => Promise<unknown>;
22
- meshColor: (id: string) => unknown;
23
- setMeshColor: (id: string, color: unknown) => Promise<unknown>;
23
+ setMeshVisibility: (id: string, visibility: boolean) => Promise<unknown>;
24
+ meshColor: (id: string) => RGBAColor | undefined;
25
+ setMeshColor: (id: string, color: RGBAColor) => Promise<unknown>;
24
26
  applyMeshStyle: (id: string) => Promise<unknown[]>;
25
27
  } & ReturnType<typeof useMeshPointsStyle> &
26
28
  ReturnType<typeof useMeshEdgesStyle> &
@@ -39,7 +41,7 @@ export function useMeshStyle(): {
39
41
  function meshVisibility(id: string): boolean | undefined {
40
42
  return dataStyleState.getStyle(id).visibility;
41
43
  }
42
- async function setMeshVisibility(id: string, visibility: boolean | undefined): Promise<unknown> {
44
+ async function setMeshVisibility(id: string, visibility: boolean): Promise<unknown> {
43
45
  const schema = meshSchemas.visibility;
44
46
  const params = { id, visibility };
45
47
  const result = await viewerStore.request(
@@ -60,11 +62,12 @@ export function useMeshStyle(): {
60
62
  return result;
61
63
  }
62
64
 
63
- function meshColor(id: string): unknown {
64
- return dataStyleState.getStyle(id).color;
65
+ function meshColor(id: string): RGBAColor | undefined {
66
+ // oxlint-disable-next-line no-unsafe-type-assertion -- color shape is defined by the data style schema.
67
+ return dataStyleState.getStyle(id).color as RGBAColor | undefined;
65
68
  }
66
69
 
67
- async function setMeshColor(id: string, color: unknown): Promise<unknown> {
70
+ async function setMeshColor(id: string, color: RGBAColor): Promise<unknown> {
68
71
  const schema = meshSchemas.color;
69
72
  const params = { id, color };
70
73
  const result = await viewerStore.request(
@@ -85,11 +88,21 @@ export function useMeshStyle(): {
85
88
  async function applyMeshStyle(id: string): Promise<unknown[]> {
86
89
  const style = dataStyleState.getStyle(id);
87
90
  const promise_array: unknown[] = [];
88
- for (const [key, value] of Object.entries(style)) {
91
+ for (const key of Object.keys(style)) {
89
92
  if (key === "visibility") {
90
- promise_array.push(setMeshVisibility(id, style.visibility));
93
+ promise_array.push(
94
+ whenDefined(style.visibility, async (visibility) => {
95
+ const applied = await setMeshVisibility(id, visibility);
96
+ return applied;
97
+ }),
98
+ );
91
99
  } else if (key === "color") {
92
- promise_array.push(setMeshColor(id, value));
100
+ promise_array.push(
101
+ whenDefined(meshColor(id), async (color) => {
102
+ const applied = await setMeshColor(id, color);
103
+ return applied;
104
+ }),
105
+ );
93
106
  } else if (key === "points") {
94
107
  promise_array.push(meshPointsStyle.applyMeshPointsStyle(id));
95
108
  } else if (key === "edges") {
@@ -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 { useMeshPointsCommonStyle } from "./common";
@@ -9,16 +10,17 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
9
10
  const schema = viewer_schemas.opengeodeweb_viewer.mesh.points.color;
10
11
 
11
12
  export function useMeshPointsColorStyle(): {
12
- meshPointsColor: (id: string) => unknown;
13
- setMeshPointsColor: (id: string, color: unknown) => Promise<unknown>;
13
+ meshPointsColor: (id: string) => RGBAColor | undefined;
14
+ setMeshPointsColor: (id: string, color: RGBAColor) => Promise<unknown>;
14
15
  } {
15
16
  const viewerStore = useViewerStore();
16
17
  const meshPointsCommonStyle = useMeshPointsCommonStyle();
17
18
 
18
- function meshPointsColor(id: string): unknown {
19
- return meshPointsCommonStyle.meshPointsColoring(id).constant;
19
+ function meshPointsColor(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 meshPointsCommonStyle.meshPointsColoring(id).constant as RGBAColor | undefined;
20
22
  }
21
- async function setMeshPointsColor(id: string, color: unknown): Promise<unknown> {
23
+ async function setMeshPointsColor(id: string, color: RGBAColor): Promise<unknown> {
22
24
  const params = { id, color };
23
25
  const result = await viewerStore.request(
24
26
  {
@@ -7,6 +7,7 @@ import { useMeshPointsColorStyle } from "./color";
7
7
  import { useMeshPointsCommonStyle } from "./common";
8
8
  import { useMeshPointsSizeStyle } from "./size";
9
9
  import { useMeshPointsVisibilityStyle } from "./visibility";
10
+ import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
10
11
 
11
12
  // Local constants
12
13
 
@@ -40,10 +41,10 @@ async function setMeshPointsActiveColoring(
40
41
  coloring: { active: type },
41
42
  });
42
43
  if (type === "constant") {
43
- const result = await deps.colorStyle.setMeshPointsColor(
44
- id,
45
- deps.colorStyle.meshPointsColor(id),
46
- );
44
+ const result = await whenDefined(deps.colorStyle.meshPointsColor(id), async (value) => {
45
+ const applied = await deps.colorStyle.setMeshPointsColor(id, value);
46
+ return applied;
47
+ });
47
48
  return result;
48
49
  }
49
50
  if (type === "vertex") {
@@ -61,8 +62,14 @@ async function applyMeshPointsStyle(
61
62
  deps: MeshPointsActiveColoringDeps,
62
63
  ): Promise<unknown[]> {
63
64
  const result = await Promise.all([
64
- visibilityStyle.setMeshPointsVisibility(id, visibilityStyle.meshPointsVisibility(id)),
65
- sizeStyle.setMeshPointsSize(id, sizeStyle.meshPointsSize(id)),
65
+ whenDefined(visibilityStyle.meshPointsVisibility(id), async (value) => {
66
+ const applied = await visibilityStyle.setMeshPointsVisibility(id, value);
67
+ return applied;
68
+ }),
69
+ whenDefined(sizeStyle.meshPointsSize(id), async (value) => {
70
+ const applied = await sizeStyle.setMeshPointsSize(id, value);
71
+ return applied;
72
+ }),
66
73
  setMeshPointsActiveColoring(id, activeColoringType, deps),
67
74
  ]);
68
75
  return result;
@@ -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.size;
10
10
 
11
11
  export function useMeshPointsSizeStyle(): {
12
12
  meshPointsSize: (id: string) => number | undefined;
13
- setMeshPointsSize: (id: string, size: number | undefined) => Promise<unknown>;
13
+ setMeshPointsSize: (id: string, size: number) => Promise<unknown>;
14
14
  } {
15
15
  const viewerStore = useViewerStore();
16
16
  const meshPointsCommonStyle = useMeshPointsCommonStyle();
@@ -19,7 +19,7 @@ export function useMeshPointsSizeStyle(): {
19
19
  // oxlint-disable-next-line no-unsafe-type-assertion -- size is defined as number in the data style schema.
20
20
  return meshPointsCommonStyle.meshPointsStyle(id).size as number | undefined;
21
21
  }
22
- async function setMeshPointsSize(id: string, size: number | undefined): Promise<unknown> {
22
+ async function setMeshPointsSize(id: string, size: number): Promise<unknown> {
23
23
  const params = { id, size };
24
24
  const result = await viewerStore.request(
25
25
  {
@@ -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 isMeshPointsVertexAttributeValid({
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 isMeshPointsVertexAttributeValid(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 UseMeshPointsVertexAttributeStyleReturn {
59
62
  name: string | undefined,
60
63
  item: number | undefined,
61
64
  ) => AttributeStoredConfig;
62
- setMeshPointsVertexAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
65
+ setMeshPointsVertexAttribute: (id: string, input: ValidAttributeInput) => Promise<unknown>;
63
66
  setMeshPointsVertexAttributeName: (id: string, name: string) => Promise<unknown>;
64
67
  setMeshPointsVertexAttributeItem: (id: string, item: number) => Promise<unknown>;
65
68
  setMeshPointsVertexAttributeRange: (
@@ -71,8 +74,11 @@ interface UseMeshPointsVertexAttributeStyleReturn {
71
74
  id: string,
72
75
  colorMap: string | undefined,
73
76
  ) => Promise<unknown>;
74
- meshPointsVertexAttributeNoDataColor: (id: string) => unknown;
75
- setMeshPointsVertexAttributeNoDataColor: (id: string, no_data_color: unknown) => Promise<unknown>;
77
+ meshPointsVertexAttributeNoDataColor: (id: string) => RGBAColor;
78
+ setMeshPointsVertexAttributeNoDataColor: (
79
+ id: string,
80
+ no_data_color: RGBAColor,
81
+ ) => Promise<unknown>;
76
82
  }
77
83
 
78
84
  // oxlint-disable-next-line max-lines-per-function
@@ -152,7 +158,7 @@ function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleR
152
158
  maximum,
153
159
  colorMap,
154
160
  no_data_color = DEFAULT_NO_DATA_COLOR,
155
- }: AttributeInput,
161
+ }: ValidAttributeInput,
156
162
  ): Promise<unknown> {
157
163
  await mutateMeshPointsVertexStyle(id, {
158
164
  name,
@@ -164,7 +170,7 @@ function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleR
164
170
  colorMap,
165
171
  no_data_color,
166
172
  });
167
- const points = getRGBPointsFromPreset(colorMap ?? "");
173
+ const points = [...getRGBPointsFromPreset(colorMap)];
168
174
  const schema = meshPointsVertexAttributeSchemas.attribute;
169
175
  const params = {
170
176
  id,
@@ -248,7 +254,7 @@ function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleR
248
254
  });
249
255
  return applyVertexAttribute(id);
250
256
  }
251
- function meshPointsVertexAttributeNoDataColor(id: string): unknown {
257
+ function meshPointsVertexAttributeNoDataColor(id: string): RGBAColor {
252
258
  const name = meshPointsVertexAttributeName(id);
253
259
  const item = meshPointsVertexAttributeItem(id);
254
260
  const storedConfig = meshPointsVertexAttributeStoredConfig(id, name, item);
@@ -256,7 +262,7 @@ function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleR
256
262
  }
257
263
  async function setMeshPointsVertexAttributeNoDataColor(
258
264
  id: string,
259
- no_data_color: unknown,
265
+ no_data_color: RGBAColor,
260
266
  ): Promise<unknown> {
261
267
  const name = meshPointsVertexAttributeName(id);
262
268
  const item = meshPointsVertexAttributeItem(id);