diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fe4aeb..767b0a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,25 @@ # CHANGELOG +## v1.4.0-rc.2 (2025-03-07) + +### Bug Fixes + +- **schemas**: All "string" => "minLength": 1 + ([`279b716`](https://github.com/Geode-solutions/OpenGeodeWeb-Viewer/commit/279b716d6b4b592f046b6417ad868cc8feb08d0f)) + +- **typo**: Elements => items + ([`9241680`](https://github.com/Geode-solutions/OpenGeodeWeb-Viewer/commit/9241680ebb1e2cb8189fc5503d1ba1462b2be749)) + + +## v1.4.0-rc.1 (2025-02-26) + +### Features + +- **meshes**: Export texture rpc & tests + ([`f65b061`](https://github.com/Geode-solutions/OpenGeodeWeb-Viewer/commit/f65b061eca647458d3333a1a07730857d815daf2)) + + ## v1.3.1 (2025-02-19) diff --git a/pyproject.toml b/pyproject.toml index 40da9f6..9b88a12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "OpenGeodeWeb-Viewer" -version = "1.3.1" +version = "1.4.0-rc.2" dynamic = ["dependencies"] authors = [ { name="Geode-solutions", email="team-web@geode-solutions.com" }, diff --git a/src/opengeodeweb_viewer/rpc/generic/schemas/deregister.json b/src/opengeodeweb_viewer/rpc/generic/schemas/deregister.json index 61715c4..70c1ba0 100644 --- a/src/opengeodeweb_viewer/rpc/generic/schemas/deregister.json +++ b/src/opengeodeweb_viewer/rpc/generic/schemas/deregister.json @@ -4,10 +4,15 @@ "properties": { "viewer_object": { "type": "string", - "enum": ["mesh", "model"] + "minLength": 1, + "enum": [ + "mesh", + "model" + ] }, "id": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/generic/schemas/register.json b/src/opengeodeweb_viewer/rpc/generic/schemas/register.json index 93a5ac2..26187d9 100644 --- a/src/opengeodeweb_viewer/rpc/generic/schemas/register.json +++ b/src/opengeodeweb_viewer/rpc/generic/schemas/register.json @@ -4,13 +4,19 @@ "properties": { "viewer_object": { "type": "string", - "enum": ["mesh", "model"] + "minLength": 1, + "enum": [ + "mesh", + "model" + ] }, "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "file_name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/color.json b/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/color.json index 720d50b..b1c5e72 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/color.json +++ b/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/color.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "color": { "type": "object", diff --git a/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/size.json b/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/size.json index d403c33..47eefd0 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/size.json +++ b/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/size.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "size": { "type": "integer" diff --git a/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/vertex_attribute.json b/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/vertex_attribute.json index 05368b8..9eb5de6 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/vertex_attribute.json +++ b/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/vertex_attribute.json @@ -3,10 +3,12 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/visibility.json b/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/visibility.json index 4b2368d..e699d92 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/visibility.json +++ b/src/opengeodeweb_viewer/rpc/mesh/edges/schemas/visibility.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "visibility": { "type": "boolean" diff --git a/src/opengeodeweb_viewer/rpc/mesh/mesh_protocols.py b/src/opengeodeweb_viewer/rpc/mesh/mesh_protocols.py index 696dc99..585d779 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/mesh_protocols.py +++ b/src/opengeodeweb_viewer/rpc/mesh/mesh_protocols.py @@ -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() diff --git a/src/opengeodeweb_viewer/rpc/mesh/points/schemas/color.json b/src/opengeodeweb_viewer/rpc/mesh/points/schemas/color.json index 720d50b..b1c5e72 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/points/schemas/color.json +++ b/src/opengeodeweb_viewer/rpc/mesh/points/schemas/color.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "color": { "type": "object", diff --git a/src/opengeodeweb_viewer/rpc/mesh/points/schemas/size.json b/src/opengeodeweb_viewer/rpc/mesh/points/schemas/size.json index b699204..75a8889 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/points/schemas/size.json +++ b/src/opengeodeweb_viewer/rpc/mesh/points/schemas/size.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "size": { "type": "number" diff --git a/src/opengeodeweb_viewer/rpc/mesh/points/schemas/vertex_attribute.json b/src/opengeodeweb_viewer/rpc/mesh/points/schemas/vertex_attribute.json index 05368b8..9eb5de6 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/points/schemas/vertex_attribute.json +++ b/src/opengeodeweb_viewer/rpc/mesh/points/schemas/vertex_attribute.json @@ -3,10 +3,12 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/points/schemas/visibility.json b/src/opengeodeweb_viewer/rpc/mesh/points/schemas/visibility.json index 4b2368d..e699d92 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/points/schemas/visibility.json +++ b/src/opengeodeweb_viewer/rpc/mesh/points/schemas/visibility.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "visibility": { "type": "boolean" diff --git a/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/color.json b/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/color.json index 720d50b..b1c5e72 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/color.json +++ b/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/color.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "color": { "type": "object", diff --git a/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/polygon_attribute.json b/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/polygon_attribute.json index cb6c23a..e301d6a 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/polygon_attribute.json +++ b/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/polygon_attribute.json @@ -3,10 +3,12 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/vertex_attribute.json b/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/vertex_attribute.json index 05368b8..9eb5de6 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/vertex_attribute.json +++ b/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/vertex_attribute.json @@ -3,10 +3,12 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/visibility.json b/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/visibility.json index 4b2368d..e699d92 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/visibility.json +++ b/src/opengeodeweb_viewer/rpc/mesh/polygons/schemas/visibility.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "visibility": { "type": "boolean" diff --git a/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/color.json b/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/color.json index 720d50b..b1c5e72 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/color.json +++ b/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/color.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "color": { "type": "object", diff --git a/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/polyhedron_attribute.json b/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/polyhedron_attribute.json index 6d3a1dd..6ee61a6 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/polyhedron_attribute.json +++ b/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/polyhedron_attribute.json @@ -3,10 +3,12 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/vertex_attribute.json b/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/vertex_attribute.json index 05368b8..9eb5de6 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/vertex_attribute.json +++ b/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/vertex_attribute.json @@ -3,10 +3,12 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/visibility.json b/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/visibility.json index 4b2368d..e699d92 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/visibility.json +++ b/src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/visibility.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "visibility": { "type": "boolean" diff --git a/src/opengeodeweb_viewer/rpc/mesh/schemas/apply_textures.json b/src/opengeodeweb_viewer/rpc/mesh/schemas/apply_textures.json index e7fd44f..311384e 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/schemas/apply_textures.json +++ b/src/opengeodeweb_viewer/rpc/mesh/schemas/apply_textures.json @@ -3,18 +3,21 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "textures": { "type": "array", - "elements": { + "items": { "type": "object", "properties": { "texture_name": { - "type": "string" + "type": "string", + "minLength": 1 }, "texture_file_name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/schemas/color.json b/src/opengeodeweb_viewer/rpc/mesh/schemas/color.json index 35a5200..14b0386 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/schemas/color.json +++ b/src/opengeodeweb_viewer/rpc/mesh/schemas/color.json @@ -3,10 +3,11 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "color": { - "type": "object", + "type": "object", "properties": { "r": { "type": "integer", diff --git a/src/opengeodeweb_viewer/rpc/mesh/schemas/deregister.json b/src/opengeodeweb_viewer/rpc/mesh/schemas/deregister.json index f87e93b..55b60b5 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/schemas/deregister.json +++ b/src/opengeodeweb_viewer/rpc/mesh/schemas/deregister.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/schemas/opacity.json b/src/opengeodeweb_viewer/rpc/mesh/schemas/opacity.json index 86eff6d..b9b3c54 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/schemas/opacity.json +++ b/src/opengeodeweb_viewer/rpc/mesh/schemas/opacity.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "opacity": { "type": "number", diff --git a/src/opengeodeweb_viewer/rpc/mesh/schemas/register.json b/src/opengeodeweb_viewer/rpc/mesh/schemas/register.json index 593d2b2..371e658 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/schemas/register.json +++ b/src/opengeodeweb_viewer/rpc/mesh/schemas/register.json @@ -3,10 +3,12 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "file_name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/mesh/schemas/visibility.json b/src/opengeodeweb_viewer/rpc/mesh/schemas/visibility.json index 4b2368d..e699d92 100644 --- a/src/opengeodeweb_viewer/rpc/mesh/schemas/visibility.json +++ b/src/opengeodeweb_viewer/rpc/mesh/schemas/visibility.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "visibility": { "type": "boolean" diff --git a/src/opengeodeweb_viewer/rpc/model/schemas/apply_textures.json b/src/opengeodeweb_viewer/rpc/model/schemas/apply_textures.json index e7fd44f..311384e 100644 --- a/src/opengeodeweb_viewer/rpc/model/schemas/apply_textures.json +++ b/src/opengeodeweb_viewer/rpc/model/schemas/apply_textures.json @@ -3,18 +3,21 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "textures": { "type": "array", - "elements": { + "items": { "type": "object", "properties": { "texture_name": { - "type": "string" + "type": "string", + "minLength": 1 }, "texture_file_name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/model/schemas/deregister.json b/src/opengeodeweb_viewer/rpc/model/schemas/deregister.json index f87e93b..55b60b5 100644 --- a/src/opengeodeweb_viewer/rpc/model/schemas/deregister.json +++ b/src/opengeodeweb_viewer/rpc/model/schemas/deregister.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/model/schemas/register.json b/src/opengeodeweb_viewer/rpc/model/schemas/register.json index 593d2b2..371e658 100644 --- a/src/opengeodeweb_viewer/rpc/model/schemas/register.json +++ b/src/opengeodeweb_viewer/rpc/model/schemas/register.json @@ -3,10 +3,12 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "file_name": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/opengeodeweb_viewer/rpc/model/schemas/set_components_color.json b/src/opengeodeweb_viewer/rpc/model/schemas/set_components_color.json index aabecc8..3199667 100644 --- a/src/opengeodeweb_viewer/rpc/model/schemas/set_components_color.json +++ b/src/opengeodeweb_viewer/rpc/model/schemas/set_components_color.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "color": { "type": "object", diff --git a/src/opengeodeweb_viewer/rpc/model/schemas/set_components_visibility.json b/src/opengeodeweb_viewer/rpc/model/schemas/set_components_visibility.json index 3f1e7ac..f574a03 100644 --- a/src/opengeodeweb_viewer/rpc/model/schemas/set_components_visibility.json +++ b/src/opengeodeweb_viewer/rpc/model/schemas/set_components_visibility.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "visibility": { "type": "boolean" diff --git a/src/opengeodeweb_viewer/rpc/model/schemas/set_corners_size.json b/src/opengeodeweb_viewer/rpc/model/schemas/set_corners_size.json index 7ae8809..8a286da 100644 --- a/src/opengeodeweb_viewer/rpc/model/schemas/set_corners_size.json +++ b/src/opengeodeweb_viewer/rpc/model/schemas/set_corners_size.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "size": { "type": "integer" diff --git a/src/opengeodeweb_viewer/rpc/model/schemas/set_mesh_visibility.json b/src/opengeodeweb_viewer/rpc/model/schemas/set_mesh_visibility.json index bb09ac8..68daba1 100644 --- a/src/opengeodeweb_viewer/rpc/model/schemas/set_mesh_visibility.json +++ b/src/opengeodeweb_viewer/rpc/model/schemas/set_mesh_visibility.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 }, "visibility": { "type": "boolean" diff --git a/src/opengeodeweb_viewer/rpc/viewer/schemas/picked_ids.json b/src/opengeodeweb_viewer/rpc/viewer/schemas/picked_ids.json index 7073303..699ce50 100644 --- a/src/opengeodeweb_viewer/rpc/viewer/schemas/picked_ids.json +++ b/src/opengeodeweb_viewer/rpc/viewer/schemas/picked_ids.json @@ -11,7 +11,8 @@ "ids": { "type": "array", "items": { - "type": "string" + "type": "string", + "minLength": 1 } } }, diff --git a/src/opengeodeweb_viewer/rpc/viewer/schemas/take_screenshot.json b/src/opengeodeweb_viewer/rpc/viewer/schemas/take_screenshot.json index f292770..2ae868e 100644 --- a/src/opengeodeweb_viewer/rpc/viewer/schemas/take_screenshot.json +++ b/src/opengeodeweb_viewer/rpc/viewer/schemas/take_screenshot.json @@ -3,10 +3,12 @@ "type": "object", "properties": { "filename": { - "type": "string" + "type": "string", + "minLength": 1 }, "output_extension": { "type": "string", + "minLength": 1, "enum": [ "png", "jpg" diff --git a/src/opengeodeweb_viewer/rpc/viewer/schemas/update_data.json b/src/opengeodeweb_viewer/rpc/viewer/schemas/update_data.json index 0efef11..ffccf4b 100644 --- a/src/opengeodeweb_viewer/rpc/viewer/schemas/update_data.json +++ b/src/opengeodeweb_viewer/rpc/viewer/schemas/update_data.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/src/tests/test_mesh_protocols.py b/src/tests/test_mesh_protocols.py index 40064f1..18c9cfc 100644 --- a/src/tests/test_mesh_protocols.py +++ b/src/tests/test_mesh_protocols.py @@ -21,7 +21,6 @@ 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) @@ -29,6 +28,13 @@ def test_color(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 + # def test_display_vertex_attribute(server): # server.call(VtkMeshView.mesh_prefix + VtkMeshView.mesh_schemas_dict["register"]["rpc"], [{"id": "123456789", "file_name": "vertex_attribute.vtp"}])