Skip to content
Open
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
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
opengeode-core==16.3.0
opengeode-core==16.3.1
opengeode-io==7.4.9
opengeode-inspector==6.8.18
opengeode-geosciences==9.5.11
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ markupsafe>=3
# flask
# jinja2
# werkzeug
opengeode-core==16.3.0
opengeode-core==16.3.1
# via
# -r requirements.in
# geode-common
Expand Down Expand Up @@ -60,4 +60,3 @@ werkzeug==3.1.2
# flask
# flask-cors

opengeodeweb-microservice==1.*,>=1.1.1
4 changes: 2 additions & 2 deletions src/opengeodeweb_back/geode_objects/geode_brep.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/opengeodeweb_back/geode_objects/geode_model.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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: ...
4 changes: 2 additions & 2 deletions src/opengeodeweb_back/geode_objects/geode_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions src/opengeodeweb_back/utils_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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)

Expand All @@ -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)
Expand All @@ -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 {
Expand Down
12 changes: 3 additions & 9 deletions tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
Loading