@geode/opengeodeweb-front 10.2.1-rc.3 → 10.2.1-rc.4

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.
@@ -39,16 +39,16 @@
39
39
  },
40
40
  })
41
41
  const vertex_attribute = computed({
42
- get: () => dataStyleStore.polyhedraVertexAttribute(id.value),
42
+ get: () => dataStyleStore.meshPolyhedraVertexAttribute(id.value),
43
43
  set: (newValue) => {
44
- dataStyleStore.setPolyhedraVertexAttribute(id.value, newValue)
44
+ dataStyleStore.setMeshPolyhedraVertexAttribute(id.value, newValue)
45
45
  hybridViewerStore.remoteRender()
46
46
  },
47
47
  })
48
48
  const polyhedron_attribute = computed({
49
- get: () => dataStyleStore.polyhedraPolyhedronAttribute(id.value),
49
+ get: () => dataStyleStore.meshPolyhedraPolyhedronAttribute(id.value),
50
50
  set: (newValue) => {
51
- dataStyleStore.setPolyhedraPolyhedronAttribute(id.value, newValue)
51
+ dataStyleStore.setMeshPolyhedraPolyhedronAttribute(id.value, newValue)
52
52
  hybridViewerStore.remoteRender()
53
53
  },
54
54
  })
@@ -131,17 +131,17 @@ export function useMeshCellsStyle() {
131
131
  return setMeshCellsColor(id, coloring.color)
132
132
  } else if (type === "textures") {
133
133
  if (coloring.textures === null) {
134
- return
134
+ throw new Error("Textures not set")
135
135
  }
136
136
  return setMeshCellsTextures(id, coloring.textures)
137
137
  } else if (type === "vertex") {
138
138
  if (coloring.vertex === null) {
139
- return
139
+ throw new Error("Vertex attribute not set")
140
140
  }
141
141
  return setMeshCellsVertexAttribute(id, coloring.vertex)
142
142
  } else if (type === "cell") {
143
143
  if (coloring.cell === null) {
144
- return
144
+ throw new Error("Cell attribute not set")
145
145
  }
146
146
  return setMeshCellsCellAttribute(id, coloring.cell)
147
147
  } else {
@@ -51,12 +51,12 @@ export function useMeshEdgesStyle() {
51
51
  return setMeshEdgesColor(id, coloring.color)
52
52
  } else if (type === "vertex") {
53
53
  if (coloring.vertex === null) {
54
- return
54
+ throw new Error("Vertex attribute not set")
55
55
  }
56
56
  return setMeshEdgesVertexAttribute(id, coloring.vertex)
57
57
  } else if (type === "edge") {
58
58
  if (coloring.edge === null) {
59
- return
59
+ throw new Error("Edge attribute not set")
60
60
  }
61
61
  return setMeshEdgesEdgeAttribute(id, coloring.edge)
62
62
  } else {
@@ -52,7 +52,7 @@ export function useMeshPointsStyle() {
52
52
  return setMeshPointsColor(id, coloring.color)
53
53
  } else if (type === "vertex") {
54
54
  if (coloring.vertex === null) {
55
- return
55
+ throw new Error("Vertex attribute not set")
56
56
  }
57
57
  return setMeshPointsVertexAttribute(id, coloring.vertex)
58
58
  } else {
@@ -137,17 +137,17 @@ export function useMeshPolygonsStyle() {
137
137
  return setMeshPolygonsColor(id, coloring.color)
138
138
  } else if (type === "textures") {
139
139
  if (coloring.textures === null) {
140
- return
140
+ throw new Error("Textures not set")
141
141
  }
142
142
  return setMeshPolygonsTextures(id, coloring.textures)
143
143
  } else if (type === "vertex") {
144
144
  if (coloring.vertex === null) {
145
- return
145
+ throw new Error("Vertex attribute not set")
146
146
  }
147
147
  return setMeshPolygonsVertexAttribute(id, coloring.vertex)
148
148
  } else if (type === "polygon") {
149
149
  if (coloring.polygon === null) {
150
- return
150
+ throw new Error("Polygon attribute not set")
151
151
  }
152
152
  return setMeshPolygonsPolygonAttribute(id, coloring.polygon)
153
153
  } else {
@@ -51,14 +51,14 @@ export function useMeshPolyhedraStyle() {
51
51
  return setMeshPolyhedraColor(id, coloring.color)
52
52
  } else if (type === "vertex") {
53
53
  if (coloring.vertex === null) {
54
- return
54
+ throw new Error("Vertex attribute not set")
55
55
  }
56
- return setPolyhedraVertexAttribute(id, coloring.vertex)
56
+ return setMeshPolyhedraVertexAttribute(id, coloring.vertex)
57
57
  } else if (type === "polyhedron") {
58
58
  if (coloring.polyhedron === null) {
59
- return
59
+ throw new Error("Polyhedron attribute not set")
60
60
  }
61
- return setPolyhedraPolyhedronAttribute(id, coloring.polyhedron)
61
+ return setMeshPolyhedraPolyhedronAttribute(id, coloring.polyhedron)
62
62
  } else {
63
63
  throw new Error("Unknown mesh polyhedra coloring type: " + type)
64
64
  }
@@ -85,10 +85,10 @@ export function useMeshPolyhedraStyle() {
85
85
  )
86
86
  }
87
87
 
88
- function polyhedraVertexAttribute(id) {
88
+ function meshPolyhedraVertexAttribute(id) {
89
89
  return meshPolyhedraStyle(id).coloring.vertex
90
90
  }
91
- function setPolyhedraVertexAttribute(id, vertex_attribute) {
91
+ function setMeshPolyhedraVertexAttribute(id, vertex_attribute) {
92
92
  const coloring_style = meshPolyhedraStyle(id).coloring
93
93
  return viewerStore.request(
94
94
  mesh_polyhedra_schemas.vertex_attribute,
@@ -97,19 +97,19 @@ export function useMeshPolyhedraStyle() {
97
97
  response_function: () => {
98
98
  coloring_style.vertex = vertex_attribute
99
99
  console.log(
100
- setPolyhedraVertexAttribute.name,
100
+ setMeshPolyhedraVertexAttribute.name,
101
101
  { id },
102
- polyhedraVertexAttribute(id),
102
+ meshPolyhedraVertexAttribute(id),
103
103
  )
104
104
  },
105
105
  },
106
106
  )
107
107
  }
108
108
 
109
- function polyhedraPolyhedronAttribute(id) {
109
+ function meshPolyhedraPolyhedronAttribute(id) {
110
110
  return meshPolyhedraStyle(id).coloring.polyhedron
111
111
  }
112
- function setPolyhedraPolyhedronAttribute(id, polyhedron_attribute) {
112
+ function setMeshPolyhedraPolyhedronAttribute(id, polyhedron_attribute) {
113
113
  const coloring = meshPolyhedraStyle(id).coloring
114
114
  return viewerStore.request(
115
115
  mesh_polyhedra_schemas.polyhedron_attribute,
@@ -118,9 +118,9 @@ export function useMeshPolyhedraStyle() {
118
118
  response_function: () => {
119
119
  coloring.polyhedron = polyhedron_attribute
120
120
  console.log(
121
- setPolyhedraPolyhedronAttribute.name,
121
+ setMeshPolyhedraPolyhedronAttribute.name,
122
122
  { id },
123
- polyhedraPolyhedronAttribute(id),
123
+ meshPolyhedraPolyhedronAttribute(id),
124
124
  )
125
125
  },
126
126
  },
@@ -139,13 +139,13 @@ export function useMeshPolyhedraStyle() {
139
139
  applyMeshPolyhedraStyle,
140
140
  meshPolyhedraActiveColoring,
141
141
  meshPolyhedraColor,
142
- polyhedraVertexAttribute,
142
+ meshPolyhedraVertexAttribute,
143
143
  meshPolyhedraVisibility,
144
- polyhedraPolyhedronAttribute,
144
+ meshPolyhedraPolyhedronAttribute,
145
145
  setMeshPolyhedraActiveColoring,
146
146
  setMeshPolyhedraColor,
147
- setPolyhedraPolyhedronAttribute,
148
- setPolyhedraVertexAttribute,
147
+ setMeshPolyhedraPolyhedronAttribute,
148
+ setMeshPolyhedraVertexAttribute,
149
149
  setMeshPolyhedraVisibility,
150
150
  }
151
151
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@geode/opengeodeweb-front",
3
3
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
4
4
  "type": "module",
5
- "version": "10.2.1-rc.3",
5
+ "version": "10.2.1-rc.4",
6
6
  "main": "./nuxt.config.js",
7
7
  "scripts": {
8
8
  "lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore .",
@@ -5,4 +5,4 @@
5
5
  # pip-compile --output-file=tests/integration/microservices/back/requirements.txt tests/integration/microservices/back/requirements.in
6
6
  #
7
7
 
8
- opengeodeweb-back==6.*,>=6.0.0
8
+ opengeodeweb-back==6.*,>=6.1.0rc2
@@ -17,6 +17,8 @@ import { setupIntegrationTests } from "../../../setup"
17
17
  const mesh_cells_schemas = viewer_schemas.opengeodeweb_viewer.mesh.cells
18
18
  const file_name = "test.og_rgd2d"
19
19
  const geode_object = "RegularGrid2D"
20
+ const vertex_attribute = { name: "points" }
21
+ const cell_attribute = { name: "RGB_data" }
20
22
 
21
23
  let id, back_port, viewer_port, project_folder_path
22
24
 
@@ -44,7 +46,9 @@ describe("Mesh cells", () => {
44
46
  const viewerStore = useViewerStore()
45
47
  const visibility = true
46
48
  const spy = vi.spyOn(viewerStore, "request")
47
- await dataStyleStore.setMeshCellsVisibility(id, visibility)
49
+ const result = dataStyleStore.setMeshCellsVisibility(id, visibility)
50
+ expect(result).toBeInstanceOf(Promise)
51
+ await result
48
52
  expect(spy).toHaveBeenCalledWith(
49
53
  mesh_cells_schemas.visibility,
50
54
  { id, visibility },
@@ -63,7 +67,9 @@ describe("Mesh cells", () => {
63
67
  const viewerStore = useViewerStore()
64
68
  const color = { r: 255, g: 0, b: 0 }
65
69
  const spy = vi.spyOn(viewerStore, "request")
66
- await dataStyleStore.setMeshCellsColor(id, color)
70
+ const result = dataStyleStore.setMeshCellsColor(id, color)
71
+ expect(result).toBeInstanceOf(Promise)
72
+ await result
67
73
  expect(spy).toHaveBeenCalledWith(
68
74
  mesh_cells_schemas.color,
69
75
  { id, color },
@@ -80,9 +86,13 @@ describe("Mesh cells", () => {
80
86
  test("Coloring vertex attribute", async () => {
81
87
  const dataStyleStore = useDataStyleStore()
82
88
  const viewerStore = useViewerStore()
83
- const vertex_attribute = { name: "points" }
84
89
  const spy = vi.spyOn(viewerStore, "request")
85
- await dataStyleStore.setMeshCellsVertexAttribute(id, vertex_attribute)
90
+ const result = dataStyleStore.setMeshCellsVertexAttribute(
91
+ id,
92
+ vertex_attribute,
93
+ )
94
+ expect(result).toBeInstanceOf(Promise)
95
+ await result
86
96
  expect(spy).toHaveBeenCalledWith(
87
97
  mesh_cells_schemas.vertex_attribute,
88
98
  { id, ...vertex_attribute },
@@ -101,9 +111,13 @@ describe("Mesh cells", () => {
101
111
  test("Coloring cell attribute", async () => {
102
112
  const dataStyleStore = useDataStyleStore()
103
113
  const viewerStore = useViewerStore()
104
- const cell_attribute = { name: "RGB_data" }
105
114
  const spy = vi.spyOn(viewerStore, "request")
106
- await dataStyleStore.setMeshCellsCellAttribute(id, cell_attribute)
115
+ const result = dataStyleStore.setMeshCellsCellAttribute(
116
+ id,
117
+ cell_attribute,
118
+ )
119
+ expect(result).toBeInstanceOf(Promise)
120
+ await result
107
121
  expect(spy).toHaveBeenCalledWith(
108
122
  mesh_cells_schemas.cell_attribute,
109
123
  { id, ...cell_attribute },
@@ -122,11 +136,37 @@ describe("Mesh cells", () => {
122
136
  test("test coloring", async () => {
123
137
  const dataStyleStore = useDataStyleStore()
124
138
  const viewerStore = useViewerStore()
125
- const coloringTypes = ["color", "vertex", "cell"]
139
+ const coloringTypes = [
140
+ { name: "color" },
141
+ {
142
+ name: "vertex",
143
+ function: () =>
144
+ dataStyleStore.setMeshCellsVertexAttribute(id, vertex_attribute),
145
+ },
146
+ {
147
+ name: "cell",
148
+ function: () =>
149
+ dataStyleStore.setMeshCellsCellAttribute(id, cell_attribute),
150
+ },
151
+ ]
126
152
  for (let i = 0; i < coloringTypes.length; i++) {
127
- dataStyleStore.setMeshCellsActiveColoring(id, coloringTypes[i])
153
+ if (coloringTypes[i].function) {
154
+ expect(() =>
155
+ dataStyleStore.setMeshCellsActiveColoring(
156
+ id,
157
+ coloringTypes[i].name,
158
+ ),
159
+ ).toThrowError()
160
+ await coloringTypes[i].function()
161
+ }
162
+ const result = dataStyleStore.setMeshCellsActiveColoring(
163
+ id,
164
+ coloringTypes[i].name,
165
+ )
166
+ expect(result).toBeInstanceOf(Promise)
167
+ await result
128
168
  expect(dataStyleStore.meshCellsActiveColoring(id)).toBe(
129
- coloringTypes[i],
169
+ coloringTypes[i].name,
130
170
  )
131
171
  expect(viewerStore.status).toBe(Status.CONNECTED)
132
172
  }
@@ -17,6 +17,8 @@ import { setupIntegrationTests } from "../../../setup"
17
17
  const mesh_edges_schemas = viewer_schemas.opengeodeweb_viewer.mesh.edges
18
18
  const file_name = "test.og_edc3d"
19
19
  const geode_object = "EdgedCurve3D"
20
+ const vertex_attribute = { name: "vertex_attribute" }
21
+ const edge_attribute = { name: "edge_attribute" }
20
22
 
21
23
  let id, back_port, viewer_port, project_folder_path
22
24
 
@@ -36,14 +38,16 @@ afterEach(async () => {
36
38
  delete_folder_recursive(project_folder_path)
37
39
  })
38
40
 
39
- describe("Mesh EdgedCurve3D", () => {
41
+ describe("Mesh edges", () => {
40
42
  describe("Edges", () => {
41
43
  test("Edges visibility", async () => {
42
44
  const dataStyleStore = useDataStyleStore()
43
45
  const viewerStore = useViewerStore()
44
46
  const visibility = true
45
47
  const spy = vi.spyOn(viewerStore, "request")
46
- await dataStyleStore.setMeshEdgesVisibility(id, visibility)
48
+ const result = dataStyleStore.setMeshEdgesVisibility(id, visibility)
49
+ expect(result).toBeInstanceOf(Promise)
50
+ await result
47
51
  expect(spy).toHaveBeenCalledWith(
48
52
  mesh_edges_schemas.visibility,
49
53
  { id, visibility },
@@ -60,7 +64,9 @@ describe("Mesh EdgedCurve3D", () => {
60
64
  const viewerStore = useViewerStore()
61
65
  const color = { r: 255, g: 0, b: 0 }
62
66
  const spy = vi.spyOn(viewerStore, "request")
63
- await dataStyleStore.setMeshEdgesColor(id, color)
67
+ const result = dataStyleStore.setMeshEdgesColor(id, color)
68
+ expect(result).toBeInstanceOf(Promise)
69
+ await result
64
70
  expect(spy).toHaveBeenCalledWith(
65
71
  mesh_edges_schemas.color,
66
72
  { id, color },
@@ -72,23 +78,10 @@ describe("Mesh EdgedCurve3D", () => {
72
78
  expect(viewerStore.status).toBe(Status.CONNECTED)
73
79
  })
74
80
 
75
- test("Edges active coloring", async () => {
76
- const dataStyleStore = useDataStyleStore()
77
- const viewerStore = useViewerStore()
78
- const coloringTypes = ["color", "vertex", "edge"]
79
- for (let i = 0; i < coloringTypes.length; i++) {
80
- dataStyleStore.setMeshEdgesActiveColoring(id, coloringTypes[i])
81
- expect(dataStyleStore.meshEdgesActiveColoring(id)).toBe(
82
- coloringTypes[i],
83
- )
84
- expect(viewerStore.status).toBe(Status.CONNECTED)
85
- }
86
- })
87
-
88
81
  test("Edges vertex attribute", async () => {
89
82
  const dataStyleStore = useDataStyleStore()
90
83
  const viewerStore = useViewerStore()
91
- const vertex_attribute = { name: "vertex_attribute" }
84
+
92
85
  const spy = vi.spyOn(viewerStore, "request")
93
86
  await dataStyleStore.setMeshEdgesVertexAttribute(id, vertex_attribute)
94
87
  expect(spy).toHaveBeenCalledWith(
@@ -107,7 +100,7 @@ describe("Mesh EdgedCurve3D", () => {
107
100
  test("Edges edge attribute", async () => {
108
101
  const dataStyleStore = useDataStyleStore()
109
102
  const viewerStore = useViewerStore()
110
- const edge_attribute = { name: "edge_attribute" }
103
+
111
104
  const spy = vi.spyOn(viewerStore, "request")
112
105
  await dataStyleStore.setMeshEdgesEdgeAttribute(id, edge_attribute)
113
106
  expect(spy).toHaveBeenCalledWith(
@@ -122,5 +115,44 @@ describe("Mesh EdgedCurve3D", () => {
122
115
  )
123
116
  expect(viewerStore.status).toBe(Status.CONNECTED)
124
117
  })
118
+
119
+ test("Edges active coloring", async () => {
120
+ const dataStyleStore = useDataStyleStore()
121
+ const viewerStore = useViewerStore()
122
+ const coloringTypes = [
123
+ { name: "color" },
124
+ {
125
+ name: "vertex",
126
+ function: () =>
127
+ dataStyleStore.setMeshEdgesVertexAttribute(id, vertex_attribute),
128
+ },
129
+ {
130
+ name: "edge",
131
+ function: () =>
132
+ dataStyleStore.setMeshEdgesEdgeAttribute(id, edge_attribute),
133
+ },
134
+ ]
135
+ for (let i = 0; i < coloringTypes.length; i++) {
136
+ if (coloringTypes[i].function) {
137
+ expect(() =>
138
+ dataStyleStore.setMeshEdgesActiveColoring(
139
+ id,
140
+ coloringTypes[i].name,
141
+ ),
142
+ ).toThrowError()
143
+ await coloringTypes[i].function()
144
+ }
145
+ const result = dataStyleStore.setMeshEdgesActiveColoring(
146
+ id,
147
+ coloringTypes[i].name,
148
+ )
149
+ expect(result).toBeInstanceOf(Promise)
150
+ await result
151
+ expect(dataStyleStore.meshEdgesActiveColoring(id)).toBe(
152
+ coloringTypes[i].name,
153
+ )
154
+ expect(viewerStore.status).toBe(Status.CONNECTED)
155
+ }
156
+ })
125
157
  })
126
158
  })
@@ -43,7 +43,9 @@ describe("Mesh", () => {
43
43
  const viewerStore = useViewerStore()
44
44
  const visibility = true
45
45
  const spy = vi.spyOn(viewerStore, "request")
46
- await dataStyleStore.setMeshVisibility(id, visibility)
46
+ const result = dataStyleStore.setMeshVisibility(id, visibility)
47
+ expect(result).toBeInstanceOf(Promise)
48
+ await result
47
49
  expect(spy).toHaveBeenCalledWith(
48
50
  mesh_schemas.visibility,
49
51
  { id, visibility },
@@ -60,7 +62,9 @@ describe("Mesh", () => {
60
62
  test("test", async () => {
61
63
  const dataStyleStore = useDataStyleStore()
62
64
  const viewerStore = useViewerStore()
63
- await dataStyleStore.applyMeshStyle(id)
65
+ const result = dataStyleStore.applyMeshStyle(id)
66
+ expect(result).toBeInstanceOf(Promise)
67
+ await result
64
68
  expect(viewerStore.status).toBe(Status.CONNECTED)
65
69
  })
66
70
  })
@@ -17,6 +17,7 @@ import { setupIntegrationTests } from "../../../setup"
17
17
  const mesh_points_schemas = viewer_schemas.opengeodeweb_viewer.mesh.points
18
18
  const file_name = "test.og_edc2d"
19
19
  const geode_object = "EdgedCurve2D"
20
+ const vertex_attribute = { name: "points" }
20
21
 
21
22
  let id, back_port, viewer_port, project_folder_path
22
23
 
@@ -43,7 +44,9 @@ describe("Mesh points", () => {
43
44
  const viewerStore = useViewerStore()
44
45
  const visibility = true
45
46
  const spy = vi.spyOn(viewerStore, "request")
46
- await dataStyleStore.setMeshPointsVisibility(id, visibility)
47
+ const result = dataStyleStore.setMeshPointsVisibility(id, visibility)
48
+ expect(result).toBeInstanceOf(Promise)
49
+ await result
47
50
  expect(spy).toHaveBeenCalledWith(
48
51
  mesh_points_schemas.visibility,
49
52
  { id, visibility },
@@ -62,7 +65,9 @@ describe("Mesh points", () => {
62
65
  const viewerStore = useViewerStore()
63
66
  const color = { r: 255, g: 0, b: 0 }
64
67
  const spy = vi.spyOn(viewerStore, "request")
65
- await dataStyleStore.setMeshPointsColor(id, color)
68
+ const result = dataStyleStore.setMeshPointsColor(id, color)
69
+ expect(result).toBeInstanceOf(Promise)
70
+ await result
66
71
  expect(spy).toHaveBeenCalledWith(
67
72
  mesh_points_schemas.color,
68
73
  { id, color },
@@ -79,11 +84,32 @@ describe("Mesh points", () => {
79
84
  test("test coloring", async () => {
80
85
  const dataStyleStore = useDataStyleStore()
81
86
  const viewerStore = useViewerStore()
82
- const coloringTypes = ["color"]
87
+ const coloringTypes = [
88
+ { name: "color" },
89
+ {
90
+ name: "vertex",
91
+ function: () =>
92
+ dataStyleStore.setMeshPointsVertexAttribute(id, vertex_attribute),
93
+ },
94
+ ]
83
95
  for (let i = 0; i < coloringTypes.length; i++) {
84
- dataStyleStore.setMeshPointsActiveColoring(id, coloringTypes[i])
96
+ if (coloringTypes[i].function) {
97
+ expect(() =>
98
+ dataStyleStore.setMeshPointsActiveColoring(
99
+ id,
100
+ coloringTypes[i].name,
101
+ ),
102
+ ).toThrowError()
103
+ await coloringTypes[i].function()
104
+ }
105
+ const result = dataStyleStore.setMeshPointsActiveColoring(
106
+ id,
107
+ coloringTypes[i].name,
108
+ )
109
+ expect(result).toBeInstanceOf(Promise)
110
+ await result
85
111
  expect(dataStyleStore.meshPointsActiveColoring(id)).toBe(
86
- coloringTypes[i],
112
+ coloringTypes[i].name,
87
113
  )
88
114
  expect(viewerStore.status).toBe(Status.CONNECTED)
89
115
  }
@@ -96,7 +122,9 @@ describe("Mesh points", () => {
96
122
  const viewerStore = useViewerStore()
97
123
  const size = 20
98
124
  const spy = vi.spyOn(viewerStore, "request")
99
- await dataStyleStore.setMeshPointsSize(id, size)
125
+ const result = dataStyleStore.setMeshPointsSize(id, size)
126
+ expect(result).toBeInstanceOf(Promise)
127
+ await result
100
128
  expect(spy).toHaveBeenCalledWith(
101
129
  mesh_points_schemas.size,
102
130
  { id, size },
@@ -111,7 +139,7 @@ describe("Mesh points", () => {
111
139
  test("Points vertex attribute", async () => {
112
140
  const dataStyleStore = useDataStyleStore()
113
141
  const viewerStore = useViewerStore()
114
- const vertex_attribute = { name: "points" }
142
+
115
143
  const spy = vi.spyOn(viewerStore, "request")
116
144
  await dataStyleStore.setMeshPointsVertexAttribute(id, vertex_attribute)
117
145
  expect(spy).toHaveBeenCalledWith(
@@ -17,6 +17,8 @@ import { setupIntegrationTests } from "../../../setup"
17
17
  const mesh_polygons_schemas = viewer_schemas.opengeodeweb_viewer.mesh.polygons
18
18
  const file_name = "test.og_psf3d"
19
19
  const geode_object = "PolygonalSurface3D"
20
+ const vertex_attribute = { name: "points" }
21
+ const polygon_attribute = { name: "test_attribute" }
20
22
 
21
23
  let id, back_port, viewer_port, project_folder_path
22
24
 
@@ -44,7 +46,9 @@ describe("Mesh polygons", () => {
44
46
  const viewerStore = useViewerStore()
45
47
  const visibility = true
46
48
  const spy = vi.spyOn(viewerStore, "request")
47
- await dataStyleStore.setMeshPolygonsVisibility(id, visibility)
49
+ const result = dataStyleStore.setMeshPolygonsVisibility(id, visibility)
50
+ expect(result).toBeInstanceOf(Promise)
51
+ await result
48
52
  expect(spy).toHaveBeenCalledWith(
49
53
  mesh_polygons_schemas.visibility,
50
54
  { id, visibility },
@@ -63,7 +67,9 @@ describe("Mesh polygons", () => {
63
67
  const viewerStore = useViewerStore()
64
68
  const color = { r: 255, g: 0, b: 0 }
65
69
  const spy = vi.spyOn(viewerStore, "request")
66
- await dataStyleStore.setMeshPolygonsColor(id, color)
70
+ const result = dataStyleStore.setMeshPolygonsColor(id, color)
71
+ expect(result).toBeInstanceOf(Promise)
72
+ await result
67
73
  expect(spy).toHaveBeenCalledWith(
68
74
  mesh_polygons_schemas.color,
69
75
  { id, color },
@@ -76,28 +82,17 @@ describe("Mesh polygons", () => {
76
82
  })
77
83
  })
78
84
 
79
- describe("Polygons active coloring", () => {
80
- test("test coloring", async () => {
81
- const dataStyleStore = useDataStyleStore()
82
- const viewerStore = useViewerStore()
83
- const coloringTypes = ["color", "vertex", "polygon"]
84
- for (let i = 0; i < coloringTypes.length; i++) {
85
- dataStyleStore.setMeshPolygonsActiveColoring(id, coloringTypes[i])
86
- expect(dataStyleStore.meshPolygonsActiveColoring(id)).toBe(
87
- coloringTypes[i],
88
- )
89
- expect(viewerStore.status).toBe(Status.CONNECTED)
90
- }
91
- })
92
- })
93
-
94
85
  describe("Polygons vertex attribute", () => {
95
86
  test("Coloring vertex attribute", async () => {
96
87
  const dataStyleStore = useDataStyleStore()
97
88
  const viewerStore = useViewerStore()
98
- const vertex_attribute = { name: "points" }
99
89
  const spy = vi.spyOn(viewerStore, "request")
100
- await dataStyleStore.setMeshPolygonsVertexAttribute(id, vertex_attribute)
90
+ const result = dataStyleStore.setMeshPolygonsVertexAttribute(
91
+ id,
92
+ vertex_attribute,
93
+ )
94
+ expect(result).toBeInstanceOf(Promise)
95
+ await result
101
96
  expect(spy).toHaveBeenCalledWith(
102
97
  mesh_polygons_schemas.vertex_attribute,
103
98
  { id, ...vertex_attribute },
@@ -116,12 +111,13 @@ describe("Mesh polygons", () => {
116
111
  test("Coloring polygon attribute", async () => {
117
112
  const dataStyleStore = useDataStyleStore()
118
113
  const viewerStore = useViewerStore()
119
- const polygon_attribute = { name: "test_attribute" }
120
114
  const spy = vi.spyOn(viewerStore, "request")
121
- await dataStyleStore.setMeshPolygonsPolygonAttribute(
115
+ const result = dataStyleStore.setMeshPolygonsPolygonAttribute(
122
116
  id,
123
117
  polygon_attribute,
124
118
  )
119
+ expect(result).toBeInstanceOf(Promise)
120
+ await result
125
121
  expect(spy).toHaveBeenCalledWith(
126
122
  mesh_polygons_schemas.polygon_attribute,
127
123
  { id, ...polygon_attribute },
@@ -135,4 +131,49 @@ describe("Mesh polygons", () => {
135
131
  expect(viewerStore.status).toBe(Status.CONNECTED)
136
132
  })
137
133
  })
134
+
135
+ describe("Polygons active coloring", () => {
136
+ test("test coloring", async () => {
137
+ const dataStyleStore = useDataStyleStore()
138
+ const viewerStore = useViewerStore()
139
+ const coloringTypes = [
140
+ { name: "color" },
141
+ {
142
+ name: "vertex",
143
+ function: () =>
144
+ dataStyleStore.setMeshPolygonsVertexAttribute(id, vertex_attribute),
145
+ },
146
+ {
147
+ name: "polygon",
148
+ function: () =>
149
+ dataStyleStore.setMeshPolygonsPolygonAttribute(
150
+ id,
151
+ polygon_attribute,
152
+ ),
153
+ },
154
+ ]
155
+
156
+ for (let i = 0; i < coloringTypes.length; i++) {
157
+ if (coloringTypes[i].function) {
158
+ expect(() =>
159
+ dataStyleStore.setMeshPolygonsActiveColoring(
160
+ id,
161
+ coloringTypes[i].name,
162
+ ),
163
+ ).toThrowError()
164
+ await coloringTypes[i].function()
165
+ }
166
+ const result = dataStyleStore.setMeshPolygonsActiveColoring(
167
+ id,
168
+ coloringTypes[i].name,
169
+ )
170
+ expect(result).toBeInstanceOf(Promise)
171
+ await result
172
+ expect(dataStyleStore.meshPolygonsActiveColoring(id)).toBe(
173
+ coloringTypes[i].name,
174
+ )
175
+ expect(viewerStore.status).toBe(Status.CONNECTED)
176
+ }
177
+ })
178
+ })
138
179
  })
@@ -15,10 +15,10 @@ import { setupIntegrationTests } from "../../../setup"
15
15
 
16
16
  // Local constants
17
17
  const mesh_polyhedra_schemas = viewer_schemas.opengeodeweb_viewer.mesh.polyhedra
18
- const mesh_polygons_schemas = viewer_schemas.opengeodeweb_viewer.mesh.polygons
19
- const mesh_edges_schemas = viewer_schemas.opengeodeweb_viewer.mesh.edges
20
18
  const file_name = "test.vtu"
21
19
  const geode_object = "HybridSolid3D"
20
+ const vertex_attribute = { name: "toto_on_vertices" }
21
+ const polyhedron_attribute = { name: "toto_on_polyhedra" }
22
22
 
23
23
  let id, back_port, viewer_port, project_folder_path
24
24
 
@@ -45,7 +45,9 @@ describe("Mesh polyhedra", () => {
45
45
  const viewerStore = useViewerStore()
46
46
  const visibility = true
47
47
  const spy = vi.spyOn(viewerStore, "request")
48
- await dataStyleStore.setMeshPolyhedraVisibility(id, visibility)
48
+ const result = dataStyleStore.setMeshPolyhedraVisibility(id, visibility)
49
+ expect(result).toBeInstanceOf(Promise)
50
+ await result
49
51
  expect(spy).toHaveBeenCalledWith(
50
52
  mesh_polyhedra_schemas.visibility,
51
53
  { id, visibility },
@@ -62,7 +64,9 @@ describe("Mesh polyhedra", () => {
62
64
  const viewerStore = useViewerStore()
63
65
  const color = { r: 255, g: 0, b: 0 }
64
66
  const spy = vi.spyOn(viewerStore, "request")
65
- await dataStyleStore.setMeshPolyhedraColor(id, color)
67
+ const result = dataStyleStore.setMeshPolyhedraColor(id, color)
68
+ expect(result).toBeInstanceOf(Promise)
69
+ await result
66
70
  expect(spy).toHaveBeenCalledWith(
67
71
  mesh_polyhedra_schemas.color,
68
72
  { id, color },
@@ -77,55 +81,87 @@ describe("Mesh polyhedra", () => {
77
81
  test("Polyhedra active coloring", async () => {
78
82
  const dataStyleStore = useDataStyleStore()
79
83
  const viewerStore = useViewerStore()
80
- const coloringTypes = ["color", "vertex", "polyhedron"]
84
+ const coloringTypes = [
85
+ { name: "color" },
86
+ {
87
+ name: "vertex",
88
+ function: () =>
89
+ dataStyleStore.setMeshPolyhedraVertexAttribute(
90
+ id,
91
+ vertex_attribute,
92
+ ),
93
+ },
94
+ {
95
+ name: "polyhedron",
96
+ function: () =>
97
+ dataStyleStore.setMeshPolyhedraPolyhedronAttribute(
98
+ id,
99
+ polyhedron_attribute,
100
+ ),
101
+ },
102
+ ]
81
103
  for (let i = 0; i < coloringTypes.length; i++) {
82
- dataStyleStore.setMeshPolyhedraActiveColoring(id, coloringTypes[i])
104
+ if (coloringTypes[i].function) {
105
+ expect(() =>
106
+ dataStyleStore.setMeshPolyhedraActiveColoring(
107
+ id,
108
+ coloringTypes[i].name,
109
+ ),
110
+ ).toThrowError()
111
+ await coloringTypes[i].function()
112
+ }
113
+ const result = dataStyleStore.setMeshPolyhedraActiveColoring(
114
+ id,
115
+ coloringTypes[i].name,
116
+ )
117
+ expect(result).toBeInstanceOf(Promise)
118
+ await result
83
119
  expect(dataStyleStore.meshPolyhedraActiveColoring(id)).toBe(
84
- coloringTypes[i],
120
+ coloringTypes[i].name,
85
121
  )
86
122
  expect(viewerStore.status).toBe(Status.CONNECTED)
87
123
  }
88
124
  })
125
+ })
89
126
 
90
- test("Polyhedra vertex attribute", async () => {
91
- const dataStyleStore = useDataStyleStore()
92
- const viewerStore = useViewerStore()
93
- const vertex_attribute = { name: "toto_on_vertices" }
94
- const spy = vi.spyOn(viewerStore, "request")
95
- await dataStyleStore.setPolyhedraVertexAttribute(id, vertex_attribute)
96
- expect(spy).toHaveBeenCalledWith(
97
- mesh_polyhedra_schemas.vertex_attribute,
98
- { id, ...vertex_attribute },
99
- {
100
- response_function: expect.any(Function),
101
- },
102
- )
103
- expect(dataStyleStore.polyhedraVertexAttribute(id)).toStrictEqual(
104
- vertex_attribute,
105
- )
106
- expect(viewerStore.status).toBe(Status.CONNECTED)
107
- })
127
+ test("Polyhedra vertex attribute", async () => {
128
+ const dataStyleStore = useDataStyleStore()
129
+ const viewerStore = useViewerStore()
108
130
 
109
- test("Polyhedra polyhedron attribute", async () => {
110
- const dataStyleStore = useDataStyleStore()
111
- const viewerStore = useViewerStore()
112
- const polyhedron_attribute = { name: "toto_on_polyhedra" }
113
- const spy = vi.spyOn(viewerStore, "request")
114
- await dataStyleStore.setPolyhedraPolyhedronAttribute(
115
- id,
116
- polyhedron_attribute,
117
- )
118
- expect(spy).toHaveBeenCalledWith(
119
- mesh_polyhedra_schemas.polyhedron_attribute,
120
- { id, ...polyhedron_attribute },
121
- {
122
- response_function: expect.any(Function),
123
- },
124
- )
125
- expect(dataStyleStore.polyhedraPolyhedronAttribute(id)).toStrictEqual(
126
- polyhedron_attribute,
127
- )
128
- expect(viewerStore.status).toBe(Status.CONNECTED)
129
- })
131
+ const spy = vi.spyOn(viewerStore, "request")
132
+ await dataStyleStore.setMeshPolyhedraVertexAttribute(id, vertex_attribute)
133
+ expect(spy).toHaveBeenCalledWith(
134
+ mesh_polyhedra_schemas.vertex_attribute,
135
+ { id, ...vertex_attribute },
136
+ {
137
+ response_function: expect.any(Function),
138
+ },
139
+ )
140
+ expect(dataStyleStore.meshPolyhedraVertexAttribute(id)).toStrictEqual(
141
+ vertex_attribute,
142
+ )
143
+ expect(viewerStore.status).toBe(Status.CONNECTED)
144
+ })
145
+
146
+ test("Polyhedra polyhedron attribute", async () => {
147
+ const dataStyleStore = useDataStyleStore()
148
+ const viewerStore = useViewerStore()
149
+
150
+ const spy = vi.spyOn(viewerStore, "request")
151
+ await dataStyleStore.setMeshPolyhedraPolyhedronAttribute(
152
+ id,
153
+ polyhedron_attribute,
154
+ )
155
+ expect(spy).toHaveBeenCalledWith(
156
+ mesh_polyhedra_schemas.polyhedron_attribute,
157
+ { id, ...polyhedron_attribute },
158
+ {
159
+ response_function: expect.any(Function),
160
+ },
161
+ )
162
+ expect(dataStyleStore.meshPolyhedraPolyhedronAttribute(id)).toStrictEqual(
163
+ polyhedron_attribute,
164
+ )
165
+ expect(viewerStore.status).toBe(Status.CONNECTED)
130
166
  })
131
167
  })
@@ -51,7 +51,13 @@ describe("Model blocks", () => {
51
51
  const visibility = false
52
52
  const spy = vi.spyOn(viewerStore, "request")
53
53
  spy.mockClear()
54
- await dataStyleStore.setModelBlocksVisibility(id, block_ids, visibility)
54
+ const result = dataStyleStore.setModelBlocksVisibility(
55
+ id,
56
+ block_ids,
57
+ visibility,
58
+ )
59
+ expect(result).toBeInstanceOf(Promise)
60
+ await result
55
61
  expect(spy).toHaveBeenCalledWith(
56
62
  model_blocks_schemas.visibility,
57
63
  { id, block_ids: block_viewer_ids, visibility },
@@ -51,7 +51,13 @@ describe("Model corners", () => {
51
51
  const visibility = false
52
52
  const spy = vi.spyOn(viewerStore, "request")
53
53
  spy.mockClear()
54
- await dataStyleStore.setModelCornersVisibility(id, corner_ids, visibility)
54
+ const result = dataStyleStore.setModelCornersVisibility(
55
+ id,
56
+ corner_ids,
57
+ visibility,
58
+ )
59
+ expect(result).toBeInstanceOf(Promise)
60
+ await result
55
61
  expect(spy).toHaveBeenCalledWith(
56
62
  model_corners_schemas.visibility,
57
63
  { id, block_ids: corner_viewer_ids, visibility },
@@ -81,7 +87,9 @@ describe("Model corners", () => {
81
87
  const color = { r: 255, g: 0, b: 0 }
82
88
  const spy = vi.spyOn(viewerStore, "request")
83
89
  spy.mockClear()
84
- await dataStyleStore.setModelCornersColor(id, corner_ids, color)
90
+ const result = dataStyleStore.setModelCornersColor(id, corner_ids, color)
91
+ expect(result).toBeInstanceOf(Promise)
92
+ await result
85
93
  expect(spy).toHaveBeenCalledWith(
86
94
  model_corners_schemas.color,
87
95
  { id, block_ids: corner_viewer_ids, color },
@@ -44,7 +44,9 @@ describe("Model edges", () => {
44
44
  const visibility = true
45
45
  const spy = vi.spyOn(viewerStore, "request")
46
46
  spy.mockClear()
47
- await dataStyleStore.setModelEdgesVisibility(id, visibility)
47
+ const result = dataStyleStore.setModelEdgesVisibility(id, visibility)
48
+ expect(result).toBeInstanceOf(Promise)
49
+ await result
48
50
  expect(spy).toHaveBeenCalledWith(
49
51
  model_edges_schemas.visibility,
50
52
  { id, visibility },
@@ -44,7 +44,9 @@ describe("Model", () => {
44
44
  const visibility = true
45
45
  const spy = vi.spyOn(viewerStore, "request")
46
46
  spy.mockClear()
47
- await dataStyleStore.setModelVisibility(id, visibility)
47
+ const result = dataStyleStore.setModelVisibility(id, visibility)
48
+ expect(result).toBeInstanceOf(Promise)
49
+ await result
48
50
  expect(spy).toHaveBeenCalledWith(
49
51
  model_schemas.visibility,
50
52
  { id, visibility },
@@ -47,7 +47,13 @@ describe("Model lines", () => {
47
47
  const visibility = false
48
48
  const spy = vi.spyOn(viewerStore, "request")
49
49
  spy.mockClear()
50
- await dataStyleStore.setModelLinesVisibility(id, line_ids, visibility)
50
+ const result = dataStyleStore.setModelLinesVisibility(
51
+ id,
52
+ line_ids,
53
+ visibility,
54
+ )
55
+ expect(result).toBeInstanceOf(Promise)
56
+ await result
51
57
  expect(spy).toHaveBeenCalledWith(
52
58
  model_lines_schemas.visibility,
53
59
  { id, block_ids: lines_viewer_ids, visibility },
@@ -75,7 +81,9 @@ describe("Model lines", () => {
75
81
  const color = { r: 255, g: 0, b: 0 }
76
82
  const spy = vi.spyOn(viewerStore, "request")
77
83
  spy.mockClear()
78
- await dataStyleStore.setModelLinesColor(id, line_ids, color)
84
+ const result = dataStyleStore.setModelLinesColor(id, line_ids, color)
85
+ expect(result).toBeInstanceOf(Promise)
86
+ await result
79
87
  expect(spy).toHaveBeenCalledWith(
80
88
  model_lines_schemas.color,
81
89
  { id, block_ids: lines_viewer_ids, color },
@@ -39,7 +39,9 @@ describe("Model points", () => {
39
39
  const visibility = true
40
40
  const spy = vi.spyOn(viewerStore, "request")
41
41
  spy.mockClear()
42
- await dataStyleStore.setModelPointsVisibility(id, visibility)
42
+ const result = dataStyleStore.setModelPointsVisibility(id, visibility)
43
+ expect(result).toBeInstanceOf(Promise)
44
+ await result
43
45
  expect(spy).toHaveBeenCalledWith(
44
46
  model_points_schemas.visibility,
45
47
  { id, visibility },
@@ -59,7 +61,9 @@ describe("Model points", () => {
59
61
  const size = 20
60
62
  const spy = vi.spyOn(viewerStore, "request")
61
63
  spy.mockClear()
62
- await dataStyleStore.setModelPointsSize(id, size)
64
+ const result = dataStyleStore.setModelPointsSize(id, size)
65
+ expect(result).toBeInstanceOf(Promise)
66
+ await result
63
67
  expect(spy).toHaveBeenCalledWith(
64
68
  model_points_schemas.size,
65
69
  { id, size },
@@ -51,11 +51,13 @@ describe("Model surfaces", () => {
51
51
  const visibility = true
52
52
  const spy = vi.spyOn(viewerStore, "request")
53
53
  spy.mockClear() // Clear calls from setup (applyDefaultStyle)
54
- await dataStyleStore.setModelSurfacesVisibility(
54
+ const result = dataStyleStore.setModelSurfacesVisibility(
55
55
  id,
56
56
  surface_ids,
57
57
  visibility,
58
58
  )
59
+ expect(result).toBeInstanceOf(Promise)
60
+ await result
59
61
  expect(spy).toHaveBeenCalledWith(
60
62
  model_surfaces_schemas.visibility,
61
63
  { id, block_ids: surface_viewer_ids, visibility },
@@ -85,7 +87,13 @@ describe("Model surfaces", () => {
85
87
  const color = { r: 255, g: 0, b: 0 }
86
88
  const spy = vi.spyOn(viewerStore, "request")
87
89
  spy.mockClear() // Clear calls from setup (applyDefaultStyle)
88
- await dataStyleStore.setModelSurfacesColor(id, surface_ids, color)
90
+ const result = dataStyleStore.setModelSurfacesColor(
91
+ id,
92
+ surface_ids,
93
+ color,
94
+ )
95
+ expect(result).toBeInstanceOf(Promise)
96
+ await result
89
97
  expect(spy).toHaveBeenCalledWith(
90
98
  model_surfaces_schemas.color,
91
99
  { id, block_ids: surface_viewer_ids, color },