@geode/opengeodeweb-front 10.44.0-rc.7 → 10.44.0-rc.9

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 (32) hide show
  1. package/.build/server/utils/scripts.js +34 -23
  2. package/app/components/MissingFilesSelector.vue +30 -17
  3. package/app/components/ObjectSelector.vue +34 -23
  4. package/app/composables/hover_highlight.ts +13 -13
  5. package/app/composables/overlapping_picker_menu.ts +43 -0
  6. package/app/composables/project_manager_helpers/restore.ts +20 -11
  7. package/app/composables/use_overlapping_picker.ts +23 -37
  8. package/app/composables/virtual_tree_flatten.ts +66 -43
  9. package/app/stores/app_helpers/extension.ts +90 -51
  10. package/app/stores/infra.ts +26 -21
  11. package/app/utils/color_picker.ts +18 -15
  12. package/internal/database/database.ts +47 -32
  13. package/internal/stores/data_style/mesh/base_style.ts +74 -0
  14. package/internal/stores/data_style/mesh/index.ts +2 -57
  15. package/internal/stores/data_style/model/blocks/color.ts +58 -57
  16. package/internal/stores/data_style/model/blocks/polyhedron.ts +88 -44
  17. package/internal/stores/data_style/model/blocks/vertex.ts +88 -44
  18. package/internal/stores/data_style/model/color.ts +25 -26
  19. package/internal/stores/data_style/model/corners/index.ts +85 -78
  20. package/internal/stores/data_style/model/corners/vertex.ts +83 -39
  21. package/internal/stores/data_style/model/lines/color.ts +53 -40
  22. package/internal/stores/data_style/model/lines/edge.ts +88 -44
  23. package/internal/stores/data_style/model/lines/vertex.ts +88 -44
  24. package/internal/stores/data_style/model/surfaces/color.ts +68 -56
  25. package/internal/stores/data_style/model/surfaces/polygon.ts +80 -36
  26. package/internal/stores/data_style/model/surfaces/vertex.ts +80 -36
  27. package/internal/stores/data_style/model/visibility_dispatch.ts +49 -99
  28. package/internal/stores/hybrid_viewer/highlight.ts +70 -54
  29. package/internal/stores/hybrid_viewer/scene.ts +31 -25
  30. package/package.json +1 -1
  31. package/server/api/local/extensions/upload.put.ts +47 -20
  32. package/server/utils/scripts.ts +35 -30
@@ -97,12 +97,28 @@ function isModelCornersVertexAttributeValid(input: AttributeInput): input is Val
97
97
  );
98
98
  }
99
99
 
100
+ type ModelCornersVertexAttributeGetters = Pick<
101
+ ModelCornersVertexAttributeApi,
102
+ | "modelCornersVertexAttributeStoredConfig"
103
+ | "modelCornersVertexAttributeName"
104
+ | "modelCornersVertexAttributeItem"
105
+ | "modelCornersVertexAttributeRange"
106
+ | "modelCornersVertexAttributeColorMap"
107
+ | "modelCornersVertexAttributeNoDataColor"
108
+ | "modelCornersVertexAttributeTimeStep"
109
+ > & {
110
+ modelCornersVertexAttributeLastItem: (
111
+ modelId: string,
112
+ componentId: string | undefined,
113
+ name: string | undefined,
114
+ ) => number;
115
+ };
116
+
100
117
  // oxlint-disable-next-line max-lines-per-function
