@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
@@ -0,0 +1,14 @@
1
+ import type { AttributeStoredConfig } from "@ogw_internal/stores/data_style/attribute_types";
2
+ import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
3
+
4
+ // What an attribute coloring starts with, before a range or a color map is stored for it
5
+ function defaultAttributeStoredConfig(): AttributeStoredConfig {
6
+ return {
7
+ minimum: undefined,
8
+ maximum: undefined,
9
+ colorMap: undefined,
10
+ no_data_color: DEFAULT_NO_DATA_COLOR,
11
+ };
12
+ }
13
+
14
+ export { defaultAttributeStoredConfig };
@@ -0,0 +1,59 @@
1
+ import type {
2
+ AttributeColorMap,
3
+ AttributeItem,
4
+ AttributeName,
5
+ AttributeRangeMaximum,
6
+ AttributeRangeMinimum,
7
+ } from "@ogw_front/types/attribute";
8
+ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
9
+
10
+ // The same fields while the user has not chosen them yet
11
+ type Undefinable<Fields> = { [Field in keyof Fields]: Fields[Field] | undefined };
12
+
13
+ // The attribute of a data, and the item of it, that colors the data
14
+ interface AttributeSelection {
15
+ name: AttributeName;
16
+ item: AttributeItem;
17
+ }
18
+
19
+ interface AttributeBounds {
20
+ minimum: AttributeRangeMinimum;
21
+ maximum: AttributeRangeMaximum;
22
+ }
23
+
24
+ interface AttributeColorMapped {
25
+ colorMap: AttributeColorMap;
26
+ }
27
+
28
+ // What is kept of an attribute coloring when another attribute is picked
29
+ interface AttributeStoredConfig
30
+ extends Undefinable<AttributeBounds>, Undefinable<AttributeColorMapped> {
31
+ no_data_color: RGBAColor;
32
+ }
33
+
34
+ // The input of an attribute coloring while the user has not chosen all of it yet
35
+ interface AttributeInput
36
+ extends
37
+ Undefinable<AttributeSelection>,
38
+ Undefinable<AttributeBounds>,
39
+ Undefinable<AttributeColorMapped> {
40
+ no_data_color?: RGBAColor;
41
+ }
42
+
43
+ interface ValidAttributeInput extends AttributeSelection, AttributeBounds, AttributeColorMapped {
44
+ no_data_color?: RGBAColor;
45
+ }
46
+
47
+ interface AttributeState extends Partial<AttributeSelection> {
48
+ storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
49
+ }
50
+
51
+ export type {
52
+ AttributeBounds,
53
+ AttributeColorMapped,
54
+ AttributeInput,
55
+ AttributeSelection,
56
+ AttributeState,
57
+ AttributeStoredConfig,
58
+ ValidAttributeInput,
59
+ };
@@ -0,0 +1,16 @@
1
+ import type {
2
+ AttributeInput,
3
+ ValidAttributeInput,
4
+ } from "@ogw_internal/stores/data_style/attribute_types";
5
+
6
+ function isAttributeValid(input: AttributeInput): input is ValidAttributeInput {
7
+ return (
8
+ input.name !== undefined &&
9
+ input.item !== undefined &&
10
+ input.minimum !== undefined &&
11
+ input.maximum !== undefined &&
12
+ input.colorMap !== undefined
13
+ );
14
+ }
15
+
16
+ export { isAttributeValid };
@@ -1,4 +1,6 @@
1
+ import type { MeshId } from "@ogw_front/types/identifiers";
1
2
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
3
+ import type { Visibility } from "@ogw_front/types/style";
2
4
  // Third party imports
3
5
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
4
6
 
@@ -12,10 +14,10 @@ import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
12
14
  const meshSchemas = viewer_schemas.opengeodeweb_viewer.mesh;
13
15
 
