@geode/opengeodeweb-front 10.44.0-rc.2 → 10.44.0-rc.4
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.
- package/.build/server/utils/cleanup.js +7 -2
- package/.build/server/utils/microservices.js +9 -81
- package/.build/server/utils/microservices_process.js +85 -0
- package/.build/server/utils/typed_handler.js +5 -1
- package/.build/server/utils/ws_client.js +7 -2
- package/.build/shared/utils/fetch_raw.js +2 -2
- package/.build/shared/utils/parse_boolean.js +2 -1
- package/app/components/ClippingPlanes.vue +22 -78
- package/app/components/DragAndDrop.vue +16 -79
- package/app/components/FileSelector.vue +9 -6
- package/app/components/HybridViewerTooltip.vue +8 -2
- package/app/components/MissingFilesSelector.vue +10 -6
- package/app/components/ObjectSelector.vue +6 -3
- package/app/components/Screenshot.vue +9 -2
- package/app/components/ThresholdCard.vue +205 -0
- package/app/components/ThresholdFilter.vue +81 -216
- package/app/components/ViewToolbar.vue +15 -231
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +228 -0
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +234 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +7 -5
- package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
- package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -292
- package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
- package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
- package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
- package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +12 -10
- package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +12 -10
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +9 -5
- package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
- package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
- package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
- package/app/components/Viewer/Options/ColorPicker.vue +4 -1
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
- package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
- package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
- package/app/components/Viewer/Surface/PolygonsColoring.vue +231 -0
- package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
- package/app/components/csv-preview/CsvPreviewer.vue +4 -1
- package/app/composables/attribute_coloring_style.ts +8 -2
- package/app/composables/attribute_selector.ts +126 -0
- package/app/composables/clipping_slices.ts +166 -0
- package/app/composables/global_attribute_style.ts +4 -3
- package/app/composables/hover_highlight.ts +6 -5
- package/app/composables/project_manager.ts +5 -5
- package/app/composables/stepper_tree.ts +10 -2
- package/app/composables/tree_filter.ts +11 -2
- package/app/composables/tree_keyboard_nav.ts +4 -2
- package/app/composables/use_overlapping_picker.ts +5 -5
- package/app/composables/view_toolbar_options.ts +126 -0
- package/app/composables/view_toolbar_tool_options.ts +115 -0
- package/app/composables/view_toolbar_tools.ts +108 -0
- package/app/composables/virtual_tree.ts +20 -131
- package/app/composables/virtual_tree_flatten.ts +86 -0
- package/app/composables/virtual_tree_types.ts +81 -0
- package/app/stores/app.ts +8 -55
- package/app/stores/app_helpers/extension.ts +1 -1
- package/app/stores/app_helpers/registry.ts +69 -0
- package/app/stores/feedback.ts +2 -2
- package/app/stores/hybrid_viewer.ts +1 -1
- package/app/stores/menu.ts +1 -124
- package/app/stores/menu_helpers/menus_data.ts +127 -0
- package/app/stores/treeview.ts +17 -10
- package/app/stores/viewer.ts +17 -78
- package/app/stores/viewer_helpers/actions.ts +68 -0
- package/app/stores/viewer_helpers/request.ts +61 -0
- package/app/utils/clipping_planes.ts +4 -131
- package/app/utils/clipping_planes_scene.ts +131 -0
- package/app/utils/coloring_styles.ts +101 -0
- package/app/utils/default_styles/mesh_components.ts +168 -0
- package/app/utils/default_styles/meshes.ts +13 -153
- package/app/utils/default_styles/model_components.ts +170 -0
- package/app/utils/default_styles/models.ts +16 -153
- package/app/utils/drag_and_drop.ts +80 -0
- package/app/utils/extension.ts +1 -1
- package/app/utils/import_workflow.ts +6 -4
- package/app/utils/model_component_coloring.ts +46 -0
- package/app/utils/threshold.ts +33 -0
- package/app/utils/threshold_sources.ts +51 -0
- package/app/utils/upload_path.ts +15 -9
- package/internal/database/database.ts +4 -1
- package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
- package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
- package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
- package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
- package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
- package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
- package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
- package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/blocks/index.ts +12 -140
- package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
- package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
- package/internal/stores/data_style/model/common.ts +10 -119
- package/internal/stores/data_style/model/common_mutations.ts +184 -0
- package/internal/stores/data_style/model/corners/vertex.ts +14 -10
- package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
- package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/lines/edge.ts +14 -10
- package/internal/stores/data_style/model/lines/index.ts +10 -134
- package/internal/stores/data_style/model/lines/vertex.ts +14 -10
- package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
- package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/surfaces/index.ts +16 -160
- package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
- package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
- package/internal/stores/data_style/model/visibility.ts +3 -156
- package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
- package/internal/stores/data_style/state.ts +1 -181
- package/internal/stores/data_style/state_shared.ts +191 -0
- package/internal/stores/hybrid_viewer/brightness.ts +8 -2
- package/internal/stores/hybrid_viewer/camera.ts +7 -161
- package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
- package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
- package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
- package/internal/stores/hybrid_viewer/filters.ts +54 -11
- package/internal/stores/hybrid_viewer/highlight.ts +10 -9
- package/internal/stores/hybrid_viewer/ruler.ts +4 -3
- package/internal/utils/ws_client.ts +8 -1
- package/package.json +2 -2
- package/server/api/local/extensions/run.post.ts +6 -4
- package/server/utils/cleanup.ts +12 -2
- package/server/utils/microservices.ts +10 -102
- package/server/utils/microservices_process.ts +127 -0
- package/server/utils/typed_handler.ts +8 -1
- package/server/utils/ws_client.ts +15 -2
- package/shared/utils/fetch_raw.ts +2 -2
- package/shared/utils/parse_boolean.ts +4 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { Dexie, Table } from "dexie";
|
|
2
|
+
import type {
|
|
3
|
+
ModelComponentStyle,
|
|
4
|
+
ModelComponentTypeStyle,
|
|
5
|
+
StyleValues,
|
|
6
|
+
} from "@ogw_internal/stores/data_style/types.js";
|
|
7
|
+
import { database } from "@ogw_internal/database/database";
|
|
8
|
+
import merge from "lodash/merge";
|
|
9
|
+
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
10
|
+
|
|
11
|
+
// The underlying dexie tables use compound array keys ([id_model, id_component] /
|
|
12
|
+
// [id_model, type]) but the shared `database` proxy types every table as
|
|
13
|
+
// Table<Record<string, unknown>, string>. Cast locally to the real key shape.
|
|
14
|
+
type ComponentTable = Table<ModelComponentStyle, [string, string]>;
|
|
15
|
+
type ComponentTypeTable = Table<ModelComponentTypeStyle, [string, string]>;
|
|
16
|
+
|
|
17
|
+
interface ComponentStyleUpdate {
|
|
18
|
+
id_component: string;
|
|
19
|
+
values: StyleValues;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function componentDatastyleTable(): ComponentTable {
|
|
23
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- compound-key table cast; see comment above.
|
|
24
|
+
return database.model_component_datastyle as unknown as ComponentTable;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function componentTypeDatastyleTable(): ComponentTypeTable {
|
|
28
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- compound-key table cast; see comment above.
|
|
29
|
+
return database.model_component_type_datastyle as unknown as ComponentTypeTable;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface UseModelComponentStyleMutationsReturn {
|
|
33
|
+
mutateComponentStyle: (
|
|
34
|
+
id_model: string,
|
|
35
|
+
id_component: string,
|
|
36
|
+
values: StyleValues,
|
|
37
|
+
) => Promise<unknown>;
|
|
38
|
+
mutateModelComponentTypeStyle: (
|
|
39
|
+
id_model: string,
|
|
40
|
+
type: string,
|
|
41
|
+
values: StyleValues,
|
|
42
|
+
) => Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface UseModelComponentsStyleMutationReturn {
|
|
46
|
+
mutateComponentStyles: (
|
|
47
|
+
id_model: string,
|
|
48
|
+
id_components: string[],
|
|
49
|
+
values: StyleValues,
|
|
50
|
+
) => Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface UseModelComponentsPerComponentStyleMutationReturn {
|
|
54
|
+
bulkMutateComponentStylesPerComponent: (
|
|
55
|
+
id_model: string,
|
|
56
|
+
component_updates: ComponentStyleUpdate[],
|
|
57
|
+
) => Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function useModelComponentStyleMutations(): UseModelComponentStyleMutationsReturn {
|
|
61
|
+
const dataStyleState = useDataStyleState();
|
|
62
|
+
const model_component_datastyle_db = componentDatastyleTable();
|
|
63
|
+
const model_component_type_datastyle_db = componentTypeDatastyleTable();
|
|
64
|
+
|
|
65
|
+
async function mutateComponentStyle(
|
|
66
|
+
id_model: string,
|
|
67
|
+
id_component: string,
|
|
68
|
+
values: StyleValues,
|
|
69
|
+
): Promise<unknown> {
|
|
70
|
+
dataStyleState.updateComponentStyleCache(id_model, id_component, values);
|
|
71
|
+
const key: [string, string] = [id_model, id_component];
|
|
72
|
+
const entry: ModelComponentStyle = (await model_component_datastyle_db.get(key)) ?? {
|
|
73
|
+
id_model,
|
|
74
|
+
id_component,
|
|
75
|
+
};
|
|
76
|
+
merge(entry, values);
|
|
77
|
+
return model_component_datastyle_db.put(structuredClone(toRaw(entry)));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function mutateModelComponentTypeStyle(
|
|
81
|
+
id_model: string,
|
|
82
|
+
type: string,
|
|
83
|
+
values: StyleValues,
|
|
84
|
+
): Promise<void> {
|
|
85
|
+
dataStyleState.updateModelComponentTypeStyleCache(id_model, type, values);
|
|
86
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- the shared database proxy types every table as Dexie; see comment above.
|
|
87
|
+
await (database as unknown as Dexie).transaction(
|
|
88
|
+
"rw",
|
|
89
|
+
model_component_type_datastyle_db,
|
|
90
|
+
async () => {
|
|
91
|
+
const key: [string, string] = [id_model, type];
|
|
92
|
+
const entry: ModelComponentTypeStyle = (await model_component_type_datastyle_db.get(
|
|
93
|
+
key,
|
|
94
|
+
)) ?? {
|
|
95
|
+
id_model,
|
|
96
|
+
type,
|
|
97
|
+
};
|
|
98
|
+
merge(entry, values);
|
|
99
|
+
return model_component_type_datastyle_db.put(structuredClone(toRaw(entry)));
|
|
100
|
+
},
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
mutateComponentStyle,
|
|
106
|
+
mutateModelComponentTypeStyle,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function useModelComponentsStyleMutation(): UseModelComponentsStyleMutationReturn {
|
|
111
|
+
const dataStyleState = useDataStyleState();
|
|
112
|
+
const model_component_datastyle_db = componentDatastyleTable();
|
|
113
|
+
|
|
114
|
+
async function mutateComponentStyles(
|
|
115
|
+
id_model: string,
|
|
116
|
+
id_components: string[],
|
|
117
|
+
values: StyleValues,
|
|
118
|
+
): Promise<void> {
|
|
119
|
+
dataStyleState.bulkUpdateComponentStylesCache(id_model, id_components, values);
|
|
120
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- the shared database proxy types every table as Dexie; see comment above.
|
|
121
|
+
await (database as unknown as Dexie).transaction(
|
|
122
|
+
"rw",
|
|
123
|
+
model_component_datastyle_db,
|
|
124
|
+
async () => {
|
|
125
|
+
const keys: [string, string][] = id_components.map((id_component) => [
|
|
126
|
+
id_model,
|
|
127
|
+
id_component,
|
|
128
|
+
]);
|
|
129
|
+
const existing = await model_component_datastyle_db.bulkGet(keys);
|
|
130
|
+
const updates = id_components.map((id_component, index) => {
|
|
131
|
+
const style: ModelComponentStyle = existing[index] ?? { id_model, id_component };
|
|
132
|
+
merge(style, values);
|
|
133
|
+
return toRaw(style);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return model_component_datastyle_db.bulkPut(structuredClone(updates));
|
|
137
|
+
},
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
mutateComponentStyles,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function useModelComponentsPerComponentStyleMutation(): UseModelComponentsPerComponentStyleMutationReturn {
|
|
147
|
+
const dataStyleState = useDataStyleState();
|
|
148
|
+
const model_component_datastyle_db = componentDatastyleTable();
|
|
149
|
+
|
|
150
|
+
async function bulkMutateComponentStylesPerComponent(
|
|
151
|
+
id_model: string,
|
|
152
|
+
component_updates: ComponentStyleUpdate[],
|
|
153
|
+
): Promise<void> {
|
|
154
|
+
dataStyleState.bulkUpdateComponentStyleCache(id_model, component_updates);
|
|
155
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- the shared database proxy types every table as Dexie; see comment above.
|
|
156
|
+
await (database as unknown as Dexie).transaction(
|
|
157
|
+
"rw",
|
|
158
|
+
model_component_datastyle_db,
|
|
159
|
+
async () => {
|
|
160
|
+
const keys: [string, string][] = component_updates.map((update) => [
|
|
161
|
+
id_model,
|
|
162
|
+
update.id_component,
|
|
163
|
+
]);
|
|
164
|
+
const existing = await model_component_datastyle_db.bulkGet(keys);
|
|
165
|
+
const updates = component_updates.map(({ id_component, values }, index) => {
|
|
166
|
+
const style: ModelComponentStyle = existing[index] ?? { id_model, id_component };
|
|
167
|
+
merge(style, values);
|
|
168
|
+
return toRaw(style);
|
|
169
|
+
});
|
|
170
|
+
return model_component_datastyle_db.bulkPut(structuredClone(updates));
|
|
171
|
+
},
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
bulkMutateComponentStylesPerComponent,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export {
|
|
180
|
+
useModelComponentStyleMutations,
|
|
181
|
+
useModelComponentsStyleMutation,
|
|
182
|
+
useModelComponentsPerComponentStyleMutation,
|
|
183
|
+
};
|
|
184
|
+
export type { ComponentStyleUpdate };
|
|
@@ -304,16 +304,20 @@ function useModelCornersVertexAttribute(): ModelCornersVertexAttributeApi {
|
|
|
304
304
|
reapplySameSeries(
|
|
305
305
|
await dataStore.getCornersGeodeIds(modelId),
|
|
306
306
|
cornerIds,
|
|
307
|
-
(id) =>
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
307
|
+
(id) => {
|
|
308
|
+
if (
|
|
309
|
+
modelCornersCommonStyle.modelCornerColoring(modelId, id).active === "vertex" &&
|
|
310
|
+
modelCornersVertexAttributeName(modelId, id) === name
|
|
311
|
+
) {
|
|
312
|
+
return [
|
|
313
|
+
modelCornersVertexAttributeItem(modelId, id),
|
|
314
|
+
modelCornersVertexAttributeRange(modelId, id),
|
|
315
|
+
modelCornersVertexAttributeColorMap(modelId, id),
|
|
316
|
+
JSON.stringify(modelCornersVertexAttributeNoDataColor(modelId, id)),
|
|
317
|
+
].join("|");
|
|
318
|
+
}
|
|
319
|
+
return undefined;
|
|
320
|
+
},
|
|
317
321
|
async (ids) => {
|
|
318
322
|
await applyVertexAttribute(modelId, ids);
|
|
319
323
|
},
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { AttributeGroup, ColorGroup } from "./coloring_groups";
|
|
2
|
+
import { isModelLinesEdgeAttributeValid, type useModelLinesEdgeAttribute } from "./edge";
|
|
3
|
+
import { isModelLinesVertexAttributeValid, type useModelLinesVertexAttribute } from "./vertex";
|
|
4
|
+
import type { useModelLinesColor } from "./color";
|
|
5
|
+
|
|
6
|
+
type ColorStyle = ReturnType<typeof useModelLinesColor>;
|
|
7
|
+
type VertexAttributeStyle = ReturnType<typeof useModelLinesVertexAttribute>;
|
|
8
|
+
type EdgeAttributeStyle = ReturnType<typeof useModelLinesEdgeAttribute>;
|
|
9
|
+
|
|
10
|
+
function applyModelLinesConstantColoring(
|
|
11
|
+
modelId: string,
|
|
12
|
+
type_lines_ids: string[],
|
|
13
|
+
modelColorStyle: ColorStyle,
|
|
14
|
+
): Promise<unknown>[] {
|
|
15
|
+
const colorGroups: Record<string, ColorGroup> = {};
|
|
16
|
+
for (const line_id of type_lines_ids) {
|
|
17
|
+
const color = modelColorStyle.modelLineColor(modelId, line_id);
|
|
18
|
+
const color_key = JSON.stringify(color);
|
|
19
|
+
colorGroups[color_key] ??= { color, lines_ids: [] };
|
|
20
|
+
colorGroups[color_key].lines_ids.push(line_id);
|
|
21
|
+
}
|
|
22
|
+
return Object.values(colorGroups).map(async ({ color, lines_ids: ids }) => {
|
|
23
|
+
const result = await modelColorStyle.setModelLinesColor(modelId, ids, color, "constant");
|
|
24
|
+
return result;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function groupModelLinesVertexAttributes(
|
|
29
|
+
modelId: string,
|
|
30
|
+
type_lines_ids: string[],
|
|
31
|
+
modelLinesVertexAttribute: VertexAttributeStyle,
|
|
32
|
+
): Record<string, AttributeGroup> {
|
|
33
|
+
const vertexGroups: Record<string, AttributeGroup> = {};
|
|
34
|
+
for (const line_id of type_lines_ids) {
|
|
35
|
+
const name = modelLinesVertexAttribute.modelLinesVertexAttributeName(modelId, line_id);
|
|
36
|
+
const item = modelLinesVertexAttribute.modelLinesVertexAttributeItem(modelId, line_id);
|
|
37
|
+
const [minimum, maximum] = modelLinesVertexAttribute.modelLinesVertexAttributeRange(
|
|
38
|
+
modelId,
|
|
39
|
+
line_id,
|
|
40
|
+
);
|
|
41
|
+
const colorMap = modelLinesVertexAttribute.modelLinesVertexAttributeColorMap(modelId, line_id);
|
|
42
|
+
const no_data_color = modelLinesVertexAttribute.modelLinesVertexAttributeNoDataColor(
|
|
43
|
+
modelId,
|
|
44
|
+
line_id,
|
|
45
|
+
);
|
|
46
|
+
const attribute = {
|
|
47
|
+
name,
|
|
48
|
+
item,
|
|
49
|
+
minimum,
|
|
50
|
+
maximum,
|
|
51
|
+
colorMap,
|
|
52
|
+
no_data_color,
|
|
53
|
+
};
|
|
54
|
+
if (!isModelLinesVertexAttributeValid(attribute)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const key = [name, item, colorMap, minimum, maximum, JSON.stringify(no_data_color)].join("_");
|
|
58
|
+
vertexGroups[key] ??= { ...attribute, lines_ids: [] };
|
|
59
|
+
vertexGroups[key].lines_ids.push(line_id);
|
|
60
|
+
}
|
|
61
|
+
return vertexGroups;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function applyModelLinesVertexColoring(
|
|
65
|
+
modelId: string,
|
|
66
|
+
type_lines_ids: string[],
|
|
67
|
+
modelLinesVertexAttribute: VertexAttributeStyle,
|
|
68
|
+
): Promise<unknown>[] {
|
|
69
|
+
const vertexGroups = groupModelLinesVertexAttributes(
|
|
70
|
+
modelId,
|
|
71
|
+
type_lines_ids,
|
|
72
|
+
modelLinesVertexAttribute,
|
|
73
|
+
);
|
|
74
|
+
return Object.values(vertexGroups).map(
|
|
75
|
+
async ({ name, item, minimum, maximum, colorMap, no_data_color, lines_ids: ids }) => {
|
|
76
|
+
const result = await modelLinesVertexAttribute.setModelLinesVertexAttribute(modelId, ids, {
|
|
77
|
+
name,
|
|
78
|
+
item,
|
|
79
|
+
minimum,
|
|
80
|
+
maximum,
|
|
81
|
+
colorMap,
|
|
82
|
+
no_data_color,
|
|
83
|
+
});
|
|
84
|
+
return result;
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function groupModelLinesEdgeAttributes(
|
|
90
|
+
modelId: string,
|
|
91
|
+
type_lines_ids: string[],
|
|
92
|
+
modelLinesEdgeAttribute: EdgeAttributeStyle,
|
|
93
|
+
): Record<string, AttributeGroup> {
|
|
94
|
+
const edgeGroups: Record<string, AttributeGroup> = {};
|
|
95
|
+
for (const line_id of type_lines_ids) {
|
|
96
|
+
const name = modelLinesEdgeAttribute.modelLinesEdgeAttributeName(modelId, line_id);
|
|
97
|
+
const item = modelLinesEdgeAttribute.modelLinesEdgeAttributeItem(modelId, line_id);
|
|
98
|
+
const [minimum, maximum] = modelLinesEdgeAttribute.modelLinesEdgeAttributeRange(
|
|
99
|
+
modelId,
|
|
100
|
+
line_id,
|
|
101
|
+
);
|
|
102
|
+
const colorMap = modelLinesEdgeAttribute.modelLinesEdgeAttributeColorMap(modelId, line_id);
|
|
103
|
+
const no_data_color = modelLinesEdgeAttribute.modelLinesEdgeAttributeNoDataColor(
|
|
104
|
+
modelId,
|
|
105
|
+
line_id,
|
|
106
|
+
);
|
|
107
|
+
const attribute = {
|
|
108
|
+
name,
|
|
109
|
+
item,
|
|
110
|
+
minimum,
|
|
111
|
+
maximum,
|
|
112
|
+
colorMap,
|
|
113
|
+
no_data_color,
|
|
114
|
+
};
|
|
115
|
+
if (!isModelLinesEdgeAttributeValid(attribute)) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const key = [name, item, colorMap, minimum, maximum, JSON.stringify(no_data_color)].join("_");
|
|
119
|
+
edgeGroups[key] ??= { ...attribute, lines_ids: [] };
|
|
120
|
+
edgeGroups[key].lines_ids.push(line_id);
|
|
121
|
+
}
|
|
122
|
+
return edgeGroups;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function applyModelLinesEdgeColoring(
|
|
126
|
+
modelId: string,
|
|
127
|
+
type_lines_ids: string[],
|
|
128
|
+
modelLinesEdgeAttribute: EdgeAttributeStyle,
|
|
129
|
+
): Promise<unknown>[] {
|
|
130
|
+
const edgeGroups = groupModelLinesEdgeAttributes(
|
|
131
|
+
modelId,
|
|
132
|
+
type_lines_ids,
|
|
133
|
+
modelLinesEdgeAttribute,
|
|
134
|
+
);
|
|
135
|
+
return Object.values(edgeGroups).map(
|
|
136
|
+
async ({ name, item, minimum, maximum, colorMap, no_data_color, lines_ids: ids }) => {
|
|
137
|
+
const result = await modelLinesEdgeAttribute.setModelLinesEdgeAttribute(modelId, ids, {
|
|
138
|
+
name,
|
|
139
|
+
item,
|
|
140
|
+
minimum,
|
|
141
|
+
maximum,
|
|
142
|
+
colorMap,
|
|
143
|
+
no_data_color,
|
|
144
|
+
});
|
|
145
|
+
return result;
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
applyModelLinesConstantColoring,
|
|
152
|
+
applyModelLinesVertexColoring,
|
|
153
|
+
applyModelLinesEdgeColoring,
|
|
154
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
|
|
3
|
+
interface ColorGroup {
|
|
4
|
+
color: RGBAColor | undefined;
|
|
5
|
+
lines_ids: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface AttributeGroup {
|
|
9
|
+
name: string;
|
|
10
|
+
item: number;
|
|
11
|
+
minimum: number;
|
|
12
|
+
maximum: number;
|
|
13
|
+
colorMap: string;
|
|
14
|
+
no_data_color?: RGBAColor;
|
|
15
|
+
lines_ids: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type { AttributeGroup, ColorGroup };
|
|
@@ -321,16 +321,20 @@ function useModelLinesEdgeAttribute(): UseModelLinesEdgeAttributeReturn {
|
|
|
321
321
|
reapplySameSeries(
|
|
322
322
|
await dataStore.getLinesGeodeIds(modelId),
|
|
323
323
|
lineIds,
|
|
324
|
-
(id) =>
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
324
|
+
(id) => {
|
|
325
|
+
if (
|
|
326
|
+
modelLinesCommonStyle.modelLineColoring(modelId, id).active === "edge" &&
|
|
327
|
+
modelLinesEdgeAttributeName(modelId, id) === name
|
|
328
|
+
) {
|
|
329
|
+
return [
|
|
330
|
+
modelLinesEdgeAttributeItem(modelId, id),
|
|
331
|
+
modelLinesEdgeAttributeRange(modelId, id),
|
|
332
|
+
modelLinesEdgeAttributeColorMap(modelId, id),
|
|
333
|
+
JSON.stringify(modelLinesEdgeAttributeNoDataColor(modelId, id)),
|
|
334
|
+
].join("|");
|
|
335
|
+
}
|
|
336
|
+
return undefined;
|
|
337
|
+
},
|
|
334
338
|
async (ids) => {
|
|
335
339
|
await applyEdgeAttribute(modelId, ids);
|
|
336
340
|
},
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
applyModelLinesConstantColoring,
|
|
3
|
+
applyModelLinesEdgeColoring,
|
|
4
|
+
applyModelLinesVertexColoring,
|
|
5
|
+
} from "./apply_coloring";
|
|
4
6
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
5
7
|
import { useModelLinesColor } from "./color";
|
|
6
8
|
import { useModelLinesCommonStyle } from "./common";
|
|
9
|
+
import { useModelLinesEdgeAttribute } from "./edge";
|
|
7
10
|
import { useModelLinesPointsStyle } from "./points";
|
|
11
|
+
import { useModelLinesVertexAttribute } from "./vertex";
|
|
8
12
|
import { useModelLinesVisibility } from "./visibility";
|
|
9
13
|
|
|
10
|
-
interface ColorGroup {
|
|
11
|
-
color: RGBAColor | undefined;
|
|
12
|
-
lines_ids: string[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface AttributeGroup {
|
|
16
|
-
name: string;
|
|
17
|
-
item: number;
|
|
18
|
-
minimum: number;
|
|
19
|
-
maximum: number;
|
|
20
|
-
colorMap: string;
|
|
21
|
-
no_data_color?: RGBAColor;
|
|
22
|
-
lines_ids: string[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
14
|
async function setModelLinesDefaultStyle(_id: string): Promise<void> {
|
|
26
15
|
// Placeholder
|
|
27
16
|
}
|
|
@@ -82,133 +71,20 @@ export function useModelLinesStyle(): ReturnType<typeof useModelLinesCommonStyle
|
|
|
82
71
|
|
|
83
72
|
for (const [type, type_lines_ids] of Object.entries(activeColoringGroups)) {
|
|
84
73
|
if (type === "constant") {
|
|
85
|
-
const colorGroups: Record<string, ColorGroup> = {};
|
|
86
|
-
for (const line_id of type_lines_ids) {
|
|
87
|
-
const color = modelColorStyle.modelLineColor(modelId, line_id);
|
|
88
|
-
const color_key = JSON.stringify(color);
|
|
89
|
-
colorGroups[color_key] ??= { color, lines_ids: [] };
|
|
90
|
-
colorGroups[color_key].lines_ids.push(line_id);
|
|
91
|
-
}
|
|
92
74
|
coloringPromises.push(
|
|
93
|
-
...
|
|
94
|
-
const result = await modelColorStyle.setModelLinesColor(
|
|
95
|
-
modelId,
|
|
96
|
-
ids,
|
|
97
|
-
color,
|
|
98
|
-
"constant",
|
|
99
|
-
);
|
|
100
|
-
return result;
|
|
101
|
-
}),
|
|
75
|
+
...applyModelLinesConstantColoring(modelId, type_lines_ids, modelColorStyle),
|
|
102
76
|
);
|
|
103
77
|
} else if (type === "random") {
|
|
104
78
|
coloringPromises.push(
|
|
105
79
|
modelColorStyle.setModelLinesColor(modelId, type_lines_ids, undefined, "random"),
|
|
106
80
|
);
|
|
107
81
|
} else if (type === "vertex") {
|
|
108
|
-
const vertexGroups: Record<string, AttributeGroup> = {};
|
|
109
|
-
for (const line_id of type_lines_ids) {
|
|
110
|
-
const name = modelLinesVertexAttribute.modelLinesVertexAttributeName(modelId, line_id);
|
|
111
|
-
const item = modelLinesVertexAttribute.modelLinesVertexAttributeItem(modelId, line_id);
|
|
112
|
-
const [minimum, maximum] = modelLinesVertexAttribute.modelLinesVertexAttributeRange(
|
|
113
|
-
modelId,
|
|
114
|
-
line_id,
|
|
115
|
-
);
|
|
116
|
-
const colorMap = modelLinesVertexAttribute.modelLinesVertexAttributeColorMap(
|
|
117
|
-
modelId,
|
|
118
|
-
line_id,
|
|
119
|
-
);
|
|
120
|
-
const no_data_color = modelLinesVertexAttribute.modelLinesVertexAttributeNoDataColor(
|
|
121
|
-
modelId,
|
|
122
|
-
line_id,
|
|
123
|
-
);
|
|
124
|
-
const attribute = {
|
|
125
|
-
name,
|
|
126
|
-
item,
|
|
127
|
-
minimum,
|
|
128
|
-
maximum,
|
|
129
|
-
colorMap,
|
|
130
|
-
no_data_color,
|
|
131
|
-
};
|
|
132
|
-
if (!isModelLinesVertexAttributeValid(attribute)) {
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
const key = [name, item, colorMap, minimum, maximum, JSON.stringify(no_data_color)].join(
|
|
136
|
-
"_",
|
|
137
|
-
);
|
|
138
|
-
vertexGroups[key] ??= { ...attribute, lines_ids: [] };
|
|
139
|
-
vertexGroups[key].lines_ids.push(line_id);
|
|
140
|
-
}
|
|
141
82
|
coloringPromises.push(
|
|
142
|
-
...
|
|
143
|
-
async ({ name, item, minimum, maximum, colorMap, no_data_color, lines_ids: ids }) => {
|
|
144
|
-
const result = await modelLinesVertexAttribute.setModelLinesVertexAttribute(
|
|
145
|
-
modelId,
|
|
146
|
-
ids,
|
|
147
|
-
{
|
|
148
|
-
name,
|
|
149
|
-
item,
|
|
150
|
-
minimum,
|
|
151
|
-
maximum,
|
|
152
|
-
colorMap,
|
|
153
|
-
no_data_color,
|
|
154
|
-
},
|
|
155
|
-
);
|
|
156
|
-
return result;
|
|
157
|
-
},
|
|
158
|
-
),
|
|
83
|
+
...applyModelLinesVertexColoring(modelId, type_lines_ids, modelLinesVertexAttribute),
|
|
159
84
|
);
|
|
160
85
|
} else if (type === "edge") {
|
|
161
|
-
const edgeGroups: Record<string, AttributeGroup> = {};
|
|
162
|
-
for (const line_id of type_lines_ids) {
|
|
163
|
-
const name = modelLinesEdgeAttribute.modelLinesEdgeAttributeName(modelId, line_id);
|
|
164
|
-
const item = modelLinesEdgeAttribute.modelLinesEdgeAttributeItem(modelId, line_id);
|
|
165
|
-
const [minimum, maximum] = modelLinesEdgeAttribute.modelLinesEdgeAttributeRange(
|
|
166
|
-
modelId,
|
|
167
|
-
line_id,
|
|
168
|
-
);
|
|
169
|
-
const colorMap = modelLinesEdgeAttribute.modelLinesEdgeAttributeColorMap(
|
|
170
|
-
modelId,
|
|
171
|
-
line_id,
|
|
172
|
-
);
|
|
173
|
-
const no_data_color = modelLinesEdgeAttribute.modelLinesEdgeAttributeNoDataColor(
|
|
174
|
-
modelId,
|
|
175
|
-
line_id,
|
|
176
|
-
);
|
|
177
|
-
const attribute = {
|
|
178
|
-
name,
|
|
179
|
-
item,
|
|
180
|
-
minimum,
|
|
181
|
-
maximum,
|
|
182
|
-
colorMap,
|
|
183
|
-
no_data_color,
|
|
184
|
-
};
|
|
185
|
-
if (!isModelLinesEdgeAttributeValid(attribute)) {
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
const key = [name, item, colorMap, minimum, maximum, JSON.stringify(no_data_color)].join(
|
|
189
|
-
"_",
|
|
190
|
-
);
|
|
191
|
-
edgeGroups[key] ??= { ...attribute, lines_ids: [] };
|
|
192
|
-
edgeGroups[key].lines_ids.push(line_id);
|
|
193
|
-
}
|
|
194
86
|
coloringPromises.push(
|
|
195
|
-
...
|
|
196
|
-
async ({ name, item, minimum, maximum, colorMap, no_data_color, lines_ids: ids }) => {
|
|
197
|
-
const result = await modelLinesEdgeAttribute.setModelLinesEdgeAttribute(
|
|
198
|
-
modelId,
|
|
199
|
-
ids,
|
|
200
|
-
{
|
|
201
|
-
name,
|
|
202
|
-
item,
|
|
203
|
-
minimum,
|
|
204
|
-
maximum,
|
|
205
|
-
colorMap,
|
|
206
|
-
no_data_color,
|
|
207
|
-
},
|
|
208
|
-
);
|
|
209
|
-
return result;
|
|
210
|
-
},
|
|
211
|
-
),
|
|
87
|
+
...applyModelLinesEdgeColoring(modelId, type_lines_ids, modelLinesEdgeAttribute),
|
|
212
88
|
);
|
|
213
89
|
}
|
|
214
90
|
}
|
|
@@ -322,16 +322,20 @@ function useModelLinesVertexAttribute(): UseModelLinesVertexAttributeReturn {
|
|
|
322
322
|
reapplySameSeries(
|
|
323
323
|
await dataStore.getLinesGeodeIds(modelId),
|
|
324
324
|
lineIds,
|
|
325
|
-
(id) =>
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
325
|
+
(id) => {
|
|
326
|
+
if (
|
|
327
|
+
modelLinesCommonStyle.modelLineColoring(modelId, id).active === "vertex" &&
|
|
328
|
+
modelLinesVertexAttributeName(modelId, id) === name
|
|
329
|
+
) {
|
|
330
|
+
return [
|
|
331
|
+
modelLinesVertexAttributeItem(modelId, id),
|
|
332
|
+
modelLinesVertexAttributeRange(modelId, id),
|
|
333
|
+
modelLinesVertexAttributeColorMap(modelId, id),
|
|
334
|
+
JSON.stringify(modelLinesVertexAttributeNoDataColor(modelId, id)),
|
|
335
|
+
].join("|");
|
|
336
|
+
}
|
|
337
|
+
return undefined;
|
|
338
|
+
},
|
|
335
339
|
async (ids) => {
|
|
336
340
|
await applyVertexAttribute(modelId, ids);
|
|
337
341
|
},
|