@geode/opengeodeweb-front 10.44.0-rc.6 → 10.44.0-rc.8

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 (59) hide show
  1. package/.build/server/utils/scripts.js +34 -23
  2. package/app/components/BasemapAttribution.vue +28 -0
  3. package/app/components/MissingFilesSelector.vue +30 -17
  4. package/app/components/ObjectSelector.vue +34 -23
  5. package/app/components/Viewer/Basemap/CropOptions.vue +50 -0
  6. package/app/components/Viewer/Basemap/OpacityOptions.vue +52 -0
  7. package/app/components/Viewer/ContextMenu/ContextMenu.vue +5 -1
  8. package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +6 -2
  9. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +49 -10
  10. package/app/components/Viewer/Ui.vue +6 -0
  11. package/app/composables/overlapping_picker_menu.ts +43 -0
  12. package/app/composables/project_manager_helpers/reset.ts +3 -0
  13. package/app/composables/project_manager_helpers/restore.ts +22 -10
  14. package/app/composables/project_manager_helpers/types.ts +2 -0
  15. package/app/composables/use_overlapping_picker.ts +23 -37
  16. package/app/composables/viewer_context_menu.ts +10 -0
  17. package/app/composables/virtual_tree_flatten.ts +66 -43
  18. package/app/stores/app_helpers/extension.ts +90 -51
  19. package/app/stores/basemap.ts +52 -0
  20. package/app/stores/basemap_detail.ts +51 -0
  21. package/app/stores/basemap_helpers/builds.ts +158 -0
  22. package/app/stores/basemap_helpers/detail_layers.ts +72 -0
  23. package/app/stores/basemap_helpers/detail_map.ts +62 -0
  24. package/app/stores/basemap_helpers/detail_refresh.ts +134 -0
  25. package/app/stores/basemap_helpers/detail_view.ts +94 -0
  26. package/app/stores/basemap_helpers/extent.ts +40 -0
  27. package/app/stores/basemap_helpers/georeferenced.ts +50 -0
  28. package/app/stores/basemap_helpers/layers.ts +66 -0
  29. package/app/stores/basemap_helpers/settings.ts +87 -0
  30. package/app/stores/basemap_helpers/viewer.ts +114 -0
  31. package/app/stores/infra.ts +26 -21
  32. package/app/stores/menu_helpers/basemap.ts +10 -0
  33. package/app/stores/menu_helpers/menus_data.ts +2 -0
  34. package/app/utils/basemap_tree.ts +76 -0
  35. package/app/utils/color_picker.ts +18 -15
  36. package/app/utils/treeview.ts +12 -1
  37. package/app/utils/visible_map_area.ts +129 -0
  38. package/internal/database/database.ts +47 -32
  39. package/internal/stores/data_style/mesh/base_style.ts +74 -0
  40. package/internal/stores/data_style/mesh/index.ts +2 -57
  41. package/internal/stores/data_style/model/blocks/color.ts +58 -57
  42. package/internal/stores/data_style/model/blocks/polyhedron.ts +88 -44
  43. package/internal/stores/data_style/model/blocks/vertex.ts +88 -44
  44. package/internal/stores/data_style/model/color.ts +25 -26
  45. package/internal/stores/data_style/model/corners/index.ts +85 -78
  46. package/internal/stores/data_style/model/corners/vertex.ts +83 -39
  47. package/internal/stores/data_style/model/lines/color.ts +53 -40
  48. package/internal/stores/data_style/model/lines/edge.ts +88 -44
  49. package/internal/stores/data_style/model/lines/vertex.ts +88 -44
  50. package/internal/stores/data_style/model/surfaces/color.ts +68 -56
  51. package/internal/stores/data_style/model/surfaces/polygon.ts +80 -36
  52. package/internal/stores/data_style/model/surfaces/vertex.ts +80 -36
  53. package/internal/stores/data_style/model/visibility_dispatch.ts +49 -99
  54. package/internal/stores/hybrid_viewer/highlight.ts +70 -54
  55. package/internal/stores/hybrid_viewer/scene.ts +31 -25
  56. package/internal/stores/hybrid_viewer/vtk_types.ts +2 -1
  57. package/package.json +1 -1
  58. package/server/api/local/extensions/upload.put.ts +47 -20
  59. package/server/utils/scripts.ts +35 -30
@@ -111,12 +111,28 @@ interface UseModelLinesVertexAttributeReturn {
111
111
  ) => Promise<unknown>;