14
16
  interface MeshBaseStyle {
15
- meshVisibility: (id: string) => boolean | undefined;
16
- setMeshVisibility: (id: string, visibility: boolean) => Promise<unknown>;
17
- meshColor: (id: string) => RGBAColor | undefined;
18
- setMeshColor: (id: string, color: RGBAColor) => Promise<unknown>;
17
+ meshVisibility: (meshId: MeshId) => Visibility | undefined;
18
+ setMeshVisibility: (meshId: MeshId, visibility: Visibility) => Promise<unknown>;
19
+ meshColor: (meshId: MeshId) => RGBAColor | undefined;
20
+ setMeshColor: (meshId: MeshId, color: RGBAColor) => Promise<unknown>;
19
21
  }
20
22
 
21
23
  export function useMeshBaseStyle(): MeshBaseStyle {
@@ -23,12 +25,12 @@ export function useMeshBaseStyle(): MeshBaseStyle {
23
25
  const viewerStore = useViewerStore();
24
26
  const dataStyleState = useDataStyleState();
25
27
 
26
- function meshVisibility(id: string): boolean | undefined {
27
- return dataStyleState.getStyle(id).visibility;
28
+ function meshVisibility(meshId: MeshId): Visibility | undefined {
29
+ return dataStyleState.getStyle(meshId).visibility;
28
30
  }
29
- async function setMeshVisibility(id: string, visibility: boolean): Promise<unknown> {
31
+ async function setMeshVisibility(meshId: MeshId, visibility: Visibility): Promise<unknown> {
30
32
  const schema = meshSchemas.visibility;
31
- const params = { id, visibility };
33
+ const params = { id: meshId, visibility };
32
34
  const result = await viewerStore.request(
33
35
  {
34
36
  schema,
@@ -37,9 +39,9 @@ export function useMeshBaseStyle(): MeshBaseStyle {
37
39
  {
38
40
  response_function: async () => {
39
41
  if (visibility !== undefined) {
40
- hybridViewerStore.setVisibility(id, visibility);
42
+ hybridViewerStore.setVisibility(meshId, visibility);
41
43
  }
42
- const mutatedId = await dataStyleState.mutateStyle(id, { visibility });
44
+ const mutatedId = await dataStyleState.mutateStyle(meshId, { visibility });
43
45
  return mutatedId;
44
46
  },
45
47
  },
@@ -47,14 +49,14 @@ export function useMeshBaseStyle(): MeshBaseStyle {
47
49
  return result;
48
50
  }
49
51
 
50
- function meshColor(id: string): RGBAColor | undefined {
52
+ function meshColor(meshId: MeshId): RGBAColor | undefined {
51
53
  // oxlint-disable-next-line no-unsafe-type-assertion -- color shape is defined by the data style schema.
52
- return dataStyleState.getStyle(id).color as RGBAColor | undefined;
54
+ return dataStyleState.getStyle(meshId).color as RGBAColor | undefined;
53
55
  }
54
56
 
55
- async function setMeshColor(id: string, color: RGBAColor): Promise<unknown> {
57
+ async function setMeshColor(meshId: MeshId, color: RGBAColor): Promise<unknown> {
56
58
  const schema = meshSchemas.color;
57
- const params = { id, color };
59
+ const params = { id: meshId, color };
58
60
  const result = await viewerStore.request(
59
61
  {
60
62
  schema,
@@ -62,7 +64,7 @@ export function useMeshBaseStyle(): MeshBaseStyle {
62
64
  },
63
65
  {
64
66
  response_function: async () => {
65
- const mutatedId = await dataStyleState.mutateStyle(id, { color });
67
+ const mutatedId = await dataStyleState.mutateStyle(meshId, { color });
66
68
  return mutatedId;
67
69
  },
68
70
  },
@@ -1,19 +1,26 @@
1
+ import type {
2
+ AttributeColorMap,
3
+ AttributeItem,
4
+ AttributeName,
5
+ AttributeRangeMaximum,
6
+ AttributeRangeMinimum,
7
+ AttributeTimeStep,
8
+ } from "@ogw_front/types/attribute";
1
9
  import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
10
+ import type { MeshId } from "@ogw_front/types/identifiers";
11
+ import type { ValidAttributeInput } from "@ogw_internal/stores/data_style/attribute_types";
12
+ import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
2
13
  // Third party imports
3
14
  import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
4
15
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
5
16
 
6
17
  // Local imports
7
- import {
8
- type UseMeshCellsCellAttributeStyleReturn,
9
- type ValidAttributeInput,
10
- isMeshCellsCellAttributeValid,
11
- } from "./cell_attribute";
12
18
  import {
13
19
  useMeshCellsCellAttributeConfig,
14
20
  useMeshCellsCellAttributeConfigValues,
15
21
  useMeshCellsCellAttributeConfigWriter,
16
22
  } from "./cell_config";
23
+ import type { UseMeshCellsCellAttributeStyleReturn } from "./cell_attribute";
17
24
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
18
25
  import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
19
26
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -40,11 +47,11 @@ function useMeshCellsCellAttributeStyle(): UseMeshCellsCellAttributeStyleReturn
40
47
  } = useMeshCellsCellAttributeConfigValues();
41
48
  const { mutateMeshCellsCellStyle, setMeshCellsCellAttributeStoredConfig } =
42
49
  useMeshCellsCellAttributeConfigWriter();
43
- function meshCellsCellAttributeTimeStep(id: string): number | undefined {
44
- return attributeTimeStep(id, attributeNamesSchema.$id, meshCellsCellAttribute(id).name);
50
+ function meshCellsCellAttributeTimeStep(meshId: MeshId): AttributeTimeStep | undefined {
51
+ return attributeTimeStep(meshId, attributeNamesSchema.$id, meshCellsCellAttribute(meshId).name);
45
52
  }
46
53
  async function setMeshCellsCellAttribute(
47
- id: string,
54
+ meshId: MeshId,
48
55
  {
49
56
  name,
50
57
  item,
@@ -54,11 +61,11 @@ function useMeshCellsCellAttributeStyle(): UseMeshCellsCellAttributeStyleReturn
54
61
  no_data_color = DEFAULT_NO_DATA_COLOR,
55
62
  }: ValidAttributeInput,
56
63
  ): Promise<unknown> {
57
- await mutateMeshCellsCellStyle(id, {
64
+ await mutateMeshCellsCellStyle(meshId, {
58
65
  name,
59
66
  item,
60
67
  });
61
- await setMeshCellsCellAttributeStoredConfig(id, name, item, {
68
+ await setMeshCellsCellAttributeStoredConfig(meshId, name, item, {
62
69
  minimum,
63
70
  maximum,
64
71
  colorMap,
@@ -67,8 +74,8 @@ function useMeshCellsCellAttributeStyle(): UseMeshCellsCellAttributeStyleReturn
67
74
  const points = [...getRGBPointsFromPreset(colorMap)];
68
75
  const schema = meshCellsCellAttributeSchemas.attribute;
69
76
  const params = {
70
- id,
71
- name: seriesArrayName(id, attributeNamesSchema.$id, name),
77
+ id: meshId,
78
+ name: seriesArrayName(meshId, attributeNamesSchema.$id, name),
72
79
  item,
73
80
  points,
74
81
  minimum,
@@ -80,10 +87,10 @@ function useMeshCellsCellAttributeStyle(): UseMeshCellsCellAttributeStyleReturn
80
87
  params,
81
88
  });
82
89
  }
83
- async function applyCellAttribute(id: string): Promise<unknown> {
84
- const name = meshCellsCellAttributeName(id);
85
- const item = meshCellsCellAttributeItem(id);
86
- const storedConfig = meshCellsCellAttributeStoredConfig(id, name, item);
90
+ async function applyCellAttribute(meshId: MeshId): Promise<unknown> {
91
+ const name = meshCellsCellAttributeName(meshId);
92
+ const item = meshCellsCellAttributeItem(meshId);
93
+ const storedConfig = meshCellsCellAttributeStoredConfig(meshId, name, item);
87
94
  const attribute = {
88
95
  name,
89
96
  item,
@@ -92,70 +99,79 @@ function useMeshCellsCellAttributeStyle(): UseMeshCellsCellAttributeStyleReturn
92
99
  colorMap: storedConfig.colorMap,
93
100
  no_data_color: storedConfig.no_data_color,
94
101
  };
95
- if (isMeshCellsCellAttributeValid(attribute)) {
96
- const result = await setMeshCellsCellAttribute(id, attribute);
102
+ if (isAttributeValid(attribute)) {
103
+ const result = await setMeshCellsCellAttribute(meshId, attribute);
97
104
  return result;
98
105
  }
99
106
  return undefined;
100
107
  }
101
- async function setMeshCellsCellAttributeName(id: string, name: string): Promise<unknown> {
102
- const item = meshCellsCellAttributeLastItem(id, name);
103
- await mutateMeshCellsCellStyle(id, {
108
+ async function setMeshCellsCellAttributeName(
109
+ meshId: MeshId,
110
+ name: AttributeName,
111
+ ): Promise<unknown> {
112
+ const item = meshCellsCellAttributeLastItem(meshId, name);
113
+ await mutateMeshCellsCellStyle(meshId, {
104
114
  name,
105
115
  item,
106
116
  });
107
- return applyCellAttribute(id);
117
+ return applyCellAttribute(meshId);
108
118
  }
109
- async function setMeshCellsCellAttributeItem(id: string, item: number): Promise<unknown> {
110
- await mutateMeshCellsCellStyle(id, {
119
+ async function setMeshCellsCellAttributeItem(
120
+ meshId: MeshId,
121
+ item: AttributeItem,
122
+ ): Promise<unknown> {
123
+ await mutateMeshCellsCellStyle(meshId, {
111
124
  item,
112
125
  });
113
- return applyCellAttribute(id);
126
+ return applyCellAttribute(meshId);
114
127
  }
115
- async function setMeshCellsCellAttributeTimeStep(id: string, timeStep: number): Promise<unknown> {
116
- const name = meshCellsCellAttributeName(id);
128
+ async function setMeshCellsCellAttributeTimeStep(
129
+ meshId: MeshId,
130
+ timeStep: AttributeTimeStep,
131
+ ): Promise<unknown> {
132
+ const name = meshCellsCellAttributeName(meshId);
117
133
  if (name === undefined) {
118
134
  return undefined;
119
135
  }
120
- await setAttributeTimeStep(id, attributeNamesSchema.$id, name, timeStep);
121
- return applyCellAttribute(id);
136
+ await setAttributeTimeStep(meshId, attributeNamesSchema.$id, name, timeStep);
137
+ return applyCellAttribute(meshId);
122
138
  }
123
139
  async function setMeshCellsCellAttributeRange(
124
- id: string,
125
- minimum: number,
126
- maximum: number,
140
+ meshId: MeshId,
141
+ minimum: AttributeRangeMinimum,
142
+ maximum: AttributeRangeMaximum,
127
143
  ): Promise<unknown> {
128
- const name = meshCellsCellAttributeName(id);
129
- const item = meshCellsCellAttributeItem(id);
130
- await setMeshCellsCellAttributeStoredConfig(id, name, item, {
144
+ const name = meshCellsCellAttributeName(meshId);
145
+ const item = meshCellsCellAttributeItem(meshId);
146
+ await setMeshCellsCellAttributeStoredConfig(meshId, name, item, {
131
147
  minimum,
132
148
  maximum,
133
149
  });
134
- return applyCellAttribute(id);
150
+ return applyCellAttribute(meshId);
135
151
  }
136
152
  async function setMeshCellsCellAttributeColorMap(
137
- id: string,
138
- colorMap: string | undefined,
153
+ meshId: MeshId,
154
+ colorMap: AttributeColorMap | undefined,
139
155
  ): Promise<unknown> {
140
- const name = meshCellsCellAttributeName(id);
141
- const item = meshCellsCellAttributeItem(id);
142
- await setMeshCellsCellAttributeStoredConfig(id, name, item, {
156
+ const name = meshCellsCellAttributeName(meshId);
157
+ const item = meshCellsCellAttributeItem(meshId);
158
+ await setMeshCellsCellAttributeStoredConfig(meshId, name, item, {
143
159
  colorMap,
144
160
  });
145
- return applyCellAttribute(id);
161
+ return applyCellAttribute(meshId);
146
162
  }
147
163
  async function setMeshCellsCellAttributeNoDataColor(
148
- id: string,
164
+ meshId: MeshId,
149
165
  no_data_color: RGBAColor,
150
166
  ): Promise<unknown> {
151
- const name = meshCellsCellAttributeName(id);
152
- const item = meshCellsCellAttributeItem(id);
153
- const storedConfig = meshCellsCellAttributeStoredConfig(id, name, item);
154
- await setMeshCellsCellAttributeStoredConfig(id, name, item, {
167
+ const name = meshCellsCellAttributeName(meshId);
168
+ const item = meshCellsCellAttributeItem(meshId);
169
+ const storedConfig = meshCellsCellAttributeStoredConfig(meshId, name, item);
170
+ await setMeshCellsCellAttributeStoredConfig(meshId, name, item, {
155
171
  ...storedConfig,
156
172
  no_data_color,
157
173
  });
158
- return applyCellAttribute(id);
174
+ return applyCellAttribute(meshId);
159
175
  }
160
176
  return {
161
177
  meshCellsCellAttributeName,
@@ -175,4 +191,3 @@ function useMeshCellsCellAttributeStyle(): UseMeshCellsCellAttributeStyleReturn
175
191
  };
176
192
  }
177
193
  export { useMeshCellsCellAttributeStyle };
178
- export { isMeshCellsCellAttributeValid } from "./cell_attribute";
@@ -1,74 +1,50 @@
1
+ import type {
2
+ AttributeColorMap,
3
+ AttributeItem,
4
+ AttributeName,
5
+ AttributeRange,
6
+ AttributeRangeMaximum,
7
+ AttributeRangeMinimum,
8
+ AttributeTimeStep,
9
+ } from "@ogw_front/types/attribute";
10
+ import type {
11
+ AttributeStoredConfig,
12
+ ValidAttributeInput,
13
+ } from "@ogw_internal/stores/data_style/attribute_types";
14
+ import type { MeshId } from "@ogw_front/types/identifiers";
1
15
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
2
16
 
3
- interface AttributeStoredConfig {
4
- minimum: number | undefined;
5
- maximum: number | undefined;
6
- colorMap: string | undefined;
7
- no_data_color: RGBAColor;
8
- }
9
-
10
- interface AttributeState {
11
- name?: string;
12
- item?: number;
13
- storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
14
- }
15
-
16
- interface AttributeInput {
17
- name: string | undefined;
18
- item: number | undefined;
19
- minimum: number | undefined;
20
- maximum: number | undefined;
21
- colorMap: string | undefined;
22
- no_data_color?: RGBAColor;
23
- }
24
-
25
- interface ValidAttributeInput {
26
- name: string;
27
- item: number;
28
- minimum: number;
29
- maximum: number;
30
- colorMap: string;
31
- no_data_color?: RGBAColor;
32
- }
33
-
34
- function isMeshCellsCellAttributeValid(input: AttributeInput): input is ValidAttributeInput {
35
- return (
36
- input.name !== undefined &&
37
- input.item !== undefined &&
38
- input.minimum !== undefined &&
39
- input.maximum !== undefined &&
40
- input.colorMap !== undefined
41
- );
42
- }
43
-
44
17
  interface UseMeshCellsCellAttributeStyleReturn {
45
- meshCellsCellAttributeName: (id: string) => string | undefined;
46
- meshCellsCellAttributeItem: (id: string) => number;
47
- meshCellsCellAttributeRange: (id: string) => [number | undefined, number | undefined];
48
- meshCellsCellAttributeTimeStep: (id: string) => number | undefined;
49
- setMeshCellsCellAttributeTimeStep: (id: string, timeStep: number) => Promise<unknown>;
50
- meshCellsCellAttributeColorMap: (id: string) => string | undefined;
18
+ meshCellsCellAttributeName: (meshId: MeshId) => AttributeName | undefined;
19
+ meshCellsCellAttributeItem: (meshId: MeshId) => AttributeItem;
20
+ meshCellsCellAttributeRange: (meshId: MeshId) => AttributeRange;
21
+ meshCellsCellAttributeTimeStep: (meshId: MeshId) => AttributeTimeStep | undefined;
22
+ setMeshCellsCellAttributeTimeStep: (
23
+ meshId: MeshId,
24
+ timeStep: AttributeTimeStep,
25
+ ) => Promise<unknown>;
26
+ meshCellsCellAttributeColorMap: (meshId: MeshId) => AttributeColorMap | undefined;
51
27
  meshCellsCellAttributeStoredConfig: (
52
- id: string,
53
- name: string | undefined,
54
- item: number | undefined,
28
+ meshId: MeshId,
29
+ name: AttributeName | undefined,
30
+ item: AttributeItem | undefined,
55
31
  ) => AttributeStoredConfig;
56
- setMeshCellsCellAttribute: (id: string, input: ValidAttributeInput) => Promise<unknown>;
57
- setMeshCellsCellAttributeName: (id: string, name: string) => Promise<unknown>;
58
- setMeshCellsCellAttributeItem: (id: string, item: number) => Promise<unknown>;
32
+ setMeshCellsCellAttribute: (meshId: MeshId, input: ValidAttributeInput) => Promise<unknown>;
33
+ setMeshCellsCellAttributeName: (meshId: MeshId, name: AttributeName) => Promise<unknown>;
34
+ setMeshCellsCellAttributeItem: (meshId: MeshId, item: AttributeItem) => Promise<unknown>;
59
35
  setMeshCellsCellAttributeRange: (
60
- id: string,
61
- minimum: number,
62
- maximum: number,
36
+ meshId: MeshId,
37
+ minimum: AttributeRangeMinimum,
38
+ maximum: AttributeRangeMaximum,
39
+ ) => Promise<unknown>;
40
+ setMeshCellsCellAttributeColorMap: (
41
+ meshId: MeshId,
42
+ colorMap: AttributeColorMap | undefined,
43
+ ) => Promise<unknown>;
44
+ meshCellsCellAttributeNoDataColor: (meshId: MeshId) => RGBAColor;
45
+ setMeshCellsCellAttributeNoDataColor: (
46
+ meshId: MeshId,
47
+ no_data_color: RGBAColor,
63
48
  ) => Promise<unknown>;
64
- setMeshCellsCellAttributeColorMap: (id: string, colorMap: string | undefined) => Promise<unknown>;
65
- meshCellsCellAttributeNoDataColor: (id: string) => RGBAColor;
66
- setMeshCellsCellAttributeNoDataColor: (id: string, no_data_color: RGBAColor) => Promise<unknown>;
67
49
  }
68
- export { isMeshCellsCellAttributeValid };
69
- export type {
70
- AttributeStoredConfig,
71
- AttributeState,
72
- ValidAttributeInput,
73
- UseMeshCellsCellAttributeStyleReturn,
74
- };
50
+ export type { UseMeshCellsCellAttributeStyleReturn };