@geode/opengeodeweb-front 10.36.0 → 10.37.0-rc.1

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 +4 -4
  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,7 +1,7 @@
1
1
  // oxlint-disable eslint/max-lines
2
- import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
2
+ import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
3
3
  // Third party imports
4
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
4
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
5
5
 
6
6
  // Local imports
7
7
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
@@ -16,7 +16,7 @@ interface AttributeStoredConfig {
16
16
  minimum: number | undefined;
17
17
  maximum: number | undefined;
18
18
  colorMap: string | undefined;
19
- no_data_color: unknown;
19
+ no_data_color: RGBAColor;
20
20
  }
21
21
 
22
22
  interface AttributeState {
@@ -31,22 +31,25 @@ interface AttributeInput {
31
31
  minimum: number | undefined;
32
32
  maximum: number | undefined;
33
33
  colorMap: string | undefined;
34
- no_data_color?: unknown;
34
+ no_data_color?: RGBAColor;
35
35
  }
36
36
 
37
- function isModelLinesVertexAttributeValid({
38
- name,
39
- item,
40
- minimum,
41
- maximum,
42
- colorMap,
43
- }: AttributeInput): boolean {
37
+ interface ValidAttributeInput {
38
+ name: string;
39
+ item: number;
40
+ minimum: number;
41
+ maximum: number;
42
+ colorMap: string;
43
+ no_data_color?: RGBAColor;
44
+ }
45
+
46
+ function isModelLinesVertexAttributeValid(input: AttributeInput): input is ValidAttributeInput {
44
47
  return (
45
- name !== undefined &&
46
- item !== undefined &&
47
- minimum !== undefined &&
48
- maximum !== undefined &&
49
- colorMap !== undefined
48
+ input.name !== undefined &&
49
+ input.item !== undefined &&
50
+ input.minimum !== undefined &&
51
+ input.maximum !== undefined &&
52
+ input.colorMap !== undefined
50
53
  );
51
54
  }
52
55
 
@@ -67,7 +70,7 @@ interface UseModelLinesVertexAttributeReturn {
67
70
  setModelLinesVertexAttribute: (
68
71
  modelId: string,
69
72
  lineIds: string[],
70
- input: AttributeInput,
73
+ input: ValidAttributeInput,
71
74
  ) => Promise<unknown>;
72
75
  setModelLinesVertexAttributeName: (
73
76
  modelId: string,
@@ -90,11 +93,11 @@ interface UseModelLinesVertexAttributeReturn {
90
93
  lineIds: string[],
91
94
  colorMap: string | undefined,
92
95
  ) => Promise<unknown>;
93
- modelLinesVertexAttributeNoDataColor: (modelId: string, lineId?: string) => unknown;
96
+ modelLinesVertexAttributeNoDataColor: (modelId: string, lineId?: string) => RGBAColor;
94
97
  setModelLinesVertexAttributeNoDataColor: (
95
98
  modelId: string,
96
99
  lineIds: string[],
97
- no_data_color: unknown,
100
+ no_data_color: RGBAColor,
98
101
  ) => Promise<unknown>;
99
102
  }
100
103
 
@@ -213,7 +216,7 @@ function useModelLinesVertexAttribute(): UseModelLinesVertexAttributeReturn {
213
216
  maximum,
214
217
  colorMap,
215
218
  no_data_color = DEFAULT_NO_DATA_COLOR,
216
- }: AttributeInput,
219
+ }: ValidAttributeInput,
217
220
  ): Promise<unknown> {
218
221
  await mutateModelLinesVertexStyle(modelId, lineIds, {
219
222
  name,
@@ -225,7 +228,7 @@ function useModelLinesVertexAttribute(): UseModelLinesVertexAttributeReturn {
225
228
  colorMap,
226
229
  no_data_color,
227
230
  });
228
- const points = getRGBPointsFromPreset(colorMap ?? "");
231
+ const points = [...getRGBPointsFromPreset(colorMap)];
229
232
  const line_viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, lineIds);
230
233
  const params = {
231
234
  id: modelId,
@@ -306,7 +309,7 @@ function useModelLinesVertexAttribute(): UseModelLinesVertexAttributeReturn {
306
309
  });
307
310
  return applyVertexAttribute(modelId, lineIds);
308
311
  }
309
- function modelLinesVertexAttributeNoDataColor(modelId: string, lineId?: string): unknown {
312
+ function modelLinesVertexAttributeNoDataColor(modelId: string, lineId?: string): RGBAColor {
310
313
  const name = modelLinesVertexAttributeName(modelId, lineId);
311
314
  const item = modelLinesVertexAttributeItem(modelId, lineId);
312
315
  const storedConfig = modelLinesVertexAttributeStoredConfig(modelId, lineId, name, item);
@@ -315,7 +318,7 @@ function useModelLinesVertexAttribute(): UseModelLinesVertexAttributeReturn {
315
318
  async function setModelLinesVertexAttributeNoDataColor(
316
319
  modelId: string,
317
320
  lineIds: string[],
318
- no_data_color: unknown,
321
+ no_data_color: RGBAColor,
319
322
  ): Promise<unknown> {
320
323
  const name = modelLinesVertexAttributeName(modelId, lineIds[0]);
321
324
  const item = modelLinesVertexAttributeItem(modelId, lineIds[0]);
@@ -1,6 +1,6 @@
1
1
  import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
2
2
  import { useModelLinesCommonStyle } from "./common";
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
  const schema = viewer_schemas.opengeodeweb_viewer.model.lines.visibility;
6
6
 
@@ -8,7 +8,7 @@ export function useModelLinesVisibility(): {
8
8
  setModelLinesVisibility: (
9
9
  modelId: string,
10
10
  lines_ids: string[],
11
- visibility: boolean | undefined,
11
+ visibility: boolean,
12
12
  ) => Promise<unknown>;
13
13
  modelLineVisibility: (id: string, line_id?: string) => unknown;
14
14
  } {
@@ -22,7 +22,7 @@ export function useModelLinesVisibility(): {
22
22
  async function setModelLinesVisibility(
23
23
  modelId: string,
24
24
  lines_ids: string[],
25
- visibility: boolean | undefined,
25
+ visibility: boolean,
26
26
  ): Promise<unknown> {
27
27
  const result = await modelCommonStyle.setModelTypeVisibility(
28
28
  modelId,
@@ -2,6 +2,7 @@
2
2
  import { useModelPointsCommonStyle } from "./common";
3
3
  import { useModelPointsSizeStyle } from "./size";
4
4
  import { useModelPointsVisibilityStyle } from "./visibility";
5
+ import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
5
6
 
6
7
  export function useModelPointsStyle(): {
7
8
  applyModelPointsStyle: (id: string) => Promise<unknown[]>;
@@ -15,13 +16,22 @@ export function useModelPointsStyle(): {
15
16
  async function applyModelPointsStyle(id: string): Promise<unknown[]> {
16
17
  const style = modelPointsCommonStyle.modelPointsStyle(id);
17
18
  const result = await Promise.all([
18
- modelPointsVisibilityStyle.setModelPointsVisibility(
19
- id,
19
+ whenDefined(
20
20
  // oxlint-disable-next-line no-unsafe-type-assertion -- points style values are dynamically typed at runtime.
21
21
  style.visibility as boolean | undefined,
22
+ async (visibility) => {
23
+ const applied = await modelPointsVisibilityStyle.setModelPointsVisibility(id, visibility);
24
+ return applied;
25
+ },
26
+ ),
27
+ whenDefined(
28
+ // oxlint-disable-next-line no-unsafe-type-assertion -- points style values are dynamically typed at runtime.
29
+ style.size as number | undefined,
30
+ async (size) => {
31
+ const applied = await modelPointsSizeStyle.setModelPointsSize(id, size);
32
+ return applied;
33
+ },
22
34
  ),
23
- // oxlint-disable-next-line no-unsafe-type-assertion -- points style values are dynamically typed at runtime.
24
- modelPointsSizeStyle.setModelPointsSize(id, style.size as number | undefined),
25
35
  ]);
26
36
  return result;
27
37
  }
@@ -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 { useModelPointsCommonStyle } from "./common";
@@ -10,7 +10,7 @@ const schema = viewer_schemas.opengeodeweb_viewer.model.points.size;
10
10
 
11
11
  export function useModelPointsSizeStyle(): {
12
12
  modelPointsSize: (id: string) => number | undefined;
13
- setModelPointsSize: (id: string, size: number | undefined) => Promise<unknown>;
13
+ setModelPointsSize: (id: string, size: number) => Promise<unknown>;
14
14
  } {
15
15
  const viewerStore = useViewerStore();
16
16
  const modelPointsCommonStyle = useModelPointsCommonStyle();
@@ -20,7 +20,7 @@ export function useModelPointsSizeStyle(): {
20
20
  return modelPointsCommonStyle.modelPointsStyle(id).size as number | undefined;
21
21
  }
22
22
 
23
- async function setModelPointsSize(id: string, size: number | undefined): Promise<unknown> {
23
+ async function setModelPointsSize(id: string, size: number): Promise<unknown> {
24
24
  const params = { id, size };
25
25
  const result = await viewerStore.request(
26
26
  {
@@ -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 { useModelPointsCommonStyle } from "./common";
@@ -10,7 +10,7 @@ const schema = viewer_schemas.opengeodeweb_viewer.model.points.visibility;
10
10
 
11
11
  export function useModelPointsVisibilityStyle(): {
12
12
  modelPointsVisibility: (id: string) => boolean | undefined;
13
- setModelPointsVisibility: (id: string, visibility: boolean | undefined) => Promise<unknown>;
13
+ setModelPointsVisibility: (id: string, visibility: boolean) => Promise<unknown>;
14
14
  } {
15
15
  const viewerStore = useViewerStore();
16
16
  const modelPointsCommonStyle = useModelPointsCommonStyle();
@@ -20,10 +20,7 @@ export function useModelPointsVisibilityStyle(): {
20
20
  return modelPointsCommonStyle.modelPointsStyle(id).visibility as boolean | undefined;
21
21
  }
22
22
 
23
- async function setModelPointsVisibility(
24
- id: string,
25
- visibility: boolean | undefined,
26
- ): Promise<unknown> {
23
+ async function setModelPointsVisibility(id: string, visibility: boolean): Promise<unknown> {
27
24
  const params = { id, visibility };
28
25
  const result = await viewerStore.request(
29
26
  { schema, params },
@@ -1,10 +1,11 @@
1
1
  import { isModelSurfacesPolygonAttributeValid, useModelSurfacesPolygonAttribute } from "./polygon";
2
2
  import { isModelSurfacesVertexAttributeValid, useModelSurfacesVertexAttribute } from "./vertex";
3
+ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
3
4
  import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
4
5
  import { useDataStore } from "@ogw_front/stores/data";
5
6
  import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
6
7
  import { useModelSurfacesCommonStyle } from "./common";
7
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
8
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
8
9
 
9
10
  const schema = viewer_schemas.opengeodeweb_viewer.model.surfaces.color;
10
11
 
@@ -12,12 +13,12 @@ export function useModelSurfacesColor(): {
12
13
  setModelSurfacesColor: (
13
14
  modelId: string,
14
15
  surfaces_ids: string[],
15
- color: unknown,
16
+ color: RGBAColor | undefined,
16
17
  activeColoring?: string,
17
18
  collectionId?: string,
18
19
  ) => Promise<unknown>;
19
20
  modelSurfaceColoring: (id: string, surface_id?: string) => StyleValues;
20
- modelSurfaceColor: (id: string, surface_id?: string) => unknown;
21
+ modelSurfaceColor: (id: string, surface_id?: string) => RGBAColor | undefined;
21
22
  modelSurfaceActiveColoring: (id: string, surface_id?: string) => unknown;
22
23
  setModelSurfacesActiveColoring: (
23
24
  modelId: string,
@@ -37,14 +38,15 @@ export function useModelSurfacesColor(): {
37
38
  return modelSurfacesCommonStyle.modelSurfaceStyle(id, surface_id).coloring as StyleValues;
38
39
  }
39
40
 
40
- function modelSurfaceColor(id: string, surface_id?: string): unknown {
41
- return modelSurfaceColoring(id, surface_id).constant;
41
+ function modelSurfaceColor(id: string, surface_id?: string): RGBAColor | undefined {
42
+ // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
43
+ return modelSurfaceColoring(id, surface_id).constant as RGBAColor | undefined;
42
44
  }
43
45
 
44
46
  async function setModelSurfacesColor(
45
47
  modelId: string,
46
48
  surfaces_ids: string[],
47
- color: unknown,
49
+ color: RGBAColor | undefined,
48
50
  activeColoring = "constant",
49
51
  collectionId?: string,
50
52
  ): Promise<unknown> {
@@ -1,21 +1,22 @@
1
1
  import { isModelSurfacesPolygonAttributeValid, useModelSurfacesPolygonAttribute } from "./polygon";
2
2
  import { isModelSurfacesVertexAttributeValid, useModelSurfacesVertexAttribute } from "./vertex";
3
+ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
3
4
  import { useDataStore } from "@ogw_front/stores/data";
4
5
  import { useModelSurfacesColor } from "./color";
5
6
  import { useModelSurfacesCommonStyle } from "./common";
6
7
  import { useModelSurfacesVisibility } from "./visibility";
7
8
 
8
9
  interface ColorGroup {
9
- color: unknown;
10
+ color: RGBAColor | undefined;
10
11
  surfaces_ids: string[];
11
12
  }
12
13
 
13
14
  interface AttributeGroup {
14
- name: string | undefined;
15
- item: number | undefined;
16
- minimum: number | undefined;
17
- maximum: number | undefined;
18
- colorMap: string | undefined;
15
+ name: string;
16
+ item: number;
17
+ minimum: number;
18
+ maximum: number;
19
+ colorMap: string;
19
20
  surfaces_ids: string[];
20
21
  }
21
22
 
@@ -127,14 +128,7 @@ export function useModelSurfacesStyle(): UseModelSurfacesStyleReturn {
127
128
  continue;
128
129
  }
129
130
  const key = `${name}_${item}_${colorMap}_${minimum}_${maximum}`;
130
- vertexGroups[key] ??= {
131
- name,
132
- item,
133
- minimum,
134
- maximum,
135
- colorMap,
136
- surfaces_ids: [],
137
- };
131
+ vertexGroups[key] ??= { ...attribute, surfaces_ids: [] };
138
132
  vertexGroups[key].surfaces_ids.push(surfaces_id);
139
133
  }
140
134
  coloringPromises.push(
@@ -177,14 +171,7 @@ export function useModelSurfacesStyle(): UseModelSurfacesStyleReturn {
177
171
  continue;
178
172
  }
179
173
  const key = `${name}_${item}_${colorMap}_${minimum}_${maximum}`;
180
- polygonGroups[key] ??= {
181
- name,
182
- item,
183
- minimum,
184
- maximum,
185
- colorMap,
186
- surfaces_ids: [],
187
- };
174
+ polygonGroups[key] ??= { ...attribute, surfaces_ids: [] };
188
175
  polygonGroups[key].surfaces_ids.push(surfaces_id);
189
176
  }
190
177
  coloringPromises.push(
@@ -1,7 +1,7 @@
1
1
  // oxlint-disable eslint/max-lines
2
- import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
2
+ import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
3
3
  // Third party imports
4
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
4
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
5
5
 
6
6
  // Local imports
7
7
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
@@ -17,7 +17,7 @@ interface AttributeStoredConfig {
17
17
  minimum: number | undefined;
18
18
  maximum: number | undefined;
19
19
  colorMap: string | undefined;
20
- no_data_color: unknown;
20
+ no_data_color: RGBAColor;
21
21
  }
22
22
 
23
23
  interface AttributeState {
@@ -32,22 +32,25 @@ interface AttributeInput {
32
32
  minimum: number | undefined;
33
33
  maximum: number | undefined;
34
34
  colorMap: string | undefined;
35
- no_data_color?: unknown;
35
+ no_data_color?: RGBAColor;
36
36
  }
37
37
 
38
- function isModelSurfacesPolygonAttributeValid({
39
- name,
40
- item,
41
- minimum,
42
- maximum,
43
- colorMap,
44
- }: AttributeInput): boolean {
38
+ interface ValidAttributeInput {
39
+ name: string;
40
+ item: number;
41
+ minimum: number;
42
+ maximum: number;
43
+ colorMap: string;
44
+ no_data_color?: RGBAColor;
45
+ }
46
+
47
+ function isModelSurfacesPolygonAttributeValid(input: AttributeInput): input is ValidAttributeInput {
45
48
  return (
46
- name !== undefined &&
47
- item !== undefined &&
48
- minimum !== undefined &&
49
- maximum !== undefined &&
50
- colorMap !== undefined
49
+ input.name !== undefined &&
50
+ input.item !== undefined &&
51
+ input.minimum !== undefined &&
52
+ input.maximum !== undefined &&
53
+ input.colorMap !== undefined
51
54
  );
52
55
  }
53
56
 
@@ -71,7 +74,7 @@ interface UseModelSurfacesPolygonAttributeReturn {
71
74
  setModelSurfacesPolygonAttribute: (
72
75
  modelId: string,
73
76
  surfaceIds: string[],
74
- input: AttributeInput,
77
+ input: ValidAttributeInput,
75
78
  ) => Promise<unknown>;
76
79
  setModelSurfacesPolygonAttributeName: (
77
80
  modelId: string,
@@ -94,11 +97,11 @@ interface UseModelSurfacesPolygonAttributeReturn {
94
97
  surfaceIds: string[],
95
98
  colorMap: string | undefined,
96
99
  ) => Promise<void>;
97
- modelSurfacesPolygonAttributeNoDataColor: (modelId: string, surfaceId?: string) => unknown;
100
+ modelSurfacesPolygonAttributeNoDataColor: (modelId: string, surfaceId?: string) => RGBAColor;
98
101
  setModelSurfacesPolygonAttributeNoDataColor: (
99
102
  modelId: string,
100
103
  surfaceIds: string[],
101
- no_data_color: unknown,
104
+ no_data_color: RGBAColor,
102
105
  ) => Promise<void>;
103
106
  }
104
107
 
@@ -216,7 +219,7 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
216
219
  maximum,
217
220
  colorMap,
218
221
  no_data_color = DEFAULT_NO_DATA_COLOR,
219
- }: AttributeInput,
222
+ }: ValidAttributeInput,
220
223
  ): Promise<unknown> {
221
224
  await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, { name, item });
222
225
  await setModelSurfacesPolygonAttributeStoredConfig(modelId, surfaceIds, name, item, {
@@ -225,7 +228,7 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
225
228
  colorMap,
226
229
  no_data_color,
227
230
  });
228
- const points = getRGBPointsFromPreset(colorMap ?? "");
231
+ const points = [...getRGBPointsFromPreset(colorMap)];
229
232
  const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, surfaceIds);
230
233
  const params = {
231
234
  id: modelId,
@@ -304,7 +307,10 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
304
307
  });
305
308
  await applyPolygonAttribute(modelId, surfaceIds);
306
309
  }
307
- function modelSurfacesPolygonAttributeNoDataColor(modelId: string, surfaceId?: string): unknown {
310
+ function modelSurfacesPolygonAttributeNoDataColor(
311
+ modelId: string,
312
+ surfaceId?: string,
313
+ ): RGBAColor {
308
314
  const name = modelSurfacesPolygonAttributeName(modelId, surfaceId);
309
315
  const item = modelSurfacesPolygonAttributeItem(modelId, surfaceId);
310
316
  const storedConfig = modelSurfacesPolygonAttributeStoredConfig(modelId, surfaceId, name, item);
@@ -313,7 +319,7 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
313
319
  async function setModelSurfacesPolygonAttributeNoDataColor(
314
320
  modelId: string,
315
321
  surfaceIds: string[],
316
- no_data_color: unknown,
322
+ no_data_color: RGBAColor,
317
323
  ): Promise<void> {
318
324
  const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
319
325
  const item = modelSurfacesPolygonAttributeItem(modelId, surfaceIds[0]);
@@ -1,7 +1,7 @@
1
1
  // oxlint-disable eslint/max-lines
2
- import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
2
+ import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
3
3
  // Third party imports
4
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
4
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
5
5
 
6
6
  // Local imports
7
7
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
@@ -17,7 +17,7 @@ interface AttributeStoredConfig {
17
17
  minimum: number | undefined;
18
18
  maximum: number | undefined;
19
19
  colorMap: string | undefined;
20
- no_data_color: unknown;
20
+ no_data_color: RGBAColor;
21
21
  }
22
22
 
23
23
  interface AttributeState {
@@ -32,22 +32,25 @@ interface AttributeInput {
32
32
  minimum: number | undefined;
33
33
  maximum: number | undefined;
34
34
  colorMap: string | undefined;
35
- no_data_color?: unknown;
35
+ no_data_color?: RGBAColor;
36
36
  }
37
37
 
38
- function isModelSurfacesVertexAttributeValid({
39
- name,
40
- item,
41
- minimum,
42
- maximum,
43
- colorMap,
44
- }: AttributeInput): boolean {
38
+ interface ValidAttributeInput {
39
+ name: string;
40
+ item: number;
41
+ minimum: number;
42
+ maximum: number;
43
+ colorMap: string;
44
+ no_data_color?: RGBAColor;
45
+ }
46
+
47
+ function isModelSurfacesVertexAttributeValid(input: AttributeInput): input is ValidAttributeInput {
45
48
  return (
46
- name !== undefined &&
47
- item !== undefined &&
48
- minimum !== undefined &&
49
- maximum !== undefined &&
50
- colorMap !== undefined
49
+ input.name !== undefined &&
50
+ input.item !== undefined &&
51
+ input.minimum !== undefined &&
52
+ input.maximum !== undefined &&
53
+ input.colorMap !== undefined
51
54
  );
52
55
  }
53
56
 
@@ -68,7 +71,7 @@ interface UseModelSurfacesVertexAttributeReturn {
68
71
  setModelSurfacesVertexAttribute: (
69
72
  modelId: string,
70
73
  surfaceIds: string[],
71
- input: AttributeInput,
74
+ input: ValidAttributeInput,
72
75
  ) => Promise<unknown>;
73
76
  setModelSurfacesVertexAttributeName: (
74
77
  modelId: string,
@@ -91,11 +94,11 @@ interface UseModelSurfacesVertexAttributeReturn {
91
94
  surfaceIds: string[],
92
95
  colorMap: string | undefined,
93
96
  ) => Promise<unknown>;
94
- modelSurfacesVertexAttributeNoDataColor: (modelId: string, surfaceId?: string) => unknown;
97
+ modelSurfacesVertexAttributeNoDataColor: (modelId: string, surfaceId?: string) => RGBAColor;
95
98
  setModelSurfacesVertexAttributeNoDataColor: (
96
99
  modelId: string,
97
100
  surfaceIds: string[],
98
- no_data_color: unknown,
101
+ no_data_color: RGBAColor,
99
102
  ) => Promise<unknown>;
100
103
  }
101
104
 
@@ -213,7 +216,7 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
213
216
  maximum,
214
217
  colorMap,
215
218
  no_data_color = DEFAULT_NO_DATA_COLOR,
216
- }: AttributeInput,
219
+ }: ValidAttributeInput,
217
220
  ): Promise<unknown> {
218
221
  await mutateModelSurfacesVertexStyle(modelId, surfaceIds, { name, item });
219
222
  await setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, {
@@ -222,7 +225,7 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
222
225
  colorMap,
223
226
  no_data_color,
224
227
  });
225
- const points = getRGBPointsFromPreset(colorMap ?? "");
228
+ const points = [...getRGBPointsFromPreset(colorMap)];
226
229
  const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, surfaceIds);
227
230
  const params = {
228
231
  id: modelId,
@@ -307,7 +310,7 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
307
310
  const result = await applyVertexAttribute(modelId, surfaceIds);
308
311
  return result;
309
312
  }
310
- function modelSurfacesVertexAttributeNoDataColor(modelId: string, surfaceId?: string): unknown {
313
+ function modelSurfacesVertexAttributeNoDataColor(modelId: string, surfaceId?: string): RGBAColor {
311
314
  const name = modelSurfacesVertexAttributeName(modelId, surfaceId);
312
315
  const item = modelSurfacesVertexAttributeItem(modelId, surfaceId);
313
316
  const storedConfig = modelSurfacesVertexAttributeStoredConfig(modelId, surfaceId, name, item);
@@ -316,7 +319,7 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
316
319
  async function setModelSurfacesVertexAttributeNoDataColor(
317
320
  modelId: string,
318
321
  surfaceIds: string[],
319
- no_data_color: unknown,
322
+ no_data_color: RGBAColor,
320
323
  ): Promise<unknown> {
321
324
  const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
322
325
  const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
@@ -1,6 +1,6 @@
1
1
  import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
2
2
  import { useModelSurfacesCommonStyle } from "./common";
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
  const schema = viewer_schemas.opengeodeweb_viewer.model.surfaces.visibility;
6
6
 
@@ -8,7 +8,7 @@ export function useModelSurfacesVisibility(): {
8
8
  setModelSurfacesVisibility: (
9
9
  modelId: string,
10
10
  surfaces_ids: readonly string[],
11
- visibility: boolean | undefined,
11
+ visibility: boolean,
12
12
  ) => Promise<unknown>;
13
13
  modelSurfaceVisibility: (id: string, surface_id?: string) => unknown;
14
14
  } {
@@ -22,7 +22,7 @@ export function useModelSurfacesVisibility(): {
22
22
  async function setModelSurfacesVisibility(
23
23
  modelId: string,
24
24
  surfaces_ids: readonly string[],
25
- visibility: boolean | undefined,
25
+ visibility: boolean,
26
26
  ): Promise<unknown> {
27
27
  const result = await modelCommonStyle.setModelTypeVisibility(
28
28
  modelId,
@@ -5,7 +5,7 @@ import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
5
5
  import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
6
6
  import { useModelSelection } from "./selection";
7
7
  import { useViewerStore } from "@ogw_front/stores/viewer";
8
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
8
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
9
9
 
10
10
  // The four per-component-type style composables (Surface/Line/Block/Corner) each expose a different, large set of methods (color, visibility, per-attribute-kind getters/setters...). This module only cares about looking a handful of them up dynamically by name, so a precise structural type for componentStyleFunctions isn't worth modelling here; `any` keeps the dynamic dispatch table honest about that.
11
11
  // oxlint-disable-next-line no-explicit-any
@@ -0,0 +1,13 @@
1
+ // Style values read back from the database may be missing: skip the viewer request rather than send an invalid one.
2
+ async function whenDefined<Value, Result>(
3
+ value: Value | undefined,
4
+ apply: (value: Value) => Promise<Result>,
5
+ ): Promise<Result | undefined> {
6
+ if (value === undefined) {
7
+ return undefined;
8
+ }
9
+ const result = await apply(value);
10
+ return result;
11
+ }
12
+
13
+ export { whenDefined };