@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,5 +1,23 @@
1
1
  // oxlint-disable eslint/max-lines
2
+ import type {
3
+ AttributeColorMap,
4
+ AttributeItem,
5
+ AttributeName,
6
+ AttributeRange,
7
+ AttributeRangeMaximum,
8
+ AttributeRangeMinimum,
9
+ AttributeTimeStep,
10
+ } from "@ogw_front/types/attribute";
11
+ import type {
12
+ AttributeInput,
13
+ AttributeState,
14
+ AttributeStoredConfig,
15
+ ValidAttributeInput,
16
+ } from "@ogw_internal/stores/data_style/attribute_types";
17
+ import type { BlockId, ModelId } from "@ogw_front/types/identifiers";
2
18
  import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
19
+ import { defaultAttributeStoredConfig } from "@ogw_internal/stores/data_style/attribute_default";
20
+ import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
3
21
  // Third party imports
4
22
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
5
23
 
@@ -17,99 +35,62 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
17
35
  const modelBlockPolyhedronAttributeSchema =
18
36
  viewer_schemas.opengeodeweb_viewer.model.blocks.attribute.polyhedron.attribute;
19
37
 
20
- interface AttributeStoredConfig {
21
- minimum: number | undefined;
22
- maximum: number | undefined;
23
- colorMap: string | undefined;
24
- no_data_color: RGBAColor;
25
- }
26
-
27
- interface AttributeState {
28
- name?: string;
29
- item?: number;
30
- storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
31
- }
32
-
33
- interface AttributeInput {
34
- name: string | undefined;
35
- item: number | undefined;
36
- minimum: number | undefined;
37
- maximum: number | undefined;
38
- colorMap: string | undefined;
39
- no_data_color?: RGBAColor;
40
- }
41
-
42
- interface ValidAttributeInput {
43
- name: string;
44
- item: number;
45
- minimum: number;
46
- maximum: number;
47
- colorMap: string;
48
- no_data_color?: RGBAColor;
49
- }
50
-
51
- function isModelBlocksPolyhedronAttributeValid(
52
- input: AttributeInput,
53
- ): input is ValidAttributeInput {
54
- return (
55
- input.name !== undefined &&
56
- input.item !== undefined &&
57
- input.minimum !== undefined &&
58
- input.maximum !== undefined &&
59
- input.colorMap !== undefined
60
- );
61
- }
62
-
63
38
  interface UseModelBlocksPolyhedronAttributeReturn {
64
- modelBlocksPolyhedronAttributeName: (modelId: string, blockId?: string) => string | undefined;
65
- modelBlocksPolyhedronAttributeItem: (modelId: string, blockId?: string) => number;
66
- modelBlocksPolyhedronAttributeRange: (
67
- modelId: string,
68
- blockId?: string,
69
- ) => [number | undefined, number | undefined];
70
- modelBlocksPolyhedronAttributeTimeStep: (modelId: string, blockId?: string) => number | undefined;
39
+ modelBlocksPolyhedronAttributeName: (
40
+ modelId: ModelId,
41
+ blockId?: BlockId,
42
+ ) => AttributeName | undefined;
43
+ modelBlocksPolyhedronAttributeItem: (modelId: ModelId, blockId?: BlockId) => AttributeItem;
44
+ modelBlocksPolyhedronAttributeRange: (modelId: ModelId, blockId?: BlockId) => AttributeRange;
45
+ modelBlocksPolyhedronAttributeTimeStep: (
46
+ modelId: ModelId,
47
+ blockId?: BlockId,
48
+ ) => AttributeTimeStep | undefined;
71
49
  setModelBlocksPolyhedronAttributeTimeStep: (
72
- modelId: string,
73
- blockIds: string[],
74
- timeStep: number,
50
+ modelId: ModelId,
51
+ blockIds: BlockId[],
52
+ timeStep: AttributeTimeStep,
75
53
  ) => Promise<boolean>;
76
- modelBlocksPolyhedronAttributeColorMap: (modelId: string, blockId?: string) => string | undefined;
54
+ modelBlocksPolyhedronAttributeColorMap: (
55
+ modelId: ModelId,
56
+ blockId?: BlockId,
57
+ ) => AttributeColorMap | undefined;
77
58
  modelBlocksPolyhedronAttributeStoredConfig: (
78
- modelId: string,
79
- blockId: string | undefined,
80
- name: string | undefined,
81
- item: number | undefined,
59
+ modelId: ModelId,
60
+ blockId: BlockId | undefined,
61
+ name: AttributeName | undefined,
62
+ item: AttributeItem | undefined,
82
63
  ) => AttributeStoredConfig;
83
64
  setModelBlocksPolyhedronAttribute: (
84
- modelId: string,
85
- blockIds: string[],
65
+ modelId: ModelId,
66
+ blockIds: BlockId[],
86
67
  input: ValidAttributeInput,
87
68
  ) => Promise<unknown>;
88
69
  setModelBlocksPolyhedronAttributeName: (
89
- modelId: string,
90
- blockIds: string[],
91
- name: string,
70
+ modelId: ModelId,
71
+ blockIds: BlockId[],
72
+ name: AttributeName,
92
73
  ) => Promise<boolean>;
93
74
  setModelBlocksPolyhedronAttributeItem: (
94
- modelId: string,
95
- blockIds: string[],
96
- item: number,
75
+ modelId: ModelId,
76
+ blockIds: BlockId[],
77
+ item: AttributeItem,
97
78
  ) => Promise<boolean>;
98
79
  setModelBlocksPolyhedronAttributeRange: (
99
- modelId: string,
100
- blockIds: string[],
101
- minimum: number,
102
- maximum: number,
80
+ modelId: ModelId,
81
+ blockIds: BlockId[],
82
+ minimum: AttributeRangeMinimum,
83
+ maximum: AttributeRangeMaximum,
103
84
  ) => Promise<boolean>;
104
85
  setModelBlocksPolyhedronAttributeColorMap: (
105
- modelId: string,
106
- blockIds: string[],
107
- colorMap: string | undefined,
86
+ modelId: ModelId,
87
+ blockIds: BlockId[],
88
+ colorMap: AttributeColorMap | undefined,
108
89
  ) => Promise<boolean>;
109
- modelBlocksPolyhedronAttributeNoDataColor: (modelId: string, blockId?: string) => RGBAColor;
90
+ modelBlocksPolyhedronAttributeNoDataColor: (modelId: ModelId, blockId?: BlockId) => RGBAColor;
110
91
  setModelBlocksPolyhedronAttributeNoDataColor: (
111
- modelId: string,
112
- blockIds: string[],
92
+ modelId: ModelId,
93
+ blockIds: BlockId[],
113
94
  no_data_color: RGBAColor,
114
95
  ) => Promise<boolean>;
115
96
  }