101
- function useModelCornersVertexAttribute(): ModelCornersVertexAttributeApi {
102
- const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
103
- const dataStore = useDataStore();
104
- const modelCornersCommonStyle = useModelCornersCommonStyle();
105
- const viewerStore = useViewerStore();
118
+ function useModelCornersVertexAttributeGetters(
119
+ modelCornersCommonStyle: ReturnType<typeof useModelCornersCommonStyle>,
120
+ ): ModelCornersVertexAttributeGetters {
121
+ const { attributeTimeStep } = useAttributeTimeStepStyle();
106
122
  function modelCornersVertexAttribute(modelId: string, cornerId?: string): AttributeState {
107
123
  // oxlint-disable-next-line no-unsafe-type-assertion -- vertex is a StyleValues sub-object stored under a StyleValues index signature.
108
124
  return modelCornersCommonStyle.modelCornerColoring(modelId, cornerId).vertex as AttributeState;
@@ -127,40 +143,6 @@ function useModelCornersVertexAttribute(): ModelCornersVertexAttributeApi {
127
143
  no_data_color: DEFAULT_NO_DATA_COLOR,
128
144
  };
129
145
  }
130
- async function mutateModelCornersVertexStyle(
131
- modelId: string,
132
- cornerIds: string[],
133
- values: Record<string, unknown>,
134
- ): Promise<void> {
135
- const tasks: Promise<void>[] = [
136
- modelCornersCommonStyle.mutateModelCornersColoring(modelId, cornerIds, {
137
- vertex: values,
138
- }),
139
- ];
140
- const totalCornerIds = await dataStore.getCornersGeodeIds(modelId);
141
- if (cornerIds.length === totalCornerIds.length) {
142
- tasks.push(
143
- modelCornersCommonStyle.mutateModelCornersTypeColoring(modelId, {
144
- vertex: values,
145
- }),
146
- );
147
- }
148
- await Promise.all(tasks);
149
- }
150
- async function setModelCornersVertexAttributeStoredConfig(
151
- modelId: string,
152
- cornerIds: string[],
153
- name: string | undefined,
154
- item: number | undefined,
155
- config: Partial<AttributeStoredConfig>,
156
- ): Promise<void> {
157
- if (name === undefined || item === undefined) {
158
- return;
159
- }
160
- await mutateModelCornersVertexStyle(modelId, cornerIds, {
161
- storedConfigs: { [name]: { lastItem: item, [item]: config } },
162
- });
163
- }
164
146
  function modelCornersVertexAttributeName(modelId: string, cornerId?: string): string | undefined {
165
147
  return modelCornersVertexAttribute(modelId, cornerId).name;
166
148
  }
@@ -219,6 +201,68 @@ function useModelCornersVertexAttribute(): ModelCornersVertexAttributeApi {
219
201
  modelCornersVertexAttribute(modelId, cornerId).name,
220
202
  );
221
203
  }
204
+ return {
205
+ modelCornersVertexAttributeStoredConfig,
206
+ modelCornersVertexAttributeName,
207
+ modelCornersVertexAttributeLastItem,
208
+ modelCornersVertexAttributeItem,
209
+ modelCornersVertexAttributeRange,
210
+ modelCornersVertexAttributeColorMap,
211
+ modelCornersVertexAttributeNoDataColor,
212
+ modelCornersVertexAttributeTimeStep,
213
+ };
214
+ }
215
+
216
+ // oxlint-disable-next-line max-lines-per-function
217
+ function useModelCornersVertexAttribute(): ModelCornersVertexAttributeApi {
218
+ const { setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
219
+ const dataStore = useDataStore();
220
+ const modelCornersCommonStyle = useModelCornersCommonStyle();
221
+ const {
222
+ modelCornersVertexAttributeStoredConfig,
223
+ modelCornersVertexAttributeName,
224
+ modelCornersVertexAttributeLastItem,
225
+ modelCornersVertexAttributeItem,
226
+ modelCornersVertexAttributeRange,
227
+ modelCornersVertexAttributeColorMap,
228
+ modelCornersVertexAttributeNoDataColor,
229
+ modelCornersVertexAttributeTimeStep,
230
+ } = useModelCornersVertexAttributeGetters(modelCornersCommonStyle);
231
+ const viewerStore = useViewerStore();
232
+ async function mutateModelCornersVertexStyle(
233
+ modelId: string,
234
+ cornerIds: string[],
235
+ values: Record<string, unknown>,
236
+ ): Promise<void> {
237
+ const tasks: Promise<void>[] = [
238
+ modelCornersCommonStyle.mutateModelCornersColoring(modelId, cornerIds, {
239
+ vertex: values,
240
+ }),
241
+ ];
242
+ const totalCornerIds = await dataStore.getCornersGeodeIds(modelId);
243
+ if (cornerIds.length === totalCornerIds.length) {
244
+ tasks.push(
245
+ modelCornersCommonStyle.mutateModelCornersTypeColoring(modelId, {
246
+ vertex: values,
247
+ }),
248
+ );
249
+ }
250
+ await Promise.all(tasks);
251
+ }
252
+ async function setModelCornersVertexAttributeStoredConfig(
253
+ modelId: string,
254
+ cornerIds: string[],
255
+ name: string | undefined,
256
+ item: number | undefined,
257
+ config: Partial<AttributeStoredConfig>,
258
+ ): Promise<void> {
259
+ if (name === undefined || item === undefined) {
260
+ return;
261
+ }
262
+ await mutateModelCornersVertexStyle(modelId, cornerIds, {
263
+ storedConfigs: { [name]: { lastItem: item, [item]: config } },
264
+ });
265
+ }
222
266
  async function setModelCornersVertexAttribute(
223
267
  modelId: string,
224
268
  cornerIds: string[],
@@ -65,6 +65,57 @@ export function useModelLinesColor(): {
65
65
  return modelLineColoring(id, line_id).active;
66
66
  }
67
67
 
68
+ async function applyVertexColoring(modelId: string, lines_ids: string[]): Promise<unknown> {
69
+ const name = modelLinesVertexAttribute.modelLinesVertexAttributeName(modelId, lines_ids[0]);
70
+ const item = modelLinesVertexAttribute.modelLinesVertexAttributeItem(modelId, lines_ids[0]);
71
+ const [minimum, maximum] = modelLinesVertexAttribute.modelLinesVertexAttributeRange(
72
+ modelId,
73
+ lines_ids[0],
74
+ );
75
+ const colorMap = modelLinesVertexAttribute.modelLinesVertexAttributeColorMap(
76
+ modelId,
77
+ lines_ids[0],
78
+ );
79
+ const no_data_color = modelLinesVertexAttribute.modelLinesVertexAttributeNoDataColor(
80
+ modelId,
81
+ lines_ids[0],
82
+ );
83
+ const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
84
+ if (isModelLinesVertexAttributeValid(attribute)) {
85
+ const result = await modelLinesVertexAttribute.setModelLinesVertexAttribute(
86
+ modelId,
87
+ lines_ids,
88
+ attribute,
89
+ );
90
+ return result;
91
+ }
92
+ return undefined;
93
+ }
94
+
95
+ async function applyEdgeColoring(modelId: string, lines_ids: string[]): Promise<unknown> {
96
+ const name = modelLinesEdgeAttribute.modelLinesEdgeAttributeName(modelId, lines_ids[0]);
97
+ const item = modelLinesEdgeAttribute.modelLinesEdgeAttributeItem(modelId, lines_ids[0]);
98
+ const [minimum, maximum] = modelLinesEdgeAttribute.modelLinesEdgeAttributeRange(
99
+ modelId,
100
+ lines_ids[0],
101
+ );
102
+ const colorMap = modelLinesEdgeAttribute.modelLinesEdgeAttributeColorMap(modelId, lines_ids[0]);
103
+ const no_data_color = modelLinesEdgeAttribute.modelLinesEdgeAttributeNoDataColor(
104
+ modelId,
105
+ lines_ids[0],
106
+ );
107
+ const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
108
+ if (isModelLinesEdgeAttributeValid(attribute)) {
109
+ const result = await modelLinesEdgeAttribute.setModelLinesEdgeAttribute(
110
+ modelId,
111
+ lines_ids,
112
+ attribute,
113
+ );
114
+ return result;
115
+ }
116
+ return undefined;
117
+ }
118
+
68
119
  async function setModelLinesActiveColoring(
69
120
  modelId: string,
70
121
  lines_ids: string[],
@@ -86,47 +137,9 @@ export function useModelLinesColor(): {
86
137
  }
87
138
 
88
139
  if (activeColoring === "vertex") {
89
- const name = modelLinesVertexAttribute.modelLinesVertexAttributeName(modelId, lines_ids[0]);
90
- const item = modelLinesVertexAttribute.modelLinesVertexAttributeItem(modelId, lines_ids[0]);
91
- const [minimum, maximum] = modelLinesVertexAttribute.modelLinesVertexAttributeRange(
92
- modelId,
93
- lines_ids[0],
94
- );
95
- const colorMap = modelLinesVertexAttribute.modelLinesVertexAttributeColorMap(
96
- modelId,
97
- lines_ids[0],
98
- );
99
- const no_data_color = modelLinesVertexAttribute.modelLinesVertexAttributeNoDataColor(
100
- modelId,
101
- lines_ids[0],
102
- );
103
- const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
104
- if (isModelLinesVertexAttributeValid(attribute)) {
105
- return modelLinesVertexAttribute.setModelLinesVertexAttribute(
106
- modelId,
107
- lines_ids,
108
- attribute,
109
- );
110
- }
140
+ return applyVertexColoring(modelId, lines_ids);
111
141
  } else if (activeColoring === "edge") {
112
- const name = modelLinesEdgeAttribute.modelLinesEdgeAttributeName(modelId, lines_ids[0]);
113
- const item = modelLinesEdgeAttribute.modelLinesEdgeAttributeItem(modelId, lines_ids[0]);
114
- const [minimum, maximum] = modelLinesEdgeAttribute.modelLinesEdgeAttributeRange(
115
- modelId,
116
- lines_ids[0],
117
- );
118
- const colorMap = modelLinesEdgeAttribute.modelLinesEdgeAttributeColorMap(
119
- modelId,
120
- lines_ids[0],
121
- );
122
- const no_data_color = modelLinesEdgeAttribute.modelLinesEdgeAttributeNoDataColor(
123
- modelId,
124
- lines_ids[0],
125
- );
126
- const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
127
- if (isModelLinesEdgeAttributeValid(attribute)) {
128
- return modelLinesEdgeAttribute.setModelLinesEdgeAttribute(modelId, lines_ids, attribute);
129
- }
142
+ return applyEdgeColoring(modelId, lines_ids);
130
143
  }
131
144
  return undefined;
132
145
  }
@@ -111,12 +111,28 @@ interface UseModelLinesEdgeAttributeReturn {
111
111
  ) => Promise<unknown>;
112
112
  }
113
113
 
114
+ type ModelLinesEdgeAttributeGetters = Pick<
115
+ UseModelLinesEdgeAttributeReturn,
116
+ | "modelLinesEdgeAttributeStoredConfig"
117
+ | "modelLinesEdgeAttributeName"
118
+ | "modelLinesEdgeAttributeItem"
119
+ | "modelLinesEdgeAttributeRange"
120
+ | "modelLinesEdgeAttributeColorMap"
121
+ | "modelLinesEdgeAttributeNoDataColor"
122
+ | "modelLinesEdgeAttributeTimeStep"
123
+ > & {
124
+ modelLinesEdgeAttributeLastItem: (
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 useModelLinesEdgeAttribute(): UseModelLinesEdgeAttributeReturn {
116
- const { attributeTimeStep, setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
117
- const dataStore = useDataStore();
118
- const modelLinesCommonStyle = useModelLinesCommonStyle();
119
- const viewerStore = useViewerStore();
132
+ function useModelLinesEdgeAttributeGetters(
133
+ modelLinesCommonStyle: ReturnType<typeof useModelLinesCommonStyle>,
134
+ ): ModelLinesEdgeAttributeGetters {
135
+ const { attributeTimeStep } = useAttributeTimeStepStyle();
120
136
  function modelLinesEdgeAttribute(modelId: string, lineId?: string): AttributeState {
121
137
  // oxlint-disable-next-line no-unsafe-type-assertion -- coloring.edge shape is defined by the data style schema.
122
138
  return modelLinesCommonStyle.modelLineColoring(modelId, lineId).edge as AttributeState;
@@ -140,45 +156,6 @@ function useModelLinesEdgeAttribute(): UseModelLinesEdgeAttributeReturn {
140
156
  no_data_color: DEFAULT_NO_DATA_COLOR,
141
157
  };
142
158
  }
143
- async function mutateModelLinesEdgeStyle(
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
- edge: values,
151
- }),
152
- ];
153
- const totalLineIds = await dataStore.getLinesGeodeIds(modelId);
154
- if (lineIds.length === totalLineIds.length) {
155
- tasks.push(
156
- modelLinesCommonStyle.mutateModelLinesTypeColoring(modelId, {
157
- edge: values,
158
- }),
159
- );
160
- }
161
- await Promise.all(tasks);
162
- }
163
- async function setModelLinesEdgeAttributeStoredConfig(
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 mutateModelLinesEdgeStyle(modelId, lineIds, {
174
- storedConfigs: {
175
- [name]: {
176
- lastItem: item,
177
- [item]: config,
178
- },
179
- },
180
- });
181
- }
182
159
  function modelLinesEdgeAttributeName(modelId: string, lineId?: string): string | undefined {
183
160
  return modelLinesEdgeAttribute(modelId, lineId).name;
184
161
  }
@@ -229,6 +206,73 @@ function useModelLinesEdgeAttribute(): UseModelLinesEdgeAttributeReturn {
229
206
  modelLinesEdgeAttribute(modelId, lineId).name,
230
207
  );
231
208
  }
209
+ return {
210
+ modelLinesEdgeAttributeStoredConfig,
211
+ modelLinesEdgeAttributeName,
212
+ modelLinesEdgeAttributeLastItem,
213
+ modelLinesEdgeAttributeItem,
214
+ modelLinesEdgeAttributeRange,
215
+ modelLinesEdgeAttributeColorMap,
216
+ modelLinesEdgeAttributeNoDataColor,
217
+ modelLinesEdgeAttributeTimeStep,
218
+ };
219
+ }
220
+
221
+ // oxlint-disable-next-line max-lines-per-function
222
+ function useModelLinesEdgeAttribute(): UseModelLinesEdgeAttributeReturn {
223
+ const { setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
224
+ const dataStore = useDataStore();
225
+ const modelLinesCommonStyle = useModelLinesCommonStyle();
226
+ const {
227
+ modelLinesEdgeAttributeStoredConfig,
228
+ modelLinesEdgeAttributeName,
229
+ modelLinesEdgeAttributeLastItem,
230
+ modelLinesEdgeAttributeItem,
231
+ modelLinesEdgeAttributeRange,
232
+ modelLinesEdgeAttributeColorMap,
233
+ modelLinesEdgeAttributeNoDataColor,
234
+ modelLinesEdgeAttributeTimeStep,
235
+ } = useModelLinesEdgeAttributeGetters(modelLinesCommonStyle);
236
+ const viewerStore = useViewerStore();
237
+ async function mutateModelLinesEdgeStyle(
238
+ modelId: string,
239
+ lineIds: string[],
240
+ values: Record<string, unknown>,
241
+ ): Promise<void> {
242
+ const tasks: Promise<void>[] = [
243
+ modelLinesCommonStyle.mutateModelLinesColoring(modelId, lineIds, {
244
+ edge: values,
245
+ }),
246
+ ];
247
+ const totalLineIds = await dataStore.getLinesGeodeIds(modelId);
248
+ if (lineIds.length === totalLineIds.length) {
249
+ tasks.push(
250
+ modelLinesCommonStyle.mutateModelLinesTypeColoring(modelId, {
251
+ edge: values,
252
+ }),
253
+ );
254
+ }
255
+ await Promise.all(tasks);
256
+ }
257
+ async function setModelLinesEdgeAttributeStoredConfig(
258
+ modelId: string,
259
+ lineIds: string[],
260
+ name: string | undefined,
261
+ item: number | undefined,
262
+ config: Partial<AttributeStoredConfig>,
263
+ ): Promise<void> {
264
+ if (name === undefined || item === undefined) {
265
+ return;
266
+ }
267
+ await mutateModelLinesEdgeStyle(modelId, lineIds, {
268
+ storedConfigs: {
269
+ [name]: {
270
+ lastItem: item,
271
+ [item]: config,
272
+ },
273
+ },
274
+ });
275
+ }
232
276
  async function setModelLinesEdgeAttribute(
233
277
  modelId: string,
234
278
  lineIds: string[],
@@ -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
  }