112
112
  }
113
113
 
114
+ type ModelLinesVertexAttributeGetters = Pick<
115
+ UseModelLinesVertexAttributeReturn,
116
+ | "modelLinesVertexAttributeStoredConfig"
117
+ | "modelLinesVertexAttributeName"
118
+ | "modelLinesVertexAttributeItem"
119
+ | "modelLinesVertexAttributeRange"
120
+ | "modelLinesVertexAttributeColorMap"
121
+ | "modelLinesVertexAttributeNoDataColor"
122
+ | "modelLinesVertexAttributeTimeStep"
123
+ > & {
124
+ modelLinesVertexAttributeLastItem: (
125
+ modelId: string,
126
+ componentId: string | undefined,
127
+ name: string | undefined,
128
+ ) => number;
129
+ };
130
+
114
131
  // oxlint-disable-next-line max-lines-per-function
115
- function useModelLinesVertexAttribute(): UseModelLinesVertexAttributeReturn {
116
- const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
117
- const dataStore = useDataStore();
118
- const modelLinesCommonStyle = useModelLinesCommonStyle();
119
- const viewerStore = useViewerStore();
132
+ function useModelLinesVertexAttributeGetters(
133
+ modelLinesCommonStyle: ReturnType<typeof useModelLinesCommonStyle>,
134
+ ): ModelLinesVertexAttributeGetters {
135
+ const { attributeTimeStep } = useAttributeTimeStepStyle();
120
136
  function modelLinesVertexAttribute(modelId: string, lineId?: string): AttributeState {
121
137
  // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
122
138
  return modelLinesCommonStyle.modelLineColoring(modelId, lineId).vertex as AttributeState;
@@ -140,45 +156,6 @@ function useModelLinesVertexAttribute(): UseModelLinesVertexAttributeReturn {
140
156
  no_data_color: DEFAULT_NO_DATA_COLOR,
141
157
  };
142
158
  }
143
- async function mutateModelLinesVertexStyle(
144
- modelId: string,
145
- lineIds: string[],
146
- values: Record<string, unknown>,
147
- ): Promise<void> {
148
- const tasks: Promise<void>[] = [
149
- modelLinesCommonStyle.mutateModelLinesColoring(modelId, lineIds, {
150
- vertex: values,
151
- }),
152
- ];
153
- const totalLineIds = await dataStore.getLinesGeodeIds(modelId);
154
- if (lineIds.length === totalLineIds.length) {
155
- tasks.push(
156
- modelLinesCommonStyle.mutateModelLinesTypeColoring(modelId, {
157
- vertex: values,
158
- }),
159
- );
160
- }
161
- await Promise.all(tasks);
162
- }
163
- async function setModelLinesVertexAttributeStoredConfig(
164
- modelId: string,
165
- lineIds: string[],
166
- name: string | undefined,
167
- item: number | undefined,
168
- config: Partial<AttributeStoredConfig>,
169
- ): Promise<void> {
170
- if (name === undefined || item === undefined) {
171
- return;
172
- }
173
- await mutateModelLinesVertexStyle(modelId, lineIds, {
174
- storedConfigs: {
175
- [name]: {
176
- lastItem: item,
177
- [item]: config,
178
- },
179
- },
180
- });
181
- }
182
159
  function modelLinesVertexAttributeName(modelId: string, lineId?: string): string | undefined {
183
160
  return modelLinesVertexAttribute(modelId, lineId).name;
184
161
  }
@@ -230,6 +207,73 @@ function useModelLinesVertexAttribute(): UseModelLinesVertexAttributeReturn {
230
207
  modelLinesVertexAttribute(modelId, lineId).name,
231
208
  );
232
209
  }
210
+ return {
211
+ modelLinesVertexAttributeStoredConfig,
212
+ modelLinesVertexAttributeName,
213
+ modelLinesVertexAttributeLastItem,
214
+ modelLinesVertexAttributeItem,
215
+ modelLinesVertexAttributeRange,
216
+ modelLinesVertexAttributeColorMap,
217
+ modelLinesVertexAttributeNoDataColor,
218
+ modelLinesVertexAttributeTimeStep,
219
+ };
220
+ }
221
+
222
+ // oxlint-disable-next-line max-lines-per-function
223
+ function useModelLinesVertexAttribute(): UseModelLinesVertexAttributeReturn {
224
+ const { setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
225
+ const dataStore = useDataStore();
226
+ const modelLinesCommonStyle = useModelLinesCommonStyle();
227
+ const {
228
+ modelLinesVertexAttributeStoredConfig,
229
+ modelLinesVertexAttributeName,
230
+ modelLinesVertexAttributeLastItem,
231
+ modelLinesVertexAttributeItem,
232
+ modelLinesVertexAttributeRange,
233
+ modelLinesVertexAttributeColorMap,
234
+ modelLinesVertexAttributeNoDataColor,
235
+ modelLinesVertexAttributeTimeStep,
236
+ } = useModelLinesVertexAttributeGetters(modelLinesCommonStyle);
237
+ const viewerStore = useViewerStore();
238
+ async function mutateModelLinesVertexStyle(
239
+ modelId: string,
240
+ lineIds: string[],
241
+ values: Record<string, unknown>,
242
+ ): Promise<void> {
243
+ const tasks: Promise<void>[] = [
244
+ modelLinesCommonStyle.mutateModelLinesColoring(modelId, lineIds, {
245
+ vertex: values,
246
+ }),
247
+ ];
248
+ const totalLineIds = await dataStore.getLinesGeodeIds(modelId);
249
+ if (lineIds.length === totalLineIds.length) {
250
+ tasks.push(
251
+ modelLinesCommonStyle.mutateModelLinesTypeColoring(modelId, {
252
+ vertex: values,
253
+ }),
254
+ );
255
+ }
256
+ await Promise.all(tasks);
257
+ }
258
+ async function setModelLinesVertexAttributeStoredConfig(
259
+ modelId: string,
260
+ lineIds: string[],
261
+ name: string | undefined,
262
+ item: number | undefined,
263
+ config: Partial<AttributeStoredConfig>,
264
+ ): Promise<void> {
265
+ if (name === undefined || item === undefined) {
266
+ return;
267
+ }
268
+ await mutateModelLinesVertexStyle(modelId, lineIds, {
269
+ storedConfigs: {
270
+ [name]: {
271
+ lastItem: item,
272
+ [item]: config,
273
+ },
274
+ },
275
+ });
276
+ }
233
277
  async function setModelLinesVertexAttribute(
234
278
  modelId: string,
235
279
  lineIds: string[],
@@ -65,6 +65,72 @@ export function useModelSurfacesColor(): {
65
65
  return modelSurfaceColoring(id, surface_id).active;
66
66
  }
67
67
 
68
+ async function applyVertexColoring(modelId: string, surfaces_ids: string[]): Promise<unknown> {
69
+ const name = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeName(
70
+ modelId,
71
+ surfaces_ids[0],
72
+ );
73
+ const item = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeItem(
74
+ modelId,
75
+ surfaces_ids[0],
76
+ );
77
+ const [minimum, maximum] = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeRange(
78
+ modelId,
79
+ surfaces_ids[0],
80
+ );
81
+ const colorMap = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeColorMap(
82
+ modelId,
83
+ surfaces_ids[0],
84
+ );
85
+ const no_data_color = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeNoDataColor(
86
+ modelId,
87
+ surfaces_ids[0],
88
+ );
89
+ const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
90
+ if (isModelSurfacesVertexAttributeValid(attribute)) {
91
+ const result = await modelSurfacesVertexAttribute.setModelSurfacesVertexAttribute(
92
+ modelId,
93
+ surfaces_ids,
94
+ attribute,
95
+ );
96
+ return result;
97
+ }
98
+ return undefined;
99
+ }
100
+
101
+ async function applyPolygonColoring(modelId: string, surfaces_ids: string[]): Promise<unknown> {
102
+ const name = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeName(
103
+ modelId,
104
+ surfaces_ids[0],
105
+ );
106
+ const item = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeItem(
107
+ modelId,
108
+ surfaces_ids[0],
109
+ );
110
+ const [minimum, maximum] = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeRange(
111
+ modelId,
112
+ surfaces_ids[0],
113
+ );
114
+ const colorMap = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeColorMap(
115
+ modelId,
116
+ surfaces_ids[0],
117
+ );
118
+ const no_data_color = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeNoDataColor(
119
+ modelId,
120
+ surfaces_ids[0],
121
+ );
122
+ const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
123
+ if (isModelSurfacesPolygonAttributeValid(attribute)) {
124
+ const result = await modelSurfacesPolygonAttribute.setModelSurfacesPolygonAttribute(
125
+ modelId,
126
+ surfaces_ids,
127
+ attribute,
128
+ );
129
+ return result;
130
+ }
131
+ return undefined;
132
+ }
133
+
68
134
  async function setModelSurfacesActiveColoring(
69
135
  modelId: string,
70
136
  surfaces_ids: string[],
@@ -86,63 +152,9 @@ export function useModelSurfacesColor(): {
86
152
  }
87
153
 
88
154
  if (activeColoring === "vertex") {
89
- const name = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeName(
90
- modelId,
91
- surfaces_ids[0],
92
- );
93
- const item = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeItem(
94
- modelId,
95
- surfaces_ids[0],
96
- );
97
- const [minimum, maximum] = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeRange(
98
- modelId,
99
- surfaces_ids[0],
100
- );
101
- const colorMap = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeColorMap(
102
- modelId,
103
- surfaces_ids[0],
104
- );
105
- const no_data_color = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeNoDataColor(
106
- modelId,
107
- surfaces_ids[0],
108
- );
109
- const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
110
- if (isModelSurfacesVertexAttributeValid(attribute)) {
111
- return modelSurfacesVertexAttribute.setModelSurfacesVertexAttribute(
112
- modelId,
113
- surfaces_ids,
114
- attribute,
115
- );
116
- }
155
+ return applyVertexColoring(modelId, surfaces_ids);
117
156
  } else if (activeColoring === "polygon") {
118
- const name = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeName(
119
- modelId,
120
- surfaces_ids[0],
121
- );
122
- const item = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeItem(
123
- modelId,
124
- surfaces_ids[0],
125
- );
126
- const [minimum, maximum] = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeRange(
127
- modelId,
128
- surfaces_ids[0],
129
- );
130
- const colorMap = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeColorMap(
131
- modelId,
132
- surfaces_ids[0],
133
- );
134
- const no_data_color = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeNoDataColor(
135
- modelId,
136
- surfaces_ids[0],
137
- );
138
- const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
139
- if (isModelSurfacesPolygonAttributeValid(attribute)) {
140
- return modelSurfacesPolygonAttribute.setModelSurfacesPolygonAttribute(
141
- modelId,
142
- surfaces_ids,
143
- attribute,
144
- );
145
- }
157
+ return applyPolygonColoring(modelId, surfaces_ids);
146
158
  }
147
159
  return undefined;
148
160
  }
@@ -118,12 +118,28 @@ interface UseModelSurfacesPolygonAttributeReturn {
118
118
  ) => Promise<void>;
119
119
  }
120
120
 
121
+ type ModelSurfacesPolygonAttributeGetters = Pick<
122
+ UseModelSurfacesPolygonAttributeReturn,
123
+ | "modelSurfacesPolygonAttributeStoredConfig"
124
+ | "modelSurfacesPolygonAttributeName"
125
+ | "modelSurfacesPolygonAttributeItem"
126
+ | "modelSurfacesPolygonAttributeRange"
127
+ | "modelSurfacesPolygonAttributeColorMap"
128
+ | "modelSurfacesPolygonAttributeNoDataColor"
129
+ | "modelSurfacesPolygonAttributeTimeStep"
130
+ > & {
131
+ modelSurfacesPolygonAttributeLastItem: (
132
+ modelId: string,
133
+ componentId: string | undefined,
134
+ name: string | undefined,
135
+ ) => number;
136
+ };
137
+
121
138
  // oxlint-disable-next-line max-lines-per-function
122
- function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeReturn {
123
- const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
124
- const dataStore = useDataStore();
125
- const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
126
- const viewerStore = useViewerStore();
139
+ function useModelSurfacesPolygonAttributeGetters(
140
+ modelSurfacesCommonStyle: ReturnType<typeof useModelSurfacesCommonStyle>,
141
+ ): ModelSurfacesPolygonAttributeGetters {
142
+ const { attributeTimeStep } = useAttributeTimeStepStyle();
127
143
  function modelSurfacesPolygonAttribute(modelId: string, surfaceId?: string): AttributeState {
128
144
  return (
129
145
  // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.polygon shape is defined by the data style schema.
@@ -149,37 +165,6 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
149
165
  no_data_color: DEFAULT_NO_DATA_COLOR,
150
166
  };
151
167
  }
152
- async function mutateModelSurfacesPolygonStyle(
153
- modelId: string,
154
- surfaceIds: string[],
155
- values: Record<string, unknown>,
156
- ): Promise<void> {
157
- const tasks: Promise<void>[] = [
158
- modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
159
- polygon: values,
160
- }),
161
- ];
162
- const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
163
- if (surfaceIds.length === totalSurfaceIds.length) {
164
- tasks.push(
165
- modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, {
166
- polygon: values,
167
- }),
168
- );
169
- }
170
- await Promise.all(tasks);
171
- }
172
- async function setModelSurfacesPolygonAttributeStoredConfig(
173
- modelId: string,
174
- surfaceIds: string[],
175
- name: string | undefined,
176
- item: number | undefined,
177
- config: Partial<AttributeStoredConfig>,
178
- ): Promise<void> {
179
- await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, {
180
- storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
181
- });
182
- }
183
168
  function modelSurfacesPolygonAttributeName(
184
169
  modelId: string,
185
170
  surfaceId?: string,
@@ -243,6 +228,65 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
243
228
  modelSurfacesPolygonAttribute(modelId, surfaceId).name,
244
229
  );
