Skip to content

Commit 0b70454

Browse files
committed
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWeb-Front into feat/save_and_load
2 parents 01a9732 + e7e5a75 commit 0b70454

37 files changed

+878
-668
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./tests

components/Viewer/Generic/Mesh/EdgesOptions.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,22 @@
2828
const dataStyleStore = useDataStyleStore()
2929
3030
const visibility = computed({
31-
get: () => dataStyleStore.edgesVisibility(id.value),
32-
set: (newValue) => dataStyleStore.setEdgesVisibility(id.value, newValue),
31+
get: () => dataStyleStore.meshEdgesVisibility(id.value),
32+
set: (newValue) =>
33+
dataStyleStore.setMeshEdgesVisibility(id.value, newValue),
3334
})
3435
const size = computed({
3536
get: () => dataStyleStore.edgesSize(id.value),
3637
set: (newValue) => dataStyleStore.setEdgesSize(id.value, newValue),
3738
})
3839
const coloring_style_key = computed({
39-
get: () => dataStyleStore.edgesActiveColoring(id.value),
40+
get: () => dataStyleStore.meshEdgesActiveColoring(id.value),
4041
set: (newValue) => {
41-
dataStyleStore.setEdgesActiveColoring(id.value, newValue)
42+
dataStyleStore.setMeshEdgesActiveColoring(id.value, newValue)
4243
},
4344
})
4445
const color = computed({
45-
get: () => dataStyleStore.edgesColor(id.value),
46-
set: (newValue) => dataStyleStore.setEdgesColor(id.value, newValue),
46+
get: () => dataStyleStore.meshEdgesColor(id.value),
47+
set: (newValue) => dataStyleStore.setMeshEdgesColor(id.value, newValue),
4748
})
4849
</script>

components/Viewer/Generic/Mesh/PointsOptions.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,26 @@
4949
const id = toRef(() => props.itemProps.id)
5050
5151
const visibility = computed({
52-
get: () => dataStyleStore.pointsVisibility(id.value),
53-
set: (newValue) => dataStyleStore.setPointsVisibility(id.value, newValue),
52+
get: () => dataStyleStore.meshPointsVisibility(id.value),
53+
set: (newValue) =>
54+
dataStyleStore.setMeshPointsVisibility(id.value, newValue),
5455
})
5556
const size = computed({
56-
get: () => dataStyleStore.pointsSize(id.value),
57-
set: (newValue) => dataStyleStore.setPointsSize(id.value, newValue),
57+
get: () => dataStyleStore.meshPointsSize(id.value),
58+
set: (newValue) => dataStyleStore.setMeshPointsSize(id.value, newValue),
5859
})
5960
const coloring_style_key = computed({
60-
get: () => dataStyleStore.pointsActiveColoring(id.value),
61+
get: () => dataStyleStore.meshPointsActiveColoring(id.value),
6162
set: (newValue) =>
62-
dataStyleStore.setPointsActiveColoring(id.value, newValue),
63+
dataStyleStore.setMeshPointsActiveColoring(id.value, newValue),
6364
})
6465
const color = computed({
65-
get: () => dataStyleStore.pointsColor(id.value),
66-
set: (newValue) => dataStyleStore.setPointsColor(id.value, newValue),
66+
get: () => dataStyleStore.meshPointsColor(id.value),
67+
set: (newValue) => dataStyleStore.setMeshPointsColor(id.value, newValue),
6768
})
6869
const vertex_attribute = computed({
69-
get: () => dataStyleStore.pointsVertexAttribute(id.value),
70+
get: () => dataStyleStore.meshPointsVertexAttribute(id.value),
7071
set: (newValue) =>
71-
dataStyleStore.setPointsVertexAttribute(id.value, newValue),
72+
dataStyleStore.setMeshPointsVertexAttribute(id.value, newValue),
7273
})
7374
</script>

