Skip to content

Commit 42945bb

Browse files
Merge pull request #180 from Geode-solutions/fix/polyhedra_style
fix(solids): fix missing binding for polyhedrons style
2 parents 748e14a + 2123157 commit 42945bb

File tree

16 files changed

+226
-227
lines changed

16 files changed

+226
-227
lines changed

components/Viewer/Generic/Mesh/PolyhedronsOptions.vue components/Viewer/Generic/Mesh/PolyhedraOptions.vue

+11-12
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,32 @@ const dataStyleStore = useDataStyleStore();
2626
const props = defineProps({
2727
itemProps: { type: Object, required: true },
2828
btn_image: { type: String, required: true },
29-
tooltip: { type: String, required: false, default: "Polyhedrons options" },
29+
tooltip: { type: String, required: false, default: "Polyhedra options" },
3030
});
3131
3232
const id = toRef(() => props.itemProps.id);
3333
3434
const visibility = computed({
35-
get: () => dataStyleStore.polyhedronsVisibility(id.value),
36-
set: (newValue) =>
37-
dataStyleStore.setPolyhedronsVisibility(id.value, newValue),
35+
get: () => dataStyleStore.polyhedraVisibility(id.value),
36+
set: (newValue) => dataStyleStore.setPolyhedraVisibility(id.value, newValue),
3837
});
3938
const coloring_style_key = computed({
40-
get: () => dataStyleStore.polyhedronsActiveColoring(id.value),
39+
get: () => dataStyleStore.polyhedraActiveColoring(id.value),
4140
set: (newValue) =>
42-
dataStyleStore.setPolyhedronsActiveColoring(id.value, newValue),
41+
dataStyleStore.setPolyhedraActiveColoring(id.value, newValue),
4342
});
4443
const color = computed({
45-
get: () => dataStyleStore.polyhedronsColor(id.value),
46-
set: (newValue) => dataStyleStore.setPolyhedronsColor(id.value, newValue),
44+
get: () => dataStyleStore.polyhedraColor(id.value),
45+
set: (newValue) => dataStyleStore.setPolyhedraColor(id.value, newValue),
4746
});
4847
const vertex_attribute = computed({
49-
get: () => dataStyleStore.polyhedronsVertexAttribute(id.value),
48+
get: () => dataStyleStore.polyhedraVertexAttribute(id.value),
5049
set: (newValue) =>
51-
dataStyleStore.setPolyhedronsVertexAttribute(id.value, newValue),
50+
dataStyleStore.setPolyhedraVertexAttribute(id.value, newValue),
5251
});
5352
const polyhedron_attribute = computed({
54-
get: () => dataStyleStore.polyhedronsPolyhedronAttribute(id.value),
53+
get: () => dataStyleStore.polyhedraPolyhedronAttribute(id.value),
5554
set: (newValue) =>
56-
dataStyleStore.setPolyhedronsPolyhedronAttribute(id.value, newValue),
55+
dataStyleStore.setPolyhedraPolyhedronAttribute(id.value, newValue),
5756
});
5857
</script>

components/Viewer/Grid/3D/CellsOptions.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<ViewerGenericMeshPolyhedronsOptions
2+
<ViewerGenericMeshPolyhedraOptions
33
:itemProps="props.itemProps"
44
:btn_image="Grid3DCells"
55
tooltip="Cells options"

components/Viewer/HybridSolid/PolyhedronsOptions.vue components/Viewer/HybridSolid/PolyhedraOptions.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
2-
<ViewerGenericMeshPolyhedronsOptions
2+
<ViewerGenericMeshPolyhedraOptions
33
:itemProps="props.itemProps"
4-
:btn_image="HybridSolidPolyhedrons"
4+
:btn_image="HybridSolidPolyhedra"
55
/>
66
</template>
77

