@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
|
@@ -9,8 +9,18 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
9
9
|
// Local constants
|
|
10
10
|
const meshEdgesEdgeAttributeSchemas = viewer_schemas.opengeodeweb_viewer.mesh.edges.attribute.edge;
|
|
11
11
|
|
|
12
|
+
function isMeshEdgesEdgeAttributeValid({ name, item, minimum, maximum, colorMap }) {
|
|
13
|
+
return (
|
|
14
|
+
name !== undefined &&
|
|
15
|
+
item !== undefined &&
|
|
16
|
+
minimum !== undefined &&
|
|
17
|
+
maximum !== undefined &&
|
|
18
|
+
colorMap !== undefined
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
// oxlint-disable-next-line max-lines-per-function
|
|
13
|
-
|
|
23
|
+
function useMeshEdgesEdgeAttributeStyle() {
|
|
14
24
|
const viewerStore = useViewerStore();
|
|
15
25
|
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
16
26
|
|
|
@@ -22,16 +32,16 @@ export function useMeshEdgesEdgeAttributeStyle() {
|
|
|
22
32
|
return meshEdgesColoring(id).edge;
|
|
23
33
|
}
|
|
24
34
|
|
|
25
|
-
function meshEdgesEdgeAttributeStoredConfig(id, name) {
|
|
35
|
+
function meshEdgesEdgeAttributeStoredConfig(id, name, item) {
|
|
26
36
|
const { storedConfigs } = meshEdgesEdgeAttribute(id);
|
|
27
|
-
if (name in storedConfigs) {
|
|
28
|
-
return storedConfigs[name];
|
|
37
|
+
if (storedConfigs && name in storedConfigs && item in storedConfigs[name]) {
|
|
38
|
+
return storedConfigs[name][item];
|
|
29
39
|
}
|
|
30
|
-
return
|
|
40
|
+
return {
|
|
31
41
|
minimum: undefined,
|
|
32
42
|
maximum: undefined,
|
|
33
43
|
colorMap: undefined,
|
|
34
|
-
}
|
|
44
|
+
};
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
function mutateMeshEdgesEdgeStyle(id, values) {
|
|
@@ -42,104 +52,110 @@ export function useMeshEdgesEdgeAttributeStyle() {
|
|
|
42
52
|
});
|
|
43
53
|
}
|
|
44
54
|
|
|
45
|
-
function setMeshEdgesEdgeAttributeStoredConfig(id, name, config) {
|
|
55
|
+
function setMeshEdgesEdgeAttributeStoredConfig(id, name, item, config) {
|
|
46
56
|
return mutateMeshEdgesEdgeStyle(id, {
|
|
47
57
|
storedConfigs: {
|
|
48
|
-
[name]:
|
|
58
|
+
[name]: {
|
|
59
|
+
lastItem: item,
|
|
60
|
+
[item]: config,
|
|
61
|
+
},
|
|
49
62
|
},
|
|
50
63
|
});
|
|
51
64
|
}
|
|
52
65
|
|
|
66
|
+
function applyEdgeAttribute(id) {
|
|
67
|
+
const name = meshEdgesEdgeAttributeName(id);
|
|
68
|
+
const item = meshEdgesEdgeAttributeItem(id);
|
|
69
|
+
const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
|
|
70
|
+
const attribute = {
|
|
71
|
+
name,
|
|
72
|
+
item,
|
|
73
|
+
minimum: storedConfig.minimum,
|
|
74
|
+
maximum: storedConfig.maximum,
|
|
75
|
+
colorMap: storedConfig.colorMap,
|
|
76
|
+
};
|
|
77
|
+
if (isMeshEdgesEdgeAttributeValid(attribute)) {
|
|
78
|
+
return setMeshEdgesEdgeAttribute(id, attribute);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
53
82
|
function meshEdgesEdgeAttributeName(id) {
|
|
54
83
|
return meshEdgesEdgeAttribute(id).name;
|
|
55
84
|
}
|
|
56
85
|
|
|
57
86
|
function setMeshEdgesEdgeAttributeName(id, name) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
);
|
|
87
|
+
const item = meshEdgesEdgeAttributeLastItem(id, name);
|
|
88
|
+
mutateMeshEdgesEdgeStyle(id, { name, item });
|
|
89
|
+
return applyEdgeAttribute(id);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function meshEdgesEdgeAttributeItem(id) {
|
|
93
|
+
const { item, name } = meshEdgesEdgeAttribute(id);
|
|
94
|
+
return item ?? meshEdgesEdgeAttributeLastItem(id, name);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function setMeshEdgesEdgeAttributeItem(id, item) {
|
|
98
|
+
mutateMeshEdgesEdgeStyle(id, { item });
|
|
99
|
+
return applyEdgeAttribute(id);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function meshEdgesEdgeAttributeLastItem(id, name) {
|
|
103
|
+
const { storedConfigs } = meshEdgesEdgeAttribute(id);
|
|
104
|
+
if (storedConfigs && name in storedConfigs) {
|
|
105
|
+
return storedConfigs[name].lastItem;
|
|
106
|
+
}
|
|
107
|
+
return 0;
|
|
82
108
|
}
|
|
83
109
|
|
|
84
110
|
function meshEdgesEdgeAttributeRange(id) {
|
|
85
111
|
const name = meshEdgesEdgeAttributeName(id);
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
return [minimum, maximum];
|
|
112
|
+
const item = meshEdgesEdgeAttributeItem(id);
|
|
113
|
+
const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
|
|
114
|
+
return [storedConfig.minimum, storedConfig.maximum];
|
|
89
115
|
}
|
|
90
116
|
|
|
91
117
|
function setMeshEdgesEdgeAttributeRange(id, minimum, maximum) {
|
|
92
118
|
const name = meshEdgesEdgeAttributeName(id);
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const params = { id, points, minimum, maximum };
|
|
97
|
-
return viewerStore.request(
|
|
98
|
-
{ schema, params },
|
|
99
|
-
{
|
|
100
|
-
response_function: () =>
|
|
101
|
-
setMeshEdgesEdgeAttributeStoredConfig(id, name, { minimum, maximum }),
|
|
102
|
-
},
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
return setMeshEdgesEdgeAttributeStoredConfig(id, name, {
|
|
106
|
-
minimum,
|
|
107
|
-
maximum,
|
|
108
|
-
});
|
|
119
|
+
const item = meshEdgesEdgeAttributeItem(id);
|
|
120
|
+
setMeshEdgesEdgeAttributeStoredConfig(id, name, item, { minimum, maximum });
|
|
121
|
+
return applyEdgeAttribute(id);
|
|
109
122
|
}
|
|
110
123
|
|
|
111
124
|
function meshEdgesEdgeAttributeColorMap(id) {
|
|
112
125
|
const name = meshEdgesEdgeAttributeName(id);
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
return colorMap;
|
|
126
|
+
const item = meshEdgesEdgeAttributeItem(id);
|
|
127
|
+
const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
|
|
128
|
+
return storedConfig.colorMap;
|
|
116
129
|
}
|
|
117
130
|
|
|
118
131
|
function setMeshEdgesEdgeAttributeColorMap(id, colorMap) {
|
|
119
132
|
const name = meshEdgesEdgeAttributeName(id);
|
|
120
|
-
const
|
|
133
|
+
const item = meshEdgesEdgeAttributeItem(id);
|
|
134
|
+
setMeshEdgesEdgeAttributeStoredConfig(id, name, item, { colorMap });
|
|
135
|
+
return applyEdgeAttribute(id);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function setMeshEdgesEdgeAttribute(id, { name, item, minimum, maximum, colorMap }) {
|
|
139
|
+
mutateMeshEdgesEdgeStyle(id, { name, item });
|
|
140
|
+
setMeshEdgesEdgeAttributeStoredConfig(id, name, item, { minimum, maximum, colorMap });
|
|
121
141
|
const points = getRGBPointsFromPreset(colorMap);
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const params = { id, points, minimum, maximum };
|
|
126
|
-
return viewerStore.request(
|
|
127
|
-
{ schema, params },
|
|
128
|
-
{
|
|
129
|
-
response_function: () => setMeshEdgesEdgeAttributeStoredConfig(id, name, { colorMap }),
|
|
130
|
-
},
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
return setMeshEdgesEdgeAttributeStoredConfig(id, name, { colorMap });
|
|
142
|
+
const schema = meshEdgesEdgeAttributeSchemas.attribute;
|
|
143
|
+
const params = { id, name, item, points, minimum, maximum };
|
|
144
|
+
return viewerStore.request({ schema, params });
|
|
134
145
|
}
|
|
135
146
|
|
|
136
147
|
return {
|
|
137
148
|
meshEdgesEdgeAttributeName,
|
|
149
|
+
meshEdgesEdgeAttributeItem,
|
|
138
150
|
meshEdgesEdgeAttributeRange,
|
|
139
151
|
meshEdgesEdgeAttributeColorMap,
|
|
140
152
|
meshEdgesEdgeAttributeStoredConfig,
|
|
153
|
+
setMeshEdgesEdgeAttribute,
|
|
141
154
|
setMeshEdgesEdgeAttributeName,
|
|
155
|
+
setMeshEdgesEdgeAttributeItem,
|
|
142
156
|
setMeshEdgesEdgeAttributeRange,
|
|
143
157
|
setMeshEdgesEdgeAttributeColorMap,
|
|
144
158
|
};
|
|
145
159
|
}
|
|
160
|
+
|
|
161
|
+
export { isMeshEdgesEdgeAttributeValid, useMeshEdgesEdgeAttributeStyle };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Third party imports
|
|
2
2
|
|
|
3
3
|
// Local imports
|
|
4
|
+
import { isMeshEdgesEdgeAttributeValid, useMeshEdgesEdgeAttributeStyle } from "./edge";
|
|
5
|
+
import { isMeshEdgesVertexAttributeValid, useMeshEdgesVertexAttributeStyle } from "./vertex";
|
|
4
6
|
import { useMeshEdgesColorStyle } from "./color";
|
|
5
7
|
import { useMeshEdgesCommonStyle } from "./common";
|
|
6
|
-
import { useMeshEdgesEdgeAttributeStyle } from "./edge";
|
|
7
|
-
import { useMeshEdgesVertexAttributeStyle } from "./vertex";
|
|
8
8
|
import { useMeshEdgesVisibilityStyle } from "./visibility";
|
|
9
9
|
import { useMeshEdgesWidthStyle } from "./width";
|
|
10
10
|
|
|
@@ -13,15 +13,15 @@ import { useMeshEdgesWidthStyle } from "./width";
|
|
|
13
13
|
export function useMeshEdgesStyle() {
|
|
14
14
|
const meshEdgesVisibility = useMeshEdgesVisibilityStyle();
|
|
15
15
|
const meshEdgesColorStyle = useMeshEdgesColorStyle();
|
|
16
|
-
|
|
17
|
-
function meshEdgesColoring(id) {
|
|
18
|
-
return meshEdgesCommonStyle.meshEdgesColoring(id);
|
|
19
|
-
}
|
|
20
16
|
const meshEdgesWidthStyle = useMeshEdgesWidthStyle();
|
|
21
17
|
const meshEdgesVertexAttributeStyle = useMeshEdgesVertexAttributeStyle();
|
|
22
18
|
const meshEdgesEdgeAttributeStyle = useMeshEdgesEdgeAttributeStyle();
|
|
23
19
|
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
24
20
|
|
|
21
|
+
function meshEdgesColoring(id) {
|
|
22
|
+
return meshEdgesCommonStyle.meshEdgesColoring(id);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
25
|
function meshEdgesActiveColoring(id) {
|
|
26
26
|
return meshEdgesColoring(id).active;
|
|
27
27
|
}
|
|
@@ -35,22 +35,25 @@ export function useMeshEdgesStyle() {
|
|
|
35
35
|
}
|
|
36
36
|
if (type === "vertex") {
|
|
37
37
|
const name = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeName(id);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const item = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeItem(id);
|
|
39
|
+
const [minimum, maximum] = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeRange(id);
|
|
40
|
+
const colorMap = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeColorMap(id);
|
|
41
|
+
const vertex_attribute = { name, item, minimum, maximum, colorMap };
|
|
42
|
+
if (!isMeshEdgesVertexAttributeValid(vertex_attribute)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
return meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttribute(id, vertex_attribute);
|
|
46
46
|
}
|
|
47
47
|
if (type === "edge") {
|
|
48
48
|
const name = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeName(id);
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
const item = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeItem(id);
|
|
50
|
+
const [minimum, maximum] = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeRange(id);
|
|
51
|
+
const colorMap = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeColorMap(id);
|
|
52
|
+
const edge_attribute = { name, item, minimum, maximum, colorMap };
|
|
53
|
+
if (!isMeshEdgesEdgeAttributeValid(edge_attribute)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
return meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttribute(id, edge_attribute);
|
|
54
57
|
}
|
|
55
58
|
throw new Error(`Unknown mesh edges coloring type: ${type}`);
|
|
56
59
|
}
|
|
@@ -10,8 +10,18 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
10
10
|
const meshEdgesVertexAttributeSchemas =
|
|
11
11
|
viewer_schemas.opengeodeweb_viewer.mesh.edges.attribute.vertex;
|
|
12
12
|
|
|
13
|
+
function isMeshEdgesVertexAttributeValid({ name, item, minimum, maximum, colorMap }) {
|
|
14
|
+
return (
|
|
15
|
+
name !== undefined &&
|
|
16
|
+
item !== undefined &&
|
|
17
|
+
minimum !== undefined &&
|
|
18
|
+
maximum !== undefined &&
|
|
19
|
+
colorMap !== undefined
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
13
23
|
// oxlint-disable-next-line max-lines-per-function
|
|
14
|
-
|
|
24
|
+
function useMeshEdgesVertexAttributeStyle() {
|
|
15
25
|
const viewerStore = useViewerStore();
|
|
16
26
|
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
17
27
|
|
|
@@ -23,16 +33,16 @@ export function useMeshEdgesVertexAttributeStyle() {
|
|
|
23
33
|
return meshEdgesColoring(id).vertex;
|
|
24
34
|
}
|
|
25
35
|
|
|
26
|
-
function meshEdgesVertexAttributeStoredConfig(id, name) {
|
|
36
|
+
function meshEdgesVertexAttributeStoredConfig(id, name, item) {
|
|
27
37
|
const { storedConfigs } = meshEdgesVertexAttribute(id);
|
|
28
|
-
if (name in storedConfigs) {
|
|
29
|
-
return storedConfigs[name];
|
|
38
|
+
if (storedConfigs && name in storedConfigs && item in storedConfigs[name]) {
|
|
39
|
+
return storedConfigs[name][item];
|
|
30
40
|
}
|
|
31
|
-
return
|
|
41
|
+
return {
|
|
32
42
|
minimum: undefined,
|
|
33
43
|
maximum: undefined,
|
|
34
44
|
colorMap: undefined,
|
|
35
|
-
}
|
|
45
|
+
};
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
function mutateMeshEdgesVertexStyle(id, values) {
|
|
@@ -43,98 +53,110 @@ export function useMeshEdgesVertexAttributeStyle() {
|
|
|
43
53
|
});
|
|
44
54
|
}
|
|
45
55
|
|
|
46
|
-
function setMeshEdgesVertexAttributeStoredConfig(id, name, config) {
|
|
56
|
+
function setMeshEdgesVertexAttributeStoredConfig(id, name, item, config) {
|
|
47
57
|
return mutateMeshEdgesVertexStyle(id, {
|
|
48
58
|
storedConfigs: {
|
|
49
|
-
[name]:
|
|
59
|
+
[name]: {
|
|
60
|
+
lastItem: item,
|
|
61
|
+
[item]: config,
|
|
62
|
+
},
|
|
50
63
|
},
|
|
51
|
-
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function applyVertexAttribute(id) {
|
|
68
|
+
const name = meshEdgesVertexAttributeName(id);
|
|
69
|
+
const item = meshEdgesVertexAttributeItem(id);
|
|
70
|
+
const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
|
|
71
|
+
const attribute = {
|
|
72
|
+
name,
|
|
73
|
+
item,
|
|
74
|
+
minimum: storedConfig.minimum,
|
|
75
|
+
maximum: storedConfig.maximum,
|
|
76
|
+
colorMap: storedConfig.colorMap,
|
|
77
|
+
};
|
|
78
|
+
if (isMeshEdgesVertexAttributeValid(attribute)) {
|
|
79
|
+
return setMeshEdgesVertexAttribute(id, attribute);
|
|
80
|
+
}
|
|
52
81
|
}
|
|
53
82
|
|
|
54
83
|
function meshEdgesVertexAttributeName(id) {
|
|
55
84
|
return meshEdgesVertexAttribute(id).name;
|
|
56
85
|
}
|
|
86
|
+
|
|
57
87
|
function setMeshEdgesVertexAttributeName(id, name) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
const item = meshEdgesVertexAttributeLastItem(id, name);
|
|
89
|
+
mutateMeshEdgesVertexStyle(id, { name, item });
|
|
90
|
+
return applyVertexAttribute(id);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function meshEdgesVertexAttributeItem(id) {
|
|
94
|
+
const { item, name } = meshEdgesVertexAttribute(id);
|
|
95
|
+
return item ?? meshEdgesVertexAttributeLastItem(id, name);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function setMeshEdgesVertexAttributeItem(id, item) {
|
|
99
|
+
mutateMeshEdgesVertexStyle(id, { item });
|
|
100
|
+
return applyVertexAttribute(id);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function meshEdgesVertexAttributeLastItem(id, name) {
|
|
104
|
+
const { storedConfigs } = meshEdgesVertexAttribute(id);
|
|
105
|
+
if (storedConfigs && name in storedConfigs) {
|
|
106
|
+
return storedConfigs[name].lastItem;
|
|
107
|
+
}
|
|
108
|
+
return 0;
|
|
79
109
|
}
|
|
80
110
|
|
|
81
111
|
function meshEdgesVertexAttributeRange(id) {
|
|
82
112
|
const name = meshEdgesVertexAttributeName(id);
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
return [minimum, maximum];
|
|
113
|
+
const item = meshEdgesVertexAttributeItem(id);
|
|
114
|
+
const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
|
|
115
|
+
return [storedConfig.minimum, storedConfig.maximum];
|
|
86
116
|
}
|
|
117
|
+
|
|
87
118
|
function setMeshEdgesVertexAttributeRange(id, minimum, maximum) {
|
|
88
119
|
const name = meshEdgesVertexAttributeName(id);
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const params = { id, points, minimum, maximum };
|
|
93
|
-
return viewerStore.request(
|
|
94
|
-
{ schema, params },
|
|
95
|
-
{
|
|
96
|
-
response_function: () =>
|
|
97
|
-
setMeshEdgesVertexAttributeStoredConfig(id, name, { minimum, maximum }),
|
|
98
|
-
},
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
return setMeshEdgesVertexAttributeStoredConfig(id, name, {
|
|
102
|
-
minimum,
|
|
103
|
-
maximum,
|
|
104
|
-
});
|
|
120
|
+
const item = meshEdgesVertexAttributeItem(id);
|
|
121
|
+
setMeshEdgesVertexAttributeStoredConfig(id, name, item, { minimum, maximum });
|
|
122
|
+
return applyVertexAttribute(id);
|
|
105
123
|
}
|
|
106
124
|
|
|
107
125
|
function meshEdgesVertexAttributeColorMap(id) {
|
|
108
126
|
const name = meshEdgesVertexAttributeName(id);
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
return colorMap;
|
|
127
|
+
const item = meshEdgesVertexAttributeItem(id);
|
|
128
|
+
const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
|
|
129
|
+
return storedConfig.colorMap;
|
|
112
130
|
}
|
|
131
|
+
|
|
113
132
|
function setMeshEdgesVertexAttributeColorMap(id, colorMap) {
|
|
114
133
|
const name = meshEdgesVertexAttributeName(id);
|
|
115
|
-
const
|
|
134
|
+
const item = meshEdgesVertexAttributeItem(id);
|
|
135
|
+
setMeshEdgesVertexAttributeStoredConfig(id, name, item, { colorMap });
|
|
136
|
+
return applyVertexAttribute(id);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function setMeshEdgesVertexAttribute(id, { name, item, minimum, maximum, colorMap }) {
|
|
140
|
+
mutateMeshEdgesVertexStyle(id, { name, item });
|
|
141
|
+
setMeshEdgesVertexAttributeStoredConfig(id, name, item, { minimum, maximum, colorMap });
|
|
116
142
|
const points = getRGBPointsFromPreset(colorMap);
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const params = { id, points, minimum, maximum };
|
|
121
|
-
return viewerStore.request(
|
|
122
|
-
{ schema, params },
|
|
123
|
-
{
|
|
124
|
-
response_function: () => setMeshEdgesVertexAttributeStoredConfig(id, name, { colorMap }),
|
|
125
|
-
},
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
return setMeshEdgesVertexAttributeStoredConfig(id, name, { colorMap });
|
|
143
|
+
const schema = meshEdgesVertexAttributeSchemas.attribute;
|
|
144
|
+
const params = { id, name, item, points, minimum, maximum };
|
|
145
|
+
return viewerStore.request({ schema, params });
|
|
129
146
|
}
|
|
130
147
|
|
|
131
148
|
return {
|
|
132
149
|
meshEdgesVertexAttributeName,
|
|
150
|
+
meshEdgesVertexAttributeItem,
|
|
133
151
|
meshEdgesVertexAttributeRange,
|
|
134
152
|
meshEdgesVertexAttributeColorMap,
|
|
135
153
|
meshEdgesVertexAttributeStoredConfig,
|
|
154
|
+
setMeshEdgesVertexAttribute,
|
|
136
155
|
setMeshEdgesVertexAttributeName,
|
|
156
|
+
setMeshEdgesVertexAttributeItem,
|
|
137
157
|
setMeshEdgesVertexAttributeRange,
|
|
138
158
|
setMeshEdgesVertexAttributeColorMap,
|
|
139
159
|
};
|
|
140
160
|
}
|
|
161
|
+
|
|
162
|
+
export { isMeshEdgesVertexAttributeValid, useMeshEdgesVertexAttributeStyle };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Third party imports
|
|
2
2
|
|
|
3
3
|
// Local imports
|
|
4
|
+
import { isMeshPointsVertexAttributeValid, useMeshPointsVertexAttributeStyle } from "./vertex";
|
|
4
5
|
import { useMeshPointsColorStyle } from "./color";
|
|
5
6
|
import { useMeshPointsCommonStyle } from "./common";
|
|
6
7
|
import { useMeshPointsSizeStyle } from "./size";
|
|
7
|
-
import { useMeshPointsVertexAttributeStyle } from "./vertex";
|
|
8
8
|
import { useMeshPointsVisibilityStyle } from "./visibility";
|
|
9
9
|
|
|
10
10
|
// Local constants
|
|
@@ -31,14 +31,14 @@ function useMeshPointsColoringStyle() {
|
|
|
31
31
|
}
|
|
32
32
|
if (type === "vertex") {
|
|
33
33
|
const name = meshPointsVertexAttributeStyle.meshPointsVertexAttributeName(id);
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
const item = meshPointsVertexAttributeStyle.meshPointsVertexAttributeItem(id);
|
|
35
|
+
const [minimum, maximum] = meshPointsVertexAttributeStyle.meshPointsVertexAttributeRange(id);
|
|
36
|
+
const colorMap = meshPointsVertexAttributeStyle.meshPointsVertexAttributeColorMap(id);
|
|
37
|
+
const vertex_attribute = { name, item, minimum, maximum, colorMap };
|
|
38
|
+
if (!isMeshPointsVertexAttributeValid(vertex_attribute)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
return meshPointsVertexAttributeStyle.setMeshPointsVertexAttribute(id, vertex_attribute);
|
|
42
42
|
}
|
|
43
43
|
throw new Error(`Unknown mesh points coloring type: ${type}`);
|
|
44
44
|
}
|