components/Viewer/Generic/Mesh/PolygonsOptions.vue

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,34 @@
3232
const id = toRef(() => props.itemProps.id)
3333
3434
const visibility = computed({
35-
get: () => dataStyleStore.polygonsVisibility(id.value),
36-
set: (newValue) => dataStyleStore.setPolygonsVisibility(id.value, newValue),
35+
get: () => dataStyleStore.meshPolygonsVisibility(id.value),
36+
set: (newValue) =>
37+
dataStyleStore.setMeshPolygonsVisibility(id.value, newValue),
3738
})
3839
const coloring_style_key = computed({
39-
get: () => dataStyleStore.polygonsActiveColoring(id.value),
40+
get: () => dataStyleStore.meshPolygonsActiveColoring(id.value),
4041
set: (newValue) =>
41-
dataStyleStore.setPolygonsActiveColoring(id.value, newValue),
42+
dataStyleStore.setMeshPolygonsActiveColoring(id.value, newValue),
4243
})
4344
const color = computed({
44-
get: () => dataStyleStore.polygonsColor(id.value),
45-
set: (newValue) => dataStyleStore.setPolygonsColor(id.value, newValue),
45+
get: () => dataStyleStore.meshPolygonsColor(id.value),
46+
set: (newValue) => dataStyleStore.setMeshPolygonsColor(id.value, newValue),
4647
})
4748
const textures = computed({
48-
get: () => dataStyleStore.polygonsTextures(id.value),
49-
set: (newValue) => dataStyleStore.setPolygonsTextures(id.value, newValue),
49+
get: () => dataStyleStore.meshPolygonsTextures(id.value),
50+
set: (newValue) =>
51+
dataStyleStore.setMeshPolygonsTextures(id.value, newValue),
5052
})
5153
const vertex_attribute = computed({
52-
get: () => dataStyleStore.polygonsVertexAttribute(id.value),
54+
get: () => dataStyleStore.meshPolygonsVertexAttribute(id.value),
5355
set: (newValue) => {
54-
console.log("setPolygonsVertexAttribute", id.value, newValue)
55-
dataStyleStore.setPolygonsVertexAttribute(id.value, newValue)
56+
dataStyleStore.setMeshPolygonsVertexAttribute(id.value, newValue)
5657
},
5758
})
5859
const polygon_attribute = computed({
59-
get: () => dataStyleStore.polygonsPolygonAttribute(id.value),
60+
get: () => dataStyleStore.meshPolygonsPolygonAttribute(id.value),
6061
set: (newValue) => {
61-
console.log("setPolygonsPolygonAttribute", id.value, newValue)
62-
dataStyleStore.setPolygonsPolygonAttribute(id.value, newValue)
62+
dataStyleStore.setMeshPolygonsPolygonAttribute(id.value, newValue)
6363
},
6464
})
6565
</script>

