@geode/opengeodeweb-front 10.38.0 → 10.39.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 (54) hide show
  1. package/app/components/ThresholdFilter.vue +33 -5
  2. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +28 -0
  3. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +28 -0
  4. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +28 -0
  5. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +14 -0
  6. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +28 -0
  7. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +30 -0
  8. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +53 -0
  9. package/app/components/Viewer/Generic/Model/CornersOptions.vue +24 -0
  10. package/app/components/Viewer/Generic/Model/LinesOptions.vue +48 -0
  11. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +58 -0
  12. package/app/components/Viewer/Options/AttributeSelector.vue +25 -0
  13. package/app/components/Viewer/Options/ColoringTypeSelector.vue +10 -0
  14. package/app/components/Viewer/Options/ColormapQuickPicker.vue +17 -2
  15. package/app/components/Viewer/Options/TimeStepSlider.vue +120 -0
  16. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +14 -0
  17. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +30 -0
  18. package/app/components/Viewer/Surface/PolygonsOptions.vue +28 -0
  19. package/app/composables/global_attribute_style.ts +94 -0
  20. package/app/stores/data_style.ts +3 -0
  21. package/app/utils/attributes.ts +46 -9
  22. package/internal/stores/data_style/mesh/cells/cell.ts +20 -1
  23. package/internal/stores/data_style/mesh/cells/index.ts +4 -2
  24. package/internal/stores/data_style/mesh/cells/vertex.ts +23 -1
  25. package/internal/stores/data_style/mesh/edges/edge.ts +20 -1
  26. package/internal/stores/data_style/mesh/edges/index.ts +4 -2
  27. package/internal/stores/data_style/mesh/edges/vertex.ts +23 -1
  28. package/internal/stores/data_style/mesh/index.ts +68 -0
  29. package/internal/stores/data_style/mesh/points/index.ts +2 -1
  30. package/internal/stores/data_style/mesh/points/vertex.ts +23 -1
  31. package/internal/stores/data_style/mesh/polygons/index.ts +11 -2
  32. package/internal/stores/data_style/mesh/polygons/polygon.ts +23 -1
  33. package/internal/stores/data_style/mesh/polygons/vertex.ts +23 -1
  34. package/internal/stores/data_style/mesh/polyhedra/index.ts +11 -2
  35. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -1
  36. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +23 -1
  37. package/internal/stores/data_style/model/blocks/color.ts +11 -2
  38. package/internal/stores/data_style/model/blocks/index.ts +36 -6
  39. package/internal/stores/data_style/model/blocks/polyhedron.ts +61 -7
  40. package/internal/stores/data_style/model/blocks/vertex.ts +61 -7
  41. package/internal/stores/data_style/model/corners/color.ts +5 -1
  42. package/internal/stores/data_style/model/corners/index.ts +18 -3
  43. package/internal/stores/data_style/model/corners/vertex.ts +68 -8
  44. package/internal/stores/data_style/model/lines/color.ts +10 -2
  45. package/internal/stores/data_style/model/lines/edge.ts +58 -7
  46. package/internal/stores/data_style/model/lines/index.ts +35 -6
  47. package/internal/stores/data_style/model/lines/vertex.ts +58 -7
  48. package/internal/stores/data_style/model/surfaces/color.ts +10 -2
  49. package/internal/stores/data_style/model/surfaces/index.ts +53 -6
  50. package/internal/stores/data_style/model/surfaces/polygon.ts +76 -15
  51. package/internal/stores/data_style/model/surfaces/vertex.ts +70 -12
  52. package/internal/stores/data_style/time_step.ts +75 -0
  53. package/internal/stores/data_style/types.ts +1 -0
  54. package/package.json +1 -1
@@ -6,6 +6,7 @@ import type {
6
6
  import type { Table } from "dexie";
7
7
  import { database } from "@ogw_internal/database/database.js";
8
8
  import { getDefaultStyle } from "@ogw_front/utils/default_styles";
9
+ import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
9
10
  import { useDataStore } from "@ogw_front/stores/data";
10
11
  import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
11
12
  import { useMeshStyle } from "@ogw_internal/stores/data_style/mesh/index";
@@ -37,6 +38,7 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
37
38
  const dataStyleState = useDataStyleState();
38
39
  const meshStyleStore = useMeshStyle();
39
40
  const modelStyleStore = useModelStyle();
41
+ const attributeTimeStepStyle = useAttributeTimeStepStyle();
40
42
  const dataStore = useDataStore();
41
43
  // oxlint-disable-next-line no-unsafe-type-assertion -- the database Proxy is typed as `{}` at its export site; this cast documents its real runtime shape.
42
44
  const typedDatabase = database as unknown as DatabaseTables;
@@ -160,6 +162,7 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
160
162
  importStores,
161
163
  applyAllStylesFromState,
162
164
  ...dataStyleState,
165
+ ...attributeTimeStepStyle,
163
166
  ...meshStyleStore,
164
167
  ...modelStyleStore,
165
168
  };
