Skip to content

Commit 655a3ab

Browse files
protocols & tests
1 parent 4136e1d commit 655a3ab

File tree

10 files changed

+52
-14
lines changed

10 files changed

+52
-14
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ __pycache__/
99
latest_logs
1010
schemas.json
1111
build
12-
src/tests/tests_output/
12+
/src/tests/tests_output/
1313
*.egg-info

src/opengeodeweb_viewer/rpc/mesh/polygons/polygons_protocols.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def setMeshPolygonsVisibility(self, params):
2222
id = params["id"]
2323
visibility = bool(params["visibility"])
2424
self.SetVisibility(id, visibility)
25-
25+
2626
@exportRpc(mesh_polygons_prefix + mesh_polygons_schemas_dict["color"]["rpc"])
2727
def setMeshPolygonsColor(self, params):
2828
print(self.mesh_polygons_prefix + self.mesh_polygons_schemas_dict["color"]["rpc"], f"{params=}", flush=True)
@@ -37,12 +37,12 @@ def setMeshPolygonsVertexAttribute(self, params):
3737
validate_schema(params, self.mesh_polygons_schemas_dict["vertex_attribute"])
3838
id = params["id"]
3939
name = str(params["name"])
40-
self.setMeshVertexAttribute(id, name)
40+
self.displayAttributeOnVertices(id, name)
4141

4242
@exportRpc(mesh_polygons_prefix + mesh_polygons_schemas_dict["polygon_attribute"]["rpc"])
4343
def setMeshPolygonsPolygonAttribute(self, params):
4444
print(self.mesh_polygons_prefix + self.mesh_polygons_schemas_dict["polygon_attribute"]["rpc"], f"{params=}", flush=True)
4545
validate_schema(params, self.mesh_polygons_schemas_dict["polygon_attribute"])
4646
id = params["id"]
4747
name = str(params["name"])
48-
self.setMeshPolygonAttribute(id, name)
48+
self.displayAttributeOnCells(id, name)

src/opengeodeweb_viewer/rpc/mesh/polyhedrons/polyhedrons_protocols.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,19 @@ def setMeshPolyhedronsColor(self, params):
3333
red, green, blue = params["color"]["r"], params["color"]["g"], params["color"]["b"]
3434
self.SetColor(id, red, green, blue)
3535

36-
# @exportRpc(mesh_polyhedrons_prefix + mesh_polyhedrons_schemas_dict["vertex_attribute"]["rpc"])
37-
# def setMeshPolyhedronsVertexAttribute(self, params):
38-
# print(self.mesh_polyhedrons_prefix + self.mesh_polyhedrons_schemas_dict["vertex_attribute"]["rpc"], f"{params=}", flush=True)
39-
# validate_schema(params, self.mesh_polyhedrons_schemas_dict["vertex_attribute"])
40-
# id = params["id"]
41-
# name = str(params["name"])
42-
# self.setMeshVertexAttribute(id, name)
36+
@exportRpc(mesh_polyhedrons_prefix + mesh_polyhedrons_schemas_dict["vertex_attribute"]["rpc"])
37+
def setMeshPolyhedronsVertexAttribute(self, params):
38+
print(self.mesh_polyhedrons_prefix + self.mesh_polyhedrons_schemas_dict["vertex_attribute"]["rpc"], f"{params=}", flush=True)
39+
validate_schema(params, self.mesh_polyhedrons_schemas_dict["vertex_attribute"])
40+
id = params["id"]
41+
name = str(params["name"])
42+
self.setMeshVertexAttribute(id, name)
43+
44+
@exportRpc(mesh_polyhedrons_prefix + mesh_polyhedrons_schemas_dict["polyhedron_attribute"]["rpc"])
45+
def setMeshPolyhedronsPolyhedronAttribute(self, params):
46+
print(self.mesh_polyhedrons_prefix + self.mesh_polyhedrons_schemas_dict["vertex_attribute"]["rpc"], f"{params=}", flush=True)
47+
validate_schema(params, self.mesh_polyhedrons_schemas_dict["vertex_attribute"])
48+
id = params["id"]
49+
name = str(params["name"])
50+
self.setMeshPolyhedronAttribute(id, name)
4351

src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/polygon_attribute.json renamed to src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/polyhedron_attribute.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"rpc": "polygon_attribute",
2+
"rpc": "polyhedron_attribute",
33
"type": "object",
44
"properties": {
55
"id": {
Loading
Loading
Loading
Loading

src/tests/mesh/polygons/test_polygons_protocols.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@ def test_polygons_color(server):
1212
test_register_mesh(server)
1313

1414
server.call(VtkMeshPolygonsView.mesh_polygons_prefix + VtkMeshPolygonsView.mesh_polygons_schemas_dict["color"]["rpc"], [{"id": "123456789", "color": {"r": 255, "g": 0, "b": 0}}])
15-
assert server.compare_image(3, "mesh/polygons/color.jpeg") == True
15+
assert server.compare_image(3, "mesh/polygons/color.jpeg") == True
16+
17+
18+
def test_polygons_visibility(server):
19+
20+
test_register_mesh(server)
21+
22+
server.call(VtkMeshPolygonsView.mesh_polygons_prefix + VtkMeshPolygonsView.mesh_polygons_schemas_dict["visibility"]["rpc"], [{"id": "123456789", "visibility": False}])
23+
assert server.compare_image(3, "mesh/polygons/visibility.jpeg") == True

src/tests/mesh/polyhedrons/test_polyhedrons_protocols.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,26 @@ def test_polyhedrons_color(server):
1717
test_register_mesh(server)
1818

1919
server.call(VtkMeshPolyhedronsView.mesh_polyhedrons_prefix + VtkMeshPolyhedronsView.mesh_polyhedrons_schemas_dict["color"]["rpc"], [{"id": "123456789", "color": {"r": 255, "g": 0, "b": 0}}])
20-
assert server.compare_image(3, "mesh/polyhedrons/color.jpeg") == True
20+
assert server.compare_image(3, "mesh/polyhedrons/color.jpeg") == True
21+
22+
def test_polyhedrons_visibility(server):
23+
24+
test_register_mesh(server)
25+
26+
server.call(VtkMeshPolyhedronsView.mesh_polyhedrons_prefix + VtkMeshPolyhedronsView.mesh_polyhedrons_schemas_dict["visibility"]["rpc"], [{"id": "123456789", "visibility": False}])
27+
assert server.compare_image(3, "mesh/polyhedrons/visibility.jpeg") == True
28+
29+
def test_vertex_attribute(server):
30+
31+
test_register_mesh(server)
32+
33+
server.call(VtkMeshPolyhedronsView.mesh_polyhedrons_prefix + VtkMeshPolyhedronsView.mesh_polyhedrons_schemas_dict["vertex_attribute"]["rpc"], [{"id": "123456789", "name": "toto_on_vertices"}])
34+
assert server.compare_image(3, "mesh/polyhedrons/vertex_attribute.jpeg") == True
35+
36+
37+
def test_polyhedron_attribute(server):
38+
39+
test_register_mesh(server)
40+
41+
server.call(VtkMeshPolyhedronsView.mesh_polyhedrons_prefix + VtkMeshPolyhedronsView.mesh_polyhedrons_schemas_dict["polyhedron_attribute"]["rpc"], [{"id": "123456789", "name": "toto_on_polyhedra"}])
42+
assert server.compare_image(3, "mesh/polyhedrons/polyhedron_attribute.jpeg") == True

0 commit comments

Comments
 (0)