245
230
  }
231
+ return {
232
+ modelSurfacesPolygonAttributeStoredConfig,
233
+ modelSurfacesPolygonAttributeName,
234
+ modelSurfacesPolygonAttributeLastItem,
235
+ modelSurfacesPolygonAttributeItem,
236
+ modelSurfacesPolygonAttributeRange,
237
+ modelSurfacesPolygonAttributeColorMap,
238
+ modelSurfacesPolygonAttributeNoDataColor,
239
+ modelSurfacesPolygonAttributeTimeStep,
240
+ };
241
+ }
242
+
243
+ // oxlint-disable-next-line max-lines-per-function
244
+ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeReturn {
245
+ const { setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
246
+ const dataStore = useDataStore();
247
+ const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
248
+ const {
249
+ modelSurfacesPolygonAttributeStoredConfig,
250
+ modelSurfacesPolygonAttributeName,
251
+ modelSurfacesPolygonAttributeLastItem,
252
+ modelSurfacesPolygonAttributeItem,
253
+ modelSurfacesPolygonAttributeRange,
254
+ modelSurfacesPolygonAttributeColorMap,
255
+ modelSurfacesPolygonAttributeNoDataColor,
256
+ modelSurfacesPolygonAttributeTimeStep,
257
+ } = useModelSurfacesPolygonAttributeGetters(modelSurfacesCommonStyle);
258
+ const viewerStore = useViewerStore();
259
+ async function mutateModelSurfacesPolygonStyle(
260
+ modelId: string,
261
+ surfaceIds: string[],
262
+ values: Record<string, unknown>,
263
+ ): Promise<void> {
264
+ const tasks: Promise<void>[] = [
265
+ modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
266
+ polygon: values,
267
+ }),
268
+ ];
269
+ const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
270
+ if (surfaceIds.length === totalSurfaceIds.length) {
271
+ tasks.push(
272
+ modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, {
273
+ polygon: values,
274
+ }),
275
+ );
276
+ }
277
+ await Promise.all(tasks);
278
+ }
279
+ async function setModelSurfacesPolygonAttributeStoredConfig(
280
+ modelId: string,
281
+ surfaceIds: string[],
282
+ name: string | undefined,
283
+ item: number | undefined,
284
+ config: Partial<AttributeStoredConfig>,
285
+ ): Promise<void> {
286
+ await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, {
287
+ storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
288
+ });
289
+ }
246
290
  async function setModelSurfacesPolygonAttribute(
247
291
  modelId: string,
248
292
  surfaceIds: string[],
@@ -112,12 +112,28 @@ interface UseModelSurfacesVertexAttributeReturn {
112
112
  ) => Promise<unknown>;
113
113
  }
