Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/opengeodeweb_viewer/rpc/mesh/mesh_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ def setMeshColor(self, params):
red, green, blue = params["color"]["r"], params["color"]["g"], params["color"]["b"]
self.SetColor(id, red, green, blue)


@exportRpc(mesh_prefix + mesh_schemas_dict["apply_textures"]["rpc"])
def meshApplyTextures(self, params):
print(self.mesh_prefix + self.mesh_schemas_dict["apply_textures"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_schemas_dict["apply_textures"])
id = params["id"]
textures = params["textures"]
self.applyTextures(id, textures)


def displayAttributeOnVertices(self, id, name):
reader = self.get_object(id)["reader"]
points = reader.GetOutput().GetPointData()
Expand Down
8 changes: 7 additions & 1 deletion src/tests/test_mesh_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ def test_opacity(server):
server.call(VtkMeshView.mesh_prefix + VtkMeshView.mesh_schemas_dict["opacity"]["rpc"], [{"id": "123456789", "opacity": 0.1}])
assert server.compare_image(3, "mesh/opacity.jpeg") == True


def test_color(server):

test_register_mesh(server)

server.call(VtkMeshView.mesh_prefix + VtkMeshView.mesh_schemas_dict["color"]["rpc"], [{"id": "123456789", "color": {"r": 50, "g": 2, "b": 250}}])
assert server.compare_image(3, "mesh/color.jpeg") == True

def test_apply_textures(server):

test_register_mesh(server)

server.call(VtkMeshView.mesh_prefix + VtkMeshView.mesh_schemas_dict["apply_textures"]["rpc"], [{"id": "123456789", "textures": [{"texture_name": "lambert2SG", "texture_file_name": "hat_lambert2SG.vti"}]}])
assert server.compare_image(3, "mesh/apply_textures.jpeg") == True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L'image était déjà là ?



# def test_display_vertex_attribute(server):
# server.call(VtkMeshView.mesh_prefix + VtkMeshView.mesh_schemas_dict["register"]["rpc"], [{"id": "123456789", "file_name": "vertex_attribute.vtp"}])
Expand Down