@geode/opengeodeweb-front 10.7.0 → 10.8.0-rc.2
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/app/components/ObjectSelector.vue +0 -2
- package/app/components/Viewer/BreadCrumb.vue +6 -1
- package/app/components/Viewer/TreeComponent.vue +8 -9
- package/app/stores/app.js +1 -0
- package/app/stores/data.js +16 -3
- package/app/stores/data_style.js +28 -25
- package/app/stores/hybrid_viewer.js +0 -1
- package/app/utils/extension.js +1 -1
- package/app/utils/file_import_workflow.js +1 -0
- package/app/utils/local/cleanup.js +5 -1
- package/app/utils/local/microservices.js +1 -13
- package/app/utils/local/path.js +20 -1
- package/internal/database/base_database.js +22 -0
- package/internal/database/database.js +5 -20
- package/internal/database/extended_database.js +3 -10
- package/internal/database/tables/data_style.js +4 -0
- package/internal/database/tables/model_component_datastyle.js +4 -0
- package/internal/stores/data_style/mesh/cells/cell.js +12 -39
- package/internal/stores/data_style/mesh/cells/color.js +4 -4
- package/internal/stores/data_style/mesh/cells/common.js +19 -3
- package/internal/stores/data_style/mesh/cells/index.js +16 -10
- package/internal/stores/data_style/mesh/cells/textures.js +4 -4
- package/internal/stores/data_style/mesh/cells/vertex.js +35 -42
- package/internal/stores/data_style/mesh/cells/visibility.js +1 -4
- package/internal/stores/data_style/mesh/edges/color.js +4 -4
- package/internal/stores/data_style/mesh/edges/common.js +12 -3
- package/internal/stores/data_style/mesh/edges/edge.js +40 -40
- package/internal/stores/data_style/mesh/edges/index.js +18 -19
- package/internal/stores/data_style/mesh/edges/vertex.js +37 -44
- package/internal/stores/data_style/mesh/edges/visibility.js +1 -5
- package/internal/stores/data_style/mesh/edges/width.js +1 -5
- package/internal/stores/data_style/mesh/index.js +32 -5
- package/internal/stores/data_style/mesh/points/color.js +4 -4
- package/internal/stores/data_style/mesh/points/common.js +12 -3
- package/internal/stores/data_style/mesh/points/index.js +34 -32
- package/internal/stores/data_style/mesh/points/size.js +1 -4
- package/internal/stores/data_style/mesh/points/vertex.js +79 -65
- package/internal/stores/data_style/mesh/points/visibility.js +1 -4
- package/internal/stores/data_style/mesh/polygons/color.js +4 -4
- package/internal/stores/data_style/mesh/polygons/common.js +12 -3
- package/internal/stores/data_style/mesh/polygons/index.js +35 -24
- package/internal/stores/data_style/mesh/polygons/polygon.js +40 -34
- package/internal/stores/data_style/mesh/polygons/textures.js +4 -4
- package/internal/stores/data_style/mesh/polygons/vertex.js +35 -42
- package/internal/stores/data_style/mesh/polygons/visibility.js +4 -4
- package/internal/stores/data_style/mesh/polyhedra/color.js +4 -4
- package/internal/stores/data_style/mesh/polyhedra/common.js +12 -3
- package/internal/stores/data_style/mesh/polyhedra/index.js +21 -11
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +80 -60
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +79 -65
- package/internal/stores/data_style/mesh/polyhedra/visibility.js +4 -4
- package/internal/stores/data_style/model/blocks/color.js +17 -29
- package/internal/stores/data_style/model/blocks/common.js +14 -4
- package/internal/stores/data_style/model/blocks/index.js +38 -8
- package/internal/stores/data_style/model/blocks/visibility.js +19 -30
- package/internal/stores/data_style/model/corners/color.js +16 -29
- package/internal/stores/data_style/model/corners/common.js +14 -4
- package/internal/stores/data_style/model/corners/index.js +42 -8
- package/internal/stores/data_style/model/corners/visibility.js +16 -29
- package/internal/stores/data_style/model/edges/common.js +8 -1
- package/internal/stores/data_style/model/edges/index.js +2 -5
- package/internal/stores/data_style/model/edges/visibility.js +7 -5
- package/internal/stores/data_style/model/index.js +102 -133
- package/internal/stores/data_style/model/lines/color.js +20 -29
- package/internal/stores/data_style/model/lines/common.js +14 -4
- package/internal/stores/data_style/model/lines/index.js +35 -6
- package/internal/stores/data_style/model/lines/visibility.js +19 -29
- package/internal/stores/data_style/model/points/common.js +7 -0
- package/internal/stores/data_style/model/points/size.js +1 -4
- package/internal/stores/data_style/model/points/visibility.js +4 -4
- package/internal/stores/data_style/model/surfaces/color.js +16 -29
- package/internal/stores/data_style/model/surfaces/common.js +14 -4
- package/internal/stores/data_style/model/surfaces/index.js +37 -6
- package/internal/stores/data_style/model/surfaces/visibility.js +17 -29
- package/internal/stores/data_style/state.js +126 -5
- package/internal/utils/viewer_call.js +1 -1
- package/package.json +3 -3
- package/server/api/extensions/run.post.js +8 -1
- package/tests/integration/microservices/back/requirements.txt +7 -0
- package/tests/integration/microservices/viewer/requirements.txt +7 -0
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +3 -1
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -0
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -0
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -0
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -0
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -0
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +10 -0
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -0
- package/tests/unit/plugins/project_load.nuxt.test.js +13 -6
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
// Local imports
|
|
1
|
+
import { database } from "@ogw_internal/database/database";
|
|
2
|
+
import { liveQuery } from "dexie";
|
|
5
3
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
6
4
|
import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state";
|
|
7
5
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
@@ -12,8 +10,8 @@ import { useModelLinesStyle } from "./lines";
|
|
|
12
10
|
import { useModelPointsStyle } from "./points";
|
|
13
11
|
import { useModelSurfacesStyle } from "./surfaces";
|
|
14
12
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
13
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
15
14
|
|
|
16
|
-
// Local constants
|
|
17
15
|
const model_schemas = viewer_schemas.opengeodeweb_viewer.model;
|
|
18
16
|
|
|
19
17
|
export function useModelStyle() {
|
|
@@ -31,158 +29,129 @@ export function useModelStyle() {
|
|
|
31
29
|
function modelVisibility(id) {
|
|
32
30
|
return dataStyleStateStore.getStyle(id).visibility;
|
|
33
31
|
}
|
|
32
|
+
|
|
34
33
|
function setModelVisibility(id, visibility) {
|
|
35
34
|
return viewerStore.request(
|
|
36
35
|
model_schemas.visibility,
|
|
37
36
|
{ id, visibility },
|
|
38
37
|
{
|
|
39
|
-
response_function: () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
response_function: async () => {
|
|
39
|
+
await hybridViewerStore.setVisibility(id, visibility);
|
|
40
|
+
await dataStyleStateStore.mutateStyle(id, { visibility });
|
|
41
|
+
return { id, visibility };
|
|
43
42
|
},
|
|
44
43
|
},
|
|
45
44
|
);
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
function visibleMeshComponents(
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
dataStyleStateStore.styles[id].color = color;
|
|
108
|
-
console.log(setModelColor.name, { id }, modelColor(id));
|
|
109
|
-
},
|
|
47
|
+
function visibleMeshComponents(id_ref) {
|
|
48
|
+
const selection = ref([]);
|
|
49
|
+
watch(
|
|
50
|
+
() => (isRef(id_ref) ? id_ref.value : id_ref),
|
|
51
|
+
(newId, oldId, onCleanup) => {
|
|
52
|
+
if (!newId) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const observable = liveQuery(async () => {
|
|
56
|
+
const components = await database.model_components.where("id").equals(newId).toArray();
|
|
57
|
+
if (components.length === 0) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const all_styles = await database.model_component_datastyle
|
|
62
|
+
.where("id_model")
|
|
63
|
+
.equals(newId)
|
|
64
|
+
.toArray();
|
|
65
|
+
const styles = {};
|
|
66
|
+
for (const style of all_styles) {
|
|
67
|
+
styles[style.id_component] = style;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const current_selection = [];
|
|
71
|
+
const meshTypes = new Set(["Corner", "Line", "Surface", "Block"]);
|
|
72
|
+
const componentsByType = {};
|
|
73
|
+
for (const component of components) {
|
|
74
|
+
if (meshTypes.has(component.type)) {
|
|
75
|
+
if (!componentsByType[component.type]) {
|
|
76
|
+
componentsByType[component.type] = [];
|
|
77
|
+
}
|
|
78
|
+
componentsByType[component.type].push(component.geode_id);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
for (const [type, geode_ids] of Object.entries(componentsByType)) {
|
|
83
|
+
let all_visible = true;
|
|
84
|
+
for (const gid of geode_ids) {
|
|
85
|
+
const is_visible = styles[gid] === undefined ? true : styles[gid].visibility;
|
|
86
|
+
if (is_visible) {
|
|
87
|
+
current_selection.push(gid);
|
|
88
|
+
} else {
|
|
89
|
+
all_visible = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (all_visible) {
|
|
93
|
+
current_selection.push(type);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return current_selection;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const subscription = observable.subscribe({
|
|
100
|
+
next: (val) => {
|
|
101
|
+
selection.value = val;
|
|
102
|
+
},
|
|
103
|
+
error: (err) => console.error(err),
|
|
104
|
+
});
|
|
105
|
+
onCleanup(() => subscription.unsubscribe());
|
|
110
106
|
},
|
|
107
|
+
{ immediate: true },
|
|
111
108
|
);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
async function setModelMeshComponentsVisibility(id, component_geode_ids, visibility) {
|
|
115
|
-
const component_type = await dataStore.meshComponentType(id, component_geode_ids[0]);
|
|
116
|
-
if (component_type === "Corner") {
|
|
117
|
-
return modelCornersStyleStore.setModelCornersVisibility(id, component_geode_ids, visibility);
|
|
118
|
-
}
|
|
119
|
-
if (component_type === "Line") {
|
|
120
|
-
return modelLinesStyleStore.setModelLinesVisibility(id, component_geode_ids, visibility);
|
|
121
|
-
}
|
|
122
|
-
if (component_type === "Surface") {
|
|
123
|
-
return modelSurfacesStyleStore.setModelSurfacesVisibility(
|
|
124
|
-
id,
|
|
125
|
-
component_geode_ids,
|
|
126
|
-
visibility,
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
if (component_type === "Block") {
|
|
130
|
-
return modelBlocksStyleStore.setModelBlocksVisibility(id, component_geode_ids, visibility);
|
|
131
|
-
}
|
|
132
|
-
throw new Error(`Unknown model component_type: ${component_type}`);
|
|
109
|
+
return selection;
|
|
133
110
|
}
|
|
134
111
|
|
|
135
112
|
function applyModelStyle(id) {
|
|
136
113
|
const style = dataStyleStateStore.getStyle(id);
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
promise_array.push(modelEdgesStyleStore.applyModelEdgesStyle(id));
|
|
153
|
-
} else {
|
|
154
|
-
throw new Error(`Unknown model key: ${key}`);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return Promise.all(promise_array);
|
|
114
|
+
const handlers = {
|
|
115
|
+
visibility: () => setModelVisibility(id, style.visibility),
|
|
116
|
+
corners: () => modelCornersStyleStore.applyModelCornersStyle(id),
|
|
117
|
+
lines: () => modelLinesStyleStore.applyModelLinesStyle(id),
|
|
118
|
+
surfaces: () => modelSurfacesStyleStore.applyModelSurfacesStyle(id),
|
|
119
|
+
blocks: () => modelBlocksStyleStore.applyModelBlocksStyle(id),
|
|
120
|
+
points: () => modelPointsStyleStore.applyModelPointsStyle(id),
|
|
121
|
+
edges: () => modelEdgesStyleStore.applyModelEdgesStyle(id),
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const promises = Object.keys(style)
|
|
125
|
+
.filter((key) => handlers[key])
|
|
126
|
+
.map((key) => handlers[key]());
|
|
127
|
+
|
|
128
|
+
return Promise.all(promises);
|
|
158
129
|
}
|
|
159
130
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
131
|
+
function setModelMeshComponentsDefaultStyle(id) {
|
|
132
|
+
return dataStore.item(id).then((item) => {
|
|
133
|
+
if (!item) {
|
|
134
|
+
return [];
|
|
135
|
+
}
|
|
136
|
+
const { mesh_components } = item;
|
|
137
|
+
const handlers = {
|
|
138
|
+
Corner: () => modelCornersStyleStore.setModelCornersDefaultStyle(id),
|
|
139
|
+
Line: () => modelLinesStyleStore.setModelLinesDefaultStyle(id),
|
|
140
|
+
Surface: () => modelSurfacesStyleStore.setModelSurfacesDefaultStyle(id),
|
|
141
|
+
Block: () => modelBlocksStyleStore.setModelBlocksDefaultStyle(id),
|
|
142
|
+
};
|
|
143
|
+
return Promise.all(
|
|
144
|
+
Object.keys(mesh_components)
|
|
145
|
+
.filter((k) => handlers[k])
|
|
146
|
+
.map((k) => handlers[k]()),
|
|
147
|
+
);
|
|
148
|
+
});
|
|
177
149
|
}
|
|
178
150
|
|
|
179
151
|
return {
|
|
180
152
|
modelVisibility,
|
|
181
153
|
visibleMeshComponents,
|
|
182
|
-
modelMeshComponentVisibility,
|
|
183
154
|
setModelVisibility,
|
|
184
|
-
setModelColor,
|
|
185
|
-
setModelMeshComponentsVisibility,
|
|
186
155
|
applyModelStyle,
|
|
187
156
|
setModelMeshComponentsDefaultStyle,
|
|
188
157
|
...useModelBlocksStyle(),
|
|
@@ -13,41 +13,32 @@ export function useModelLinesColorStyle() {
|
|
|
13
13
|
const dataStore = useDataStore();
|
|
14
14
|
const viewerStore = useViewerStore();
|
|
15
15
|
const modelLinesCommonStyle = useModelLinesCommonStyle();
|
|
16
|
+
|
|
16
17
|
function modelLineColor(id, line_id) {
|
|
17
18
|
return modelLinesCommonStyle.modelLineStyle(id, line_id).color;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
async function setModelLinesColor(id, line_ids, color) {
|
|
20
|
+
|
|
21
|
+
function setModelLinesColor(id, line_ids, color) {
|
|
23
22
|
if (!line_ids || line_ids.length === 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const line_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, line_ids);
|
|
27
|
-
if (!line_viewer_ids || line_viewer_ids.length === 0) {
|
|
28
|
-
console.warn("[setModelLinesColor] No viewer IDs found, skipping color request", {
|
|
29
|
-
id,
|
|
30
|
-
line_ids,
|
|
31
|
-
});
|
|
32
|
-
return;
|
|
23
|
+
return Promise.resolve();
|
|
33
24
|
}
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
return dataStore.getMeshComponentsViewerIds(id, line_ids).then((line_viewer_ids) => {
|
|
26
|
+
if (!line_viewer_ids || line_viewer_ids.length === 0) {
|
|
27
|
+
return modelLinesCommonStyle.mutateModelLinesStyle(id, line_ids, {
|
|
28
|
+
color,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return viewerStore.request(
|
|
32
|
+
model_lines_schemas.color,
|
|
33
|
+
{ id, block_ids: line_viewer_ids, color },
|
|
34
|
+
{
|
|
35
|
+
response_function: () =>
|
|
36
|
+
modelLinesCommonStyle.mutateModelLinesStyle(id, line_ids, {
|
|
37
|
+
color,
|
|
38
|
+
}),
|
|
48
39
|
},
|
|
49
|
-
|
|
50
|
-
);
|
|
40
|
+
);
|
|
41
|
+
});
|
|
51
42
|
}
|
|
52
43
|
|
|
53
44
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import merge from "lodash/merge";
|
|
1
2
|
import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state";
|
|
2
3
|
|
|
3
4
|
export function useModelLinesCommonStyle() {
|
|
@@ -8,14 +9,23 @@ export function useModelLinesCommonStyle() {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
function modelLineStyle(id, line_id) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
12
|
+
const groupStyle = modelLinesStyle(id);
|
|
13
|
+
const individualStyle = dataStyleStateStore.getComponentStyle(id, line_id);
|
|
14
|
+
return merge({}, groupStyle, individualStyle);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function mutateModelLinesStyle(id, line_ids, values) {
|
|
18
|
+
return dataStyleStateStore.mutateComponentStyles(id, line_ids, values);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function mutateModelLineStyle(id, line_id, values) {
|
|
22
|
+
return dataStyleStateStore.mutateComponentStyle(id, line_id, values);
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
return {
|
|
18
26
|
modelLinesStyle,
|
|
19
27
|
modelLineStyle,
|
|
28
|
+
mutateModelLinesStyle,
|
|
29
|
+
mutateModelLineStyle,
|
|
20
30
|
};
|
|
21
31
|
}
|
|
@@ -5,7 +5,7 @@ import { useModelLinesCommonStyle } from "./common";
|
|
|
5
5
|
import { useModelLinesVisibilityStyle } from "./visibility";
|
|
6
6
|
|
|
7
7
|
async function setModelLinesDefaultStyle(_id) {
|
|
8
|
-
// Placeholder
|
|
8
|
+
// Placeholder
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function useModelLinesStyle() {
|
|
@@ -15,12 +15,41 @@ export function useModelLinesStyle() {
|
|
|
15
15
|
const modelLinesColorStyle = useModelLinesColorStyle();
|
|
16
16
|
|
|
17
17
|
async function applyModelLinesStyle(id) {
|
|
18
|
-
const style = modelLinesCommonStyle.modelLinesStyle(id);
|
|
19
18
|
const line_ids = await dataStore.getLinesGeodeIds(id);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
if (line_ids.length === 0) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const visibilityGroups = {};
|
|
24
|
+
const colorGroups = {};
|
|
25
|
+
|
|
26
|
+
for (const line_id of line_ids) {
|
|
27
|
+
const style = modelLinesCommonStyle.modelLineStyle(id, line_id);
|
|
28
|
+
|
|
29
|
+
const vKey = String(style.visibility);
|
|
30
|
+
if (!visibilityGroups[vKey]) {
|
|
31
|
+
visibilityGroups[vKey] = [];
|
|
32
|
+
}
|
|
33
|
+
visibilityGroups[vKey].push(line_id);
|
|
34
|
+
|
|
35
|
+
const cKey = JSON.stringify(style.color);
|
|
36
|
+
if (!colorGroups[cKey]) {
|
|
37
|
+
colorGroups[cKey] = [];
|
|
38
|
+
}
|
|
39
|
+
colorGroups[cKey].push(line_id);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const promises = [];
|
|
43
|
+
|
|
44
|
+
for (const [vValue, ids] of Object.entries(visibilityGroups)) {
|
|
45
|
+
promises.push(modelLinesVisibilityStyle.setModelLinesVisibility(id, ids, vValue === "true"));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
for (const [cValue, ids] of Object.entries(colorGroups)) {
|
|
49
|
+
promises.push(modelLinesColorStyle.setModelLinesColor(id, ids, JSON.parse(cValue)));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return Promise.all(promises);
|
|
24
53
|
}
|
|
25
54
|
|
|
26
55
|
return {
|
|
@@ -16,38 +16,28 @@ export function useModelLinesVisibilityStyle() {
|
|
|
16
16
|
function modelLineVisibility(id, line_id) {
|
|
17
17
|
return modelLinesCommonStyle.modelLineStyle(id, line_id).visibility;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
modelLinesCommonStyle.modelLineStyle(id, line_id).visibility = visibility;
|
|
21
|
-
}
|
|
22
|
-
async function setModelLinesVisibility(id, line_ids, visibility) {
|
|
19
|
+
function setModelLinesVisibility(id, line_ids, visibility) {
|
|
23
20
|
if (!line_ids || line_ids.length === 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const line_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, line_ids);
|
|
27
|
-
if (!line_viewer_ids || line_viewer_ids.length === 0) {
|
|
28
|
-
console.warn("[setModelLinesVisibility] No viewer IDs found, skipping visibility request", {
|
|
29
|
-
id,
|
|
30
|
-
line_ids,
|
|
31
|
-
});
|
|
32
|
-
return;
|
|
21
|
+
return Promise.resolve();
|
|
33
22
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
23
|
+
|
|
24
|
+
return dataStore.getMeshComponentsViewerIds(id, line_ids).then((line_viewer_ids) => {
|
|
25
|
+
if (!line_viewer_ids || line_viewer_ids.length === 0) {
|
|
26
|
+
return modelLinesCommonStyle.mutateModelLinesStyle(id, line_ids, {
|
|
27
|
+
visibility,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return viewerStore.request(
|
|
31
|
+
model_lines_schemas.visibility,
|
|
32
|
+
{ id, block_ids: line_viewer_ids, visibility },
|
|
33
|
+
{
|
|
34
|
+
response_function: () =>
|
|
35
|
+
modelLinesCommonStyle.mutateModelLinesStyle(id, line_ids, {
|
|
36
|
+
visibility,
|
|
37
|
+
}),
|
|
48
38
|
},
|
|
49
|
-
|
|
50
|
-
);
|
|
39
|
+
);
|
|
40
|
+
});
|
|
51
41
|
}
|
|
52
42
|
|
|
53
43
|
return {
|
|
@@ -3,11 +3,18 @@ import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state";
|
|
|
3
3
|
export function useModelPointsCommonStyle() {
|
|
4
4
|
const dataStyleStateStore = useDataStyleStateStore();
|
|
5
5
|
|
|
6
|
+
function mutateModelPointsStyle(id, values) {
|
|
7
|
+
return dataStyleStateStore.mutateStyle(id, {
|
|
8
|
+
points: values,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
function modelPointsStyle(id) {
|
|
7
13
|
return dataStyleStateStore.getStyle(id).points;
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
return {
|
|
11
17
|
modelPointsStyle,
|
|
18
|
+
mutateModelPointsStyle,
|
|
12
19
|
};
|
|
13
20
|
}
|
|
@@ -21,10 +21,7 @@ export function useModelPointsSizeStyle() {
|
|
|
21
21
|
model_points_schemas.size,
|
|
22
22
|
{ id, size },
|
|
23
23
|
{
|
|
24
|
-
response_function: () => {
|
|
25
|
-
modelPointsCommonStyle.modelPointsStyle(id).size = size;
|
|
26
|
-
console.log(setModelPointsSize.name, { id }, modelPointsSize(id));
|
|
27
|
-
},
|
|
24
|
+
response_function: () => modelPointsCommonStyle.mutateModelPointsStyle(id, { size }),
|
|
28
25
|
},
|
|
29
26
|
);
|
|
30
27
|
}
|
|
@@ -21,10 +21,10 @@ export function useModelPointsVisibilityStyle() {
|
|
|
21
21
|
model_points_schemas.visibility,
|
|
22
22
|
{ id, visibility },
|
|
23
23
|
{
|
|
24
|
-
response_function: () =>
|
|
25
|
-
modelPointsCommonStyle.
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
response_function: () =>
|
|
25
|
+
modelPointsCommonStyle.mutateModelPointsStyle(id, {
|
|
26
|
+
visibility,
|
|
27
|
+
}),
|
|
28
28
|
},
|
|
29
29
|
);
|
|
30
30
|
}
|
|
@@ -13,41 +13,28 @@ export function useModelSurfacesColorStyle() {
|
|
|
13
13
|
const dataStore = useDataStore();
|
|
14
14
|
const viewerStore = useViewerStore();
|
|
15
15
|
const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
|
|
16
|
+
|
|
16
17
|
function modelSurfaceColor(id, surface_id) {
|
|
17
18
|
return modelSurfacesCommonStyle.modelSurfaceStyle(id, surface_id).color;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
async function setModelSurfacesColor(id, surface_ids, color) {
|
|
20
|
+
|
|
21
|
+
function setModelSurfacesColor(id, surface_ids, color) {
|
|
23
22
|
if (!surface_ids || surface_ids.length === 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, surface_ids);
|
|
27
|
-
if (!surface_viewer_ids || surface_viewer_ids.length === 0) {
|
|
28
|
-
console.warn("[setModelSurfacesColor] No viewer IDs found, skipping color request", {
|
|
29
|
-
id,
|
|
30
|
-
surface_ids,
|
|
31
|
-
});
|
|
32
|
-
return;
|
|
23
|
+
return Promise.resolve();
|
|
33
24
|
}
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{ id },
|
|
45
|
-
{ surface_ids },
|
|
46
|
-
JSON.stringify(modelSurfaceColor(id, surface_ids[0])),
|
|
47
|
-
);
|
|
25
|
+
return dataStore.getMeshComponentsViewerIds(id, surface_ids).then((surface_viewer_ids) => {
|
|
26
|
+
if (!surface_viewer_ids || surface_viewer_ids.length === 0) {
|
|
27
|
+
return modelSurfacesCommonStyle.mutateModelSurfacesStyle(id, surface_ids, { color });
|
|
28
|
+
}
|
|
29
|
+
return viewerStore.request(
|
|
30
|
+
model_surfaces_schemas.color,
|
|
31
|
+
{ id, block_ids: surface_viewer_ids, color },
|
|
32
|
+
{
|
|
33
|
+
response_function: () =>
|
|
34
|
+
modelSurfacesCommonStyle.mutateModelSurfacesStyle(id, surface_ids, { color }),
|
|
48
35
|
},
|
|
49
|
-
|
|
50
|
-
);
|
|
36
|
+
);
|
|
37
|
+
});
|
|
51
38
|
}
|
|
52
39
|
|
|
53
40
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import merge from "lodash/merge";
|
|
1
2
|
import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state";
|
|
2
3
|
|
|
3
4
|
export function useModelSurfacesCommonStyle() {
|
|
@@ -8,14 +9,23 @@ export function useModelSurfacesCommonStyle() {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
function modelSurfaceStyle(id, surface_id) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
12
|
+
const groupStyle = modelSurfacesStyle(id);
|
|
13
|
+
const individualStyle = dataStyleStateStore.getComponentStyle(id, surface_id);
|
|
14
|
+
return merge({}, groupStyle, individualStyle);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function mutateModelSurfacesStyle(id, surface_ids, values) {
|
|
18
|
+
return dataStyleStateStore.mutateComponentStyles(id, surface_ids, values);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function mutateModelSurfaceStyle(id, surface_id, values) {
|
|
22
|
+
return dataStyleStateStore.mutateComponentStyle(id, surface_id, values);
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
return {
|
|
18
26
|
modelSurfacesStyle,
|
|
19
27
|
modelSurfaceStyle,
|
|
28
|
+
mutateModelSurfacesStyle,
|
|
29
|
+
mutateModelSurfaceStyle,
|
|
20
30
|
};
|
|
21
31
|
}
|