114
114
 
115
+ type ModelSurfacesVertexAttributeGetters = Pick<
116
+ UseModelSurfacesVertexAttributeReturn,
117
+ | "modelSurfacesVertexAttributeStoredConfig"
118
+ | "modelSurfacesVertexAttributeName"
119
+ | "modelSurfacesVertexAttributeItem"
120
+ | "modelSurfacesVertexAttributeRange"
121
+ | "modelSurfacesVertexAttributeColorMap"
122
+ | "modelSurfacesVertexAttributeNoDataColor"
123
+ | "modelSurfacesVertexAttributeTimeStep"
124
+ > & {
125
+ modelSurfacesVertexAttributeLastItem: (
126
+ modelId: string,
127
+ componentId: string | undefined,
128
+ name: string | undefined,
129
+ ) => number;
130
+ };
131
+
115
132
  // oxlint-disable-next-line max-lines-per-function
116
- function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeReturn {
117
- const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
118
- const dataStore = useDataStore();
119
- const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
120
- const viewerStore = useViewerStore();
133
+ function useModelSurfacesVertexAttributeGetters(
134
+ modelSurfacesCommonStyle: ReturnType<typeof useModelSurfacesCommonStyle>,
135
+ ): ModelSurfacesVertexAttributeGetters {
136
+ const { attributeTimeStep } = useAttributeTimeStepStyle();
121
137
  function modelSurfacesVertexAttribute(modelId: string, surfaceId?: string): AttributeState {
122
138
  return (
123
139
  // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
@@ -143,37 +159,6 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
143
159
  no_data_color: DEFAULT_NO_DATA_COLOR,
144
160
  };
145
161
  }
146
- async function mutateModelSurfacesVertexStyle(
147
- modelId: string,
148
- surfaceIds: string[],
149
- values: Record<string, unknown>,
150
- ): Promise<void> {
151
- const tasks: Promise<void>[] = [
152
- modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
153
- vertex: values,
154
- }),
155
- ];
156
- const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
157
- if (surfaceIds.length === totalSurfaceIds.length) {
158
- tasks.push(
159
- modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, {
160
- vertex: values,
161
- }),
162
- );
163
- }
164
- await Promise.all(tasks);
165
- }
166
- async function setModelSurfacesVertexAttributeStoredConfig(
167
- modelId: string,
168
- surfaceIds: string[],
169
- name: string | undefined,
170
- item: number | undefined,
171
- config: Partial<AttributeStoredConfig>,
172
- ): Promise<void> {
173
- await mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
174
- storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
175
- });
176
- }
177
162
  function modelSurfacesVertexAttributeName(
178
163
  modelId: string,
179
164
  surfaceId?: string,
@@ -234,6 +219,65 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
234
219
  modelSurfacesVertexAttribute(modelId, surfaceId).name,
235
220
  );