@@ -1,3 +1,5 @@
1
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
2
+
1
3
  interface AttributeRangeSource {
2
4
  min_values?: readonly number[];
3
5
  max_values?: readonly number[];
@@ -55,13 +57,29 @@ const MESH_ELEMENT_KINDS: Record<string, string> = {
55
57
  TetrahedralSolid3D: "polyhedron",
56
58
  };
57
59
 
58
- const MODEL_COMPONENT_KINDS: Record<string, string[]> = {
59
- Corner: ["vertex"],
60
- Line: ["vertex", "edge"],
61
- Surface: ["vertex", "polygon"],
62
- Block: ["vertex", "polyhedron"],
60
+ const MODEL_COMPONENT_ATTRIBUTE_SCHEMAS: Record<string, Record<string, { $id: string }>> = {
61
+ Corner: { vertex: viewer_schemas.opengeodeweb_viewer.model.corners.attribute.vertex.attribute },
62
+ Line: {
63
+ vertex: viewer_schemas.opengeodeweb_viewer.model.lines.attribute.vertex.attribute,
64
+ edge: viewer_schemas.opengeodeweb_viewer.model.lines.attribute.edge.attribute,
65
+ },
66
+ Surface: {
67
+ vertex: viewer_schemas.opengeodeweb_viewer.model.surfaces.attribute.vertex.attribute,
68
+ polygon: viewer_schemas.opengeodeweb_viewer.model.surfaces.attribute.polygon.attribute,
69
+ },
70
+ Block: {
71
+ vertex: viewer_schemas.opengeodeweb_viewer.model.blocks.attribute.vertex.attribute,
72
+ polyhedron: viewer_schemas.opengeodeweb_viewer.model.blocks.attribute.polyhedron.attribute,
73
+ },
63
74
  };
64
75
 
76
+ const MODEL_COMPONENT_KINDS: Record<string, string[]> = Object.fromEntries(
77
+ Object.entries(MODEL_COMPONENT_ATTRIBUTE_SCHEMAS).map(([type, schemas]) => [
78
+ type,
79
+ Object.keys(schemas),
80
+ ]),
81
+ );
82
+
65
83
  function intersectBy<TItem>(
66
84
  lists: readonly (readonly TItem[])[],
67
85
  key: (item: TItem) => string,
@@ -75,6 +93,16 @@ function intersectBy<TItem>(
75
93
  interface NamedAttribute {
76
94
  attribute_name: string;
77
95
  nb_items: number;
96
+ time_steps?: readonly number[];
97
+ }
98
+
99
+ function sameTimeSteps(left: NamedAttribute, right: NamedAttribute): boolean {
100
+ const leftSteps = left.time_steps ?? [];
101
+ const rightSteps = right.time_steps ?? [];
102
+ return (
103
+ leftSteps.length === rightSteps.length &&
104
+ leftSteps.every((time, index) => time === rightSteps[index])
105
+ );
78
106
  }
79
107
 
80
108
  function intersectAttributes<TAttribute extends NamedAttribute>(
@@ -83,19 +111,28 @@ function intersectAttributes<TAttribute extends NamedAttribute>(
83
111
  const allAttributes = attributesPerData.flat();
84
112
  const common: TAttribute[] = [];
85
113
  for (const attribute of intersectBy(attributesPerData, (item) => item.attribute_name)) {
86
- const nb_items = Math.min(
87
- ...allAttributes
88
- .filter((other) => other.attribute_name === attribute.attribute_name)
89
- .map((other) => other.nb_items),
114
+ const sameName = allAttributes.filter(
115
+ (other) => other.attribute_name === attribute.attribute_name,
90
116
  );
117
+ if (!sameName.every((other) => sameTimeSteps(other, attribute))) {
118
+ continue;
119
+ }
120
+ const nb_items = Math.min(...sameName.map((other) => other.nb_items));
91
121
  common.push({ ...attribute, nb_items });
92
122
  }
93
123
  return common;
94
124
  }
95
125
 
126
+ // OpenGeode-IO writes each step of a time series as the "<name>@<step>" VTK array
127
+ function attributeArrayName(name: string, timeStep: number | undefined): string {
128
+ return timeStep === undefined ? name : `${name}@${timeStep}`;
129
+ }
130
+
96
131
  export {
97
132
  MESH_ELEMENT_KINDS,
133
+ MODEL_COMPONENT_ATTRIBUTE_SCHEMAS,
98
134
  MODEL_COMPONENT_KINDS,
135
+ attributeArrayName,
99
136
  getAttributeRange,
100
137
  intersectAttributes,
101
138
  intersectBy,
@@ -1,13 +1,16 @@
1
1
  import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
2
  // Third party imports
3
+ import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
4
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
4
5
 
5
6
  // Local imports
6
7
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
8
+ import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
7
9
  import { useMeshCellsCommonStyle } from "./common";
8
10
  import { useViewerStore } from "@ogw_front/stores/viewer";
9
11
 
10
12
  // Local constants
13
+ const attributeNamesSchema = back_schemas.opengeodeweb_back.cell_attribute_names;
11
14
  const meshCellsCellAttributeSchemas = viewer_schemas.opengeodeweb_viewer.mesh.cells.attribute.cell;
12
15
 
13
16
  interface AttributeStoredConfig {
@@ -56,6 +59,8 @@ function useMeshCellsCellAttributeStyle(): {
56
59
  meshCellsCellAttributeName: (id: string) => string | undefined;
57
60
  meshCellsCellAttributeItem: (id: string) => number;
58
61
  meshCellsCellAttributeRange: (id: string) => [number | undefined, number | undefined];
62
+ meshCellsCellAttributeTimeStep: (id: string) => number | undefined;
63
+ setMeshCellsCellAttributeTimeStep: (id: string, timeStep: number) => Promise<unknown>;
59
64
  meshCellsCellAttributeColorMap: (id: string) => string | undefined;
60
65
  meshCellsCellAttributeStoredConfig: (
61
66
  id: string,
@@ -74,6 +79,7 @@ function useMeshCellsCellAttributeStyle(): {
74
79
  meshCellsCellAttributeNoDataColor: (id: string) => RGBAColor;
75
80
  setMeshCellsCellAttributeNoDataColor: (id: string, no_data_color: RGBAColor) => Promise<unknown>;
76
81
  } {
82
+ const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
77
83
  const viewerStore = useViewerStore();
78
84
  const meshCellsCommonStyle = useMeshCellsCommonStyle();
79
85
  function meshCellsCellAttribute(id: string): AttributeState {
@@ -140,6 +146,9 @@ function useMeshCellsCellAttributeStyle(): {
140
146
  const { item, name } = meshCellsCellAttribute(id);
141
147
  return item ?? meshCellsCellAttributeLastItem(id, name);
142
148
  }
149
+ function meshCellsCellAttributeTimeStep(id: string): number | undefined {
150
+ return attributeTimeStep(id, attributeNamesSchema.$id, meshCellsCellAttribute(id).name);
151
+ }
143
152
  async function setMeshCellsCellAttribute(
144
153
  id: string,
145
154
  {
@@ -165,7 +174,7 @@ function useMeshCellsCellAttributeStyle(): {
165
174
  const schema = meshCellsCellAttributeSchemas.attribute;
166
175
  const params = {
167
176
  id,
168
- name,
177
+ name: seriesArrayName(id, attributeNamesSchema.$id, name),
169
178
  item,
170
179
  points,
171
180
  minimum,
@@ -215,6 +224,14 @@ function useMeshCellsCellAttributeStyle(): {
215
224
  const storedConfig = meshCellsCellAttributeStoredConfig(id, name, item);
216
225
  return [storedConfig.minimum, storedConfig.maximum];
217
226
  }
227
+ async function setMeshCellsCellAttributeTimeStep(id: string, timeStep: number): Promise<unknown> {
228
+ const name = meshCellsCellAttributeName(id);
229
+ if (name === undefined) {
230
+ return undefined;
231
+ }
232
+ await setAttributeTimeStep(id, attributeNamesSchema.$id, name, timeStep);
233
+ return applyCellAttribute(id);
234
+ }
218
235
  async function setMeshCellsCellAttributeRange(
219
236
  id: string,
220
237
  minimum: number,
@@ -266,6 +283,8 @@ function useMeshCellsCellAttributeStyle(): {
266
283
  }
267
284
  return {
268
285
  meshCellsCellAttributeName,
286
+ meshCellsCellAttributeTimeStep,
287
+ setMeshCellsCellAttributeTimeStep,
269
288
  meshCellsCellAttributeItem,
270
289
  meshCellsCellAttributeRange,
271
290
  meshCellsCellAttributeColorMap,
@@ -28,7 +28,8 @@ function handleMeshCellsVertexColoring(
28
28
  const item = vertexAttributeStyle.meshCellsVertexAttributeItem(id);
29
29
  const [minimum, maximum] = vertexAttributeStyle.meshCellsVertexAttributeRange(id);
30
30
  const colorMap = vertexAttributeStyle.meshCellsVertexAttributeColorMap(id);
31
- const vertex_attribute = { name, item, minimum, maximum, colorMap };
31
+ const no_data_color = vertexAttributeStyle.meshCellsVertexAttributeNoDataColor(id);
32
+ const vertex_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
32
33
  if (!isMeshCellsVertexAttributeValid(vertex_attribute)) {
33
34
  return undefined;
34
35
  }
@@ -43,7 +44,8 @@ function handleMeshCellsCellColoring(
43
44
  const item = cellAttributeStyle.meshCellsCellAttributeItem(id);
44
45
  const [minimum, maximum] = cellAttributeStyle.meshCellsCellAttributeRange(id);
45
46
  const colorMap = cellAttributeStyle.meshCellsCellAttributeColorMap(id);
46
- const cell_attribute = { name, item, minimum, maximum, colorMap };
47
+ const no_data_color = cellAttributeStyle.meshCellsCellAttributeNoDataColor(id);
48
+ const cell_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
47
49
  if (!isMeshCellsCellAttributeValid(cell_attribute)) {
48
50
  return undefined;
49
51
  }
@@ -1,13 +1,16 @@
1
1
  import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
2
  // Third party imports
3
+ import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
4
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
4
5
 
5
6
  // Local imports
6
7
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
8
+ import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
7
9
  import { useMeshCellsCommonStyle } from "./common";
8
10
  import { useViewerStore } from "@ogw_front/stores/viewer";
9
11
 
10
12
  // Local constants
13
+ const attributeNamesSchema = back_schemas.opengeodeweb_back.vertex_attribute_names;
11
14
  const meshCellsVertexAttributeSchemas =
12
15
  viewer_schemas.opengeodeweb_viewer.mesh.cells.attribute.vertex;
13
16
 
@@ -56,6 +59,8 @@ interface UseMeshCellsVertexAttributeStyleReturn {
56
59
  meshCellsVertexAttributeName: (id: string) => string | undefined;
57
60
  meshCellsVertexAttributeItem: (id: string) => number;
58
61
  meshCellsVertexAttributeRange: (id: string) => [number | undefined, number | undefined];
62
+ meshCellsVertexAttributeTimeStep: (id: string) => number | undefined;
63
+ setMeshCellsVertexAttributeTimeStep: (id: string, timeStep: number) => Promise<unknown>;
59
64
  meshCellsVertexAttributeColorMap: (id: string) => string | undefined;
60
65
  meshCellsVertexAttributeStoredConfig: (
61
66
  id: string,
@@ -83,6 +88,7 @@ interface UseMeshCellsVertexAttributeStyleReturn {
83
88
 
84
89
  // oxlint-disable-next-line max-lines-per-function
85
90
  function useMeshCellsVertexAttributeStyle(): UseMeshCellsVertexAttributeStyleReturn {
91
+ const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
86
92
  const viewerStore = useViewerStore();
87
93
  const meshCellsCommonStyle = useMeshCellsCommonStyle();
88
94
  function meshCellsVertexAttribute(id: string): AttributeState {
@@ -149,6 +155,9 @@ function useMeshCellsVertexAttributeStyle(): UseMeshCellsVertexAttributeStyleRet
149
155
  const { item, name } = meshCellsVertexAttribute(id);
150
156
  return item ?? meshCellsVertexAttributeLastItem(id, name);
151
157
  }
158
+ function meshCellsVertexAttributeTimeStep(id: string): number | undefined {
159
+ return attributeTimeStep(id, attributeNamesSchema.$id, meshCellsVertexAttribute(id).name);
160
+ }
152
161
  async function setMeshCellsVertexAttribute(
153
162
  id: string,
154
163
  {
@@ -174,7 +183,7 @@ function useMeshCellsVertexAttributeStyle(): UseMeshCellsVertexAttributeStyleRet
174
183
  const schema = meshCellsVertexAttributeSchemas.attribute;
175
184
  const params = {
176
185
  id,
177
- name,
186
+ name: seriesArrayName(id, attributeNamesSchema.$id, name),
178
187
  item,
179
188
  points,
180
189
  minimum,
@@ -224,6 +233,17 @@ function useMeshCellsVertexAttributeStyle(): UseMeshCellsVertexAttributeStyleRet
224
233
  const storedConfig = meshCellsVertexAttributeStoredConfig(id, name, item);
225
234
  return [storedConfig.minimum, storedConfig.maximum];
226
235
  }
236
+ async function setMeshCellsVertexAttributeTimeStep(
237
+ id: string,
238
+ timeStep: number,
239
+ ): Promise<unknown> {
240
+ const name = meshCellsVertexAttributeName(id);
241
+ if (name === undefined) {
242
+ return undefined;
243
+ }
244
+ await setAttributeTimeStep(id, attributeNamesSchema.$id, name, timeStep);
245
+ return applyVertexAttribute(id);
246
+ }
227
247
  async function setMeshCellsVertexAttributeRange(
228
248
  id: string,
229
249
  minimum: number,
@@ -275,6 +295,8 @@ function useMeshCellsVertexAttributeStyle(): UseMeshCellsVertexAttributeStyleRet
275
295
  }
276
296
  return {
277
297
  meshCellsVertexAttributeName,
298
+ meshCellsVertexAttributeTimeStep,
299
+ setMeshCellsVertexAttributeTimeStep,
278
300
  meshCellsVertexAttributeItem,
279
301
  meshCellsVertexAttributeRange,
280
302
  meshCellsVertexAttributeColorMap,
@@ -1,13 +1,16 @@
1
1
  import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
2
  // Third party imports
3
+ import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
4
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
4
5
 
5
6
  // Local imports
6
7
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
8
+ import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
7
9
  import { useMeshEdgesCommonStyle } from "./common";
8
10
  import { useViewerStore } from "@ogw_front/stores/viewer";
9
11
 
10
12
  // Local constants
13
+ const attributeNamesSchema = back_schemas.opengeodeweb_back.edge_attribute_names;
11
14
  const meshEdgesEdgeAttributeSchemas = viewer_schemas.opengeodeweb_viewer.mesh.edges.attribute.edge;
12
15
 
13
16
  interface AttributeStoredConfig {
@@ -56,6 +59,8 @@ function useMeshEdgesEdgeAttributeStyle(): {
56
59
  meshEdgesEdgeAttributeName: (id: string) => string | undefined;
57
60
  meshEdgesEdgeAttributeItem: (id: string) => number;
58
61
  meshEdgesEdgeAttributeRange: (id: string) => [number | undefined, number | undefined];
62
+ meshEdgesEdgeAttributeTimeStep: (id: string) => number | undefined;
63
+ setMeshEdgesEdgeAttributeTimeStep: (id: string, timeStep: number) => Promise<unknown>;
59
64
  meshEdgesEdgeAttributeColorMap: (id: string) => string | undefined;
60
65
  meshEdgesEdgeAttributeStoredConfig: (
61
66
  id: string,
@@ -74,6 +79,7 @@ function useMeshEdgesEdgeAttributeStyle(): {
74
79
  meshEdgesEdgeAttributeNoDataColor: (id: string) => RGBAColor;
75
80
  setMeshEdgesEdgeAttributeNoDataColor: (id: string, no_data_color: RGBAColor) => Promise<unknown>;
76
81
  } {
82
+ const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
77
83
  const viewerStore = useViewerStore();
78
84
  const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
79
85
  function meshEdgesEdgeAttribute(id: string): AttributeState {
@@ -140,6 +146,9 @@ function useMeshEdgesEdgeAttributeStyle(): {
140
146
  const { item, name } = meshEdgesEdgeAttribute(id);
141
147
  return item ?? meshEdgesEdgeAttributeLastItem(id, name);
142
148
  }
149
+ function meshEdgesEdgeAttributeTimeStep(id: string): number | undefined {
150
+ return attributeTimeStep(id, attributeNamesSchema.$id, meshEdgesEdgeAttribute(id).name);
151
+ }
143
152
  async function setMeshEdgesEdgeAttribute(
144
153
  id: string,
145
154
  {
@@ -165,7 +174,7 @@ function useMeshEdgesEdgeAttributeStyle(): {
165
174
  const schema = meshEdgesEdgeAttributeSchemas.attribute;
166
175
  const params = {
167
176
  id,
168
- name,
177
+ name: seriesArrayName(id, attributeNamesSchema.$id, name),
169
178
  item,
170
179
  points,
171
180
  minimum,
@@ -215,6 +224,14 @@ function useMeshEdgesEdgeAttributeStyle(): {
215
224
  const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
216
225
  return [storedConfig.minimum, storedConfig.maximum];
217
226
  }
227
+ async function setMeshEdgesEdgeAttributeTimeStep(id: string, timeStep: number): Promise<unknown> {
228
+ const name = meshEdgesEdgeAttributeName(id);
229
+ if (name === undefined) {
230
+ return undefined;
231
+ }
232
+ await setAttributeTimeStep(id, attributeNamesSchema.$id, name, timeStep);
233
+ return applyEdgeAttribute(id);
234
+ }
218
235
  async function setMeshEdgesEdgeAttributeRange(
219
236
  id: string,
220
237
  minimum: number,
@@ -266,6 +283,8 @@ function useMeshEdgesEdgeAttributeStyle(): {
266
283
  }
267
284
  return {
268
285
  meshEdgesEdgeAttributeName,
286
+ meshEdgesEdgeAttributeTimeStep,
287
+ setMeshEdgesEdgeAttributeTimeStep,
269
288
  meshEdgesEdgeAttributeItem,
270
289
  meshEdgesEdgeAttributeRange,
271
290
  meshEdgesEdgeAttributeColorMap,
@@ -27,7 +27,8 @@ function handleMeshEdgesVertexColoring(
27
27
  const item = vertexAttributeStyle.meshEdgesVertexAttributeItem(id);
28
28
  const [minimum, maximum] = vertexAttributeStyle.meshEdgesVertexAttributeRange(id);
29
29
  const colorMap = vertexAttributeStyle.meshEdgesVertexAttributeColorMap(id);
30
- const vertex_attribute = { name, item, minimum, maximum, colorMap };
30
+ const no_data_color = vertexAttributeStyle.meshEdgesVertexAttributeNoDataColor(id);
31
+ const vertex_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
31
32
  if (!isMeshEdgesVertexAttributeValid(vertex_attribute)) {
32
33
  return undefined;
33
34
  }
@@ -42,7 +43,8 @@ function handleMeshEdgesEdgeColoring(
42
43
  const item = edgeAttributeStyle.meshEdgesEdgeAttributeItem(id);
43
44
  const [minimum, maximum] = edgeAttributeStyle.meshEdgesEdgeAttributeRange(id);
44
45
  const colorMap = edgeAttributeStyle.meshEdgesEdgeAttributeColorMap(id);
45
- const edge_attribute = { name, item, minimum, maximum, colorMap };
46
+ const no_data_color = edgeAttributeStyle.meshEdgesEdgeAttributeNoDataColor(id);
47
+ const edge_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
46
48
  if (!isMeshEdgesEdgeAttributeValid(edge_attribute)) {
47
49
  return undefined;
48
50
  }
@@ -1,13 +1,16 @@
1
1
  import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
2
  // Third party imports
3
+ import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
4
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
4
5
 
5
6
  // Local imports
6
7
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
8
+ import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
7
9
  import { useMeshEdgesCommonStyle } from "./common";
8
10
  import { useViewerStore } from "@ogw_front/stores/viewer";
9
11
 
10
12
  // Local constants
13
+ const attributeNamesSchema = back_schemas.opengeodeweb_back.vertex_attribute_names;
11
14
  const meshEdgesVertexAttributeSchemas =
12
15
  viewer_schemas.opengeodeweb_viewer.mesh.edges.attribute.vertex;
13
16
 
@@ -56,6 +59,8 @@ interface UseMeshEdgesVertexAttributeStyleReturn {
56
59
  meshEdgesVertexAttributeName: (id: string) => string | undefined;
57
60
  meshEdgesVertexAttributeItem: (id: string) => number;
58
61
  meshEdgesVertexAttributeRange: (id: string) => [number | undefined, number | undefined];
62
+ meshEdgesVertexAttributeTimeStep: (id: string) => number | undefined;
63
+ setMeshEdgesVertexAttributeTimeStep: (id: string, timeStep: number) => Promise<unknown>;
59
64
  meshEdgesVertexAttributeColorMap: (id: string) => string | undefined;
60
65
  meshEdgesVertexAttributeStoredConfig: (
61
66
  id: string,
@@ -83,6 +88,7 @@ interface UseMeshEdgesVertexAttributeStyleReturn {
83
88
 
84
89
  // oxlint-disable-next-line max-lines-per-function
85
90
  function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleReturn {
91
+ const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
86
92
  const viewerStore = useViewerStore();
87
93
  const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
88
94
  function meshEdgesVertexAttribute(id: string): AttributeState {
@@ -149,6 +155,9 @@ function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleRet
149
155
  const { item, name } = meshEdgesVertexAttribute(id);
150
156
  return item ?? meshEdgesVertexAttributeLastItem(id, name);
151
157
  }
158
+ function meshEdgesVertexAttributeTimeStep(id: string): number | undefined {
159
+ return attributeTimeStep(id, attributeNamesSchema.$id, meshEdgesVertexAttribute(id).name);
160
+ }
152
161
  async function setMeshEdgesVertexAttribute(
153
162
  id: string,
154
163
  {
@@ -174,7 +183,7 @@ function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleRet
174
183
  const schema = meshEdgesVertexAttributeSchemas.attribute;
175
184
  const params = {
176
185
  id,
177
- name,
186
+ name: seriesArrayName(id, attributeNamesSchema.$id, name),
178
187
  item,
179
188
  points,
180
189
  minimum,
@@ -224,6 +233,17 @@ function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleRet
224
233
  const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
225
234
  return [storedConfig.minimum, storedConfig.maximum];
226
235
  }
236
+ async function setMeshEdgesVertexAttributeTimeStep(
237
+ id: string,
238
+ timeStep: number,
239
+ ): Promise<unknown> {
240
+ const name = meshEdgesVertexAttributeName(id);
241
+ if (name === undefined) {
242
+ return undefined;
243
+ }
244
+ await setAttributeTimeStep(id, attributeNamesSchema.$id, name, timeStep);
245
+ return applyVertexAttribute(id);
246
+ }
227
247
  async function setMeshEdgesVertexAttributeRange(
228
248
  id: string,
229
249
  minimum: number,
@@ -275,6 +295,8 @@ function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleRet
275
295
  }
276
296
  return {
277
297
  meshEdgesVertexAttributeName,
298
+ meshEdgesVertexAttributeTimeStep,
299
+ setMeshEdgesVertexAttributeTimeStep,
278
300
  meshEdgesVertexAttributeItem,
279
301
  meshEdgesVertexAttributeRange,
280
302
  meshEdgesVertexAttributeColorMap,
@@ -85,6 +85,69 @@ export function useMeshStyle(): {
85
85
  return result;
86
86
  }
87
87
 
88
+ const pointsCard = {
89
+ key: "points",
90
+ name: meshPointsStyle.meshPointsVertexAttributeName,
91
+ active: meshPointsStyle.meshPointsActiveColoring,
92
+ setActive: meshPointsStyle.setMeshPointsActiveColoring,
93
+ setTimeStep: meshPointsStyle.setMeshPointsVertexAttributeTimeStep,
94
+ };
95
+ const edgesCard = {
96
+ key: "edges",
97
+ name: meshEdgesStyle.meshEdgesVertexAttributeName,
98
+ active: meshEdgesStyle.meshEdgesActiveColoring,
99
+ setActive: meshEdgesStyle.setMeshEdgesActiveColoring,
100
+ setTimeStep: meshEdgesStyle.setMeshEdgesVertexAttributeTimeStep,
101
+ };
102
+ const cellsCard = {
103
+ key: "cells",
104
+ name: meshCellsStyle.meshCellsVertexAttributeName,
105
+ active: meshCellsStyle.meshCellsActiveColoring,
106
+ setActive: meshCellsStyle.setMeshCellsActiveColoring,
107
+ setTimeStep: meshCellsStyle.setMeshCellsVertexAttributeTimeStep,
108
+ };
109
+ const polygonsCard = {
110
+ key: "polygons",
111
+ name: meshPolygonsStyle.meshPolygonsVertexAttributeName,
112
+ active: meshPolygonsStyle.meshPolygonsActiveColoring,
113
+ setActive: meshPolygonsStyle.setMeshPolygonsActiveColoring,
114
+ setTimeStep: meshPolygonsStyle.setMeshPolygonsVertexAttributeTimeStep,
115
+ };
116
+ const polyhedraCard = {
117
+ key: "polyhedra",
118
+ name: meshPolyhedraStyle.meshPolyhedraVertexAttributeName,
119
+ active: meshPolyhedraStyle.meshPolyhedraActiveColoring,
120
+ setActive: meshPolyhedraStyle.setMeshPolyhedraActiveColoring,
121
+ setTimeStep: meshPolyhedraStyle.setMeshPolyhedraVertexAttributeTimeStep,
122
+ };
123
+ const vertexCards = [pointsCard, edgesCard, cellsCard, polygonsCard, polyhedraCard];
124
+
125
+ // The vertex series is shared by all the cards: re-render the other cards showing it
126
+ function sharedVertexTimeStep(
127
+ card: (typeof vertexCards)[number],
128
+ ): (id: string, timeStep: number) => Promise<unknown> {
129
+ return async (id, timeStep) => {
130
+ const result = await card.setTimeStep(id, timeStep);
131
+ const name = card.name(id);
132
+ const style = dataStyleState.getStyle(id);
133
+ const others = vertexCards.filter(
134
+ (other) =>
135
+ other !== card &&
136
+ style[other.key] !== undefined &&
137
+ other.active(id) === "vertex" &&
138
+ other.name(id) === name,
139
+ );
140
+ if (name !== undefined) {
141
+ await Promise.all(
142
+ others.map(async (other) => {
143
+ await other.setActive(id, "vertex");
144
+ }),
145
+ );
146
+ }
147
+ return result;
148
+ };
149
+ }
150
+
88
151
  async function applyMeshStyle(id: string): Promise<unknown[]> {
89
152
  const style = dataStyleState.getStyle(id);
90
153
  const promise_array: unknown[] = [];
@@ -142,5 +205,10 @@ export function useMeshStyle(): {
142
205
  ...meshCellsStyle,
143
206
  ...meshPolygonsStyle,
144
207
  ...meshPolyhedraStyle,
208
+ setMeshPointsVertexAttributeTimeStep: sharedVertexTimeStep(pointsCard),
209
+ setMeshEdgesVertexAttributeTimeStep: sharedVertexTimeStep(edgesCard),
210
+ setMeshCellsVertexAttributeTimeStep: sharedVertexTimeStep(cellsCard),
211
+ setMeshPolygonsVertexAttributeTimeStep: sharedVertexTimeStep(polygonsCard),
212
+ setMeshPolyhedraVertexAttributeTimeStep: sharedVertexTimeStep(polyhedraCard),
145
213
  };
146
214
  }
@@ -25,7 +25,8 @@ function handleMeshPointsVertexColoring(
25
25
  const item = vertexAttributeStyle.meshPointsVertexAttributeItem(id);
26
26
  const [minimum, maximum] = vertexAttributeStyle.meshPointsVertexAttributeRange(id);
27
27
  const colorMap = vertexAttributeStyle.meshPointsVertexAttributeColorMap(id);
28
- const vertex_attribute = { name, item, minimum, maximum, colorMap };
28
+ const no_data_color = vertexAttributeStyle.meshPointsVertexAttributeNoDataColor(id);
29
+ const vertex_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
29
30
  if (!isMeshPointsVertexAttributeValid(vertex_attribute)) {
30
31
  return undefined;
31
32
  }
@@ -1,13 +1,16 @@
1
1
  import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
2
  // Third party imports
3
+ import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
4
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
4
5
 
5
6
  // Local imports
6
7
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
8
+ import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
7
9
  import { useMeshPointsCommonStyle } from "./common";
8
10
  import { useViewerStore } from "@ogw_front/stores/viewer";
9
11
 
10
12
  // Local constants
13
+ const attributeNamesSchema = back_schemas.opengeodeweb_back.vertex_attribute_names;
11
14
  const meshPointsVertexAttributeSchemas =
12
15
  viewer_schemas.opengeodeweb_viewer.mesh.points.attribute.vertex;
13
16
 
@@ -56,6 +59,8 @@ interface UseMeshPointsVertexAttributeStyleReturn {
56
59
  meshPointsVertexAttributeName: (id: string) => string | undefined;
57
60
  meshPointsVertexAttributeItem: (id: string) => number;
58
61
  meshPointsVertexAttributeRange: (id: string) => [number | undefined, number | undefined];
62
+ meshPointsVertexAttributeTimeStep: (id: string) => number | undefined;
63
+ setMeshPointsVertexAttributeTimeStep: (id: string, timeStep: number) => Promise<unknown>;
59
64
  meshPointsVertexAttributeColorMap: (id: string) => string | undefined;
60
65
  meshPointsVertexAttributeStoredConfig: (
61
66
  id: string,
@@ -83,6 +88,7 @@ interface UseMeshPointsVertexAttributeStyleReturn {
83
88
 
84
89
  // oxlint-disable-next-line max-lines-per-function
85
90
  function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleReturn {
91
+ const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
86
92
  const viewerStore = useViewerStore();
87
93
  const meshPointsCommonStyle = useMeshPointsCommonStyle();
88
94
  function meshPointsVertexAttribute(id: string): AttributeState {
@@ -149,6 +155,9 @@ function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleR
149
155
  const { item, name } = meshPointsVertexAttribute(id);
150
156
  return item ?? meshPointsVertexAttributeLastItem(id, name);
151
157
  }
158
+ function meshPointsVertexAttributeTimeStep(id: string): number | undefined {
159
+ return attributeTimeStep(id, attributeNamesSchema.$id, meshPointsVertexAttribute(id).name);
160
+ }
152
161
  async function setMeshPointsVertexAttribute(
153
162
  id: string,
154
163
  {
@@ -174,7 +183,7 @@ function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleR
174
183
  const schema = meshPointsVertexAttributeSchemas.attribute;
175
184
  const params = {
176
185
  id,
177
- name,
186
+ name: seriesArrayName(id, attributeNamesSchema.$id, name),
178
187
  item,
179
188
  points,
180
189
  minimum,
@@ -224,6 +233,17 @@ function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleR
224
233
  const storedConfig = meshPointsVertexAttributeStoredConfig(id, name, item);
225
234
  return [storedConfig.minimum, storedConfig.maximum];
226
235
  }
236
+ async function setMeshPointsVertexAttributeTimeStep(
237
+ id: string,
238
+ timeStep: number,
239
+ ): Promise<unknown> {
240
+ const name = meshPointsVertexAttributeName(id);
241
+ if (name === undefined) {
242
+ return undefined;
243
+ }
244
+ await setAttributeTimeStep(id, attributeNamesSchema.$id, name, timeStep);
245
+ return applyVertexAttribute(id);
246
+ }
227
247
  async function setMeshPointsVertexAttributeRange(
228
248
  id: string,
229
249
  minimum: number,
@@ -275,6 +295,8 @@ function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleR
275
295
  }
276
296
  return {
277
297
  meshPointsVertexAttributeName,
298
+ meshPointsVertexAttributeTimeStep,
299
+ setMeshPointsVertexAttributeTimeStep,
278
300
  meshPointsVertexAttributeItem,
279
301
  meshPointsVertexAttributeRange,
280
302
  meshPointsVertexAttributeColorMap,
@@ -31,7 +31,8 @@ function handleMeshPolygonsVertexColoring(
31
31
  const item = vertexAttributeStyle.meshPolygonsVertexAttributeItem(id);
32
32
  const [minimum, maximum] = vertexAttributeStyle.meshPolygonsVertexAttributeRange(id);
33
33
  const colorMap = vertexAttributeStyle.meshPolygonsVertexAttributeColorMap(id);
34
- const vertex_attribute = { name, item, minimum, maximum, colorMap };
34
+ const no_data_color = vertexAttributeStyle.meshPolygonsVertexAttributeNoDataColor(id);
35
+ const vertex_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
35
36
  if (!isMeshPolygonsVertexAttributeValid(vertex_attribute)) {
36
37
  return undefined;
37
38
  }
@@ -46,7 +47,15 @@ function handleMeshPolygonsPolygonColoring(
46
47
  const item = polygonAttributeStyle.meshPolygonsPolygonAttributeItem(id);
47
48
  const [minimum, maximum] = polygonAttributeStyle.meshPolygonsPolygonAttributeRange(id);
48
49
  const colorMap = polygonAttributeStyle.meshPolygonsPolygonAttributeColorMap(id);
49
- const polygon_attribute = { name, item, minimum, maximum, colorMap };
50
+ const no_data_color = polygonAttributeStyle.meshPolygonsPolygonAttributeNoDataColor(id);
51
+ const polygon_attribute = {
52
+ name,
53
+ item,
54
+ minimum,
55
+ maximum,
56
+ colorMap,
57
+ no_data_color,
58
+ };
50
59
  if (!isMeshPolygonsPolygonAttributeValid(polygon_attribute)) {
51
60
  return undefined;
52
61
  }