@@ -125,9 +106,9 @@ type ModelBlocksPolyhedronAttributeGetters = Pick<
125
106
  | "modelBlocksPolyhedronAttributeTimeStep"
126
107
  > & {
127
108
  modelBlocksPolyhedronAttributeLastItem: (
128
- modelId: string,
109
+ modelId: ModelId,
129
110
  componentId: string | undefined,
130
- name: string | undefined,
111
+ name: AttributeName | undefined,
131
112
  ) => number;
132
113
  };
133
114
 
@@ -136,15 +117,15 @@ function useModelBlocksPolyhedronAttributeGetters(
136
117
  modelBlocksCommonStyle: ReturnType<typeof useModelBlocksCommonStyle>,
137
118
  ): ModelBlocksPolyhedronAttributeGetters {
138
119
  const { attributeTimeStep } = useAttributeTimeStepStyle();
139
- function modelBlocksPolyhedronAttribute(modelId: string, blockId?: string): AttributeState {
120
+ function modelBlocksPolyhedronAttribute(modelId: ModelId, blockId?: BlockId): AttributeState {
140
121
  // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.polyhedron shape is defined by the data style schema.
141
122
  return modelBlocksCommonStyle.modelBlockColoring(modelId, blockId).polyhedron as AttributeState;
142
123
  }
143
124
  function modelBlocksPolyhedronAttributeStoredConfig(
144
- modelId: string,
145
- blockId: string | undefined,
146
- name: string | undefined,
147
- item: number | undefined,
125
+ modelId: ModelId,
126
+ blockId: BlockId | undefined,
127
+ name: AttributeName | undefined,
128
+ item: AttributeItem | undefined,
148
129
  ): AttributeStoredConfig {
149
130
  const { storedConfigs } = modelBlocksPolyhedronAttribute(modelId, blockId);
150
131
  const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
@@ -152,23 +133,18 @@ function useModelBlocksPolyhedronAttributeGetters(
152
133
  if (itemConfig !== undefined) {
153
134
  return itemConfig;
154
135
  }
155
- return {
156
- minimum: undefined,
157
- maximum: undefined,
158
- colorMap: undefined,
159
- no_data_color: DEFAULT_NO_DATA_COLOR,
160
- };
136
+ return defaultAttributeStoredConfig();
161
137
  }
162
138
  function modelBlocksPolyhedronAttributeName(
163
- modelId: string,
164
- blockId?: string,
165
- ): string | undefined {
139
+ modelId: ModelId,
140
+ blockId?: BlockId,
141
+ ): AttributeName | undefined {
166
142
  return modelBlocksPolyhedronAttribute(modelId, blockId).name;
167
143
  }
168
144
  function modelBlocksPolyhedronAttributeLastItem(
169
- modelId: string,
170
- blockId: string | undefined,
171
- name: string | undefined,
145
+ modelId: ModelId,
146
+ blockId: BlockId | undefined,
147
+ name: AttributeName | undefined,
172
148
  ): number {
173
149
  const { storedConfigs } = modelBlocksPolyhedronAttribute(modelId, blockId);
174
150
  const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
@@ -177,7 +153,7 @@ function useModelBlocksPolyhedronAttributeGetters(
177
153
  }
178
154
  return 0;
179
155
  }
180
- function modelBlocksPolyhedronAttributeItem(modelId: string, blockId?: string): number {
156
+ function modelBlocksPolyhedronAttributeItem(modelId: ModelId, blockId?: BlockId): AttributeItem {
181
157
  const polyhedronAttribute = modelBlocksPolyhedronAttribute(modelId, blockId);
182
158
  return (
183
159
  polyhedronAttribute.item ??
@@ -185,9 +161,9 @@ function useModelBlocksPolyhedronAttributeGetters(
185
161
  );
186
162
  }
187
163
  function modelBlocksPolyhedronAttributeRange(
188
- modelId: string,
189
- blockId?: string,
190
- ): [number | undefined, number | undefined] {
164
+ modelId: ModelId,
165
+ blockId?: BlockId,
166
+ ): AttributeRange {
191
167
  const name = modelBlocksPolyhedronAttributeName(modelId, blockId);
192
168
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockId);
193
169
  const storedConfig = modelBlocksPolyhedronAttributeStoredConfig(modelId, blockId, name, item);
@@ -195,24 +171,27 @@ function useModelBlocksPolyhedronAttributeGetters(
195
171
  return [minimum, maximum];
196
172
  }
197
173
  function modelBlocksPolyhedronAttributeColorMap(
198
- modelId: string,
199
- blockId?: string,
200
- ): string | undefined {
174
+ modelId: ModelId,
175
+ blockId?: BlockId,
176
+ ): AttributeColorMap | undefined {
201
177
  const name = modelBlocksPolyhedronAttributeName(modelId, blockId);
202
178
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockId);
203
179
  const storedConfig = modelBlocksPolyhedronAttributeStoredConfig(modelId, blockId, name, item);
204
180
  return storedConfig.colorMap;
205
181
  }
206
- function modelBlocksPolyhedronAttributeNoDataColor(modelId: string, blockId?: string): RGBAColor {
182
+ function modelBlocksPolyhedronAttributeNoDataColor(
183
+ modelId: ModelId,
184
+ blockId?: BlockId,
185
+ ): RGBAColor {
207
186
  const name = modelBlocksPolyhedronAttributeName(modelId, blockId);
208
187
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockId);
209
188
  const storedConfig = modelBlocksPolyhedronAttributeStoredConfig(modelId, blockId, name, item);
210
189
  return storedConfig.no_data_color;
211
190
  }
212
191
  function modelBlocksPolyhedronAttributeTimeStep(
213
- modelId: string,
214
- blockId?: string,
215
- ): number | undefined {
192
+ modelId: ModelId,
193
+ blockId?: BlockId,
194
+ ): AttributeTimeStep | undefined {
216
195
  return attributeTimeStep(
217
196
  modelId,
218
197
  modelBlockPolyhedronAttributeSchema.$id,
@@ -248,8 +227,8 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
248
227
  } = useModelBlocksPolyhedronAttributeGetters(modelBlocksCommonStyle);
249
228
  const viewerStore = useViewerStore();
250
229
  async function mutateModelBlocksPolyhedronStyle(
251
- modelId: string,
252
- blockIds: string[],
230
+ modelId: ModelId,
231
+ blockIds: BlockId[],
253
232
  values: Record<string, unknown>,
254
233
  ): Promise<void> {
255
234
  const tasks: Promise<void>[] = [
@@ -268,10 +247,10 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
268
247
  await Promise.all(tasks);
269
248
  }
270
249
  async function setModelBlocksPolyhedronAttributeStoredConfig(
271
- modelId: string,
272
- blockIds: string[],
273
- name: string | undefined,
274
- item: number | undefined,
250
+ modelId: ModelId,
251
+ blockIds: BlockId[],
252
+ name: AttributeName | undefined,
253
+ item: AttributeItem | undefined,
275
254
  config: Partial<AttributeStoredConfig>,
276
255
  ): Promise<void> {
277
256
  if (name === undefined || item === undefined) {
@@ -287,8 +266,8 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
287
266
  });
288
267
  }
289
268
  async function setModelBlocksPolyhedronAttribute(
290
- modelId: string,
291
- blockIds: string[],
269
+ modelId: ModelId,
270
+ blockIds: BlockId[],
292
271
  {
293
272
  name,
294
273
  item,
@@ -326,7 +305,7 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
326
305
  });
327
306
  }
328
307
  // True when the attribute was sent to the viewer, so the caller knows a render is needed
329
- async function applyPolyhedronAttribute(modelId: string, blockIds: string[]): Promise<boolean> {
308
+ async function applyPolyhedronAttribute(modelId: ModelId, blockIds: BlockId[]): Promise<boolean> {
330
309
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
331
310
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockIds[0]);
332
311
  const storedConfig = modelBlocksPolyhedronAttributeStoredConfig(
@@ -343,16 +322,16 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
343
322
  colorMap: storedConfig.colorMap,
344
323
  no_data_color: storedConfig.no_data_color,
345
324
  };
346
- if (!isModelBlocksPolyhedronAttributeValid(attribute)) {
325
+ if (!isAttributeValid(attribute)) {
347
326
  return false;
348
327
  }
349
328
  await setModelBlocksPolyhedronAttribute(modelId, blockIds, attribute);
350
329
  return true;
351
330
  }
352
331
  async function setModelBlocksPolyhedronAttributeName(
353
- modelId: string,
354
- blockIds: string[],
355
- name: string,
332
+ modelId: ModelId,
333
+ blockIds: BlockId[],
334
+ name: AttributeName,
356
335
  ): Promise<boolean> {
357
336
  const item = modelBlocksPolyhedronAttributeLastItem(modelId, blockIds[0], name);
358
337
  await mutateModelBlocksPolyhedronStyle(modelId, blockIds, {
@@ -362,9 +341,9 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
362
341
  return applyPolyhedronAttribute(modelId, blockIds);
363
342
  }
364
343
  async function setModelBlocksPolyhedronAttributeItem(
365
- modelId: string,
366
- blockIds: string[],
367
- item: number,
344
+ modelId: ModelId,
345
+ blockIds: BlockId[],
346
+ item: AttributeItem,
368
347
  ): Promise<boolean> {
369
348
  await mutateModelBlocksPolyhedronStyle(modelId, blockIds, {
370
349
  item,
@@ -372,9 +351,9 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
372
351
  return applyPolyhedronAttribute(modelId, blockIds);
373
352
  }
374
353
  async function setModelBlocksPolyhedronAttributeTimeStep(
375
- modelId: string,
376
- blockIds: string[],
377
- timeStep: number,
354
+ modelId: ModelId,
355
+ blockIds: BlockId[],
356
+ timeStep: AttributeTimeStep,
378
357
  ): Promise<boolean> {
379
358
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
380
359
  if (name === undefined) {
@@ -409,10 +388,10 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
409
388
  return applied || reapplied;
410
389
  }
411
390
  async function setModelBlocksPolyhedronAttributeRange(
412
- modelId: string,
413
- blockIds: string[],
414
- minimum: number,
415
- maximum: number,
391
+ modelId: ModelId,
392
+ blockIds: BlockId[],
393
+ minimum: AttributeRangeMinimum,
394
+ maximum: AttributeRangeMaximum,
416
395
  ): Promise<boolean> {
417
396
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
418
397
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockIds[0]);
@@ -423,9 +402,9 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
423
402
  return applyPolyhedronAttribute(modelId, blockIds);
424
403
  }
425
404
  async function setModelBlocksPolyhedronAttributeColorMap(
426
- modelId: string,
427
- blockIds: string[],
428
- colorMap: string | undefined,
405
+ modelId: ModelId,
406
+ blockIds: BlockId[],
407
+ colorMap: AttributeColorMap | undefined,
429
408
  ): Promise<boolean> {
430
409
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
431
410
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockIds[0]);
@@ -435,8 +414,8 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
435
414
  return applyPolyhedronAttribute(modelId, blockIds);
436
415
  }
437
416
  async function setModelBlocksPolyhedronAttributeNoDataColor(
438
- modelId: string,
439
- blockIds: string[],
417
+ modelId: ModelId,
418
+ blockIds: BlockId[],
440
419
  no_data_color: RGBAColor,
441
420
  ): Promise<boolean> {
442
421
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
@@ -470,4 +449,4 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
470
449
  setModelBlocksPolyhedronAttributeNoDataColor,
471
450
  };
472
451
  }
473
- export { isModelBlocksPolyhedronAttributeValid, useModelBlocksPolyhedronAttribute };
452
+ export { useModelBlocksPolyhedronAttribute };