@geode/opengeodeweb-front 10.25.0-rc.7 → 10.25.0
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/Viewer/Generic/Model/BlocksOptions.vue +13 -17
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -17
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -17
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +29 -43
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +13 -17
- package/app/components/Viewer/Options/AttributeSelector.vue +6 -1
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +37 -15
- package/app/utils/default_styles/constants.js +15 -0
- package/app/utils/default_styles/index.js +6 -1
- package/app/utils/default_styles/meshes.js +19 -15
- package/app/utils/default_styles/models.js +74 -36
- package/internal/stores/data_style/mesh/cells/color.js +2 -2
- package/internal/stores/data_style/mesh/cells/index.js +1 -10
- package/internal/stores/data_style/mesh/edges/color.js +2 -2
- package/internal/stores/data_style/mesh/edges/index.js +1 -7
- package/internal/stores/data_style/mesh/points/color.js +2 -2
- package/internal/stores/data_style/mesh/points/index.js +1 -4
- package/internal/stores/data_style/mesh/polygons/color.js +2 -2
- package/internal/stores/data_style/mesh/polygons/index.js +1 -10
- package/internal/stores/data_style/mesh/polyhedra/color.js +2 -2
- package/internal/stores/data_style/mesh/polyhedra/index.js +1 -7
- package/internal/stores/data_style/model/blocks/color.js +86 -7
- package/internal/stores/data_style/model/blocks/common.js +15 -6
- package/internal/stores/data_style/model/blocks/index.js +28 -26
- package/internal/stores/data_style/model/blocks/polyhedron.js +7 -20
- package/internal/stores/data_style/model/blocks/vertex.js +7 -20
- package/internal/stores/data_style/model/color.js +58 -32
- package/internal/stores/data_style/model/common.js +19 -10
- package/internal/stores/data_style/model/corners/color.js +59 -7
- package/internal/stores/data_style/model/corners/common.js +15 -6
- package/internal/stores/data_style/model/corners/index.js +26 -24
- package/internal/stores/data_style/model/corners/vertex.js +7 -20
- package/internal/stores/data_style/model/lines/color.js +71 -7
- package/internal/stores/data_style/model/lines/common.js +15 -6
- package/internal/stores/data_style/model/lines/edge.js +7 -20
- package/internal/stores/data_style/model/lines/index.js +28 -26
- package/internal/stores/data_style/model/lines/vertex.js +7 -20
- package/internal/stores/data_style/model/surfaces/color.js +86 -8
- package/internal/stores/data_style/model/surfaces/common.js +15 -6
- package/internal/stores/data_style/model/surfaces/index.js +28 -26
- package/internal/stores/data_style/model/surfaces/polygon.js +7 -20
- package/internal/stores/data_style/model/surfaces/vertex.js +7 -20
- package/internal/stores/data_style/state.js +2 -2
- package/package.json +3 -3
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +1 -1
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +1 -1
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +1 -1
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +1 -1
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +1 -1
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +7 -7
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +5 -5
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +31 -0
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +7 -7
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +7 -7
|
@@ -16,24 +16,24 @@ export function useModelBlocksPolyhedronAttribute() {
|
|
|
16
16
|
const viewerStore = useViewerStore();
|
|
17
17
|
|
|
18
18
|
function modelBlocksPolyhedronAttribute(modelId, blockId) {
|
|
19
|
-
return modelBlocksCommonStyle.
|
|
19
|
+
return modelBlocksCommonStyle.modelBlockColoring(modelId, blockId).polyhedron;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function modelBlocksPolyhedronAttributeStoredConfig(modelId, blockId, name) {
|
|
23
23
|
const { storedConfigs } = modelBlocksPolyhedronAttribute(modelId, blockId);
|
|
24
|
-
if (name
|
|
24
|
+
if (name in storedConfigs) {
|
|
25
25
|
return storedConfigs[name];
|
|
26
26
|
}
|
|
27
|
-
return {
|
|
27
|
+
return setModelBlocksPolyhedronAttributeStoredConfig(modelId, [blockId], name, {
|
|
28
28
|
minimum: undefined,
|
|
29
29
|
maximum: undefined,
|
|
30
30
|
colorMap: undefined,
|
|
31
|
-
};
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function mutateModelBlocksPolyhedronStyle(modelId, blockIds, values) {
|
|
35
|
-
return modelBlocksCommonStyle.
|
|
36
|
-
|
|
35
|
+
return modelBlocksCommonStyle.mutateModelBlocksColoring(modelId, blockIds, {
|
|
36
|
+
polyhedron: values,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -51,24 +51,11 @@ export function useModelBlocksPolyhedronAttribute() {
|
|
|
51
51
|
|
|
52
52
|
async function setModelBlocksPolyhedronAttributeName(modelId, blockIds, name) {
|
|
53
53
|
const viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, blockIds);
|
|
54
|
-
|
|
55
|
-
const updates = { name };
|
|
56
|
-
const polyhedron = modelBlocksPolyhedronAttribute(modelId, blockIds[0]);
|
|
57
|
-
if (!(name in polyhedron.storedConfigs)) {
|
|
58
|
-
updates.storedConfigs = {
|
|
59
|
-
[name]: {
|
|
60
|
-
minimum: undefined,
|
|
61
|
-
maximum: undefined,
|
|
62
|
-
colorMap: undefined,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
54
|
const params = { id: modelId, block_ids: viewer_ids, name };
|
|
68
55
|
return viewerStore.request(
|
|
69
56
|
{ schema: schema.name, params },
|
|
70
57
|
{
|
|
71
|
-
response_function: () => mutateModelBlocksPolyhedronStyle(modelId, blockIds,
|
|
58
|
+
response_function: () => mutateModelBlocksPolyhedronStyle(modelId, blockIds, { name }),
|
|
72
59
|
},
|
|
73
60
|
);
|
|
74
61
|
}
|
|
@@ -16,24 +16,24 @@ export function useModelBlocksVertexAttribute() {
|
|
|
16
16
|
const viewerStore = useViewerStore();
|
|
17
17
|
|
|
18
18
|
function modelBlocksVertexAttribute(modelId, blockId) {
|
|
19
|
-
return modelBlocksCommonStyle.
|
|
19
|
+
return modelBlocksCommonStyle.modelBlockColoring(modelId, blockId).vertex;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function modelBlocksVertexAttributeStoredConfig(modelId, blockId, name) {
|
|
23
23
|
const { storedConfigs } = modelBlocksVertexAttribute(modelId, blockId);
|
|
24
|
-
if (name
|
|
24
|
+
if (name in storedConfigs) {
|
|
25
25
|
return storedConfigs[name];
|
|
26
26
|
}
|
|
27
|
-
return {
|
|
27
|
+
return setModelBlocksVertexAttributeStoredConfig(modelId, [blockId], name, {
|
|
28
28
|
minimum: undefined,
|
|
29
29
|
maximum: undefined,
|
|
30
30
|
colorMap: undefined,
|
|
31
|
-
};
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function mutateModelBlocksVertexStyle(modelId, blockIds, values) {
|
|
35
|
-
return modelBlocksCommonStyle.
|
|
36
|
-
|
|
35
|
+
return modelBlocksCommonStyle.mutateModelBlocksColoring(modelId, blockIds, {
|
|
36
|
+
vertex: values,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -51,24 +51,11 @@ export function useModelBlocksVertexAttribute() {
|
|
|
51
51
|
|
|
52
52
|
async function setModelBlocksVertexAttributeName(modelId, blockIds, name) {
|
|
53
53
|
const viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, blockIds);
|
|
54
|
-
|
|
55
|
-
const updates = { name };
|
|
56
|
-
const vertex = modelBlocksVertexAttribute(modelId, blockIds[0]);
|
|
57
|
-
if (!(name in vertex.storedConfigs)) {
|
|
58
|
-
updates.storedConfigs = {
|
|
59
|
-
[name]: {
|
|
60
|
-
minimum: undefined,
|
|
61
|
-
maximum: undefined,
|
|
62
|
-
colorMap: undefined,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
54
|
const params = { id: modelId, block_ids: viewer_ids, name };
|
|
68
55
|
return viewerStore.request(
|
|
69
56
|
{ schema: schema.name, params },
|
|
70
57
|
{
|
|
71
|
-
response_function: () => mutateModelBlocksVertexStyle(modelId, blockIds,
|
|
58
|
+
response_function: () => mutateModelBlocksVertexStyle(modelId, blockIds, { name }),
|
|
72
59
|
},
|
|
73
60
|
);
|
|
74
61
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DEFAULT_MODEL_COMPONENT_TYPE_COLORS } from "@ogw_front/utils/default_styles";
|
|
2
1
|
import { dispatchToComponentTypes } from "./visibility";
|
|
3
2
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
4
3
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
@@ -79,7 +78,7 @@ function useModelColorStyle(componentStyleFunctions) {
|
|
|
79
78
|
};
|
|
80
79
|
|
|
81
80
|
function getModelComponentColor(modelId, componentId) {
|
|
82
|
-
return dataStyleState.getComponentStyle(modelId, componentId).
|
|
81
|
+
return dataStyleState.getComponentStyle(modelId, componentId).coloring.constant;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
function getModelComponentEffectiveColor(modelId, componentId, type) {
|
|
@@ -90,27 +89,30 @@ function useModelColorStyle(componentStyleFunctions) {
|
|
|
90
89
|
return modelComponentTypeColor(modelId, type);
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
return mode === "constant" ? "color" : mode;
|
|
92
|
+
function getModelComponentActiveColoring(modelId, componentId) {
|
|
93
|
+
return dataStyleState.getComponentStyle(modelId, componentId).coloring.active;
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
function modelComponentTypeColor(modelId, type) {
|
|
99
97
|
return (
|
|
100
|
-
dataStyleState.getModelComponentTypeStyle(modelId, type).
|
|
101
|
-
|
|
98
|
+
dataStyleState.getModelComponentTypeStyle(modelId, type).coloring.constant ||
|
|
99
|
+
dataStyleState.getStyle(modelId)[`${type.toLowerCase()}s`].coloring.constant
|
|
102
100
|
);
|
|
103
101
|
}
|
|
104
102
|
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
function getModelComponentTypeActiveColoring(modelId, type) {
|
|
104
|
+
return (
|
|
105
|
+
dataStyleState.getModelComponentTypeStyle(modelId, type).coloring.active ||
|
|
106
|
+
dataStyleState.getStyle(modelId)[`${type.toLowerCase()}s`].coloring.active
|
|
107
|
+
);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
async function setModelComponentTypeColor(modelId, type, color) {
|
|
111
111
|
await modelCommonStyle.mutateModelComponentTypeStyle(modelId, type, {
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
coloring: {
|
|
113
|
+
constant: color,
|
|
114
|
+
active: "constant",
|
|
115
|
+
},
|
|
114
116
|
});
|
|
115
117
|
const idsForType = await dataStore.getMeshComponentGeodeIds(modelId, type);
|
|
116
118
|
if (idsForType.length === 0) {
|
|
@@ -119,22 +121,25 @@ function useModelColorStyle(componentStyleFunctions) {
|
|
|
119
121
|
await setModelComponentsColor(modelId, idsForType, color);
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
async function
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
async function setModelComponentTypeActiveColoring(modelId, type, activeColoring) {
|
|
125
|
+
await modelCommonStyle.mutateModelComponentTypeStyle(modelId, type, {
|
|
126
|
+
coloring: { active: activeColoring },
|
|
127
|
+
});
|
|
125
128
|
const idsForType = await dataStore.getMeshComponentGeodeIds(modelId, type);
|
|
126
129
|
if (idsForType.length === 0) {
|
|
127
130
|
return;
|
|
128
131
|
}
|
|
129
132
|
|
|
130
|
-
if (
|
|
131
|
-
await setModelComponentsColor(modelId, idsForType, undefined,
|
|
133
|
+
if (activeColoring === "random" || activeColoring === "constant") {
|
|
134
|
+
await setModelComponentsColor(modelId, idsForType, undefined, activeColoring);
|
|
132
135
|
return;
|
|
133
136
|
}
|
|
134
137
|
|
|
135
|
-
await modelCommonStyle.mutateComponentStyles(modelId, idsForType, {
|
|
138
|
+
await modelCommonStyle.mutateComponentStyles(modelId, idsForType, {
|
|
139
|
+
coloring: { active: activeColoring },
|
|
140
|
+
});
|
|
136
141
|
const { getName, setName, getRange, setRange, getColorMap, setColorMap } =
|
|
137
|
-
ATTRIBUTE_FUNCTIONS[type][
|
|
142
|
+
ATTRIBUTE_FUNCTIONS[type][activeColoring];
|
|
138
143
|
|
|
139
144
|
const name = getName(modelId, idsForType[0]);
|
|
140
145
|
if (name) {
|
|
@@ -150,17 +155,18 @@ function useModelColorStyle(componentStyleFunctions) {
|
|
|
150
155
|
}
|
|
151
156
|
}
|
|
152
157
|
|
|
153
|
-
async function
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
async function setModelComponentActiveColoring(modelId, componentId, activeColoring) {
|
|
159
|
+
await modelCommonStyle.mutateComponentStyle(modelId, componentId, {
|
|
160
|
+
coloring: { active: activeColoring },
|
|
161
|
+
});
|
|
162
|
+
if (activeColoring === "random" || activeColoring === "constant") {
|
|
163
|
+
await setModelComponentsColor(modelId, [componentId], undefined, activeColoring);
|
|
158
164
|
return;
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
const type = await dataStore.meshComponentType(modelId, componentId);
|
|
162
168
|
const { getName, setName, getRange, setRange, getColorMap, setColorMap } =
|
|
163
|
-
ATTRIBUTE_FUNCTIONS[type][
|
|
169
|
+
ATTRIBUTE_FUNCTIONS[type][activeColoring];
|
|
164
170
|
|
|
165
171
|
const name = getName(modelId, componentId);
|
|
166
172
|
if (name) {
|
|
@@ -176,27 +182,47 @@ function useModelColorStyle(componentStyleFunctions) {
|
|
|
176
182
|
}
|
|
177
183
|
}
|
|
178
184
|
|
|
179
|
-
async function setModelComponentsColor(
|
|
180
|
-
|
|
185
|
+
async function setModelComponentsColor(
|
|
186
|
+
modelId,
|
|
187
|
+
componentIds,
|
|
188
|
+
color,
|
|
189
|
+
activeColoring = "constant",
|
|
190
|
+
) {
|
|
191
|
+
await modelCommonStyle.mutateComponentStyles(modelId, componentIds, {
|
|
192
|
+
coloring: {
|
|
193
|
+
constant: color,
|
|
194
|
+
active: activeColoring,
|
|
195
|
+
},
|
|
196
|
+
});
|
|
181
197
|
return await dispatchToComponentTypes(
|
|
182
198
|
modelId,
|
|
183
199
|
componentIds,
|
|
184
200
|
"Color",
|
|
185
201
|
{ componentStyleFunctions },
|
|
186
202
|
color,
|
|
187
|
-
|
|
203
|
+
activeColoring,
|
|
188
204
|
);
|
|
189
205
|
}
|
|
190
206
|
|
|
207
|
+
function getModelColor(modelId) {
|
|
208
|
+
return dataStyleState.getStyle(modelId).coloring.constant;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function getModelActiveColoring(modelId) {
|
|
212
|
+
return dataStyleState.getStyle(modelId).coloring.active;
|
|
213
|
+
}
|
|
214
|
+
|
|
191
215
|
return {
|
|
216
|
+
getModelColor,
|
|
217
|
+
getModelActiveColoring,
|
|
192
218
|
getModelComponentColor,
|
|
193
219
|
getModelComponentEffectiveColor,
|
|
194
|
-
|
|
220
|
+
getModelComponentActiveColoring,
|
|
195
221
|
modelComponentTypeColor,
|
|
196
|
-
|
|
222
|
+
getModelComponentTypeActiveColoring,
|
|
197
223
|
setModelComponentTypeColor,
|
|
198
|
-
|
|
199
|
-
|
|
224
|
+
setModelComponentTypeActiveColoring,
|
|
225
|
+
setModelComponentActiveColoring,
|
|
200
226
|
setModelComponentsColor,
|
|
201
227
|
};
|
|
202
228
|
}
|
|
@@ -59,7 +59,7 @@ export function useModelCommonStyle() {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
async function setModelTypeColor(id, component_ids, color, schema,
|
|
62
|
+
async function setModelTypeColor(id, component_ids, color, schema, activeColoring = "constant") {
|
|
63
63
|
if (!component_ids?.length) {
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
@@ -69,12 +69,13 @@ export function useModelCommonStyle() {
|
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
const params = { id, block_ids: viewer_ids, color_mode: activeColoring };
|
|
73
|
+
if (activeColoring === "constant") {
|
|
74
|
+
await mutateComponentStyles(id, component_ids, {
|
|
75
|
+
coloring: {
|
|
76
|
+
constant: color,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
78
79
|
params.color = color;
|
|
79
80
|
}
|
|
80
81
|
|
|
@@ -82,8 +83,12 @@ export function useModelCommonStyle() {
|
|
|
82
83
|
{ schema, params },
|
|
83
84
|
{
|
|
84
85
|
response_function: async (colors) => {
|
|
85
|
-
if (
|
|
86
|
-
await mutateComponentStyles(id, component_ids, {
|
|
86
|
+
if (activeColoring === "constant") {
|
|
87
|
+
await mutateComponentStyles(id, component_ids, {
|
|
88
|
+
coloring: {
|
|
89
|
+
constant: color,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
87
92
|
return;
|
|
88
93
|
}
|
|
89
94
|
|
|
@@ -95,7 +100,11 @@ export function useModelCommonStyle() {
|
|
|
95
100
|
id,
|
|
96
101
|
colors.map(({ geode_id, color: color_value }) => ({
|
|
97
102
|
id_component: geode_id,
|
|
98
|
-
values: {
|
|
103
|
+
values: {
|
|
104
|
+
coloring: {
|
|
105
|
+
constant: color_value,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
99
108
|
})),
|
|
100
109
|
);
|
|
101
110
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
2
2
|
import { useModelCornersCommonStyle } from "./common";
|
|
3
|
+
import { useModelCornersVertexAttribute } from "./vertex";
|
|
3
4
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
4
5
|
|
|
5
6
|
const schema = viewer_schemas.opengeodeweb_viewer.model.corners.color;
|
|
@@ -7,19 +8,70 @@ const schema = viewer_schemas.opengeodeweb_viewer.model.corners.color;
|
|
|
7
8
|
export function useModelCornersColor() {
|
|
8
9
|
const modelCommonStyle = useModelCommonStyle();
|
|
9
10
|
const modelCornersCommonStyle = useModelCornersCommonStyle();
|
|
11
|
+
const modelCornersVertexAttribute = useModelCornersVertexAttribute();
|
|
12
|
+
|
|
13
|
+
function modelCornerColoring(id, corner_id) {
|
|
14
|
+
return modelCornersCommonStyle.modelCornerStyle(id, corner_id).coloring;
|
|
15
|
+
}
|
|
10
16
|
|
|
11
17
|
function modelCornerColor(id, corner_id) {
|
|
12
|
-
return
|
|
18
|
+
return modelCornerColoring(id, corner_id).constant;
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
function setModelCornersColor(modelId, corners_ids, color,
|
|
16
|
-
return modelCommonStyle.setModelTypeColor(modelId, corners_ids, color, schema,
|
|
21
|
+
function setModelCornersColor(modelId, corners_ids, color, activeColoring = "constant") {
|
|
22
|
+
return modelCommonStyle.setModelTypeColor(modelId, corners_ids, color, schema, activeColoring);
|
|
17
23
|
}
|
|
18
24
|
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
function modelCornerActiveColoring(id, corner_id) {
|
|
26
|
+
return modelCornerColoring(id, corner_id).active;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function setModelCornersActiveColoring(modelId, corners_ids, activeColoring) {
|
|
30
|
+
await modelCommonStyle.mutateComponentStyles(modelId, corners_ids, {
|
|
31
|
+
coloring: { active: activeColoring },
|
|
32
|
+
});
|
|
33
|
+
if (activeColoring === "constant" || activeColoring === "random") {
|
|
34
|
+
const color = modelCornerColor(modelId, corners_ids[0]);
|
|
35
|
+
return setModelCornersColor(modelId, corners_ids, color, activeColoring);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (activeColoring === "vertex") {
|
|
39
|
+
const name = modelCornersVertexAttribute.modelCornersVertexAttributeName(
|
|
40
|
+
modelId,
|
|
41
|
+
corners_ids[0],
|
|
42
|
+
);
|
|
43
|
+
await modelCornersVertexAttribute.setModelCornersVertexAttributeName(
|
|
44
|
+
modelId,
|
|
45
|
+
corners_ids,
|
|
46
|
+
name,
|
|
47
|
+
);
|
|
48
|
+
const [min, max] = modelCornersVertexAttribute.modelCornersVertexAttributeRange(
|
|
49
|
+
modelId,
|
|
50
|
+
corners_ids[0],
|
|
51
|
+
);
|
|
52
|
+
await modelCornersVertexAttribute.setModelCornersVertexAttributeRange(
|
|
53
|
+
modelId,
|
|
54
|
+
corners_ids,
|
|
55
|
+
min,
|
|
56
|
+
max,
|
|
57
|
+
);
|
|
58
|
+
const colorMap = modelCornersVertexAttribute.modelCornersVertexAttributeColorMap(
|
|
59
|
+
modelId,
|
|
60
|
+
corners_ids[0],
|
|
61
|
+
);
|
|
62
|
+
await modelCornersVertexAttribute.setModelCornersVertexAttributeColorMap(
|
|
63
|
+
modelId,
|
|
64
|
+
corners_ids,
|
|
65
|
+
colorMap,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
22
68
|
}
|
|
23
69
|
|
|
24
|
-
return {
|
|
70
|
+
return {
|
|
71
|
+
setModelCornersColor,
|
|
72
|
+
modelCornerColoring,
|
|
73
|
+
modelCornerColor,
|
|
74
|
+
modelCornerActiveColoring,
|
|
75
|
+
setModelCornersActiveColoring,
|
|
76
|
+
};
|
|
25
77
|
}
|
|
@@ -16,18 +16,27 @@ export function useModelCornersCommonStyle() {
|
|
|
16
16
|
return merge({}, groupStyle, individualStyle);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function modelCornerColoring(id, corner_id) {
|
|
20
|
+
return modelCornerStyle(id, corner_id).coloring;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function
|
|
24
|
-
return modelCommonStyle.
|
|
23
|
+
function mutateModelCornersColoring(id, corners_ids, values) {
|
|
24
|
+
return modelCommonStyle.mutateComponentStyles(id, corners_ids, {
|
|
25
|
+
coloring: values,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function mutateModelCornerColoring(id, corner_id, values) {
|
|
30
|
+
return modelCommonStyle.mutateComponentStyle(id, corner_id, {
|
|
31
|
+
coloring: values,
|
|
32
|
+
});
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
return {
|
|
28
36
|
modelCornersStyle,
|
|
29
37
|
modelCornerStyle,
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
modelCornerColoring,
|
|
39
|
+
mutateModelCornersColoring,
|
|
40
|
+
mutateModelCornerColoring,
|
|
32
41
|
};
|
|
33
42
|
}
|
|
@@ -34,34 +34,36 @@ export function useModelCornersStyle() {
|
|
|
34
34
|
}
|
|
35
35
|
visibilityGroups[visibility].push(corner_id);
|
|
36
36
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const coloring = modelColorStyle.modelCornerColoring(modelId, corner_id);
|
|
38
|
+
const activeColoring = modelColorStyle.modelCornerActiveColoring(modelId, corner_id);
|
|
39
|
+
if (activeColoring === "constant") {
|
|
40
|
+
const color = modelColorStyle.modelCornerColor(modelId, corner_id);
|
|
41
|
+
const color_key = JSON.stringify(color);
|
|
40
42
|
if (!colorGroups[color_key]) {
|
|
41
|
-
colorGroups[color_key] = {
|
|
43
|
+
colorGroups[color_key] = { activeColoring, color, corners_ids: [] };
|
|
42
44
|
}
|
|
43
45
|
colorGroups[color_key].corners_ids.push(corner_id);
|
|
46
|
+
} else if (activeColoring === "random") {
|
|
47
|
+
if (!colorGroups["random"]) {
|
|
48
|
+
colorGroups["random"] = { activeColoring, color: undefined, corners_ids: [] };
|
|
49
|
+
}
|
|
50
|
+
colorGroups["random"].corners_ids.push(corner_id);
|
|
44
51
|
} else {
|
|
45
|
-
const
|
|
46
|
-
const attributeStyle = style[attributeTypeKey] || {};
|
|
52
|
+
const attributeStyle = coloring[activeColoring];
|
|
47
53
|
const { name } = attributeStyle;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
colorMap,
|
|
60
|
-
corners_ids: [],
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
attributeGroups[attributeGroupKey].corners_ids.push(corner_id);
|
|
54
|
+
const { minimum, maximum, colorMap } = attributeStyle.storedConfigs[name];
|
|
55
|
+
const attributeGroupKey = `${activeColoring}_${name}_${colorMap}_${minimum}_${maximum}`;
|
|
56
|
+
if (!attributeGroups[attributeGroupKey]) {
|
|
57
|
+
attributeGroups[attributeGroupKey] = {
|
|
58
|
+
activeColoring,
|
|
59
|
+
name,
|
|
60
|
+
minimum,
|
|
61
|
+
maximum,
|
|
62
|
+
colorMap,
|
|
63
|
+
corners_ids: [],
|
|
64
|
+
};
|
|
64
65
|
}
|
|
66
|
+
attributeGroups[attributeGroupKey].corners_ids.push(corner_id);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -69,8 +71,8 @@ export function useModelCornersStyle() {
|
|
|
69
71
|
...Object.entries(visibilityGroups).map(([visibility, ids]) =>
|
|
70
72
|
modelVisibilityStyle.setModelCornersVisibility(modelId, ids, visibility === "true"),
|
|
71
73
|
),
|
|
72
|
-
...Object.values(colorGroups).map(({
|
|
73
|
-
modelColorStyle.setModelCornersColor(modelId, ids, color,
|
|
74
|
+
...Object.values(colorGroups).map(({ activeColoring, color, corners_ids: ids }) =>
|
|
75
|
+
modelColorStyle.setModelCornersColor(modelId, ids, color, activeColoring),
|
|
74
76
|
),
|
|
75
77
|
...Object.values(attributeGroups).flatMap(
|
|
76
78
|
({ name, minimum, maximum, colorMap, corners_ids: ids }) => {
|
|
@@ -16,24 +16,24 @@ export function useModelCornersVertexAttribute() {
|
|
|
16
16
|
const viewerStore = useViewerStore();
|
|
17
17
|
|
|
18
18
|
function modelCornersVertexAttribute(modelId, cornerId) {
|
|
19
|
-
return modelCornersCommonStyle.
|
|
19
|
+
return modelCornersCommonStyle.modelCornerColoring(modelId, cornerId).vertex;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function modelCornersVertexAttributeStoredConfig(modelId, cornerId, name) {
|
|
23
23
|
const { storedConfigs } = modelCornersVertexAttribute(modelId, cornerId);
|
|
24
|
-
if (name
|
|
24
|
+
if (name in storedConfigs) {
|
|
25
25
|
return storedConfigs[name];
|
|
26
26
|
}
|
|
27
|
-
return {
|
|
27
|
+
return setModelCornersVertexAttributeStoredConfig(modelId, [cornerId], name, {
|
|
28
28
|
minimum: undefined,
|
|
29
29
|
maximum: undefined,
|
|
30
30
|
colorMap: undefined,
|
|
31
|
-
};
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function mutateModelCornersVertexStyle(modelId, cornerIds, values) {
|
|
35
|
-
return modelCornersCommonStyle.
|
|
36
|
-
|
|
35
|
+
return modelCornersCommonStyle.mutateModelCornersColoring(modelId, cornerIds, {
|
|
36
|
+
vertex: values,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -51,24 +51,11 @@ export function useModelCornersVertexAttribute() {
|
|
|
51
51
|
|
|
52
52
|
async function setModelCornersVertexAttributeName(modelId, cornerIds, name) {
|
|
53
53
|
const viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, cornerIds);
|
|
54
|
-
|
|
55
|
-
const updates = { name };
|
|
56
|
-
const vertex = modelCornersVertexAttribute(modelId, cornerIds[0]);
|
|
57
|
-
if (!(name in vertex.storedConfigs)) {
|
|
58
|
-
updates.storedConfigs = {
|
|
59
|
-
[name]: {
|
|
60
|
-
minimum: undefined,
|
|
61
|
-
maximum: undefined,
|
|
62
|
-
colorMap: undefined,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
54
|
const params = { id: modelId, block_ids: viewer_ids, name };
|
|
68
55
|
return viewerStore.request(
|
|
69
56
|
{ schema: schema.name, params },
|
|
70
57
|
{
|
|
71
|
-
response_function: () => mutateModelCornersVertexStyle(modelId, cornerIds,
|
|
58
|
+
response_function: () => mutateModelCornersVertexStyle(modelId, cornerIds, { name }),
|
|
72
59
|
},
|
|
73
60
|
);
|
|
74
61
|
}
|