88
<script setup>
9-
import HybridSolidPolyhedrons from "@/assets/viewer_svgs/solid_polyhedrons.svg";
9+
import HybridSolidPolyhedra from "@/assets/viewer_svgs/solid_polyhedra.svg";
1010
1111
const props = defineProps({
1212
itemProps: { type: Object, required: true },

components/Viewer/Options/ColoringTypeSelector.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const has_vertex = computed(() =>
8080
const has_polygons = computed(() =>
8181
polygon_attribute.value !== undefined ? true : false
8282
);
83-
const has_polyhedrons = computed(() =>
83+
const has_polyhedra = computed(() =>
8484
polyhedron_attribute.value !== undefined ? true : false
8585
);
8686
@@ -100,7 +100,7 @@ const coloring_styles = computed(() => {
100100
if (has_vertex.value) array.push(vertex_dict);
101101
// if (has_edges.value) array.push(edge_dict);
102102
if (has_polygons.value) array.push(polygon_dict);
103-
if (has_polyhedrons.value) array.push(polyhedron_dict);
103+
if (has_polyhedra.value) array.push(polyhedron_dict);
104104
105105
const labels = array.map((coloring) => {
106106
return coloring.name;

components/Viewer/Solid/PolyhedronsOptions.vue components/Viewer/Solid/PolyhedraOptions.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
2-
<ViewerGenericMeshPolyhedronsOptions
2+
<ViewerGenericMeshPolyhedraOptions
33
:itemProps="props.itemProps"
4-
:btn_image="SolidPolyhedrons"
4+
:btn_image="SolidPolyhedra"
55
/>
66
</template>
77

88
<script setup>
9-
import SolidPolyhedrons from "@/assets/viewer_svgs/solid_polyhedrons.svg";
9+
import SolidPolyhedra from "@/assets/viewer_svgs/solid_polyhedra.svg";
1010
1111
const props = defineProps({
1212
itemProps: { type: Object, required: true },
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<ViewerGenericMeshPolyhedraOptions
3+
:itemProps="props.itemProps"
4+
:btn_image="TetrahedralSolidTetrahedra"
5+
tooltip="Tetrahedra options"
6+
/>
7+
</template>
8+
9+
<script setup>
10+
import TetrahedralSolidTetrahedra from "@/assets/viewer_svgs/solid_polyhedra.svg";
11+
12+
const props = defineProps({
13+
itemProps: { type: Object, required: true },
14+
});
15+
</script>

components/Viewer/TetrahedralSolid/TetrahedronsOptions.vue

-15
This file was deleted.

electron-server/viewer/requirements.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ multidict==6.0.5
7272
# opengeodeweb-viewer
7373
# vease-viewer
7474
# yarl
75-
numpy==2.2.3
75+
numpy==2.2.4
7676
# via
7777
# contourpy
7878
# matplotlib
7979
# vease-viewer
80-
opengeodeweb-viewer[gpu]==1.4.0
80+
opengeodeweb-viewer[gpu]==1.6.1
8181
# via vease-viewer
8282
packaging==24.2
8383
# via
@@ -87,7 +87,7 @@ pillow==11.1.0
8787
# via
8888
# matplotlib
8989
# vease-viewer
90-
pyparsing==3.2.1
90+
pyparsing==3.2.3
9191
# via
9292
# matplotlib
9393
# vease-viewer
@@ -115,7 +115,7 @@ six==1.17.0
115115
# via
116116
# python-dateutil
117117
# vease-viewer
118-
vease-viewer[gpu]==2.3.1
118+
vease-viewer[gpu]==2.3.3
119119
# via -r ./electron-server/viewer/requirements.in
120120
vtk==9.3.1
121121
# via

internal_stores/mesh/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { getDefaultStyle } from "@/utils/default_styles";
33
import { useMeshPointsStyle } from "./points.js";
44
import { useMeshEdgesStyle } from "./edges.js";
55
import { useMeshPolygonsStyle } from "./polygons.js";
6-
import { useMeshPolyhedronsStyle } from "./polyhedrons.js";
6+
import { useMeshPolyhedraStyle } from "./polyhedra.js";
77

88
export default function useMeshStyle() {
99
const dataStyleStore = useDataStyleStore();
1010
const pointsStyleStore = useMeshPointsStyle();
1111
const edgesStyleStore = useMeshEdgesStyle();
1212
const polygonsStyleStore = useMeshPolygonsStyle();
13-
const polyhedronsStyleStore = useMeshPolyhedronsStyle();
13+
const polyhedraStyleStore = useMeshPolyhedraStyle();
1414

1515
const objectVisibility = computed(
1616
(id) => dataStyleStore.styles[id].visibility
@@ -52,8 +52,8 @@ export default function useMeshStyle() {
5252
else if (key == "edges") edgesStyleStore.applyEdgesStyle(id, value);
5353
else if (key == "polygons")
5454
polygonsStyleStore.applyPolygonsStyle(id, value);
55-
else if (key == "polyhedrons")
56-
polyhedronsStyleStore.applyPolyhedronsStyle(id, value);
55+
else if (key == "polyhedra")
56+
polyhedraStyleStore.applyPolyhedraStyle(id, value);
5757
}
5858
}
5959

@@ -66,6 +66,6 @@ export default function useMeshStyle() {
6666
...useMeshPointsStyle(),
6767
...useMeshEdgesStyle(),
6868
...useMeshPolygonsStyle(),
69-
...useMeshPolyhedronsStyle(),
69+
...useMeshPolyhedraStyle(),
7070
};
7171
}

internal_stores/mesh/polyhedra.js

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
import viewer_schemas from "@geode/opengeodeweb-viewer/schemas.json";
2+
const mesh_polyhedra_schemas =
3+
viewer_schemas.opengeodeweb_viewer.mesh.polyhedra;
4+
5+
export function useMeshPolyhedraStyle() {
6+
/** State **/
7+
const dataStyleStore = useDataStyleStore();
8+
9+
/** Getters **/
10+
function polyhedraVisibility(id) {
11+
return dataStyleStore.styles[id].polyhedra.visibility;
12+
}
13+
function polyhedraActiveColoring(id) {
14+
return dataStyleStore.styles[id].polyhedra.coloring.active;
15+
}
16+
function polyhedraColor(id) {
17+
return dataStyleStore.styles[id].polyhedra.coloring.color;
18+
}
19+
function polyhedraVertexAttribute(id) {
20+
return dataStyleStore.styles[id].polyhedra.coloring.vertex;
21+
}
22+
function polyhedraPolygonAttribute(id) {
23+
return dataStyleStore.styles[id].polyhedra.coloring.polygon;
24+
}
25+
function polyhedraPolyhedronAttribute(id) {
26+
return dataStyleStore.styles[id].polyhedra.coloring.polyhedron;
27+
}
28+
29+
/** Actions **/
30+
function setPolyhedraVisibility(id, visibility) {
31+
viewer_call(
32+
{
33+
schema: mesh_polyhedra_schemas.visibility,
34+
params: { id, visibility },
35+
},
36+
{
37+
response_function: () => {
38+
dataStyleStore.styles[id].polyhedra.visibility = visibility;
39+
console.log(
40+
"setPolyhedraVisibility",
41+
dataStyleStore.styles[id].polyhedra.visibility
42+
);
43+
},
44+
}
45+
);
46+
}
47+
function setPolyhedraActiveColoring(id, type) {
48+
if (type == "color")
49+
setPolyhedraColor(id, dataStyleStore.styles[id].polyhedra.coloring.color);
50+
else if (type == "vertex") {
51+
const vertex = dataStyleStore.styles[id].polyhedra.coloring.vertex;
52+
if (vertex !== null) setPolyhedraVertexAttribute(id, vertex);
53+
} else if (type == "polyhedron") {
54+
const polyhedron =
55+
dataStyleStore.styles[id].polyhedra.coloring.polyhedron;
56+
if (polyhedron !== null) setPolyhedraPolyhedronAttribute(id, polyhedron);
57+
} else throw new Error("Unknown polyhedra coloring type: " + type);
58+
dataStyleStore.styles[id].polyhedra.coloring.active = type;
59+
console.log(
60+
"setPolyhedraActiveColoring",
61+
dataStyleStore.styles[id].polyhedra.coloring.active
62+
);
63+
}
64+
function setPolyhedraColor(id, color) {
65+
viewer_call(
66+
{
67+
schema: mesh_polyhedra_schemas.color,
68+
params: { id, color },
69+
},
70+
{
71+
response_function: () => {
72+
dataStyleStore.styles[id].polyhedra.coloring.color = color;
73+
console.log(
74+
"setPolyhedraColor",
75+
dataStyleStore.styles[id].polyhedra.coloring.color
76+
);
77+
},
78+
}
79+
);
80+
}
81+
82+
function setPolyhedraVertexAttribute(id, vertex_attribute) {
83+
viewer_call(
84+
{
85+
schema: mesh_polyhedra_schemas.vertex_attribute,
86+
params: { id, ...vertex_attribute },
87+
},
88+
{
89+
response_function: () => {
90+
dataStyleStore.styles[id].polyhedra.coloring.vertex =
91+
vertex_attribute;
92+
console.log(
93+
"setPolyhedraVertexAttribute",
94+
dataStyleStore.styles[id].polyhedra.coloring.vertex
95+
);
96+
},
97+
}
98+
);
99+
}
100+
101+
function setPolyhedraPolyhedronAttribute(id, polyhedron_attribute) {
102+
viewer_call(
103+
{
104+
schema: mesh_polyhedra_schemas.polyhedron_attribute,
105+
params: { id, ...polyhedron_attribute },
106+
},
107+
{
108+
response_function: () => {
109+
dataStyleStore.styles[id].polyhedra.coloring.polyhedron =
110+
polyhedron_attribute;
111+
console.log(
112+
"setPolyhedraPolyhedronAttribute",
113+
dataStyleStore.styles[id].polyhedra.coloring.polyhedron
114+
);
115+
},
116+
}
117+
);
118+
}
119+
120+
function applyPolyhedraStyle(id, style) {
121+
setPolyhedraVisibility(id, style.visibility);
122+
setPolyhedraActiveColoring(id, style.coloring.active);
123+
}
124+
125+
return {
126+
polyhedraVisibility,
127+
polyhedraActiveColoring,
128+
polyhedraColor,
129+
polyhedraVertexAttribute,
130+
polyhedraPolygonAttribute,
131+
polyhedraPolyhedronAttribute,
132+
setPolyhedraVisibility,
133+
setPolyhedraActiveColoring,
134+
setPolyhedraColor,
135+
setPolyhedraVertexAttribute,
136+
setPolyhedraPolyhedronAttribute,
137+
applyPolyhedraStyle,
138+
};
139+
}

0 commit comments

Comments
 (0)