components/Viewer/Generic/Mesh/PolyhedraOptions.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@
3232
const id = toRef(() => props.itemProps.id)
3333
3434
const visibility = computed({
35-
get: () => dataStyleStore.polyhedraVisibility(id.value),
35+
get: () => dataStyleStore.meshPolyhedraVisibility(id.value),
3636
set: (newValue) =>
37-
dataStyleStore.setPolyhedraVisibility(id.value, newValue),
37+
dataStyleStore.setMeshPolyhedraVisibility(id.value, newValue),
3838
})
3939
const coloring_style_key = computed({
40-
get: () => dataStyleStore.polyhedraActiveColoring(id.value),
40+
get: () => dataStyleStore.meshPolyhedraActiveColoring(id.value),
4141
set: (newValue) =>
42-
dataStyleStore.setPolyhedraActiveColoring(id.value, newValue),
42+
dataStyleStore.setMeshPolyhedraActiveColoring(id.value, newValue),
4343
})
4444
const color = computed({
45-
get: () => dataStyleStore.polyhedraColor(id.value),
46-
set: (newValue) => dataStyleStore.setPolyhedraColor(id.value, newValue),
45+
get: () => dataStyleStore.meshPolyhedraColor(id.value),
46+
set: (newValue) => dataStyleStore.setMeshPolyhedraColor(id.value, newValue),
4747
})
4848
const vertex_attribute = computed({
4949
get: () => dataStyleStore.polyhedraVertexAttribute(id.value),

components/Viewer/PointSet/SpecificPointsOptions.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,26 @@
5050
const id = toRef(() => props.itemProps.id)
5151
5252
const visibility = computed({
53-
get: () => dataStyleStore.pointsVisibility(id.value),
54-
set: (newValue) => dataStyleStore.setPointsVisibility(id.value, newValue),
53+
get: () => dataStyleStore.meshPointsVisibility(id.value),
54+
set: (newValue) =>
55+
dataStyleStore.setMeshPointsVisibility(id.value, newValue),
5556
})
5657
const size = computed({
57-
get: () => dataStyleStore.pointsSize(id.value),
58-
set: (newValue) => dataStyleStore.setPointsSize(id.value, newValue),
58+
get: () => dataStyleStore.meshPointsSize(id.value),
59+
set: (newValue) => dataStyleStore.setMeshPointsSize(id.value, newValue),
5960
})
6061
const coloring_style_key = computed({
61-
get: () => dataStyleStore.pointsActiveColoring(id.value),
62+
get: () => dataStyleStore.meshPointsActiveColoring(id.value),
6263
set: (newValue) =>
63-
dataStyleStore.setPointsActiveColoring(id.value, newValue),
64+
dataStyleStore.setMeshPointsActiveColoring(id.value, newValue),
6465
})
6566
const color = computed({
66-
get: () => dataStyleStore.pointsColor(id.value),
67-
set: (newValue) => dataStyleStore.setPointsColor(id.value, newValue),
67+
get: () => dataStyleStore.meshPointsColor(id.value),
68+
set: (newValue) => dataStyleStore.setMeshPointsColor(id.value, newValue),
6869
})
6970
const vertex_attribute = computed({
70-
get: () => dataStyleStore.pointsVertexAttribute(id.value),
71+
get: () => dataStyleStore.meshPointsVertexAttribute(id.value),
7172
set: (newValue) =>
72-
dataStyleStore.setPointsVertexAttribute(id.value, newValue),
73+
dataStyleStore.setMeshPointsVertexAttribute(id.value, newValue),
7374
})
7475
</script>

composables/api_fetch.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ export function api_fetch(
1212
const { valid, error } = validate_schema(schema, body)
1313

1414
if (!valid) {
15-
if (process.env.NODE_ENV === "development") {
15+
if (process.env.NODE_ENV !== "production") {
1616
console.log("Bad request", error, schema, params)
17-
console.log("schema", schema)
18-
console.log("params", params)
1917
}
2018
feedback_store.add_error(400, schema.$id, "Bad request", error)
2119
throw new Error(schema.$id.concat(": ", error))

composables/viewer_call.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ export function viewer_call(
88
const { valid, error } = validate_schema(schema, params)
99

1010
if (!valid) {
11-
if (process.env.NODE_ENV === "development") {
11+
if (process.env.NODE_ENV !== "production") {
1212
console.log("Bad request", error, schema, params)
13-
console.log("schema", schema)
14-
console.log("params", params)
1513
}
1614
feedback_store.add_error(400, schema.$id, "Bad request", error)
1715
throw new Error(schema.$id.concat(": "))

internal_stores/data_style_state.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { reactive, computed } from "vue"
33
export default function useDataStyleState() {
44
const styles = reactive({})
55

6-
const objectVisibility = computed(() => (id) => styles[id]?.visibility)
6+
const objectVisibility = computed(() => (id) => styles[id].visibility)
77
const selectedObjects = computed(() => {
88
const selection = []
99
for (const [id, value] of Object.entries(styles)) {
@@ -17,5 +17,6 @@ export default function useDataStyleState() {
1717
function getStyle(id) {
1818
return styles[id]
1919
}
20+
2021
return { getStyle, styles, objectVisibility, selectedObjects }
2122
}

internal_stores/mesh/edges.js

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,101 @@
1+
// Third party imports
12
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
23
const mesh_edges_schemas = viewer_schemas.opengeodeweb_viewer.mesh.edges
34

45
export function useMeshEdgesStyle() {
56
const dataStyleStore = useDataStyleStore()
67

7-
function edgesStyle(id) {
8+
function meshEdgesStyle(id) {
89
return dataStyleStore.getStyle(id).edges
910
}
1011

11-
function edgesVisibility(id) {
12-
return edgesStyle(id).visibility
12+
function meshEdgesVisibility(id) {
13+
return meshEdgesStyle(id).visibility
1314
}
14-
function setEdgesVisibility(id, visibility) {
15-
const edges_style = edgesStyle(id)
15+
function setMeshEdgesVisibility(id, visibility) {
16+
const mesh_edges_style = meshEdgesStyle(id)
1617
return viewer_call(
1718
{ schema: mesh_edges_schemas.visibility, params: { id, visibility } },
1819
{
1920
response_function: () => {
20-
edges_style.visibility = visibility
21-
console.log(`${setEdgesVisibility.name} ${id} ${edgesVisibility(id)}`)
21+
mesh_edges_style.visibility = visibility
22+
console.log(
23+
`${setMeshEdgesVisibility.name} ${id} ${meshEdgesVisibility(id)}`,
24+
)
2225
},
2326
},
2427
)
2528
}
2629

27-
function edgesActiveColoring(id) {
28-
return edgesStyle(id).coloring.active
30+
function meshEdgesActiveColoring(id) {
31+
return meshEdgesStyle(id).coloring.active
2932
}
30-
function setEdgesActiveColoring(id, type) {
31-
const coloring = edgesStyle(id).coloring
33+
function setMeshEdgesActiveColoring(id, type) {
34+
const coloring = meshEdgesStyle(id).coloring
3235
coloring.active = type
3336
console.log(
34-
`${setEdgesActiveColoring.name} ${id} ${edgesActiveColoring(id)}`,
37+
`${setMeshEdgesActiveColoring.name} ${id} ${meshEdgesActiveColoring(id)}`,
3538
)
3639
if (type === "color") {
37-
return setEdgesColor(id, coloring.color)
40+
return setMeshEdgesColor(id, coloring.color)
3841
// } else if (type == "vertex" && coloring.vertex !== null) {
3942
// return setEdgesVertexAttribute(id, coloring.vertex)
4043
// } else if (type == "edges" && coloring.edges !== null) {
4144
// return setEdgesEdgeAttribute(id, coloring.edges)
4245
} else throw new Error("Unknown edges coloring type: " + type)
4346
}
4447

45-
function edgesColor(id) {
46-
return edgesStyle(id).coloring.color
48+
function meshEdgesColor(id) {
49+
return meshEdgesStyle(id).coloring.color
4750
}
48-
function setEdgesColor(id, color) {
49-
const coloring_style = edgesStyle(id).coloring
51+
function setMeshEdgesColor(id, color) {
52+
const coloring_style = meshEdgesStyle(id).coloring
5053
return viewer_call(
5154
{ schema: mesh_edges_schemas.color, params: { id, color } },
5255
{
5356
response_function: () => {
5457
coloring_style.color = color
5558
console.log(
56-
`${setEdgesColor.name} ${id} ${JSON.stringify(edgesColor(id))}`,
59+
`${setMeshEdgesColor.name} ${id} ${JSON.stringify(meshEdgesColor(id))}`,
5760
)
5861
},
5962
},
6063
)
6164
}
6265

63-
function edgesWidth(id) {
64-
return edgesStyle(id).size
66+
function meshEdgesWidth(id) {
67+
return meshEdgesStyle(id).size
6568
}
66-
function setEdgesWidth(id, width) {
67-
const edges_style = edgesStyle(id)
69+
function setMeshEdgesWidth(id, width) {
70+
const edges_style = meshEdgesStyle(id)
6871
return viewer_call(
6972
{ schema: mesh_edges_schemas.width, params: { id, width } },
7073
{
7174
response_function: () => {
7275
edges_style.width = width
73-
console.log(`${setEdgesWidth.name} ${id} ${edgesWidth(id)}`)
76+
console.log(`${setMeshEdgesWidth.name} ${id} ${meshEdgesWidth(id)}`)
7477
},
7578
},
7679
)
7780
}
7881

79-
function applyEdgesStyle(id, style) {
82+
function applyMeshEdgesStyle(id, style) {
8083
return Promise.all([
81-
setEdgesVisibility(id, style.visibility),
82-
setEdgesActiveColoring(id, style.coloring.active),
83-
// setEdgesWidth(id, style.width);
84+
setMeshEdgesVisibility(id, style.visibility),
85+
setMeshEdgesActiveColoring(id, style.coloring.active),
86+
// setMeshEdgesWidth(id, style.width);
8487
])
8588
}
8689

8790
return {
88-
applyEdgesStyle,
89-
edgesActiveColoring,
90-
edgesColor,
91-
edgesVisibility,
92-
edgesWidth,
93-
setEdgesActiveColoring,
94-
setEdgesColor,
95-
setEdgesVisibility,
96-
setEdgesWidth,
91+
applyMeshEdgesStyle,
92+
meshEdgesActiveColoring,
93+
meshEdgesColor,
94+
meshEdgesVisibility,
95+
meshEdgesWidth,
96+
setMeshEdgesActiveColoring,
97+
setMeshEdgesColor,
98+
setMeshEdgesVisibility,
99+
setMeshEdgesWidth,
97100
}
98101
}

0 commit comments

Comments
 (0)