236
221
  }
222
+ return {
223
+ modelSurfacesVertexAttributeStoredConfig,
224
+ modelSurfacesVertexAttributeName,
225
+ modelSurfacesVertexAttributeLastItem,
226
+ modelSurfacesVertexAttributeItem,
227
+ modelSurfacesVertexAttributeRange,
228
+ modelSurfacesVertexAttributeColorMap,
229
+ modelSurfacesVertexAttributeNoDataColor,
230
+ modelSurfacesVertexAttributeTimeStep,
231
+ };
232
+ }
233
+
234
+ // oxlint-disable-next-line max-lines-per-function
235
+ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeReturn {
236
+ const { setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
237
+ const dataStore = useDataStore();
238
+ const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
239
+ const {
240
+ modelSurfacesVertexAttributeStoredConfig,
241
+ modelSurfacesVertexAttributeName,
242
+ modelSurfacesVertexAttributeLastItem,
243
+ modelSurfacesVertexAttributeItem,
244
+ modelSurfacesVertexAttributeRange,
245
+ modelSurfacesVertexAttributeColorMap,
246
+ modelSurfacesVertexAttributeNoDataColor,
247
+ modelSurfacesVertexAttributeTimeStep,
248
+ } = useModelSurfacesVertexAttributeGetters(modelSurfacesCommonStyle);
249
+ const viewerStore = useViewerStore();
250
+ async function mutateModelSurfacesVertexStyle(
251
+ modelId: string,
252
+ surfaceIds: string[],
253
+ values: Record<string, unknown>,
254
+ ): Promise<void> {
255
+ const tasks: Promise<void>[] = [
256
+ modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
257
+ vertex: values,
258
+ }),
259
+ ];
260
+ const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
261
+ if (surfaceIds.length === totalSurfaceIds.length) {
262
+ tasks.push(
263
+ modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, {
264
+ vertex: values,
265
+ }),
266
+ );
267
+ }
268
+ await Promise.all(tasks);
269
+ }
270
+ async function setModelSurfacesVertexAttributeStoredConfig(
271
+ modelId: string,
272
+ surfaceIds: string[],
273
+ name: string | undefined,
274
+ item: number | undefined,
275
+ config: Partial<AttributeStoredConfig>,
276
+ ): Promise<void> {
277
+ await mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
278
+ storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
279
+ });
280
+ }
237
281
  async function setModelSurfacesVertexAttribute(
238
282
  modelId: string,
239
283
  surfaceIds: string[],