@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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
2
2
|
import { useModelLinesCommonStyle } from "./common";
|
|
3
|
+
import { useModelLinesEdgeAttribute } from "./edge";
|
|
4
|
+
import { useModelLinesVertexAttribute } from "./vertex";
|
|
3
5
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
4
6
|
|
|
5
7
|
const schema = viewer_schemas.opengeodeweb_viewer.model.lines.color;
|
|
@@ -7,19 +9,81 @@ const schema = viewer_schemas.opengeodeweb_viewer.model.lines.color;
|
|
|
7
9
|
export function useModelLinesColor() {
|
|
8
10
|
const modelCommonStyle = useModelCommonStyle();
|
|
9
11
|
const modelLinesCommonStyle = useModelLinesCommonStyle();
|
|
12
|
+
const modelLinesVertexAttribute = useModelLinesVertexAttribute();
|
|
13
|
+
const modelLinesEdgeAttribute = useModelLinesEdgeAttribute();
|
|
14
|
+
|
|
15
|
+
function modelLineColoring(id, line_id) {
|
|
16
|
+
return modelLinesCommonStyle.modelLineStyle(id, line_id).coloring;
|
|
17
|
+
}
|
|
10
18
|
|
|
11
19
|
function modelLineColor(id, line_id) {
|
|
12
|
-
return
|
|
20
|
+
return modelLineColoring(id, line_id).constant;
|
|
13
21
|
}
|
|
14
22
|
|
|
15
|
-
function setModelLinesColor(modelId, lines_ids, color,
|
|
16
|
-
return modelCommonStyle.setModelTypeColor(modelId, lines_ids, color, schema,
|
|
23
|
+
function setModelLinesColor(modelId, lines_ids, color, activeColoring = "constant") {
|
|
24
|
+
return modelCommonStyle.setModelTypeColor(modelId, lines_ids, color, schema, activeColoring);
|
|
17
25
|
}
|
|
18
26
|
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
function modelLineActiveColoring(id, line_id) {
|
|
28
|
+
return modelLineColoring(id, line_id).active;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function setModelLinesActiveColoring(modelId, lines_ids, activeColoring) {
|
|
32
|
+
await modelCommonStyle.mutateComponentStyles(modelId, lines_ids, {
|
|
33
|
+
coloring: { active: activeColoring },
|
|
34
|
+
});
|
|
35
|
+
if (activeColoring === "constant" || activeColoring === "random") {
|
|
36
|
+
const color = modelLineColor(modelId, lines_ids[0]);
|
|
37
|
+
return setModelLinesColor(modelId, lines_ids, color, activeColoring);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (activeColoring === "vertex") {
|
|
41
|
+
const name = modelLinesVertexAttribute.modelLinesVertexAttributeName(modelId, lines_ids[0]);
|
|
42
|
+
await modelLinesVertexAttribute.setModelLinesVertexAttributeName(modelId, lines_ids, name);
|
|
43
|
+
const [min, max] = modelLinesVertexAttribute.modelLinesVertexAttributeRange(
|
|
44
|
+
modelId,
|
|
45
|
+
lines_ids[0],
|
|
46
|
+
);
|
|
47
|
+
await modelLinesVertexAttribute.setModelLinesVertexAttributeRange(
|
|
48
|
+
modelId,
|
|
49
|
+
lines_ids,
|
|
50
|
+
min,
|
|
51
|
+
max,
|
|
52
|
+
);
|
|
53
|
+
const colorMap = modelLinesVertexAttribute.modelLinesVertexAttributeColorMap(
|
|
54
|
+
modelId,
|
|
55
|
+
lines_ids[0],
|
|
56
|
+
);
|
|
57
|
+
await modelLinesVertexAttribute.setModelLinesVertexAttributeColorMap(
|
|
58
|
+
modelId,
|
|
59
|
+
lines_ids,
|
|
60
|
+
colorMap,
|
|
61
|
+
);
|
|
62
|
+
} else if (activeColoring === "edge") {
|
|
63
|
+
const name = modelLinesEdgeAttribute.modelLinesEdgeAttributeName(modelId, lines_ids[0]);
|
|
64
|
+
await modelLinesEdgeAttribute.setModelLinesEdgeAttributeName(modelId, lines_ids, name);
|
|
65
|
+
const [min, max] = modelLinesEdgeAttribute.modelLinesEdgeAttributeRange(
|
|
66
|
+
modelId,
|
|
67
|
+
lines_ids[0],
|
|
68
|
+
);
|
|
69
|
+
await modelLinesEdgeAttribute.setModelLinesEdgeAttributeRange(modelId, lines_ids, min, max);
|
|
70
|
+
const colorMap = modelLinesEdgeAttribute.modelLinesEdgeAttributeColorMap(
|
|
71
|
+
modelId,
|
|
72
|
+
lines_ids[0],
|
|
73
|
+
);
|
|
74
|
+
await modelLinesEdgeAttribute.setModelLinesEdgeAttributeColorMap(
|
|
75
|
+
modelId,
|
|
76
|
+
lines_ids,
|
|
77
|
+
colorMap,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
22
80
|
}
|
|
23
81
|
|
|
24
|
-
return {
|
|
82
|
+
return {
|
|
83
|
+
setModelLinesColor,
|
|
84
|
+
modelLineColoring,
|
|
85
|
+
modelLineColor,
|
|
86
|
+
modelLineActiveColoring,
|
|
87
|
+
setModelLinesActiveColoring,
|
|
88
|
+
};
|
|
25
89
|
}
|
|
@@ -16,18 +16,27 @@ export function useModelLinesCommonStyle() {
|
|
|
16
16
|
return merge({}, groupStyle, individualStyle);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function modelLineColoring(id, line_id) {
|
|
20
|
+
return modelLineStyle(id, line_id).coloring;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function
|
|
24
|
-
return modelCommonStyle.
|
|
23
|
+
function mutateModelLinesColoring(id, lines_ids, values) {
|
|
24
|
+
return modelCommonStyle.mutateComponentStyles(id, lines_ids, {
|
|
25
|
+
coloring: values,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function mutateModelLineColoring(id, line_id, values) {
|
|
30
|
+
return modelCommonStyle.mutateComponentStyle(id, line_id, {
|
|
31
|
+
coloring: values,
|
|
32
|
+
});
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
return {
|
|
28
36
|
modelLinesStyle,
|
|
29
37
|
modelLineStyle,
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
modelLineColoring,
|
|
39
|
+
mutateModelLinesColoring,
|
|
40
|
+
mutateModelLineColoring,
|
|
32
41
|
};
|
|
33
42
|
}
|
|
@@ -16,24 +16,24 @@ export function useModelLinesEdgeAttribute() {
|
|
|
16
16
|
const viewerStore = useViewerStore();
|
|
17
17
|
|
|
18
18
|
function modelLinesEdgeAttribute(modelId, lineId) {
|
|
19
|
-
return modelLinesCommonStyle.
|
|
19
|
+
return modelLinesCommonStyle.modelLineColoring(modelId, lineId).edge;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function modelLinesEdgeAttributeStoredConfig(modelId, lineId, name) {
|
|
23
23
|
const { storedConfigs } = modelLinesEdgeAttribute(modelId, lineId);
|
|
24
|
-
if (name
|
|
24
|
+
if (name in storedConfigs) {
|
|
25
25
|
return storedConfigs[name];
|
|
26
26
|
}
|
|
27
|
-
return {
|
|
27
|
+
return setModelLinesEdgeAttributeStoredConfig(modelId, [lineId], name, {
|
|
28
28
|
minimum: undefined,
|
|
29
29
|
maximum: undefined,
|
|
30
30
|
colorMap: undefined,
|
|
31
|
-
};
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function mutateModelLinesEdgeStyle(modelId, lineIds, values) {
|
|
35
|
-
return modelLinesCommonStyle.
|
|
36
|
-
|
|
35
|
+
return modelLinesCommonStyle.mutateModelLinesColoring(modelId, lineIds, {
|
|
36
|
+
edge: values,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -51,24 +51,11 @@ export function useModelLinesEdgeAttribute() {
|
|
|
51
51
|
|
|
52
52
|
async function setModelLinesEdgeAttributeName(modelId, lineIds, name) {
|
|
53
53
|
const viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, lineIds);
|
|
54
|
-
|
|
55
|
-
const updates = { name };
|
|
56
|
-
const edge = modelLinesEdgeAttribute(modelId, lineIds[0]);
|
|
57
|
-
if (!(name in edge.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: () => mutateModelLinesEdgeStyle(modelId, lineIds,
|
|
58
|
+
response_function: () => mutateModelLinesEdgeStyle(modelId, lineIds, { name }),
|
|
72
59
|
},
|
|
73
60
|
);
|
|
74
61
|
}
|
|
@@ -36,34 +36,36 @@ export function useModelLinesStyle() {
|
|
|
36
36
|
}
|
|
37
37
|
visibilityGroups[visibility].push(line_id);
|
|
38
38
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const coloring = modelColorStyle.modelLineColoring(modelId, line_id);
|
|
40
|
+
const activeColoring = modelColorStyle.modelLineActiveColoring(modelId, line_id);
|
|
41
|
+
if (activeColoring === "constant") {
|
|
42
|
+
const color = modelColorStyle.modelLineColor(modelId, line_id);
|
|
43
|
+
const color_key = JSON.stringify(color);
|
|
42
44
|
if (!colorGroups[color_key]) {
|
|
43
|
-
colorGroups[color_key] = {
|
|
45
|
+
colorGroups[color_key] = { activeColoring, color, lines_ids: [] };
|
|
44
46
|
}
|
|
45
47
|
colorGroups[color_key].lines_ids.push(line_id);
|
|
48
|
+
} else if (activeColoring === "random") {
|
|
49
|
+
if (!colorGroups["random"]) {
|
|
50
|
+
colorGroups["random"] = { activeColoring, color: undefined, lines_ids: [] };
|
|
51
|
+
}
|
|
52
|
+
colorGroups["random"].lines_ids.push(line_id);
|
|
46
53
|
} else {
|
|
47
|
-
const
|
|
48
|
-
const attributeStyle = style[attributeTypeKey] || {};
|
|
54
|
+
const attributeStyle = coloring[activeColoring];
|
|
49
55
|
const { name } = attributeStyle;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
colorMap,
|
|
62
|
-
lines_ids: [],
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
attributeGroups[attributeGroupKey].lines_ids.push(line_id);
|
|
56
|
+
const { minimum, maximum, colorMap } = attributeStyle.storedConfigs[name];
|
|
57
|
+
const attributeGroupKey = `${activeColoring}_${name}_${colorMap}_${minimum}_${maximum}`;
|
|
58
|
+
if (!attributeGroups[attributeGroupKey]) {
|
|
59
|
+
attributeGroups[attributeGroupKey] = {
|
|
60
|
+
activeColoring,
|
|
61
|
+
name,
|
|
62
|
+
minimum,
|
|
63
|
+
maximum,
|
|
64
|
+
colorMap,
|
|
65
|
+
lines_ids: [],
|
|
66
|
+
};
|
|
66
67
|
}
|
|
68
|
+
attributeGroups[attributeGroupKey].lines_ids.push(line_id);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -71,12 +73,12 @@ export function useModelLinesStyle() {
|
|
|
71
73
|
...Object.entries(visibilityGroups).map(([visibility, ids]) =>
|
|
72
74
|
modelVisibilityStyle.setModelLinesVisibility(modelId, ids, visibility === "true"),
|
|
73
75
|
),
|
|
74
|
-
...Object.values(colorGroups).map(({
|
|
75
|
-
modelColorStyle.setModelLinesColor(modelId, ids, color,
|
|
76
|
+
...Object.values(colorGroups).map(({ activeColoring, color, lines_ids: ids }) =>
|
|
77
|
+
modelColorStyle.setModelLinesColor(modelId, ids, color, activeColoring),
|
|
76
78
|
),
|
|
77
79
|
...Object.values(attributeGroups).flatMap(
|
|
78
|
-
({
|
|
79
|
-
const isVertex =
|
|
80
|
+
({ activeColoring, name, minimum, maximum, colorMap, lines_ids: ids }) => {
|
|
81
|
+
const isVertex = activeColoring === "vertex";
|
|
80
82
|
const attributeStyle = isVertex ? modelLinesVertexAttribute : modelLinesEdgeAttribute;
|
|
81
83
|
const setAttributeName = isVertex
|
|
82
84
|
? attributeStyle.setModelLinesVertexAttributeName
|
|
@@ -16,24 +16,24 @@ export function useModelLinesVertexAttribute() {
|
|
|
16
16
|
const viewerStore = useViewerStore();
|
|
17
17
|
|
|
18
18
|
function modelLinesVertexAttribute(modelId, lineId) {
|
|
19
|
-
return modelLinesCommonStyle.
|
|
19
|
+
return modelLinesCommonStyle.modelLineColoring(modelId, lineId).vertex;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function modelLinesVertexAttributeStoredConfig(modelId, lineId, name) {
|
|
23
23
|
const { storedConfigs } = modelLinesVertexAttribute(modelId, lineId);
|
|
24
|
-
if (name
|
|
24
|
+
if (name in storedConfigs) {
|
|
25
25
|
return storedConfigs[name];
|
|
26
26
|
}
|
|
27
|
-
return {
|
|
27
|
+
return setModelLinesVertexAttributeStoredConfig(modelId, [lineId], name, {
|
|
28
28
|
minimum: undefined,
|
|
29
29
|
maximum: undefined,
|
|
30
30
|
colorMap: undefined,
|
|
31
|
-
};
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function mutateModelLinesVertexStyle(modelId, lineIds, values) {
|
|
35
|
-
return modelLinesCommonStyle.
|
|
36
|
-
|
|
35
|
+
return modelLinesCommonStyle.mutateModelLinesColoring(modelId, lineIds, {
|
|
36
|
+
vertex: values,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -51,24 +51,11 @@ export function useModelLinesVertexAttribute() {
|
|
|
51
51
|
|
|
52
52
|
async function setModelLinesVertexAttributeName(modelId, lineIds, name) {
|
|
53
53
|
const viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, lineIds);
|
|
54
|
-
|
|
55
|
-
const updates = { name };
|
|
56
|
-
const vertex = modelLinesVertexAttribute(modelId, lineIds[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: () => mutateModelLinesVertexStyle(modelId, lineIds,
|
|
58
|
+
response_function: () => mutateModelLinesVertexStyle(modelId, lineIds, { name }),
|
|
72
59
|
},
|
|
73
60
|
);
|
|
74
61
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
2
2
|
import { useModelSurfacesCommonStyle } from "./common";
|
|
3
|
+
import { useModelSurfacesPolygonAttribute } from "./polygon";
|
|
4
|
+
import { useModelSurfacesVertexAttribute } from "./vertex";
|
|
3
5
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
4
6
|
|
|
5
7
|
const schema = viewer_schemas.opengeodeweb_viewer.model.surfaces.color;
|
|
@@ -7,24 +9,100 @@ const schema = viewer_schemas.opengeodeweb_viewer.model.surfaces.color;
|
|
|
7
9
|
export function useModelSurfacesColor() {
|
|
8
10
|
const modelCommonStyle = useModelCommonStyle();
|
|
9
11
|
const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
|
|
12
|
+
const modelSurfacesVertexAttribute = useModelSurfacesVertexAttribute();
|
|
13
|
+
const modelSurfacesPolygonAttribute = useModelSurfacesPolygonAttribute();
|
|
14
|
+
|
|
15
|
+
function modelSurfaceColoring(id, surface_id) {
|
|
16
|
+
return modelSurfacesCommonStyle.modelSurfaceStyle(id, surface_id).coloring;
|
|
17
|
+
}
|
|
10
18
|
|
|
11
19
|
function modelSurfaceColor(id, surface_id) {
|
|
12
|
-
return
|
|
20
|
+
return modelSurfaceColoring(id, surface_id).constant;
|
|
13
21
|
}
|
|
14
22
|
|
|
15
|
-
function setModelSurfacesColor(modelId, surfaces_ids, color,
|
|
16
|
-
return modelCommonStyle.setModelTypeColor(modelId, surfaces_ids, color, schema,
|
|
23
|
+
function setModelSurfacesColor(modelId, surfaces_ids, color, activeColoring = "constant") {
|
|
24
|
+
return modelCommonStyle.setModelTypeColor(modelId, surfaces_ids, color, schema, activeColoring);
|
|
17
25
|
}
|
|
18
26
|
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
function modelSurfaceActiveColoring(id, surface_id) {
|
|
28
|
+
return modelSurfaceColoring(id, surface_id).active;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function setModelSurfacesActiveColoring(modelId, surfaces_ids, activeColoring) {
|
|
32
|
+
await modelCommonStyle.mutateComponentStyles(modelId, surfaces_ids, {
|
|
33
|
+
coloring: { active: activeColoring },
|
|
34
|
+
});
|
|
35
|
+
if (activeColoring === "constant" || activeColoring === "random") {
|
|
36
|
+
const color = modelSurfaceColor(modelId, surfaces_ids[0]);
|
|
37
|
+
return setModelSurfacesColor(modelId, surfaces_ids, color, activeColoring);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (activeColoring === "vertex") {
|
|
41
|
+
const name = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeName(
|
|
42
|
+
modelId,
|
|
43
|
+
surfaces_ids[0],
|
|
44
|
+
);
|
|
45
|
+
await modelSurfacesVertexAttribute.setModelSurfacesVertexAttributeName(
|
|
46
|
+
modelId,
|
|
47
|
+
surfaces_ids,
|
|
48
|
+
name,
|
|
49
|
+
);
|
|
50
|
+
const [min, max] = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeRange(
|
|
51
|
+
modelId,
|
|
52
|
+
surfaces_ids[0],
|
|
53
|
+
);
|
|
54
|
+
await modelSurfacesVertexAttribute.setModelSurfacesVertexAttributeRange(
|
|
55
|
+
modelId,
|
|
56
|
+
surfaces_ids,
|
|
57
|
+
min,
|
|
58
|
+
max,
|
|
59
|
+
);
|
|
60
|
+
const colorMap = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeColorMap(
|
|
61
|
+
modelId,
|
|
62
|
+
surfaces_ids[0],
|
|
63
|
+
);
|
|
64
|
+
await modelSurfacesVertexAttribute.setModelSurfacesVertexAttributeColorMap(
|
|
65
|
+
modelId,
|
|
66
|
+
surfaces_ids,
|
|
67
|
+
colorMap,
|
|
68
|
+
);
|
|
69
|
+
} else if (activeColoring === "polygon") {
|
|
70
|
+
const name = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeName(
|
|
71
|
+
modelId,
|
|
72
|
+
surfaces_ids[0],
|
|
73
|
+
);
|
|
74
|
+
await modelSurfacesPolygonAttribute.setModelSurfacesPolygonAttributeName(
|
|
75
|
+
modelId,
|
|
76
|
+
surfaces_ids,
|
|
77
|
+
name,
|
|
78
|
+
);
|
|
79
|
+
const [min, max] = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeRange(
|
|
80
|
+
modelId,
|
|
81
|
+
surfaces_ids[0],
|
|
82
|
+
);
|
|
83
|
+
await modelSurfacesPolygonAttribute.setModelSurfacesPolygonAttributeRange(
|
|
84
|
+
modelId,
|
|
85
|
+
surfaces_ids,
|
|
86
|
+
min,
|
|
87
|
+
max,
|
|
88
|
+
);
|
|
89
|
+
const colorMap = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeColorMap(
|
|
90
|
+
modelId,
|
|
91
|
+
surfaces_ids[0],
|
|
92
|
+
);
|
|
93
|
+
await modelSurfacesPolygonAttribute.setModelSurfacesPolygonAttributeColorMap(
|
|
94
|
+
modelId,
|
|
95
|
+
surfaces_ids,
|
|
96
|
+
colorMap,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
23
99
|
}
|
|
24
100
|
|
|
25
101
|
return {
|
|
26
102
|
setModelSurfacesColor,
|
|
103
|
+
modelSurfaceColoring,
|
|
27
104
|
modelSurfaceColor,
|
|
28
|
-
|
|
105
|
+
modelSurfaceActiveColoring,
|
|
106
|
+
setModelSurfacesActiveColoring,
|
|
29
107
|
};
|
|
30
108
|
}
|
|
@@ -16,18 +16,27 @@ export function useModelSurfacesCommonStyle() {
|
|
|
16
16
|
return merge({}, groupStyle, individualStyle);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function modelSurfaceColoring(id, surface_id) {
|
|
20
|
+
return modelSurfaceStyle(id, surface_id).coloring;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function
|
|
24
|
-
return modelCommonStyle.
|
|
23
|
+
function mutateModelSurfacesColoring(id, surfaces_ids, values) {
|
|
24
|
+
return modelCommonStyle.mutateComponentStyles(id, surfaces_ids, {
|
|
25
|
+
coloring: values,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function mutateModelSurfaceColoring(id, surface_id, values) {
|
|
30
|
+
return modelCommonStyle.mutateComponentStyle(id, surface_id, {
|
|
31
|
+
coloring: values,
|
|
32
|
+
});
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
return {
|
|
28
36
|
modelSurfacesStyle,
|
|
29
37
|
modelSurfaceStyle,
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
modelSurfaceColoring,
|
|
39
|
+
mutateModelSurfacesColoring,
|
|
40
|
+
mutateModelSurfaceColoring,
|
|
32
41
|
};
|
|
33
42
|
}
|
|
@@ -36,34 +36,36 @@ export function useModelSurfacesStyle() {
|
|
|
36
36
|
}
|
|
37
37
|
visibilityGroups[visibility].push(surfaces_id);
|
|
38
38
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const coloring = modelColorStyle.modelSurfaceColoring(modelId, surfaces_id);
|
|
40
|
+
const activeColoring = modelColorStyle.modelSurfaceActiveColoring(modelId, surfaces_id);
|
|
41
|
+
if (activeColoring === "constant") {
|
|
42
|
+
const color = modelColorStyle.modelSurfaceColor(modelId, surfaces_id);
|
|
43
|
+
const color_key = JSON.stringify(color);
|
|
42
44
|
if (!colorGroups[color_key]) {
|
|
43
|
-
colorGroups[color_key] = {
|
|
45
|
+
colorGroups[color_key] = { activeColoring, color, surfaces_ids: [] };
|
|
44
46
|
}
|
|
45
47
|
colorGroups[color_key].surfaces_ids.push(surfaces_id);
|
|
48
|
+
} else if (activeColoring === "random") {
|
|
49
|
+
if (!colorGroups["random"]) {
|
|
50
|
+
colorGroups["random"] = { activeColoring, color: undefined, surfaces_ids: [] };
|
|
51
|
+
}
|
|
52
|
+
colorGroups["random"].surfaces_ids.push(surfaces_id);
|
|
46
53
|
} else {
|
|
47
|
-
const
|
|
48
|
-
const attributeStyle = style[attributeTypeKey] || {};
|
|
54
|
+
const attributeStyle = coloring[activeColoring];
|
|
49
55
|
const { name } = attributeStyle;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
colorMap,
|
|
62
|
-
surfaces_ids: [],
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
attributeGroups[attributeGroupKey].surfaces_ids.push(surfaces_id);
|
|
56
|
+
const { minimum, maximum, colorMap } = attributeStyle.storedConfigs[name];
|
|
57
|
+
const attributeGroupKey = `${activeColoring}_${name}_${colorMap}_${minimum}_${maximum}`;
|
|
58
|
+
if (!attributeGroups[attributeGroupKey]) {
|
|
59
|
+
attributeGroups[attributeGroupKey] = {
|
|
60
|
+
activeColoring,
|
|
61
|
+
name,
|
|
62
|
+
minimum,
|
|
63
|
+
maximum,
|
|
64
|
+
colorMap,
|
|
65
|
+
surfaces_ids: [],
|
|
66
|
+
};
|
|
66
67
|
}
|
|
68
|
+
attributeGroups[attributeGroupKey].surfaces_ids.push(surfaces_id);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -71,12 +73,12 @@ export function useModelSurfacesStyle() {
|
|
|
71
73
|
...Object.entries(visibilityGroups).map(([visibility, ids]) =>
|
|
72
74
|
modelVisibilityStyle.setModelSurfacesVisibility(modelId, ids, visibility === "true"),
|
|
73
75
|
),
|
|
74
|
-
...Object.values(colorGroups).map(({
|
|
75
|
-
modelColorStyle.setModelSurfacesColor(modelId, ids, color,
|
|
76
|
+
...Object.values(colorGroups).map(({ activeColoring, color, surfaces_ids: ids }) =>
|
|
77
|
+
modelColorStyle.setModelSurfacesColor(modelId, ids, color, activeColoring),
|
|
76
78
|
),
|
|
77
79
|
...Object.values(attributeGroups).flatMap(
|
|
78
|
-
({
|
|
79
|
-
const isVertex =
|
|
80
|
+
({ activeColoring, name, minimum, maximum, colorMap, surfaces_ids: ids }) => {
|
|
81
|
+
const isVertex = activeColoring === "vertex";
|
|
80
82
|
const attributeStyle = isVertex
|
|
81
83
|
? modelSurfacesVertexAttribute
|
|
82
84
|
: modelSurfacesPolygonAttribute;
|
|
@@ -16,24 +16,24 @@ export function useModelSurfacesPolygonAttribute() {
|
|
|
16
16
|
const viewerStore = useViewerStore();
|
|
17
17
|
|
|
18
18
|
function modelSurfacesPolygonAttribute(modelId, surfaceId) {
|
|
19
|
-
return modelSurfacesCommonStyle.
|
|
19
|
+
return modelSurfacesCommonStyle.modelSurfaceColoring(modelId, surfaceId).polygon;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function modelSurfacesPolygonAttributeStoredConfig(modelId, surfaceId, name) {
|
|
23
23
|
const { storedConfigs } = modelSurfacesPolygonAttribute(modelId, surfaceId);
|
|
24
|
-
if (name
|
|
24
|
+
if (name in storedConfigs) {
|
|
25
25
|
return storedConfigs[name];
|
|
26
26
|
}
|
|
27
|
-
return {
|
|
27
|
+
return setModelSurfacesPolygonAttributeStoredConfig(modelId, [surfaceId], name, {
|
|
28
28
|
minimum: undefined,
|
|
29
29
|
maximum: undefined,
|
|
30
30
|
colorMap: undefined,
|
|
31
|
-
};
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function mutateModelSurfacesPolygonStyle(modelId, surfaceIds, values) {
|
|
35
|
-
return modelSurfacesCommonStyle.
|
|
36
|
-
|
|
35
|
+
return modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
|
|
36
|
+
polygon: values,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -51,24 +51,11 @@ export function useModelSurfacesPolygonAttribute() {
|
|
|
51
51
|
|
|
52
52
|
async function setModelSurfacesPolygonAttributeName(modelId, surfaceIds, name) {
|
|
53
53
|
const viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, surfaceIds);
|
|
54
|
-
|
|
55
|
-
const updates = { name };
|
|
56
|
-
const polygon = modelSurfacesPolygonAttribute(modelId, surfaceIds[0]);
|
|
57
|
-
if (!(name in polygon.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: () => mutateModelSurfacesPolygonStyle(modelId, surfaceIds,
|
|
58
|
+
response_function: () => mutateModelSurfacesPolygonStyle(modelId, surfaceIds, { name }),
|
|
72
59
|
},
|
|
73
60
|
);
|
|
74
61
|
}
|
|
@@ -16,24 +16,24 @@ export function useModelSurfacesVertexAttribute() {
|
|
|
16
16
|
const viewerStore = useViewerStore();
|
|
17
17
|
|
|
18
18
|
function modelSurfacesVertexAttribute(modelId, surfaceId) {
|
|
19
|
-
return modelSurfacesCommonStyle.
|
|
19
|
+
return modelSurfacesCommonStyle.modelSurfaceColoring(modelId, surfaceId).vertex;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function modelSurfacesVertexAttributeStoredConfig(modelId, surfaceId, name) {
|
|
23
23
|
const { storedConfigs } = modelSurfacesVertexAttribute(modelId, surfaceId);
|
|
24
|
-
if (name
|
|
24
|
+
if (name in storedConfigs) {
|
|
25
25
|
return storedConfigs[name];
|
|
26
26
|
}
|
|
27
|
-
return {
|
|
27
|
+
return setModelSurfacesVertexAttributeStoredConfig(modelId, [surfaceId], name, {
|
|
28
28
|
minimum: undefined,
|
|
29
29
|
maximum: undefined,
|
|
30
30
|
colorMap: undefined,
|
|
31
|
-
};
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function mutateModelSurfacesVertexStyle(modelId, surfaceIds, values) {
|
|
35
|
-
return modelSurfacesCommonStyle.
|
|
36
|
-
|
|
35
|
+
return modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
|
|
36
|
+
vertex: values,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -51,24 +51,11 @@ export function useModelSurfacesVertexAttribute() {
|
|
|
51
51
|
|
|
52
52
|
async function setModelSurfacesVertexAttributeName(modelId, surfaceIds, name) {
|
|
53
53
|
const viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, surfaceIds);
|
|
54
|
-
|
|
55
|
-
const updates = { name };
|
|
56
|
-
const vertex = modelSurfacesVertexAttribute(modelId, surfaceIds[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: () => mutateModelSurfacesVertexStyle(modelId, surfaceIds,
|
|
58
|
+
response_function: () => mutateModelSurfacesVertexStyle(modelId, surfaceIds, { name }),
|
|
72
59
|
},
|
|
73
60
|
);
|
|
74
61
|
}
|