@geode/opengeodeweb-front 10.44.0 → 10.44.1-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 (218) hide show
  1. package/app/components/ClippingPlanes.vue +7 -5
  2. package/app/components/CrsSelector.vue +2 -1
  3. package/app/components/ExtensionSelector.vue +8 -7
  4. package/app/components/FactorFilterPanel.vue +4 -4
  5. package/app/components/MissingFilesSelector.vue +2 -1
  6. package/app/components/ObjectSelector.vue +4 -3
  7. package/app/components/ThresholdCard.vue +6 -5
  8. package/app/components/ThresholdFilter.vue +11 -10
  9. package/app/components/TimeSeriesTargetSelector.vue +10 -7
  10. package/app/components/Viewer/ContextMenu/InfoCard.vue +12 -10
  11. package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +72 -63
  12. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +12 -10
  13. package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +76 -71
  14. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +8 -6
  15. package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +72 -63
  16. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +12 -10
  17. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +54 -45
  18. package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +76 -73
  19. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +8 -6
  20. package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +72 -67
  21. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +8 -6
  22. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +29 -21
  23. package/app/components/Viewer/Generic/Model/ComponentEdgesOptions.vue +8 -6
  24. package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +8 -6
  25. package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +15 -7
  26. package/app/components/Viewer/Generic/Model/CornersOptions.vue +2 -1
  27. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +13 -6
  28. package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +19 -11
  29. package/app/components/Viewer/Generic/Model/LinesOptions.vue +2 -1
  30. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +17 -10
  31. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +3 -2
  32. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +2 -1
  33. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +3 -2
  34. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +29 -21
  35. package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +2 -2
  36. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +2 -3
  37. package/app/components/Viewer/Options/AttributeSelector.vue +11 -7
  38. package/app/components/Viewer/Options/ColoringTypeSelector.vue +10 -13
  39. package/app/components/Viewer/Options/TextureItem.vue +5 -4
  40. package/app/components/Viewer/Options/TexturesSelector.vue +5 -8
  41. package/app/components/Viewer/Options/TimeStepSlider.vue +3 -1
  42. package/app/components/Viewer/OverlappingObjectsPicker.vue +6 -13
  43. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +40 -38
  44. package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +69 -65
  45. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +8 -6
  46. package/app/components/Viewer/Surface/PolygonsColoring.vue +73 -71
  47. package/app/components/Viewer/Surface/PolygonsOptions.vue +8 -6
  48. package/app/composables/attribute_coloring_style.ts +17 -12
  49. package/app/composables/attribute_selector.ts +9 -15
  50. package/app/composables/batch_style.ts +25 -16
  51. package/app/composables/batch_style_model.ts +6 -5
  52. package/app/composables/clipping_planes_widget.ts +2 -5
  53. package/app/composables/clipping_slices.ts +2 -1
  54. package/app/composables/hover_highlight.ts +17 -16
  55. package/app/composables/live_data_item.ts +3 -2
  56. package/app/composables/model_attribute_style.ts +2 -1
  57. package/app/composables/model_menu_context.ts +3 -4
  58. package/app/composables/model_tree.ts +3 -2
  59. package/app/composables/project_manager_helpers/types.ts +10 -4
  60. package/app/composables/tree_filter.ts +3 -3
  61. package/app/composables/tree_keyboard_nav.ts +1 -6
  62. package/app/composables/tree_scroll.ts +2 -0
  63. package/app/composables/use_overlapping_picker.ts +9 -9
  64. package/app/stores/basemap_helpers/georeferenced.ts +1 -1
  65. package/app/stores/basemap_helpers/viewer.ts +2 -1
  66. package/app/stores/crs.ts +6 -5
  67. package/app/stores/data.ts +84 -69
  68. package/app/stores/data_helpers/collections.ts +13 -21
  69. package/app/stores/data_helpers/mesh.ts +19 -24
  70. package/app/stores/data_helpers/relations.ts +12 -12
  71. package/app/stores/data_style.ts +26 -20
  72. package/app/stores/menu.ts +17 -11
  73. package/app/stores/treeview.ts +28 -27
  74. package/app/types/attribute.ts +37 -0
  75. package/app/types/identifiers.ts +72 -0
  76. package/app/types/style.ts +13 -0
  77. package/app/types/texture.ts +6 -0
  78. package/app/types/tree.ts +17 -0
  79. package/app/utils/attribute_range.ts +2 -1
  80. package/app/utils/attributes.ts +13 -4
  81. package/app/utils/basemap_tree.ts +3 -5
  82. package/app/utils/clipping_planes.ts +6 -4
  83. package/app/utils/clipping_planes_scene.ts +4 -3
  84. package/app/utils/crs.ts +4 -1
  85. package/app/utils/default_styles/constants.ts +8 -1
  86. package/app/utils/default_styles/mesh_components.ts +21 -25
  87. package/app/utils/default_styles/meshes.ts +7 -22
  88. package/app/utils/default_styles/model_components.ts +22 -26
  89. package/app/utils/default_styles/models.ts +11 -13
  90. package/app/utils/import_workflow.ts +37 -29
  91. package/app/utils/legacy_data_id.ts +16 -0
  92. package/app/utils/slice.ts +7 -2
  93. package/app/utils/threshold.ts +1 -8
  94. package/app/utils/threshold_sources.ts +8 -5
  95. package/app/utils/treeview.ts +3 -2
  96. package/internal/database/tables/data.ts +1 -1
  97. package/internal/database/tables/data_style.ts +1 -1
  98. package/internal/database/tables/model_components.ts +1 -1
  99. package/internal/database/tables/model_components_relation.ts +1 -1
  100. package/internal/stores/data_style/attribute_default.ts +14 -0
  101. package/internal/stores/data_style/attribute_types.ts +59 -0
  102. package/internal/stores/data_style/attribute_valid.ts +16 -0
  103. package/internal/stores/data_style/mesh/base_style.ts +17 -15
  104. package/internal/stores/data_style/mesh/cells/cell.ts +64 -49
  105. package/internal/stores/data_style/mesh/cells/cell_attribute.ts +42 -66
  106. package/internal/stores/data_style/mesh/cells/cell_config.ts +59 -53
  107. package/internal/stores/data_style/mesh/cells/color.ts +8 -7
  108. package/internal/stores/data_style/mesh/cells/common.ts +16 -15
  109. package/internal/stores/data_style/mesh/cells/index.ts +49 -47
  110. package/internal/stores/data_style/mesh/cells/opacity.ts +12 -10
  111. package/internal/stores/data_style/mesh/cells/textures.ts +8 -7
  112. package/internal/stores/data_style/mesh/cells/vertex.ts +66 -50
  113. package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +37 -67
  114. package/internal/stores/data_style/mesh/cells/vertex_config.ts +62 -53
  115. package/internal/stores/data_style/mesh/cells/visibility.ts +11 -7
  116. package/internal/stores/data_style/mesh/edges/color.ts +8 -7
  117. package/internal/stores/data_style/mesh/edges/common.ts +13 -12
  118. package/internal/stores/data_style/mesh/edges/edge.ts +64 -49
  119. package/internal/stores/data_style/mesh/edges/edge_attribute.ts +42 -66
  120. package/internal/stores/data_style/mesh/edges/edge_config.ts +59 -53
  121. package/internal/stores/data_style/mesh/edges/index.ts +49 -47
  122. package/internal/stores/data_style/mesh/edges/opacity.ts +12 -10
  123. package/internal/stores/data_style/mesh/edges/vertex.ts +66 -50
  124. package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +37 -67
  125. package/internal/stores/data_style/mesh/edges/vertex_config.ts +62 -53
  126. package/internal/stores/data_style/mesh/edges/visibility.ts +11 -7
  127. package/internal/stores/data_style/mesh/edges/width.ts +9 -7
  128. package/internal/stores/data_style/mesh/index.ts +27 -24
  129. package/internal/stores/data_style/mesh/points/color.ts +8 -7
  130. package/internal/stores/data_style/mesh/points/common.ts +16 -14
  131. package/internal/stores/data_style/mesh/points/index.ts +39 -37
  132. package/internal/stores/data_style/mesh/points/opacity.ts +12 -10
  133. package/internal/stores/data_style/mesh/points/size.ts +9 -7
  134. package/internal/stores/data_style/mesh/points/vertex.ts +66 -50
  135. package/internal/stores/data_style/mesh/points/vertex_attribute.ts +37 -67
  136. package/internal/stores/data_style/mesh/points/vertex_config.ts +62 -53
  137. package/internal/stores/data_style/mesh/points/visibility.ts +8 -6
  138. package/internal/stores/data_style/mesh/polygons/color.ts +8 -7
  139. package/internal/stores/data_style/mesh/polygons/common.ts +19 -15
  140. package/internal/stores/data_style/mesh/polygons/index.ts +49 -50
  141. package/internal/stores/data_style/mesh/polygons/opacity.ts +12 -10
  142. package/internal/stores/data_style/mesh/polygons/polygon.ts +66 -50
  143. package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +37 -67
  144. package/internal/stores/data_style/mesh/polygons/polygon_config.ts +65 -53
  145. package/internal/stores/data_style/mesh/polygons/textures.ts +8 -7
  146. package/internal/stores/data_style/mesh/polygons/vertex.ts +66 -50
  147. package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +37 -67
  148. package/internal/stores/data_style/mesh/polygons/vertex_config.ts +65 -53
  149. package/internal/stores/data_style/mesh/polygons/visibility.ts +12 -7
  150. package/internal/stores/data_style/mesh/polyhedra/color.ts +13 -9
  151. package/internal/stores/data_style/mesh/polyhedra/common.ts +13 -12
  152. package/internal/stores/data_style/mesh/polyhedra/index.ts +51 -51
  153. package/internal/stores/data_style/mesh/polyhedra/opacity.ts +12 -10
  154. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +59 -53
  155. package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +46 -69
  156. package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +65 -55
  157. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +66 -50
  158. package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +37 -67
  159. package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +65 -53
  160. package/internal/stores/data_style/mesh/polyhedra/visibility.ts +12 -7
  161. package/internal/stores/data_style/model/blocks/apply_coloring.ts +11 -12
  162. package/internal/stores/data_style/model/blocks/color.ts +25 -26
  163. package/internal/stores/data_style/model/blocks/coloring_groups.ts +5 -9
  164. package/internal/stores/data_style/model/blocks/common.ts +26 -22
  165. package/internal/stores/data_style/model/blocks/index.ts +8 -7
  166. package/internal/stores/data_style/model/blocks/polyhedron.ts +114 -135
  167. package/internal/stores/data_style/model/blocks/vertex.ts +110 -132
  168. package/internal/stores/data_style/model/blocks/visibility.ts +11 -9
  169. package/internal/stores/data_style/model/color.ts +55 -41
  170. package/internal/stores/data_style/model/common.ts +16 -14
  171. package/internal/stores/data_style/model/component_style.ts +0 -16
  172. package/internal/stores/data_style/model/corners/color.ts +21 -19
  173. package/internal/stores/data_style/model/corners/common.ts +26 -22
  174. package/internal/stores/data_style/model/corners/index.ts +21 -24
  175. package/internal/stores/data_style/model/corners/vertex.ts +103 -122
  176. package/internal/stores/data_style/model/corners/visibility.ts +11 -9
  177. package/internal/stores/data_style/model/edges/common.ts +7 -6
  178. package/internal/stores/data_style/model/edges/component.ts +63 -55
  179. package/internal/stores/data_style/model/edges/visibility.ts +24 -16
  180. package/internal/stores/data_style/model/edges/width.ts +10 -8
  181. package/internal/stores/data_style/model/index.ts +7 -6
  182. package/internal/stores/data_style/model/lines/apply_coloring.ts +11 -9
  183. package/internal/stores/data_style/model/lines/color.ts +25 -23
  184. package/internal/stores/data_style/model/lines/coloring_groups.ts +5 -9
  185. package/internal/stores/data_style/model/lines/common.ts +29 -21
  186. package/internal/stores/data_style/model/lines/edge.ts +109 -128
  187. package/internal/stores/data_style/model/lines/index.ts +8 -7
  188. package/internal/stores/data_style/model/lines/vertex.ts +109 -128
  189. package/internal/stores/data_style/model/lines/visibility.ts +11 -9
  190. package/internal/stores/data_style/model/points/common.ts +7 -6
  191. package/internal/stores/data_style/model/points/component.ts +62 -54
  192. package/internal/stores/data_style/model/points/index.ts +12 -7
  193. package/internal/stores/data_style/model/points/size.ts +10 -8
  194. package/internal/stores/data_style/model/points/visibility.ts +13 -8
  195. package/internal/stores/data_style/model/selection.ts +6 -11
  196. package/internal/stores/data_style/model/surfaces/apply_coloring.ts +11 -15
  197. package/internal/stores/data_style/model/surfaces/color.ts +31 -23
  198. package/internal/stores/data_style/model/surfaces/coloring_groups.ts +5 -9
  199. package/internal/stores/data_style/model/surfaces/common.ts +26 -22
  200. package/internal/stores/data_style/model/surfaces/index.ts +8 -7
  201. package/internal/stores/data_style/model/surfaces/polygon.ts +113 -138
  202. package/internal/stores/data_style/model/surfaces/vertex.ts +117 -133
  203. package/internal/stores/data_style/model/surfaces/visibility.ts +11 -9
  204. package/internal/stores/data_style/model/visibility.ts +18 -16
  205. package/internal/stores/data_style/model/visibility_dispatch.ts +4 -4
  206. package/internal/stores/data_style/state.ts +7 -6
  207. package/internal/stores/data_style/state_shared.ts +11 -10
  208. package/internal/stores/data_style/time_step.ts +21 -15
  209. package/internal/stores/data_style/types.ts +4 -3
  210. package/internal/stores/hybrid_viewer/camera.ts +11 -6
  211. package/internal/stores/hybrid_viewer/filters.ts +16 -14
  212. package/internal/stores/hybrid_viewer/highlight.ts +6 -5
  213. package/internal/stores/hybrid_viewer/scene.ts +20 -18
  214. package/internal/stores/hybrid_viewer/vtk_types.ts +2 -2
  215. package/internal/utils/api_fetch.ts +1 -1
  216. package/internal/utils/upload_file.ts +1 -7
  217. package/package.json +4 -4
  218. package/shared/utils/fetch_raw.ts +7 -8
