diff --git a/requirements.in b/requirements.in index 5846c313..eb6f0f33 100644 --- a/requirements.in +++ b/requirements.in @@ -1,9 +1,9 @@ -opengeode-core==16.2.0 +opengeode-core==16.3.1-rc.2 opengeode-io==7.4.9 opengeode-inspector==6.8.18 -opengeode-geosciences==9.5.10 +opengeode-geosciences==9.5.11 opengeode-geosciencesio==5.8.11 -geode-common==33.19.1 +geode-common==33.20.0 geode-viewables==3.3.5 flask[async]==3.1.2 flask-cors==6.0.1 diff --git a/requirements.txt b/requirements.txt index e18b73d9..eaaae7c8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,7 @@ flask[async]>=3 # flask-cors flask-cors==6.0.1 # via -r requirements.in -geode-common==33.19.1 +geode-common==33.20.0 # via # -r requirements.in # geode-viewables @@ -31,7 +31,7 @@ markupsafe>=3 # flask # jinja2 # werkzeug -opengeode-core==16.2.0 +opengeode-core==16.3.1rc2 # via # -r requirements.in # geode-common @@ -40,7 +40,7 @@ opengeode-core==16.2.0 # opengeode-geosciencesio # opengeode-inspector # opengeode-io -opengeode-geosciences==9.5.10 +opengeode-geosciences==9.5.11 # via # -r requirements.in # geode-viewables diff --git a/src/opengeodeweb_back/geode_objects/geode_brep.py b/src/opengeodeweb_back/geode_objects/geode_brep.py index fc9faa70..98b2b481 100644 --- a/src/opengeodeweb_back/geode_objects/geode_brep.py +++ b/src/opengeodeweb_back/geode_objects/geode_brep.py @@ -88,8 +88,8 @@ def internals(self, id: og.uuid) -> list[og.ComponentID]: def items(self, id: og.uuid) -> list[og.ComponentID]: return self.brep.items(id) - def component_name(self, id: og.uuid) -> str | None: - return self.brep.brep_component(id).name() + def component(self, id: og.uuid) -> og.Component3D: + return self.brep.brep_component(id) def inspect(self) -> og_inspector.BRepInspectionResult: return og_inspector.inspect_brep(self.brep) diff --git a/src/opengeodeweb_back/geode_objects/geode_model.py b/src/opengeodeweb_back/geode_objects/geode_model.py index 5baca669..3aafd671 100644 --- a/src/opengeodeweb_back/geode_objects/geode_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_model.py @@ -1,6 +1,7 @@ # Standard library imports from __future__ import annotations from abc import abstractmethod +from typing import Union # Third party imports import opengeode as og @@ -37,4 +38,4 @@ def internals(self, id: og.uuid) -> list[og.ComponentID]: ... def items(self, id: og.uuid) -> list[og.ComponentID]: ... @abstractmethod - def component_name(self, id: og.uuid) -> str | None: ... + def component(self, id: og.uuid) -> og.Component2D | og.Component3D: ... diff --git a/src/opengeodeweb_back/geode_objects/geode_section.py b/src/opengeodeweb_back/geode_objects/geode_section.py index a2f26b78..d8155395 100644 --- a/src/opengeodeweb_back/geode_objects/geode_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_section.py @@ -90,8 +90,8 @@ def internals(self, id: og.uuid) -> list[og.ComponentID]: def items(self, id: og.uuid) -> list[og.ComponentID]: return self.section.items(id) - def component_name(self, id: og.uuid) -> str | None: - return self.section.section_component(id).name() + def component(self, id: og.uuid) -> og.Component2D: + return self.section.section_component(id) def inspect(self) -> og_inspector.SectionInspectionResult: return og_inspector.inspect_section(self.section) diff --git a/src/opengeodeweb_back/utils_functions.py b/src/opengeodeweb_back/utils_functions.py index bf11ad11..6df55ca3 100644 --- a/src/opengeodeweb_back/utils_functions.py +++ b/src/opengeodeweb_back/utils_functions.py @@ -213,8 +213,9 @@ def model_components( for mesh_component, ids in model_mesh_components.items(): component_type = mesh_component.get() for id in ids: + component = model.component(id) geode_id = id.string() - component_name = model.component_name(id) + component_name = component.name() if not component_name: component_name = geode_id viewer_id = uuid_to_flat_index[geode_id] @@ -229,6 +230,7 @@ def model_components( "type": component_type, "boundaries": boundaries_uuid, "internals": internals_uuid, + "is_active": component.is_active(), } mesh_components.append(mesh_component_object) @@ -237,8 +239,9 @@ def model_components( for collection_component, ids in model_collection_components.items(): component_type = collection_component.get() for id in ids: + component = model.component(id) geode_id = id.string() - component_name = model.component_name(id) + component_name = component.name() if not component_name: component_name = geode_id items = model.items(id) @@ -248,6 +251,7 @@ def model_components( "name": component_name, "type": component_type, "items": items_uuid, + "is_active": component.is_active(), } collection_components.append(collection_component_object) return { diff --git a/tests/test_routes.py b/tests/test_routes.py index 215afd13..530b298a 100644 --- a/tests/test_routes.py +++ b/tests/test_routes.py @@ -431,33 +431,26 @@ def get_full_data() -> test_utils.JsonData: def test_model_components(client: FlaskClient) -> None: geode_object_type = "BRep" - filename = "LS2.og_brep" + filename = "cube.og_brep" response = test_save_viewable_file(client, geode_object_type, filename) assert response.status_code == 200 assert "mesh_components" in response.get_json() mesh_components = response.get_json()["mesh_components"] assert isinstance(mesh_components, list) assert len(mesh_components) > 0 - name_is_uuid = False - name_is_not_uuid = False for mesh_component in mesh_components: assert isinstance(mesh_component, object) assert isinstance(mesh_component["geode_id"], str) assert isinstance(mesh_component["viewer_id"], int) assert isinstance(mesh_component["name"], str) assert isinstance(mesh_component["type"], str) - if mesh_component["name"] == mesh_component["geode_id"]: - name_is_uuid = True - else: - name_is_not_uuid = True assert isinstance(mesh_component["boundaries"], list) for boundary_uuid in mesh_component["boundaries"]: assert isinstance(boundary_uuid, str) assert isinstance(mesh_component["internals"], list) for internal_uuid in mesh_component["internals"]: assert isinstance(internal_uuid, str) - assert name_is_uuid is True - assert name_is_not_uuid is True + assert isinstance(mesh_component["is_active"], bool) assert "collection_components" in response.get_json() collection_components = response.get_json()["collection_components"] assert isinstance(collection_components, list) @@ -468,6 +461,7 @@ def test_model_components(client: FlaskClient) -> None: assert isinstance(collection_component["items"], list) for item_uuid in collection_component["items"]: assert isinstance(item_uuid, str) + assert isinstance(collection_component["is_active"], bool) def test_export_project_route(client: FlaskClient, tmp_path: Path) -> None: