@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.
- package/.build/server/utils/scripts.js +34 -23
- package/app/components/BasemapAttribution.vue +28 -0
- package/app/components/MissingFilesSelector.vue +30 -17
- package/app/components/ObjectSelector.vue +34 -23
- package/app/components/Viewer/Basemap/CropOptions.vue +50 -0
- package/app/components/Viewer/Basemap/OpacityOptions.vue +52 -0
- package/app/components/Viewer/ContextMenu/ContextMenu.vue +5 -1
- package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +6 -2
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +49 -10
- package/app/components/Viewer/Ui.vue +6 -0
- package/app/composables/overlapping_picker_menu.ts +43 -0
- package/app/composables/project_manager_helpers/reset.ts +3 -0
- package/app/composables/project_manager_helpers/restore.ts +22 -10
- package/app/composables/project_manager_helpers/types.ts +2 -0
- package/app/composables/use_overlapping_picker.ts +23 -37
- package/app/composables/viewer_context_menu.ts +10 -0
- package/app/composables/virtual_tree_flatten.ts +66 -43
- package/app/stores/app_helpers/extension.ts +90 -51
- package/app/stores/basemap.ts +52 -0
- package/app/stores/basemap_detail.ts +51 -0
- package/app/stores/basemap_helpers/builds.ts +158 -0
- package/app/stores/basemap_helpers/detail_layers.ts +72 -0
- package/app/stores/basemap_helpers/detail_map.ts +62 -0
- package/app/stores/basemap_helpers/detail_refresh.ts +134 -0
- package/app/stores/basemap_helpers/detail_view.ts +94 -0
- package/app/stores/basemap_helpers/extent.ts +40 -0
- package/app/stores/basemap_helpers/georeferenced.ts +50 -0
- package/app/stores/basemap_helpers/layers.ts +66 -0
- package/app/stores/basemap_helpers/settings.ts +87 -0
- package/app/stores/basemap_helpers/viewer.ts +114 -0
- package/app/stores/infra.ts +26 -21
- package/app/stores/menu_helpers/basemap.ts +10 -0
- package/app/stores/menu_helpers/menus_data.ts +2 -0
- package/app/utils/basemap_tree.ts +76 -0
- package/app/utils/color_picker.ts +18 -15
- package/app/utils/treeview.ts +12 -1
- package/app/utils/visible_map_area.ts +129 -0
- package/internal/database/database.ts +47 -32
- package/internal/stores/data_style/mesh/base_style.ts +74 -0
- package/internal/stores/data_style/mesh/index.ts +2 -57
- package/internal/stores/data_style/model/blocks/color.ts +58 -57
- package/internal/stores/data_style/model/blocks/polyhedron.ts +88 -44
- package/internal/stores/data_style/model/blocks/vertex.ts +88 -44
- package/internal/stores/data_style/model/color.ts +25 -26
- package/internal/stores/data_style/model/corners/index.ts +85 -78
- package/internal/stores/data_style/model/corners/vertex.ts +83 -39
- package/internal/stores/data_style/model/lines/color.ts +53 -40
- package/internal/stores/data_style/model/lines/edge.ts +88 -44
- package/internal/stores/data_style/model/lines/vertex.ts +88 -44
- package/internal/stores/data_style/model/surfaces/color.ts +68 -56
- package/internal/stores/data_style/model/surfaces/polygon.ts +80 -36
- package/internal/stores/data_style/model/surfaces/vertex.ts +80 -36
- package/internal/stores/data_style/model/visibility_dispatch.ts +49 -99
- package/internal/stores/hybrid_viewer/highlight.ts +70 -54
- package/internal/stores/hybrid_viewer/scene.ts +31 -25
- package/internal/stores/hybrid_viewer/vtk_types.ts +2 -1
- package/package.json +1 -1
- package/server/api/local/extensions/upload.put.ts +47 -20
- package/server/utils/scripts.ts +35 -30
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
// Third party imports
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
|
+
|
|
5
|
+
// Local imports
|
|
6
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
7
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
|
+
|
|
9
|
+
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
10
|
+
|
|
11
|
+
// Local constants
|
|
12
|
+
const meshSchemas = viewer_schemas.opengeodeweb_viewer.mesh;
|
|
13
|
+
|
|
14
|
+
interface MeshBaseStyle {
|
|
15
|
+
meshVisibility: (id: string) => boolean | undefined;
|
|
16
|
+
setMeshVisibility: (id: string, visibility: boolean) => Promise<unknown>;
|
|
17
|
+
meshColor: (id: string) => RGBAColor | undefined;
|
|
18
|
+
setMeshColor: (id: string, color: RGBAColor) => Promise<unknown>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function useMeshBaseStyle(): MeshBaseStyle {
|
|
22
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
23
|
+
const viewerStore = useViewerStore();
|
|
24
|
+
const dataStyleState = useDataStyleState();
|
|
25
|
+
|
|
26
|
+
function meshVisibility(id: string): boolean | undefined {
|
|
27
|
+
return dataStyleState.getStyle(id).visibility;
|
|
28
|
+
}
|
|
29
|
+
async function setMeshVisibility(id: string, visibility: boolean): Promise<unknown> {
|
|
30
|
+
const schema = meshSchemas.visibility;
|
|
31
|
+
const params = { id, visibility };
|
|
32
|
+
const result = await viewerStore.request(
|
|
33
|
+
{
|
|
34
|
+
schema,
|
|
35
|
+
params,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
response_function: async () => {
|
|
39
|
+
if (visibility !== undefined) {
|
|
40
|
+
hybridViewerStore.setVisibility(id, visibility);
|
|
41
|
+
}
|
|
42
|
+
const mutatedId = await dataStyleState.mutateStyle(id, { visibility });
|
|
43
|
+
return mutatedId;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function meshColor(id: string): RGBAColor | undefined {
|
|
51
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- color shape is defined by the data style schema.
|
|
52
|
+
return dataStyleState.getStyle(id).color as RGBAColor | undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function setMeshColor(id: string, color: RGBAColor): Promise<unknown> {
|
|
56
|
+
const schema = meshSchemas.color;
|
|
57
|
+
const params = { id, color };
|
|
58
|
+
const result = await viewerStore.request(
|
|
59
|
+
{
|
|
60
|
+
schema,
|
|
61
|
+
params,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
response_function: async () => {
|
|
65
|
+
const mutatedId = await dataStyleState.mutateStyle(id, { color });
|
|
66
|
+
return mutatedId;
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return { meshVisibility, setMeshVisibility, meshColor, setMeshColor };
|
|
74
|
+
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
-
// Third party imports
|
|
3
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
2
|
|
|
5
3
|
// Local imports
|
|
6
|
-
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
7
|
-
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
|
-
|
|
9
4
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
5
|
+
import { useMeshBaseStyle } from "./base_style";
|
|
10
6
|
import { useMeshCellsStyle } from "./cells";
|
|
11
7
|
import { useMeshEdgesStyle } from "./edges";
|
|
12
8
|
import { useMeshPointsStyle } from "./points";
|
|
@@ -14,9 +10,6 @@ import { useMeshPolygonsStyle } from "./polygons";
|
|
|
14
10
|
import { useMeshPolyhedraStyle } from "./polyhedra";
|
|
15
11
|
import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
|
|
16
12
|
|
|
17
|
-
// Local constants
|
|
18
|
-
const meshSchemas = viewer_schemas.opengeodeweb_viewer.mesh;
|
|
19
|
-
|
|
20
13
|
// oxlint-disable-next-line max-lines-per-function
|
|
21
14
|
export function useMeshStyle(): {
|
|
22
15
|
meshVisibility: (id: string) => boolean | undefined;
|
|
@@ -29,62 +22,14 @@ export function useMeshStyle(): {
|
|
|
29
22
|
ReturnType<typeof useMeshCellsStyle> &
|
|
30
23
|
ReturnType<typeof useMeshPolygonsStyle> &
|
|
31
24
|
ReturnType<typeof useMeshPolyhedraStyle> {
|
|
32
|
-
const hybridViewerStore = useHybridViewerStore();
|
|
33
|
-
const viewerStore = useViewerStore();
|
|
34
25
|
const dataStyleState = useDataStyleState();
|
|
26
|
+
const { meshVisibility, setMeshVisibility, meshColor, setMeshColor } = useMeshBaseStyle();
|
|
35
27
|
const meshPointsStyle = useMeshPointsStyle();
|
|
36
28
|
const meshEdgesStyle = useMeshEdgesStyle();
|
|
37
29
|
const meshCellsStyle = useMeshCellsStyle();
|
|
38
30
|
const meshPolygonsStyle = useMeshPolygonsStyle();
|
|
39
31
|
const meshPolyhedraStyle = useMeshPolyhedraStyle();
|
|
40
32
|
|
|
41
|
-
function meshVisibility(id: string): boolean | undefined {
|
|
42
|
-
return dataStyleState.getStyle(id).visibility;
|
|
43
|
-
}
|
|
44
|
-
async function setMeshVisibility(id: string, visibility: boolean): Promise<unknown> {
|
|
45
|
-
const schema = meshSchemas.visibility;
|
|
46
|
-
const params = { id, visibility };
|
|
47
|
-
const result = await viewerStore.request(
|
|
48
|
-
{
|
|
49
|
-
schema,
|
|
50
|
-
params,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
response_function: async () => {
|
|
54
|
-
if (visibility !== undefined) {
|
|
55
|
-
hybridViewerStore.setVisibility(id, visibility);
|
|
56
|
-
}
|
|
57
|
-
const mutatedId = await dataStyleState.mutateStyle(id, { visibility });
|
|
58
|
-
return mutatedId;
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
);
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function meshColor(id: string): RGBAColor | undefined {
|
|
66
|
-
// oxlint-disable-next-line no-unsafe-type-assertion -- color shape is defined by the data style schema.
|
|
67
|
-
return dataStyleState.getStyle(id).color as RGBAColor | undefined;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async function setMeshColor(id: string, color: RGBAColor): Promise<unknown> {
|
|
71
|
-
const schema = meshSchemas.color;
|
|
72
|
-
const params = { id, color };
|
|
73
|
-
const result = await viewerStore.request(
|
|
74
|
-
{
|
|
75
|
-
schema,
|
|
76
|
-
params,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
response_function: async () => {
|
|
80
|
-
const mutatedId = await dataStyleState.mutateStyle(id, { color });
|
|
81
|
-
return mutatedId;
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
);
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
33
|
const pointsCard = {
|
|
89
34
|
key: "points",
|
|
90
35
|
name: meshPointsStyle.meshPointsVertexAttributeName,
|
|
@@ -68,6 +68,62 @@ export function useModelBlocksColor(): {
|
|
|
68
68
|
return modelBlockColoring(id, block_id).active;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
async function applyVertexColoring(modelId: string, blocks_ids: string[]): Promise<void> {
|
|
72
|
+
const name = modelBlocksVertexAttribute.modelBlocksVertexAttributeName(modelId, blocks_ids[0]);
|
|
73
|
+
const item = modelBlocksVertexAttribute.modelBlocksVertexAttributeItem(modelId, blocks_ids[0]);
|
|
74
|
+
const [minimum, maximum] = modelBlocksVertexAttribute.modelBlocksVertexAttributeRange(
|
|
75
|
+
modelId,
|
|
76
|
+
blocks_ids[0],
|
|
77
|
+
);
|
|
78
|
+
const colorMap = modelBlocksVertexAttribute.modelBlocksVertexAttributeColorMap(
|
|
79
|
+
modelId,
|
|
80
|
+
blocks_ids[0],
|
|
81
|
+
);
|
|
82
|
+
const no_data_color = modelBlocksVertexAttribute.modelBlocksVertexAttributeNoDataColor(
|
|
83
|
+
modelId,
|
|
84
|
+
blocks_ids[0],
|
|
85
|
+
);
|
|
86
|
+
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
87
|
+
if (isModelBlocksVertexAttributeValid(attribute)) {
|
|
88
|
+
await modelBlocksVertexAttribute.setModelBlocksVertexAttribute(
|
|
89
|
+
modelId,
|
|
90
|
+
blocks_ids,
|
|
91
|
+
attribute,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function applyPolyhedronColoring(modelId: string, blocks_ids: string[]): Promise<void> {
|
|
97
|
+
const name = modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeName(
|
|
98
|
+
modelId,
|
|
99
|
+
blocks_ids[0],
|
|
100
|
+
);
|
|
101
|
+
const item = modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeItem(
|
|
102
|
+
modelId,
|
|
103
|
+
blocks_ids[0],
|
|
104
|
+
);
|
|
105
|
+
const [minimum, maximum] = modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeRange(
|
|
106
|
+
modelId,
|
|
107
|
+
blocks_ids[0],
|
|
108
|
+
);
|
|
109
|
+
const colorMap = modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeColorMap(
|
|
110
|
+
modelId,
|
|
111
|
+
blocks_ids[0],
|
|
112
|
+
);
|
|
113
|
+
const no_data_color = modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeNoDataColor(
|
|
114
|
+
modelId,
|
|
115
|
+
blocks_ids[0],
|
|
116
|
+
);
|
|
117
|
+
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
118
|
+
if (isModelBlocksPolyhedronAttributeValid(attribute)) {
|
|
119
|
+
await modelBlocksPolyhedronAttribute.setModelBlocksPolyhedronAttribute(
|
|
120
|
+
modelId,
|
|
121
|
+
blocks_ids,
|
|
122
|
+
attribute,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
71
127
|
async function setModelBlocksActiveColoring(
|
|
72
128
|
modelId: string,
|
|
73
129
|
blocks_ids: string[],
|
|
@@ -90,64 +146,9 @@ export function useModelBlocksColor(): {
|
|
|
90
146
|
}
|
|
91
147
|
|
|
92
148
|
if (activeColoring === "vertex") {
|
|
93
|
-
|
|
94
|
-
modelId,
|
|
95
|
-
blocks_ids[0],
|
|
96
|
-
);
|
|
97
|
-
const item = modelBlocksVertexAttribute.modelBlocksVertexAttributeItem(
|
|
98
|
-
modelId,
|
|
99
|
-
blocks_ids[0],
|
|
100
|
-
);
|
|
101
|
-
const [minimum, maximum] = modelBlocksVertexAttribute.modelBlocksVertexAttributeRange(
|
|
102
|
-
modelId,
|
|
103
|
-
blocks_ids[0],
|
|
104
|
-
);
|
|
105
|
-
const colorMap = modelBlocksVertexAttribute.modelBlocksVertexAttributeColorMap(
|
|
106
|
-
modelId,
|
|
107
|
-
blocks_ids[0],
|
|
108
|
-
);
|
|
109
|
-
const no_data_color = modelBlocksVertexAttribute.modelBlocksVertexAttributeNoDataColor(
|
|
110
|
-
modelId,
|
|
111
|
-
blocks_ids[0],
|
|
112
|
-
);
|
|
113
|
-
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
114
|
-
if (isModelBlocksVertexAttributeValid(attribute)) {
|
|
115
|
-
await modelBlocksVertexAttribute.setModelBlocksVertexAttribute(
|
|
116
|
-
modelId,
|
|
117
|
-
blocks_ids,
|
|
118
|
-
attribute,
|
|
119
|
-
);
|
|
120
|
-
}
|
|
149
|
+
await applyVertexColoring(modelId, blocks_ids);
|
|
121
150
|
} else if (activeColoring === "polyhedron") {
|
|
122
|
-
|
|
123
|
-
modelId,
|
|
124
|
-
blocks_ids[0],
|
|
125
|
-
);
|
|
126
|
-
const item = modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeItem(
|
|
127
|
-
modelId,
|
|
128
|
-
blocks_ids[0],
|
|
129
|
-
);
|
|
130
|
-
const [minimum, maximum] = modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeRange(
|
|
131
|
-
modelId,
|
|
132
|
-
blocks_ids[0],
|
|
133
|
-
);
|
|
134
|
-
const colorMap = modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeColorMap(
|
|
135
|
-
modelId,
|
|
136
|
-
blocks_ids[0],
|
|
137
|
-
);
|
|
138
|
-
const no_data_color =
|
|
139
|
-
modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeNoDataColor(
|
|
140
|
-
modelId,
|
|
141
|
-
blocks_ids[0],
|
|
142
|
-
);
|
|
143
|
-
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
144
|
-
if (isModelBlocksPolyhedronAttributeValid(attribute)) {
|
|
145
|
-
await modelBlocksPolyhedronAttribute.setModelBlocksPolyhedronAttribute(
|
|
146
|
-
modelId,
|
|
147
|
-
blocks_ids,
|
|
148
|
-
attribute,
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
+
await applyPolyhedronColoring(modelId, blocks_ids);
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
|
|
@@ -114,12 +114,28 @@ interface UseModelBlocksPolyhedronAttributeReturn {
|
|
|
114
114
|
) => Promise<boolean>;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
type ModelBlocksPolyhedronAttributeGetters = Pick<
|
|
118
|
+
UseModelBlocksPolyhedronAttributeReturn,
|
|
119
|
+
| "modelBlocksPolyhedronAttributeStoredConfig"
|
|
120
|
+
| "modelBlocksPolyhedronAttributeName"
|
|
121
|
+
| "modelBlocksPolyhedronAttributeItem"
|
|
122
|
+
| "modelBlocksPolyhedronAttributeRange"
|
|
123
|
+
| "modelBlocksPolyhedronAttributeColorMap"
|
|
124
|
+
| "modelBlocksPolyhedronAttributeNoDataColor"
|
|
125
|
+
| "modelBlocksPolyhedronAttributeTimeStep"
|
|
126
|
+
> & {
|
|
127
|
+
modelBlocksPolyhedronAttributeLastItem: (
|
|
128
|
+
modelId: string,
|
|
129
|
+
componentId: string | undefined,
|
|
130
|
+
name: string | undefined,
|
|
131
|
+
) => number;
|
|
132
|
+
};
|
|
133
|
+
|
|
117
134
|
// oxlint-disable-next-line max-lines-per-function
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
const viewerStore = useViewerStore();
|
|
135
|
+
function useModelBlocksPolyhedronAttributeGetters(
|
|
136
|
+
modelBlocksCommonStyle: ReturnType<typeof useModelBlocksCommonStyle>,
|
|
137
|
+
): ModelBlocksPolyhedronAttributeGetters {
|
|
138
|
+
const { attributeTimeStep } = useAttributeTimeStepStyle();
|
|
123
139
|
function modelBlocksPolyhedronAttribute(modelId: string, blockId?: string): AttributeState {
|
|
124
140
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.polyhedron shape is defined by the data style schema.
|
|
125
141
|
return modelBlocksCommonStyle.modelBlockColoring(modelId, blockId).polyhedron as AttributeState;
|
|
@@ -143,45 +159,6 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
|
|
|
143
159
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
144
160
|
};
|
|
145
161
|
}
|
|
146
|
-
async function mutateModelBlocksPolyhedronStyle(
|
|
147
|
-
modelId: string,
|
|
148
|
-
blockIds: string[],
|
|
149
|
-
values: Record<string, unknown>,
|
|
150
|
-
): Promise<void> {
|
|
151
|
-
const tasks: Promise<void>[] = [
|
|
152
|
-
modelBlocksCommonStyle.mutateModelBlocksColoring(modelId, blockIds, {
|
|
153
|
-
polyhedron: values,
|
|
154
|
-
}),
|
|
155
|
-
];
|
|
156
|
-
const totalBlockIds = await dataStore.getBlocksGeodeIds(modelId);
|
|
157
|
-
if (blockIds.length === totalBlockIds.length) {
|
|
158
|
-
tasks.push(
|
|
159
|
-
modelBlocksCommonStyle.mutateModelBlocksTypeColoring(modelId, {
|
|
160
|
-
polyhedron: values,
|
|
161
|
-
}),
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
await Promise.all(tasks);
|
|
165
|
-
}
|
|
166
|
-
async function setModelBlocksPolyhedronAttributeStoredConfig(
|
|
167
|
-
modelId: string,
|
|
168
|
-
blockIds: string[],
|
|
169
|
-
name: string | undefined,
|
|
170
|
-
item: number | undefined,
|
|
171
|
-
config: Partial<AttributeStoredConfig>,
|
|
172
|
-
): Promise<void> {
|
|
173
|
-
if (name === undefined || item === undefined) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
await mutateModelBlocksPolyhedronStyle(modelId, blockIds, {
|
|
177
|
-
storedConfigs: {
|
|
178
|
-
[name]: {
|
|
179
|
-
lastItem: item,
|
|
180
|
-
[item]: config,
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
162
|
function modelBlocksPolyhedronAttributeName(
|
|
186
163
|
modelId: string,
|
|
187
164
|
blockId?: string,
|
|
@@ -242,6 +219,73 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
|
|
|
242
219
|
modelBlocksPolyhedronAttribute(modelId, blockId).name,
|
|
243
220
|
);
|
|
244
221
|
}
|
|
222
|
+
return {
|
|
223
|
+
modelBlocksPolyhedronAttributeStoredConfig,
|
|
224
|
+
modelBlocksPolyhedronAttributeName,
|
|
225
|
+
modelBlocksPolyhedronAttributeLastItem,
|
|
226
|
+
modelBlocksPolyhedronAttributeItem,
|
|
227
|
+
modelBlocksPolyhedronAttributeRange,
|
|
228
|
+
modelBlocksPolyhedronAttributeColorMap,
|
|
229
|
+
modelBlocksPolyhedronAttributeNoDataColor,
|
|
230
|
+
modelBlocksPolyhedronAttributeTimeStep,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// oxlint-disable-next-line max-lines-per-function
|
|
235
|
+
function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeReturn {
|
|
236
|
+
const { setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
|
|
237
|
+
const dataStore = useDataStore();
|
|
238
|
+
const modelBlocksCommonStyle = useModelBlocksCommonStyle();
|
|
239
|
+
const {
|
|
240
|
+
modelBlocksPolyhedronAttributeStoredConfig,
|
|
241
|
+
modelBlocksPolyhedronAttributeName,
|
|
242
|
+
modelBlocksPolyhedronAttributeLastItem,
|
|
243
|
+
modelBlocksPolyhedronAttributeItem,
|
|
244
|
+
modelBlocksPolyhedronAttributeRange,
|
|
245
|
+
modelBlocksPolyhedronAttributeColorMap,
|
|
246
|
+
modelBlocksPolyhedronAttributeNoDataColor,
|
|
247
|
+
modelBlocksPolyhedronAttributeTimeStep,
|
|
248
|
+
} = useModelBlocksPolyhedronAttributeGetters(modelBlocksCommonStyle);
|
|
249
|
+
const viewerStore = useViewerStore();
|
|
250
|
+
async function mutateModelBlocksPolyhedronStyle(
|
|
251
|
+
modelId: string,
|
|
252
|
+
blockIds: string[],
|
|
253
|
+
values: Record<string, unknown>,
|
|
254
|
+
): Promise<void> {
|
|
255
|
+
const tasks: Promise<void>[] = [
|
|
256
|
+
modelBlocksCommonStyle.mutateModelBlocksColoring(modelId, blockIds, {
|
|
257
|
+
polyhedron: values,
|
|
258
|
+
}),
|
|
259
|
+
];
|
|
260
|
+
const totalBlockIds = await dataStore.getBlocksGeodeIds(modelId);
|
|
261
|
+
if (blockIds.length === totalBlockIds.length) {
|
|
262
|
+
tasks.push(
|
|
263
|
+
modelBlocksCommonStyle.mutateModelBlocksTypeColoring(modelId, {
|
|
264
|
+
polyhedron: values,
|
|
265
|
+
}),
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
await Promise.all(tasks);
|
|
269
|
+
}
|
|
270
|
+
async function setModelBlocksPolyhedronAttributeStoredConfig(
|
|
271
|
+
modelId: string,
|
|
272
|
+
blockIds: string[],
|
|
273
|
+
name: string | undefined,
|
|
274
|
+
item: number | undefined,
|
|
275
|
+
config: Partial<AttributeStoredConfig>,
|
|
276
|
+
): Promise<void> {
|
|
277
|
+
if (name === undefined || item === undefined) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
await mutateModelBlocksPolyhedronStyle(modelId, blockIds, {
|
|
281
|
+
storedConfigs: {
|
|
282
|
+
[name]: {
|
|
283
|
+
lastItem: item,
|
|
284
|
+
[item]: config,
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
}
|
|
245
289
|
async function setModelBlocksPolyhedronAttribute(
|
|
246
290
|
modelId: string,
|
|
247
291
|
blockIds: string[],
|
|
@@ -111,12 +111,28 @@ interface UseModelBlocksVertexAttributeReturn {
|
|
|
111
111
|
) => Promise<unknown>;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
type ModelBlocksVertexAttributeGetters = Pick<
|
|
115
|
+
UseModelBlocksVertexAttributeReturn,
|
|
116
|
+
| "modelBlocksVertexAttributeStoredConfig"
|
|
117
|
+
| "modelBlocksVertexAttributeName"
|
|
118
|
+
| "modelBlocksVertexAttributeItem"
|
|
119
|
+
| "modelBlocksVertexAttributeRange"
|
|
120
|
+
| "modelBlocksVertexAttributeColorMap"
|
|
121
|
+
| "modelBlocksVertexAttributeNoDataColor"
|
|
122
|
+
| "modelBlocksVertexAttributeTimeStep"
|
|
123
|
+
> & {
|
|
124
|
+
modelBlocksVertexAttributeLastItem: (
|
|
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
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
const viewerStore = useViewerStore();
|
|
132
|
+
function useModelBlocksVertexAttributeGetters(
|
|
133
|
+
modelBlocksCommonStyle: ReturnType<typeof useModelBlocksCommonStyle>,
|
|
134
|
+
): ModelBlocksVertexAttributeGetters {
|
|
135
|
+
const { attributeTimeStep } = useAttributeTimeStepStyle();
|
|
120
136
|
function modelBlocksVertexAttribute(modelId: string, blockId?: 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 modelBlocksCommonStyle.modelBlockColoring(modelId, blockId).vertex as AttributeState;
|
|
@@ -140,45 +156,6 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
140
156
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
141
157
|
};
|
|
142
158
|
}
|
|
143
|
-
async function mutateModelBlocksVertexStyle(
|
|
144
|
-
modelId: string,
|
|
145
|
-
blockIds: string[],
|
|
146
|
-
values: Record<string, unknown>,
|
|
147
|
-
): Promise<void> {
|
|
148
|
-
const tasks: Promise<void>[] = [
|
|
149
|
-
modelBlocksCommonStyle.mutateModelBlocksColoring(modelId, blockIds, {
|
|
150
|
-
vertex: values,
|
|
151
|
-
}),
|
|
152
|
-
];
|
|
153
|
-
const totalBlockIds = await dataStore.getBlocksGeodeIds(modelId);
|
|
154
|
-
if (blockIds.length === totalBlockIds.length) {
|
|
155
|
-
tasks.push(
|
|
156
|
-
modelBlocksCommonStyle.mutateModelBlocksTypeColoring(modelId, {
|
|
157
|
-
vertex: values,
|
|
158
|
-
}),
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
await Promise.all(tasks);
|
|
162
|
-
}
|
|
163
|
-
async function setModelBlocksVertexAttributeStoredConfig(
|
|
164
|
-
modelId: string,
|
|
165
|
-
blockIds: 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 mutateModelBlocksVertexStyle(modelId, blockIds, {
|
|
174
|
-
storedConfigs: {
|
|
175
|
-
[name]: {
|
|
176
|
-
lastItem: item,
|
|
177
|
-
[item]: config,
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
159
|
function modelBlocksVertexAttributeName(modelId: string, blockId?: string): string | undefined {
|
|
183
160
|
return modelBlocksVertexAttribute(modelId, blockId).name;
|
|
184
161
|
}
|
|
@@ -236,6 +213,73 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
236
213
|
modelBlocksVertexAttribute(modelId, blockId).name,
|
|
237
214
|
);
|
|
238
215
|
}
|
|
216
|
+
return {
|
|
217
|
+
modelBlocksVertexAttributeStoredConfig,
|
|
218
|
+
modelBlocksVertexAttributeName,
|
|
219
|
+
modelBlocksVertexAttributeLastItem,
|
|
220
|
+
modelBlocksVertexAttributeItem,
|
|
221
|
+
modelBlocksVertexAttributeRange,
|
|
222
|
+
modelBlocksVertexAttributeColorMap,
|
|
223
|
+
modelBlocksVertexAttributeNoDataColor,
|
|
224
|
+
modelBlocksVertexAttributeTimeStep,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// oxlint-disable-next-line max-lines-per-function
|
|
229
|
+
function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
230
|
+
const { setAttributeTimeStep, seriesArrayName } = useAttributeTimeStepStyle();
|
|
231
|
+
const dataStore = useDataStore();
|
|
232
|
+
const modelBlocksCommonStyle = useModelBlocksCommonStyle();
|
|
233
|
+
const {
|
|
234
|
+
modelBlocksVertexAttributeStoredConfig,
|
|
235
|
+
modelBlocksVertexAttributeName,
|
|
236
|
+
modelBlocksVertexAttributeLastItem,
|
|
237
|
+
modelBlocksVertexAttributeItem,
|
|
238
|
+
modelBlocksVertexAttributeRange,
|
|
239
|
+
modelBlocksVertexAttributeColorMap,
|
|
240
|
+
modelBlocksVertexAttributeNoDataColor,
|
|
241
|
+
modelBlocksVertexAttributeTimeStep,
|
|
242
|
+
} = useModelBlocksVertexAttributeGetters(modelBlocksCommonStyle);
|
|
243
|
+
const viewerStore = useViewerStore();
|
|
244
|
+
async function mutateModelBlocksVertexStyle(
|
|
245
|
+
modelId: string,
|
|
246
|
+
blockIds: string[],
|
|
247
|
+
values: Record<string, unknown>,
|
|
248
|
+
): Promise<void> {
|
|
249
|
+
const tasks: Promise<void>[] = [
|
|
250
|
+
modelBlocksCommonStyle.mutateModelBlocksColoring(modelId, blockIds, {
|
|
251
|
+
vertex: values,
|
|
252
|
+
}),
|
|
253
|
+
];
|
|
254
|
+
const totalBlockIds = await dataStore.getBlocksGeodeIds(modelId);
|
|
255
|
+
if (blockIds.length === totalBlockIds.length) {
|
|
256
|
+
tasks.push(
|
|
257
|
+
modelBlocksCommonStyle.mutateModelBlocksTypeColoring(modelId, {
|
|
258
|
+
vertex: values,
|
|
259
|
+
}),
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
await Promise.all(tasks);
|
|
263
|
+
}
|
|
264
|
+
async function setModelBlocksVertexAttributeStoredConfig(
|
|
265
|
+
modelId: string,
|
|
266
|
+
blockIds: string[],
|
|
267
|
+
name: string | undefined,
|
|
268
|
+
item: number | undefined,
|
|
269
|
+
config: Partial<AttributeStoredConfig>,
|
|
270
|
+
): Promise<void> {
|
|
271
|
+
if (name === undefined || item === undefined) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
await mutateModelBlocksVertexStyle(modelId, blockIds, {
|
|
275
|
+
storedConfigs: {
|
|
276
|
+
[name]: {
|
|
277
|
+
lastItem: item,
|
|
278
|
+
[item]: config,
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
}
|
|
239
283
|
async function setModelBlocksVertexAttribute(
|
|
240
284
|
modelId: string,
|
|
241
285
|
blockIds: string[],
|
|
@@ -46,6 +46,29 @@ function attributeFn<Signature>(method: unknown): Signature {
|
|
|
46
46
|
return method as Signature;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
// Re-applies the attribute name, range and color map of `firstId` to every id in `componentIds`
|
|
50
|
+
async function applyAttributeAccessors(
|
|
51
|
+
modelId: string,
|
|
52
|
+
componentIds: string[],
|
|
53
|
+
firstId: string,
|
|
54
|
+
accessors: AttributeAccessors,
|
|
55
|
+
): Promise<void> {
|
|
56
|
+
const { getName, setName, getRange, setRange, getColorMap, setColorMap } = accessors;
|
|
57
|
+
const name = getName(modelId, firstId);
|
|
58
|
+
if (name === undefined || name === "") {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
await setName(modelId, componentIds, name);
|
|
62
|
+
const [minimum, maximum] = getRange(modelId, firstId);
|
|
63
|
+
if (minimum !== undefined && maximum !== undefined) {
|
|
64
|
+
await setRange(modelId, componentIds, minimum, maximum);
|
|
65
|
+
}
|
|
66
|
+
const colorMap = getColorMap(modelId, firstId);
|
|
67
|
+
if (colorMap !== undefined && colorMap !== "") {
|
|
68
|
+
await setColorMap(modelId, componentIds, colorMap);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
49
72
|
// oxlint-disable-next-line max-lines-per-function
|
|
50
73
|
function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
51
74
|
getModelColor: (modelId: string) => RGBAColor | undefined;
|
|
@@ -270,23 +293,11 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
270
293
|
if (attributeFunctions === undefined) {
|
|
271
294
|
return;
|
|
272
295
|
}
|
|
273
|
-
const { getName, setName, getRange, setRange, getColorMap, setColorMap } = attributeFunctions;
|
|
274
296
|
const [firstId] = idsForType;
|
|
275
297
|
if (firstId === undefined) {
|
|
276
298
|
return;
|
|
277
299
|
}
|
|
278
|
-
|
|
279
|
-
if (name !== undefined && name !== "") {
|
|
280
|
-
await setName(modelId, idsForType, name);
|
|
281
|
-
const [minimum, maximum] = getRange(modelId, firstId);
|
|
282
|
-
if (minimum !== undefined && maximum !== undefined) {
|
|
283
|
-
await setRange(modelId, idsForType, minimum, maximum);
|
|
284
|
-
}
|
|
285
|
-
const colorMap = getColorMap(modelId, firstId);
|
|
286
|
-
if (colorMap !== undefined && colorMap !== "") {
|
|
287
|
-
await setColorMap(modelId, idsForType, colorMap);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
300
|
+
await applyAttributeAccessors(modelId, idsForType, firstId, attributeFunctions);
|
|
290
301
|
}
|
|
291
302
|
async function setModelComponentActiveColoring(
|
|
292
303
|
modelId: string,
|
|
@@ -310,19 +321,7 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
310
321
|
if (attributeFunctions === undefined) {
|
|
311
322
|
return;
|
|
312
323
|
}
|
|
313
|
-
|
|
314
|
-
const name = getName(modelId, componentId);
|
|
315
|
-
if (name !== undefined && name !== "") {
|
|
316
|
-
await setName(modelId, [componentId], name);
|
|
317
|
-
const [minimum, maximum] = getRange(modelId, componentId);
|
|
318
|
-
if (minimum !== undefined && maximum !== undefined) {
|
|
319
|
-
await setRange(modelId, [componentId], minimum, maximum);
|
|
320
|
-
}
|
|
321
|
-
const colorMap = getColorMap(modelId, componentId);
|
|
322
|
-
if (colorMap !== undefined && colorMap !== "") {
|
|
323
|
-
await setColorMap(modelId, [componentId], colorMap);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
324
|
+
await applyAttributeAccessors(modelId, [componentId], componentId, attributeFunctions);
|
|
326
325
|
}
|
|
327
326
|
function getModelColor(modelId: string): RGBAColor | undefined {
|
|
328
327
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|