@@ -1,3 +1,5 @@
1
+ import type { DataId, GeodeObjectType } from "@ogw_front/types/identifiers";
2
+ import { type LegacyDataId, fromLegacyDataId } from "@ogw_front/utils/legacy_data_id";
1
3
  import type {
2
4
  ModelComponentStyle,
3
5
  ModelComponentTypeStyle,
@@ -5,6 +7,7 @@ import type {
5
7
  SceneStyle,
6
8
  } from "@ogw_internal/stores/data_style/types";
7
9
  import type { Table } from "dexie";
10
+ import type { Visibility } from "@ogw_front/types/style";
8
11
  import { database } from "@ogw_internal/database/database.js";
9
12
  import { getDefaultStyle } from "@ogw_front/utils/default_styles";
10
13
  import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
@@ -15,7 +18,8 @@ import { useModelStyle } from "@ogw_internal/stores/data_style/model/index";
15
18
  import { useSceneStyle } from "@ogw_internal/stores/data_style/scene";
16
19
 
17
20
  interface DataStyleSnapshot {
18
- readonly styles: Record<string, ObjectStyle>;
21
+ // Projects saved before data_id existed hold their styles with an `id`
22
+ readonly styles: Record<string, LegacyDataId<ObjectStyle> | ObjectStyle>;
19
23
  readonly componentStyles: Record<string, ModelComponentStyle>;
20
24
  readonly modelComponentTypeStyles: Record<string, ModelComponentTypeStyle>;
21
25
  readonly sceneStyle?: SceneStyle;
@@ -56,43 +60,43 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
56
60
  "model_component_datastyle",
57
61
  );
58
62
 
59
- async function addDataStyle(id: string, geode_object: string): Promise<void> {
60
- const defaultStyle = getDefaultStyle(geode_object);
63
+ async function addDataStyle(dataId: DataId, geodeObjectType: GeodeObjectType): Promise<void> {
64
+ const defaultStyle = getDefaultStyle(geodeObjectType);
61
65
  await data_style_db.put(
62
- structuredClone({ id, ...(isRecord(defaultStyle) ? defaultStyle : {}) }),
66
+ structuredClone({ data_id: dataId, ...(isRecord(defaultStyle) ? defaultStyle : {}) }),
63
67
  );
64
68
  }
65
69
 
66
- async function setVisibility(id: string, visibility: boolean): Promise<unknown> {
67
- const item = await dataStore.item(id);
70
+ async function setVisibility(dataId: DataId, visibility: Visibility): Promise<unknown> {
71
+ const item = await dataStore.item(dataId);
68
72
  if (!(await dataStore.isItemViewable(item))) {
69
- return dataStyleState.mutateStyle(id, { visibility });
73
+ return dataStyleState.mutateStyle(dataId, { visibility });
70
74
  }
71
75
 
72
76
  const { viewer_type } = item;
73
77
 
74
78
  if (viewer_type === "mesh") {
75
- return meshStyleStore.setMeshVisibility(id, visibility);
79
+ return meshStyleStore.setMeshVisibility(dataId, visibility);
76
80
  }
77
81
  if (viewer_type === "model") {
78
- return modelStyleStore.setModelVisibility(id, visibility);
82
+ return modelStyleStore.setModelVisibility(dataId, visibility);
79
83
  }
80
84
  throw new Error("Unknown viewer_type");
81
85
  }
82
86
 
83
- async function applyDefaultStyle(id: string): Promise<unknown[]> {
84
- const item = await dataStore.item(id);
87
+ async function applyDefaultStyle(dataId: DataId): Promise<unknown[]> {
88
+ const item = await dataStore.item(dataId);
85
89
  if (!(await dataStore.isItemViewable(item))) {
86
- throw new Error(`applyDefaultStyle called for non-viewable item: ${id}`);
90
+ throw new Error(`applyDefaultStyle called for non-viewable item: ${dataId}`);
87
91
  }
88
92
 
89
93
  const { viewer_type } = item;
90
94
 
91
95
  if (viewer_type === "mesh") {
92
- return meshStyleStore.applyMeshStyle(id);
96
+ return meshStyleStore.applyMeshStyle(dataId);
93
97
  }
94
98
  if (viewer_type === "model") {
95
- return modelStyleStore.applyModelStyle(id);
99
+ return modelStyleStore.applyModelStyle(dataId);
96
100
  }
97
101
  throw new Error(`Unknown viewer_type: ${viewer_type}`);
98
102
  }
@@ -116,8 +120,10 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
116
120
 
117
121
  const style_promises = Object.entries(stylesSnapshot).map(
118
122
  // oxlint-disable-next-line prefer-readonly-parameter-types -- same external ObjectStyle limitation as above.
119
- async ([id, style]: readonly [string, ObjectStyle]) => {
120
- const key = await data_style_db.put(structuredClone({ ...style, id }));
123
+ async ([dataId, style]: readonly [string, LegacyDataId<ObjectStyle> | ObjectStyle]) => {
124
+ const key = await data_style_db.put(
125
+ structuredClone({ ...fromLegacyDataId<ObjectStyle>(style), data_id: dataId }),
126
+ );
121
127
  return key;
122
128
  },
123
129
  );
@@ -145,16 +151,16 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
145
151
 
146
152
  async function applyAllStylesFromState(): Promise<void> {
147
153
  const ids = Object.keys(dataStyleState.styles.value);
148
- const promises = ids.map(async (id) => {
149
- const meta = await dataStore.item(id);
154
+ const promises = ids.map(async (dataId) => {
155
+ const meta = await dataStore.item(dataId);
150
156
  if (!(await dataStore.isItemViewable(meta))) {
151
157
  return;
152
158
  }
153
159
  const viewerType = meta.viewer_type;
154
160
  if (viewerType === "mesh") {
155
- await meshStyleStore.applyMeshStyle(id);
161
+ await meshStyleStore.applyMeshStyle(dataId);
156
162
  } else if (viewerType === "model") {
157
- await modelStyleStore.applyModelStyle(id);
163
+ await modelStyleStore.applyModelStyle(dataId);
158
164
  }
159
165
  });
160
166
  await Promise.all(promises);
@@ -1,8 +1,14 @@
1
+ import type {
2
+ DataIdentified,
3
+ GeodeObjectType,
4
+ GeodeObjectTyped,
5
+ ViewerType,
6
+ ViewerTyped,
7
+ } from "@ogw_front/types/identifiers";
1
8
  import { type MenuItems, menusData } from "./menu_helpers/menus_data.js";
2
9
 
3
- interface MenuMetaData {
4
- viewer_type?: string;
5
- geode_object_type?: string;
10
+ interface MenuMetaData
11
+ extends Partial<DataIdentified>, Partial<GeodeObjectTyped>, Partial<ViewerTyped> {
6
12
  targetIds?: string[];
7
13
  [key: string]: unknown;
8
14
  }
@@ -38,19 +44,19 @@ export const useMenuStore = defineStore("menu", () => {
38
44
  );
39
45
 
40
46
  function getMenuItems(
41
- objectType: string | undefined,
42
- geodeObject: string | undefined,
47
+ viewerType: ViewerType | undefined,
48
+ geodeObjectType: GeodeObjectType | undefined,
43
49
  ): MenuItems {
44
50
  if (
45
- objectType === undefined ||
46
- objectType === "" ||
47
- geodeObject === undefined ||
48
- geodeObject === "" ||
49
- !menus.value[objectType]
51
+ viewerType === undefined ||
52
+ viewerType === "" ||
53
+ geodeObjectType === undefined ||
54
+ geodeObjectType === "" ||
55
+ !menus.value[viewerType]
50
56
  ) {
51
57
  return [];
52
58
  }
53
- return menus.value[objectType]?.[geodeObject] ?? [];
59
+ return menus.value[viewerType]?.[geodeObjectType] ?? [];
54
60
  }
55
61
 
56
62
  function closeMenu(): void {
@@ -4,34 +4,33 @@ import { consola } from "consola";
4
4
  // oxlint-disable eslint/sort-imports, eslint/max-lines
5
5
  import { defineStore } from "pinia";
6
6
 
7
+ import type {
8
+ DataId,
9
+ GeodeId,
10
+ GeodeIdentified,
11
+ GeodeObjectType,
12
+ GeodeObjectTyped,
13
+ ViewerType,
14
+ ViewerTyped,
15
+ } from "@ogw_front/types/identifiers";
7
16
  import type { Table } from "dexie";
17
+ import type { TreeGroup, TreeNode } from "@ogw_front/types/tree";
8
18
  import { ref, watch } from "vue";
9
19
  import { database } from "@ogw_internal/database/database";
10
20
 
11
21
  const PANEL_WIDTH = 300;
12
22
 
13
- interface OpenedView {
23
+ interface OpenedView extends Partial<GeodeObjectTyped> {
14
24
  type: "object" | "component";
15
25
  id: string;
16
26
  title: string;
17
27
  scrollTop: number;
18
28
  opened: string[];
19
- geode_object_type?: string;
20
29
  }
21
30
 
22
- interface TreeviewChild {
23
- title: string;
24
- id: string;
25
- geode_id: string;
26
- viewer_type: string;
27
- geode_object_type: string;
28
- }
31
+ interface TreeviewChild extends TreeNode, GeodeIdentified, GeodeObjectTyped, ViewerTyped {}
29
32
 
30
- interface TreeviewGroup {
31
- id: string;
32
- title: string;
33
- children: TreeviewChild[];
34
- }
33
+ type TreeviewGroup = TreeGroup<TreeviewChild>;
35
34
 
36
35
  interface TreeviewConfigRecord {
37
36
  id: string;
@@ -166,15 +165,15 @@ export const useTreeviewStore = defineStore("treeview", () => {
166
165
  }
167
166
 
168
167
  function addItem(
169
- geodeObjectType: string,
168
+ geodeObjectType: GeodeObjectType,
170
169
  name: string,
171
- id: string,
172
- geode_id: string,
173
- viewer_type: string,
170
+ dataId: DataId,
171
+ geode_id: GeodeId,
172
+ viewer_type: ViewerType,
174
173
  ): void {
175
174
  const child: TreeviewChild = {
176
175
  title: name,
177
- id,
176
+ id: dataId,
178
177
  geode_id,
179
178
  viewer_type,
180
179
  geode_object_type: geodeObjectType,
@@ -198,22 +197,22 @@ export const useTreeviewStore = defineStore("treeview", () => {
198
197
  groupA.title.localeCompare(groupB.title, undefined, sort_options),
199
198
  );
200
199
  }
201
- selection.value = [...selection.value, id];
200
+ selection.value = [...selection.value, dataId];
202
201
  }
203
202
 
204
- function removeItem(id: string): void {
203
+ function removeItem(dataId: DataId): void {
205
204
  for (let index = 0; index < items.value.length; index += 1) {
206
205
  const group = items.value[index];
207
206
  if (!group) {
208
207
  continue;
209
208
  }
210
- const childIndex = group.children.findIndex((child) => child.id === id);
209
+ const childIndex = group.children.findIndex((child) => child.id === dataId);
211
210
  if (childIndex !== -1) {
212
211
  group.children.splice(childIndex, 1);
213
212
  if (group.children.length === 0) {
214
213
  items.value.splice(index, 1);
215
214
  }
216
- selection.value = selection.value.filter((selection_id) => selection_id !== id);
215
+ selection.value = selection.value.filter((selection_id) => selection_id !== dataId);
217
216
  return;
218
217
  }
219
218
  }
@@ -222,7 +221,7 @@ export const useTreeviewStore = defineStore("treeview", () => {
222
221
  function displayAdditionalTree(
223
222
  id: string,
224
223
  title: string | undefined,
225
- geodeObjectType: string,
224
+ geodeObjectType: GeodeObjectType,
226
225
  ): void {
227
226
  const index = opened_views.value.findIndex((view: ReadonlyOpenedView) => view.id === id);
228
227
  if (index !== -1) {
@@ -330,9 +329,9 @@ export const useTreeviewStore = defineStore("treeview", () => {
330
329
  };
331
330
  }
332
331
 
333
- function renameItem(id: string, newName: string): void {
332
+ function renameItem(dataId: DataId, newName: string): void {
334
333
  for (const group of items.value) {
335
- const child = group.children.find((childItem) => childItem.id === id);
334
+ const child = group.children.find((childItem) => childItem.id === dataId);
336
335
  if (child) {
337
336
  child.title = newName;
338
337
  const options = { numeric: true, sensitivity: "base" as const };
@@ -342,7 +341,9 @@ export const useTreeviewStore = defineStore("treeview", () => {
342
341
  break;
343
342
  }
344
343
  }
345
- const view = opened_views.value.find((openedView: ReadonlyOpenedView) => openedView.id === id);
344
+ const view = opened_views.value.find(
345
+ (openedView: ReadonlyOpenedView) => openedView.id === dataId,
346
+ );
346
347
  if (view) {
347
348
  view.title = newName;
348
349
  }
@@ -0,0 +1,37 @@
1
+ // What an attribute of a data is called
2
+ type AttributeName = string;
3
+
4
+ // Which item of an attribute colors a data, an attribute having one or several items
5
+ type AttributeItem = number;
6
+
7
+ // The name of the color map that colors a data by an attribute
8
+ type AttributeColorMap = string;
9
+
10
+ // Which time step of its series an attribute is read at, an index into the time steps of the attribute
11
+ type AttributeTimeStep = number;
12
+
13
+ // The lower bound of the range an attribute coloring covers
14
+ type AttributeRangeMinimum = number;
15
+
16
+ // The upper bound of the range an attribute coloring covers
17
+ type AttributeRangeMaximum = number;
18
+
19
+ // The range an attribute coloring covers, a bound being undefined until one is stored for it
20
+ type AttributeRange = [
21
+ minimum: AttributeRangeMinimum | undefined,
22
+ maximum: AttributeRangeMaximum | undefined,
23
+ ];
24
+
25
+ // A range of an attribute with both of its bounds set
26
+ type ValidAttributeRange = [minimum: AttributeRangeMinimum, maximum: AttributeRangeMaximum];
27
+
28
+ export type {
29
+ AttributeColorMap,
30
+ AttributeItem,
31
+ AttributeName,
32
+ AttributeRange,
33
+ AttributeRangeMaximum,
34
+ AttributeRangeMinimum,
35
+ AttributeTimeStep,
36
+ ValidAttributeRange,
37
+ };
@@ -0,0 +1,72 @@
1
+ // Id given by OpenGeode to an object (a uuid): the same data loaded twice has the same geode_id
2
+ type GeodeId = string;
3
+
4
+ // Id of a data loaded in the app, unique even when the same data is loaded twice (see GeodeId)
5
+ type DataId = string;
6
+
7
+ // Id of a component of a model (a corner, a line, a surface or a block): its geode_id
8
+ type ModelComponentId = GeodeId;
9
+
10
+ // The data of a mesh, the data a mesh style applies to
11
+ type MeshId = DataId;
12
+
13
+ // The data of a model, the data a model style or a model component applies to
14
+ type ModelId = DataId;
15
+
16
+ // A corner of a model, by its id in the model
17
+ type CornerId = ModelComponentId;
18
+
19
+ // A line of a model, by its id in the model
20
+ type LineId = ModelComponentId;
21
+
22
+ // A surface of a model, by its id in the model
23
+ type SurfaceId = ModelComponentId;
24
+
25
+ // A block of a model, by its id in the model
26
+ type BlockId = ModelComponentId;
27
+
28
+ // Type of an OpenGeode object, as named by OpenGeode (BRep, TriangulatedSurface3D, ...)
29
+ type GeodeObjectType = string;
30
+
31
+ // What a data is displayed as in the viewer: mesh, model, or an entry of the menus (basemap, model_component, ...)
32
+ type ViewerType = string;
33
+
34
+ interface GeodeIdentified {
35
+ geode_id: GeodeId;
36
+ }
37
+
38
+ interface DataIdentified {
39
+ data_id: DataId;
40
+ }
41
+
42
+ interface GeodeObjectTyped {
43
+ geode_object_type: GeodeObjectType;
44
+ }
45
+
46
+ interface ViewerTyped {
47
+ viewer_type: ViewerType;
48
+ }
49
+
50
+ // The data a model style or a model component applies to
51
+ interface ModelIdentified {
52
+ modelId: ModelId;
53
+ }
54
+
55
+ export type {
56
+ BlockId,
57
+ CornerId,
58
+ DataId,
59
+ DataIdentified,
60
+ GeodeId,
61
+ GeodeIdentified,
62
+ GeodeObjectType,
63
+ GeodeObjectTyped,
64
+ LineId,
65
+ MeshId,
66
+ ModelComponentId,
67
+ ModelId,
68
+ ModelIdentified,
69
+ SurfaceId,
70
+ ViewerType,
71
+ ViewerTyped,
72
+ };
@@ -0,0 +1,13 @@
1
+ // Whether something is shown in the viewer
2
+ type Visibility = boolean;
3
+
4
+ // How wide the edges of a data are drawn in the viewer
5
+ type Width = number;
6
+
7
+ // How big the points of a data are drawn in the viewer
8
+ type Size = number;
9
+
10
+ // How opaque something is drawn in the viewer
11
+ type Opacity = number;
12
+
13
+ export type { Opacity, Size, Visibility, Width };
@@ -0,0 +1,6 @@
1
+ import type { MeshApplyTexturesParamsTexture } from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
2
+
3
+ // A texture of a mesh, as the viewer takes it: the data of the image and the name of the texture coordinates
4
+ type Texture = MeshApplyTexturesParamsTexture;
5
+
6
+ export type { Texture };
@@ -0,0 +1,17 @@
1
+ // A node of a tree: what identifies it and what is displayed for it
2
+ interface TreeNode {
3
+ id: string;
4
+ title: string;
5
+ }
6
+
7
+ // A node that groups other nodes
8
+ interface TreeGroup<Child> extends TreeNode {
9
+ children: Child[];
10
+ }
11
+
12
+ // A node that groups other nodes and whose list of children is not changed
13
+ interface ReadonlyTreeGroup<Child> extends TreeNode {
14
+ readonly children: readonly Child[];
15
+ }
16
+
17
+ export type { ReadonlyTreeGroup, TreeGroup, TreeNode };
@@ -1,3 +1,4 @@
1
+ import type { AttributeName } from "@ogw_front/types/attribute";
1
2
  import type { JsonRpcSchema } from "@ogw_shared/utils/types.js";
2
3
  import { useBackStore } from "@ogw_front/stores/back";
3
4
 
@@ -34,7 +35,7 @@ async function requestAttributeRange(
34
35
  async function fetchAttributeRange(
35
36
  rangeSchema: JsonRpcSchema,
36
37
  target: AttributeRangeTarget,
37
- attributeName: string,
38
+ attributeName: AttributeName,
38
39
  ): Promise<AttributeRangeInfo> {
39
40
  const params = { ...target, attribute_name: attributeName };
40
41
  const key = JSON.stringify([rangeSchema.$id, params]);
@@ -1,3 +1,4 @@
1
+ import type { AttributeName, AttributeTimeStep } from "@ogw_front/types/attribute";
1
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
2
3
 
3
4
  interface AttributeRangeSource {
@@ -7,7 +8,7 @@ interface AttributeRangeSource {
7
8
  max_value?: number;
8
9
  }
9
10
 
10
- interface AttributeRange {
11
+ interface AttributeMinMax {
11
12
  min: number;
12
13
  max: number;
13
14
  }
@@ -15,7 +16,7 @@ interface AttributeRange {
15
16
  function getAttributeRange(
16
17
  currentAttribute: AttributeRangeSource | undefined | null,
17
18
  compIndex = 0,
18
- ): AttributeRange {
19
+ ): AttributeMinMax {
19
20
  if (!currentAttribute) {
20
21
  return { min: 0, max: 1 };
21
22
  }
@@ -90,12 +91,19 @@ function intersectBy<TItem>(
90
91
  );
91
92
  }
92
93
 
94
+ // An attribute of a data: its name, its number of items and the time steps it is defined at
93
95
  interface NamedAttribute {
94
- attribute_name: string;
96
+ attribute_name: AttributeName;
95
97
  nb_items: number;
96
98
  time_steps?: readonly number[];
97
99
  }
98
100
 
101
+ // What the back-end answers for an attribute, which may carry more fields than these
102
+ interface AttributeInfo extends NamedAttribute {
103
+ time_steps?: number[];
104
+ [key: string]: unknown;
105
+ }
106
+
99
107
  function sameTimeSteps(left: NamedAttribute, right: NamedAttribute): boolean {
100
108
  const leftSteps = left.time_steps ?? [];
101
109
  const rightSteps = right.time_steps ?? [];
@@ -124,10 +132,11 @@ function intersectAttributes<TAttribute extends NamedAttribute>(
124
132
  }
125
133
 
126
134
  // OpenGeode-IO writes each step of a time series as the "<name>@<step>" VTK array
127
- function attributeArrayName(name: string, timeStep: number | undefined): string {
135
+ function attributeArrayName(name: string, timeStep: AttributeTimeStep | undefined): string {
128
136
  return timeStep === undefined ? name : `${name}@${timeStep}`;
129
137
  }
130
138
 
139
+ export type { AttributeInfo, NamedAttribute };
131
140
  export {
132
141
  MESH_ELEMENT_KINDS,
133
142
  MODEL_COMPONENT_ATTRIBUTE_SCHEMAS,
@@ -1,10 +1,8 @@
1
+ import type { TreeGroup, TreeNode } from "@ogw_front/types/tree";
2
+
1
3
  type MapStyle = "satellite" | "plan" | "routes";
2
4
 
3
- interface BasemapTreeGroup {
4
- id: string;
5
- title: string;
6
- children: { id: string; title: string }[];
7
- }
5
+ type BasemapTreeGroup = TreeGroup<TreeNode>;
8
6
 
9
7
  // Tree order and stacking order: from the bottom up, the routes stay readable on top
10
8
  const MAP_STYLES: readonly MapStyle[] = ["satellite", "plan", "routes"];
@@ -1,3 +1,5 @@
1
+ import type { Opacity } from "@ogw_front/types/style";
2
+
1
3
  const AXIS_SCALE = 0.45;
2
4
  const SIZE_RATIO = 0.1;
3
5
  const DEBOUNCE_DELAY = 200;
@@ -52,9 +54,9 @@ function hasPlaneChanged(
52
54
  }
53
55
 
54
56
  interface PlaneVisualState {
55
- readonly plane: { readonly opacity: number; readonly color: readonly number[] };
56
- readonly normal: { readonly opacity: number; readonly color: readonly number[] };
57
- readonly origin: { readonly opacity: number; readonly color: readonly number[] };
57
+ readonly plane: { readonly opacity: Opacity; readonly color: readonly number[] };
58
+ readonly normal: { readonly opacity: Opacity; readonly color: readonly number[] };
59
+ readonly origin: { readonly opacity: Opacity; readonly color: readonly number[] };
58
60
  }
59
61
 
60
62
  interface PlaneStyle {
@@ -64,7 +66,7 @@ interface PlaneStyle {
64
66
  readonly display2D: { readonly representation: number };
65
67
  readonly outline: {
66
68
  readonly color: readonly number[];
67
- readonly opacity: number;
69
+ readonly opacity: Opacity;
68
70
  readonly representation: number;
69
71
  readonly interpolation: number;
70
72
  };
@@ -1,4 +1,5 @@
1
1
  import type { Bounds } from "@kitware/vtk.js/types";
2
+ import type { DataIdentified } from "@ogw_front/types/identifiers";
2
3
  import type vtkActor from "@kitware/vtk.js/Rendering/Core/Actor";
3
4
  import type { vtkCamera } from "@kitware/vtk.js/Rendering/Core/Camera";
4
5
 
@@ -65,16 +66,16 @@ interface MainCameraOptions {
65
66
 
66
67
  function resolveActiveActors(
67
68
  targetAllVisible: boolean,
68
- allItems: readonly { readonly id: string }[],
69
+ allItems: readonly Readonly<DataIdentified>[],
69
70
  selectedDatasetIds: readonly string[],
70
71
  hybridDb: Record<string, ActorEntry | undefined>,
71
72
  ): vtkActor[] {
72
73
  let targetIds: readonly string[] = selectedDatasetIds;
73
74
  if (targetAllVisible) {
74
- targetIds = allItems.map((item: { id: string }) => item.id);
75
+ targetIds = allItems.map((item: Readonly<DataIdentified>) => item.data_id);
75
76
  }
76
77
  const targeted = targetIds
77
- .map((id) => hybridDb[id]?.actor)
78
+ .map((dataId) => hybridDb[dataId]?.actor)
78
79
  .filter((actor: vtkActor | undefined): actor is vtkActor => actor !== undefined);
79
80
  if (targeted.length > 0) {
80
81
  return targeted;
package/app/utils/crs.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { CrsItem, NewDataItem } from "@ogw_front/stores/data";
2
2
  import type { CRSList } from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
+ import type { LegacyDataId } from "@ogw_front/utils/legacy_data_id";
3
4
 
4
5
  function formatCrs(crs: CRSList | undefined): string {
5
6
  return crs ? `${crs.authority}:${crs.code} — ${crs.name}` : "None";
@@ -27,7 +28,9 @@ function sameCrsState(left: CRSList | undefined, right: CRSList | undefined): bo
27
28
 
28
29
  // The CRS of the oldest georeferenced data: the project CRS of a project saved before it was stored
29
30
  function oldestCrs(
30
- items: readonly Pick<CrsItem, "crs" | "created_at">[] | readonly NewDataItem[],
31
+ items:
32
+ | readonly Pick<CrsItem, "crs" | "created_at">[]
33
+ | readonly (LegacyDataId<NewDataItem> | NewDataItem)[],
31
34
  ): CRSList | undefined {
32
35
  return items
33
36
  .filter((item) => item.crs !== undefined)
@@ -10,6 +10,13 @@ interface AttributeConfig {
10
10
  storedConfigs: Record<string, unknown>;
11
11
  }
12
12
 
13
+ // How a component of a data is colored: by a constant color or by the attribute of its vertices
14
+ interface ComponentColoring {
15
+ active: string;
16
+ constant: RGBAColor;
17
+ vertex: AttributeConfig;
18
+ }
19
+
13
20
  // Mesh
14
21
  const MESH_DEFAULT_ACTIVE_COLORING = "constant";
15
22
  const POINTS_DEFAULT_VISIBILITY = true;
@@ -59,7 +66,7 @@ const SCENE_DEFAULT_TEXT_COLOR: RGBAColor = { red: 0, green: 0, blue: 0, alpha:
59
66
  const SCENE_DEFAULT_FONT_FAMILY = "arial";
60
67
  const SCENE_DEFAULT_ORIENTATION_WIDGET = "axes";
61
68
 
62
- export type { RGBAColor, AttributeConfig };
69
+ export type { RGBAColor, AttributeConfig, ComponentColoring };
63
70
  export {
64
71
  POINTS_DEFAULT_VISIBILITY,
65
72
  POINTS_DEFAULT_SIZE,