@geode/opengeodeweb-front 10.28.1-rc.4 → 10.29.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/Viewer/ContextMenu/InfoCard.vue +56 -21
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +21 -0
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +21 -0
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +80 -0
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +10 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +81 -0
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +20 -0
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +36 -0
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +18 -0
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +36 -0
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +36 -0
- package/app/components/Viewer/Options/AttributeSelector.vue +47 -38
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +26 -22
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +10 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +20 -0
- package/app/components/Viewer/Surface/PolygonsOptions.vue +20 -0
- package/internal/stores/data_style/mesh/cells/cell.js +94 -60
- package/internal/stores/data_style/mesh/cells/index.js +21 -22
- package/internal/stores/data_style/mesh/cells/vertex.js +83 -64
- package/internal/stores/data_style/mesh/edges/edge.js +83 -67
- package/internal/stores/data_style/mesh/edges/index.js +22 -19
- package/internal/stores/data_style/mesh/edges/vertex.js +87 -65
- package/internal/stores/data_style/mesh/points/index.js +9 -9
- package/internal/stores/data_style/mesh/points/vertex.js +96 -99
- package/internal/stores/data_style/mesh/polygons/index.js +26 -16
- package/internal/stores/data_style/mesh/polygons/polygon.js +88 -66
- package/internal/stores/data_style/mesh/polygons/vertex.js +88 -66
- package/internal/stores/data_style/mesh/polyhedra/index.js +33 -22
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +101 -103
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +101 -103
- package/internal/stores/data_style/model/blocks/color.js +27 -28
- package/internal/stores/data_style/model/blocks/index.js +140 -72
- package/internal/stores/data_style/model/blocks/polyhedron.js +114 -58
- package/internal/stores/data_style/model/blocks/vertex.js +107 -57
- package/internal/stores/data_style/model/common.js +6 -6
- package/internal/stores/data_style/model/corners/color.js +12 -16
- package/internal/stores/data_style/model/corners/index.js +95 -63
- package/internal/stores/data_style/model/corners/vertex.js +108 -58
- package/internal/stores/data_style/model/lines/color.js +18 -23
- package/internal/stores/data_style/model/lines/edge.js +106 -54
- package/internal/stores/data_style/model/lines/index.js +132 -71
- package/internal/stores/data_style/model/lines/vertex.js +107 -54
- package/internal/stores/data_style/model/surfaces/color.js +24 -32
- package/internal/stores/data_style/model/surfaces/index.js +142 -74
- package/internal/stores/data_style/model/surfaces/polygon.js +114 -58
- package/internal/stores/data_style/model/surfaces/vertex.js +114 -58
- package/internal/stores/data_style/state.js +105 -94
- package/package.json +1 -1
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +200 -24
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +132 -34
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +60 -11
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +116 -22
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +145 -34
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +206 -33
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +94 -15
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +187 -30
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +379 -31
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { isModelCornersVertexAttributeValid, useModelCornersVertexAttribute } from "./vertex";
|
|
1
2
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
2
3
|
import { useModelCornersColor } from "./color";
|
|
3
4
|
import { useModelCornersCommonStyle } from "./common";
|
|
4
|
-
import { useModelCornersVertexAttribute } from "./vertex";
|
|
5
5
|
import { useModelCornersVisibility } from "./visibility";
|
|
6
6
|
|
|
7
7
|
async function setModelCornersDefaultStyle(_id) {
|
|
@@ -15,85 +15,117 @@ export function useModelCornersStyle() {
|
|
|
15
15
|
const modelColorStyle = useModelCornersColor();
|
|
16
16
|
const modelCornersVertexAttribute = useModelCornersVertexAttribute();
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
const corners_ids = await dataStore.getCornersGeodeIds(modelId);
|
|
20
|
-
if (!corners_ids?.length) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
18
|
+
function applyModelCornersVisibilityStyle(modelId, corners_ids) {
|
|
24
19
|
const visibilityGroups = {};
|
|
25
|
-
const colorGroups = {};
|
|
26
|
-
const attributeGroups = {};
|
|
27
|
-
|
|
28
20
|
for (const corner_id of corners_ids) {
|
|
29
21
|
const style = modelCommonStyle.modelCornerStyle(modelId, corner_id);
|
|
30
|
-
|
|
31
22
|
const visibility = String(style.visibility);
|
|
32
23
|
if (!visibilityGroups[visibility]) {
|
|
33
24
|
visibilityGroups[visibility] = [];
|
|
34
25
|
}
|
|
35
26
|
visibilityGroups[visibility].push(corner_id);
|
|
27
|
+
}
|
|
28
|
+
return Object.entries(visibilityGroups).map(([visibility, ids]) =>
|
|
29
|
+
modelVisibilityStyle.setModelCornersVisibility(modelId, ids, visibility === "true"),
|
|
30
|
+
);
|
|
31
|
+
}
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
function applyModelCornersColoringStyle(modelId, corners_ids) {
|
|
34
|
+
const activeColoringGroups = {};
|
|
35
|
+
for (const corner_id of corners_ids) {
|
|
38
36
|
const activeColoring = modelColorStyle.modelCornerActiveColoring(modelId, corner_id);
|
|
39
|
-
if (activeColoring
|
|
40
|
-
|
|
41
|
-
const color_key = JSON.stringify(color);
|
|
42
|
-
if (!colorGroups[color_key]) {
|
|
43
|
-
colorGroups[color_key] = { activeColoring, color, corners_ids: [] };
|
|
44
|
-
}
|
|
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);
|
|
51
|
-
} else {
|
|
52
|
-
const attributeStyle = coloring[activeColoring];
|
|
53
|
-
const { name } = attributeStyle;
|
|
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
|
-
};
|
|
65
|
-
}
|
|
66
|
-
attributeGroups[attributeGroupKey].corners_ids.push(corner_id);
|
|
37
|
+
if (!activeColoringGroups[activeColoring]) {
|
|
38
|
+
activeColoringGroups[activeColoring] = [];
|
|
67
39
|
}
|
|
40
|
+
activeColoringGroups[activeColoring].push(corner_id);
|
|
68
41
|
}
|
|
69
42
|
|
|
70
|
-
const
|
|
71
|
-
...Object.entries(visibilityGroups).map(([visibility, ids]) =>
|
|
72
|
-
modelVisibilityStyle.setModelCornersVisibility(modelId, ids, visibility === "true"),
|
|
73
|
-
),
|
|
74
|
-
...Object.values(colorGroups).map(({ activeColoring, color, corners_ids: ids }) =>
|
|
75
|
-
modelColorStyle.setModelCornersColor(modelId, ids, color, activeColoring),
|
|
76
|
-
),
|
|
77
|
-
...Object.values(attributeGroups).flatMap(
|
|
78
|
-
({ name, minimum, maximum, colorMap, corners_ids: ids }) => {
|
|
79
|
-
const attribute = modelCornersVertexAttribute;
|
|
80
|
-
const setAttributeName = attribute.setModelCornersVertexAttributeName;
|
|
81
|
-
const setAttributeRange = attribute.setModelCornersVertexAttributeRange;
|
|
82
|
-
const setAttributeColorMap = attribute.setModelCornersVertexAttributeColorMap;
|
|
43
|
+
const coloringPromises = [];
|
|
83
44
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
45
|
+
for (const [type, type_corners_ids] of Object.entries(activeColoringGroups)) {
|
|
46
|
+
if (type === "constant") {
|
|
47
|
+
const colorGroups = {};
|
|
48
|
+
for (const corner_id of type_corners_ids) {
|
|
49
|
+
const color = modelColorStyle.modelCornerColor(modelId, corner_id);
|
|
50
|
+
const color_key = JSON.stringify(color);
|
|
51
|
+
if (!colorGroups[color_key]) {
|
|
52
|
+
colorGroups[color_key] = { color, corners_ids: [] };
|
|
87
53
|
}
|
|
88
|
-
|
|
89
|
-
|
|
54
|
+
colorGroups[color_key].corners_ids.push(corner_id);
|
|
55
|
+
}
|
|
56
|
+
coloringPromises.push(
|
|
57
|
+
...Object.values(colorGroups).map(({ color, corners_ids: ids }) =>
|
|
58
|
+
modelColorStyle.setModelCornersColor(modelId, ids, color, "constant"),
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
} else if (type === "random") {
|
|
62
|
+
coloringPromises.push(
|
|
63
|
+
modelColorStyle.setModelCornersColor(modelId, type_corners_ids, undefined, "random"),
|
|
64
|
+
);
|
|
65
|
+
} else if (type === "vertex") {
|
|
66
|
+
const vertexGroups = {};
|
|
67
|
+
for (const corner_id of type_corners_ids) {
|
|
68
|
+
const name = modelCornersVertexAttribute.modelCornersVertexAttributeName(
|
|
69
|
+
modelId,
|
|
70
|
+
corner_id,
|
|
71
|
+
);
|
|
72
|
+
const item = modelCornersVertexAttribute.modelCornersVertexAttributeItem(
|
|
73
|
+
modelId,
|
|
74
|
+
corner_id,
|
|
75
|
+
);
|
|
76
|
+
const [minimum, maximum] = modelCornersVertexAttribute.modelCornersVertexAttributeRange(
|
|
77
|
+
modelId,
|
|
78
|
+
corner_id,
|
|
79
|
+
);
|
|
80
|
+
const colorMap = modelCornersVertexAttribute.modelCornersVertexAttributeColorMap(
|
|
81
|
+
modelId,
|
|
82
|
+
corner_id,
|
|
83
|
+
);
|
|
84
|
+
const attribute = { name, item, minimum, maximum, colorMap };
|
|
85
|
+
if (!isModelCornersVertexAttributeValid(attribute)) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const key = `${name}_${item}_${colorMap}_${minimum}_${maximum}`;
|
|
89
|
+
if (!vertexGroups[key]) {
|
|
90
|
+
vertexGroups[key] = {
|
|
91
|
+
name,
|
|
92
|
+
item,
|
|
93
|
+
minimum,
|
|
94
|
+
maximum,
|
|
95
|
+
colorMap,
|
|
96
|
+
corners_ids: [],
|
|
97
|
+
};
|
|
90
98
|
}
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
vertexGroups[key].corners_ids.push(corner_id);
|
|
100
|
+
}
|
|
101
|
+
coloringPromises.push(
|
|
102
|
+
...Object.values(vertexGroups).map(
|
|
103
|
+
({ name, item, minimum, maximum, colorMap, corners_ids: ids }) =>
|
|
104
|
+
modelCornersVertexAttribute.setModelCornersVertexAttribute(modelId, ids, {
|
|
105
|
+
name,
|
|
106
|
+
item,
|
|
107
|
+
minimum,
|
|
108
|
+
maximum,
|
|
109
|
+
colorMap,
|
|
110
|
+
}),
|
|
111
|
+
),
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return Promise.all(coloringPromises);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function applyModelCornersStyle(modelId) {
|
|
120
|
+
const corners_ids = await dataStore.getCornersGeodeIds(modelId);
|
|
121
|
+
if (corners_ids.length === 0) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
95
124
|
|
|
96
|
-
return Promise.all(
|
|
125
|
+
return Promise.all([
|
|
126
|
+
applyModelCornersVisibilityStyle(modelId, corners_ids),
|
|
127
|
+
applyModelCornersColoringStyle(modelId, corners_ids),
|
|
128
|
+
]);
|
|
97
129
|
}
|
|
98
130
|
|
|
99
131
|
return {
|
|
@@ -8,9 +8,20 @@ import { useModelCornersCommonStyle } from "./common";
|
|
|
8
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
9
9
|
|
|
10
10
|
// Local constants
|
|
11
|
-
const
|
|
11
|
+
const attributeSchema = viewer_schemas.opengeodeweb_viewer.model.corners.attribute.vertex.attribute;
|
|
12
|
+
|
|
13
|
+
function isModelCornersVertexAttributeValid({ name, item, minimum, maximum, colorMap }) {
|
|
14
|
+
return (
|
|
15
|
+
name !== undefined &&
|
|
16
|
+
item !== undefined &&
|
|
17
|
+
minimum !== undefined &&
|
|
18
|
+
maximum !== undefined &&
|
|
19
|
+
colorMap !== undefined
|
|
20
|
+
);
|
|
21
|
+
}
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
// oxlint-disable-next-line max-lines-per-function
|
|
24
|
+
function useModelCornersVertexAttribute() {
|
|
14
25
|
const dataStore = useDataStore();
|
|
15
26
|
const modelCornersCommonStyle = useModelCornersCommonStyle();
|
|
16
27
|
const viewerStore = useViewerStore();
|
|
@@ -19,16 +30,16 @@ export function useModelCornersVertexAttribute() {
|
|
|
19
30
|
return modelCornersCommonStyle.modelCornerColoring(modelId, cornerId).vertex;
|
|
20
31
|
}
|
|
21
32
|
|
|
22
|
-
function modelCornersVertexAttributeStoredConfig(modelId, cornerId, name) {
|
|
33
|
+
function modelCornersVertexAttributeStoredConfig(modelId, cornerId, name, item) {
|
|
23
34
|
const { storedConfigs } = modelCornersVertexAttribute(modelId, cornerId);
|
|
24
|
-
if (name in storedConfigs) {
|
|
25
|
-
return storedConfigs[name];
|
|
35
|
+
if (storedConfigs && name in storedConfigs && item in storedConfigs[name]) {
|
|
36
|
+
return storedConfigs[name][item];
|
|
26
37
|
}
|
|
27
|
-
return
|
|
38
|
+
return {
|
|
28
39
|
minimum: undefined,
|
|
29
40
|
maximum: undefined,
|
|
30
41
|
colorMap: undefined,
|
|
31
|
-
}
|
|
42
|
+
};
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
function mutateModelCornersVertexStyle(modelId, cornerIds, values) {
|
|
@@ -37,10 +48,13 @@ export function useModelCornersVertexAttribute() {
|
|
|
37
48
|
});
|
|
38
49
|
}
|
|
39
50
|
|
|
40
|
-
function setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, config) {
|
|
51
|
+
function setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, config) {
|
|
41
52
|
return mutateModelCornersVertexStyle(modelId, cornerIds, {
|
|
42
53
|
storedConfigs: {
|
|
43
|
-
[name]:
|
|
54
|
+
[name]: {
|
|
55
|
+
lastItem: item,
|
|
56
|
+
[item]: config,
|
|
57
|
+
},
|
|
44
58
|
},
|
|
45
59
|
});
|
|
46
60
|
}
|
|
@@ -49,83 +63,119 @@ export function useModelCornersVertexAttribute() {
|
|
|
49
63
|
return modelCornersVertexAttribute(modelId, cornerId).name;
|
|
50
64
|
}
|
|
51
65
|
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
response_function: () => mutateModelCornersVertexStyle(modelId, cornerIds, { name }),
|
|
59
|
-
},
|
|
66
|
+
function modelCornersVertexAttributeItem(modelId, cornerId) {
|
|
67
|
+
const vertexAttribute = modelCornersVertexAttribute(modelId, cornerId);
|
|
68
|
+
return (
|
|
69
|
+
vertexAttribute.item ??
|
|
70
|
+
modelCornersVertexAttributeLastItem(modelId, cornerId, vertexAttribute.name)
|
|
60
71
|
);
|
|
61
72
|
}
|
|
62
73
|
|
|
74
|
+
function modelCornersVertexAttributeLastItem(modelId, cornerId, name) {
|
|
75
|
+
const { storedConfigs } = modelCornersVertexAttribute(modelId, cornerId);
|
|
76
|
+
if (!(name in storedConfigs)) {
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
return storedConfigs[name].lastItem;
|
|
80
|
+
}
|
|
81
|
+
|
|
63
82
|
function modelCornersVertexAttributeRange(modelId, cornerId) {
|
|
64
83
|
const name = modelCornersVertexAttributeName(modelId, cornerId);
|
|
65
|
-
const
|
|
84
|
+
const item = modelCornersVertexAttributeItem(modelId, cornerId);
|
|
85
|
+
const storedConfig = modelCornersVertexAttributeStoredConfig(modelId, cornerId, name, item);
|
|
66
86
|
const { minimum, maximum } = storedConfig;
|
|
67
87
|
return [minimum, maximum];
|
|
68
88
|
}
|
|
69
89
|
|
|
70
|
-
|
|
71
|
-
const name = modelCornersVertexAttributeName(modelId,
|
|
72
|
-
const
|
|
73
|
-
const
|
|
90
|
+
function modelCornersVertexAttributeColorMap(modelId, cornerId) {
|
|
91
|
+
const name = modelCornersVertexAttributeName(modelId, cornerId);
|
|
92
|
+
const item = modelCornersVertexAttributeItem(modelId, cornerId);
|
|
93
|
+
const storedConfig = modelCornersVertexAttributeStoredConfig(modelId, cornerId, name, item);
|
|
94
|
+
return storedConfig.colorMap;
|
|
95
|
+
}
|
|
74
96
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
97
|
+
function applyVertexAttribute(modelId, cornerIds) {
|
|
98
|
+
const name = modelCornersVertexAttributeName(modelId, cornerIds[0]);
|
|
99
|
+
const item = modelCornersVertexAttributeItem(modelId, cornerIds[0]);
|
|
100
|
+
const storedConfig = modelCornersVertexAttributeStoredConfig(modelId, cornerIds[0], name, item);
|
|
101
|
+
const attribute = {
|
|
102
|
+
name,
|
|
103
|
+
item,
|
|
104
|
+
minimum: storedConfig.minimum,
|
|
105
|
+
maximum: storedConfig.maximum,
|
|
106
|
+
colorMap: storedConfig.colorMap,
|
|
107
|
+
};
|
|
108
|
+
if (isModelCornersVertexAttributeValid(attribute)) {
|
|
109
|
+
return setModelCornersVertexAttribute(modelId, cornerIds, attribute);
|
|
88
110
|
}
|
|
89
|
-
return
|
|
111
|
+
return Promise.resolve();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function setModelCornersVertexAttributeName(modelId, cornerIds, name) {
|
|
115
|
+
const item = modelCornersVertexAttributeLastItem(modelId, cornerIds[0], name);
|
|
116
|
+
mutateModelCornersVertexStyle(modelId, cornerIds, { name, item });
|
|
117
|
+
return applyVertexAttribute(modelId, cornerIds);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function setModelCornersVertexAttributeItem(modelId, cornerIds, item) {
|
|
121
|
+
mutateModelCornersVertexStyle(modelId, cornerIds, { item });
|
|
122
|
+
return applyVertexAttribute(modelId, cornerIds);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function setModelCornersVertexAttributeRange(modelId, cornerIds, minimum, maximum) {
|
|
126
|
+
const name = modelCornersVertexAttributeName(modelId, cornerIds[0]);
|
|
127
|
+
const item = modelCornersVertexAttributeItem(modelId, cornerIds[0]);
|
|
128
|
+
setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, {
|
|
90
129
|
minimum,
|
|
91
130
|
maximum,
|
|
92
131
|
});
|
|
132
|
+
return applyVertexAttribute(modelId, cornerIds);
|
|
93
133
|
}
|
|
94
134
|
|
|
95
|
-
function
|
|
96
|
-
const name = modelCornersVertexAttributeName(modelId,
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
return
|
|
135
|
+
function setModelCornersVertexAttributeColorMap(modelId, cornerIds, colorMap) {
|
|
136
|
+
const name = modelCornersVertexAttributeName(modelId, cornerIds[0]);
|
|
137
|
+
const item = modelCornersVertexAttributeItem(modelId, cornerIds[0]);
|
|
138
|
+
setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, { colorMap });
|
|
139
|
+
return applyVertexAttribute(modelId, cornerIds);
|
|
100
140
|
}
|
|
101
141
|
|
|
102
|
-
async function
|
|
103
|
-
|
|
104
|
-
|
|
142
|
+
async function setModelCornersVertexAttribute(
|
|
143
|
+
modelId,
|
|
144
|
+
cornerIds,
|
|
145
|
+
{ name, item, minimum, maximum, colorMap },
|
|
146
|
+
) {
|
|
147
|
+
mutateModelCornersVertexStyle(modelId, cornerIds, { name, item });
|
|
148
|
+
setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, {
|
|
149
|
+
minimum,
|
|
150
|
+
maximum,
|
|
151
|
+
colorMap,
|
|
152
|
+
});
|
|
105
153
|
const points = getRGBPointsFromPreset(colorMap);
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
return setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, { colorMap });
|
|
154
|
+
const corner_viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, cornerIds);
|
|
155
|
+
const params = {
|
|
156
|
+
id: modelId,
|
|
157
|
+
block_ids: corner_viewer_ids,
|
|
158
|
+
name,
|
|
159
|
+
item,
|
|
160
|
+
points,
|
|
161
|
+
minimum,
|
|
162
|
+
maximum,
|
|
163
|
+
};
|
|
164
|
+
return viewerStore.request({ schema: attributeSchema, params });
|
|
120
165
|
}
|
|
121
166
|
|
|
122
167
|
return {
|
|
123
168
|
modelCornersVertexAttributeName,
|
|
169
|
+
modelCornersVertexAttributeItem,
|
|
124
170
|
modelCornersVertexAttributeRange,
|
|
125
171
|
modelCornersVertexAttributeColorMap,
|
|
126
172
|
modelCornersVertexAttributeStoredConfig,
|
|
173
|
+
setModelCornersVertexAttribute,
|
|
127
174
|
setModelCornersVertexAttributeName,
|
|
175
|
+
setModelCornersVertexAttributeItem,
|
|
128
176
|
setModelCornersVertexAttributeRange,
|
|
129
177
|
setModelCornersVertexAttributeColorMap,
|
|
130
178
|
};
|
|
131
179
|
}
|
|
180
|
+
|
|
181
|
+
export { isModelCornersVertexAttributeValid, useModelCornersVertexAttribute };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { isModelLinesEdgeAttributeValid, useModelLinesEdgeAttribute } from "./edge";
|
|
2
|
+
import { isModelLinesVertexAttributeValid, useModelLinesVertexAttribute } from "./vertex";
|
|
1
3
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
2
4
|
import { useModelLinesCommonStyle } from "./common";
|
|
3
|
-
import { useModelLinesEdgeAttribute } from "./edge";
|
|
4
|
-
import { useModelLinesVertexAttribute } from "./vertex";
|
|
5
5
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
6
6
|
|
|
7
7
|
const schema = viewer_schemas.opengeodeweb_viewer.model.lines.color;
|
|
@@ -39,43 +39,38 @@ export function useModelLinesColor() {
|
|
|
39
39
|
|
|
40
40
|
if (activeColoring === "vertex") {
|
|
41
41
|
const name = modelLinesVertexAttribute.modelLinesVertexAttributeName(modelId, lines_ids[0]);
|
|
42
|
-
|
|
43
|
-
const [
|
|
42
|
+
const item = modelLinesVertexAttribute.modelLinesVertexAttributeItem(modelId, lines_ids[0]);
|
|
43
|
+
const [minimum, maximum] = modelLinesVertexAttribute.modelLinesVertexAttributeRange(
|
|
44
44
|
modelId,
|
|
45
45
|
lines_ids[0],
|
|
46
46
|
);
|
|
47
|
-
await modelLinesVertexAttribute.setModelLinesVertexAttributeRange(
|
|
48
|
-
modelId,
|
|
49
|
-
lines_ids,
|
|
50
|
-
min,
|
|
51
|
-
max,
|
|
52
|
-
);
|
|
53
47
|
const colorMap = modelLinesVertexAttribute.modelLinesVertexAttributeColorMap(
|
|
54
48
|
modelId,
|
|
55
49
|
lines_ids[0],
|
|
56
50
|
);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
const attribute = { name, item, minimum, maximum, colorMap };
|
|
52
|
+
if (isModelLinesVertexAttributeValid(attribute)) {
|
|
53
|
+
return modelLinesVertexAttribute.setModelLinesVertexAttribute(
|
|
54
|
+
modelId,
|
|
55
|
+
lines_ids,
|
|
56
|
+
attribute,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
62
59
|
} else if (activeColoring === "edge") {
|
|
63
60
|
const name = modelLinesEdgeAttribute.modelLinesEdgeAttributeName(modelId, lines_ids[0]);
|
|
64
|
-
|
|
65
|
-
const [
|
|
61
|
+
const item = modelLinesEdgeAttribute.modelLinesEdgeAttributeItem(modelId, lines_ids[0]);
|
|
62
|
+
const [minimum, maximum] = modelLinesEdgeAttribute.modelLinesEdgeAttributeRange(
|
|
66
63
|
modelId,
|
|
67
64
|
lines_ids[0],
|
|
68
65
|
);
|
|
69
|
-
await modelLinesEdgeAttribute.setModelLinesEdgeAttributeRange(modelId, lines_ids, min, max);
|
|
70
66
|
const colorMap = modelLinesEdgeAttribute.modelLinesEdgeAttributeColorMap(
|
|
71
67
|
modelId,
|
|
72
68
|
lines_ids[0],
|
|
73
69
|
);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
lines_ids,
|
|
77
|
-
|
|
78
|
-
);
|
|
70
|
+
const attribute = { name, item, minimum, maximum, colorMap };
|
|
71
|
+
if (isModelLinesEdgeAttributeValid(attribute)) {
|
|
72
|
+
return modelLinesEdgeAttribute.setModelLinesEdgeAttribute(modelId, lines_ids, attribute);
|
|
73
|
+
}
|
|
79
74
|
}
|
|
80
75
|
}
|
|
81
76
|
|