Skip to content

Commit 831f7f7

Browse files
committed
wip
1 parent ad1479d commit 831f7f7

16 files changed

+1084
-243
lines changed

src/opengeodeweb_back/geode_objects/__init__.py

Lines changed: 0 additions & 237 deletions
Large diffs are not rendered by default.

src/opengeodeweb_back/geode_objects/geode_brep.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
# Third party imports
55
import opengeode as og
6+
import opengeode_geosciences as og_geosciences
67
import opengeode_inspector as og_inspector
78
import geode_viewables as viewables
89

910
# Local application imports
10-
from .types import GeodeModelType, ViewerType
11+
from .types import GeodeModelType
1112
from .geode_model import GeodeModel, ComponentRegistry
1213

1314

@@ -77,3 +78,25 @@ def mesh_components(self) -> ComponentRegistry:
7778

7879
def inspect(self) -> og_inspector.BRepInspectionResult:
7980
return og_inspector.inspect_brep(self.brep)
81+
82+
# def assign_crs(
83+
# self, crs_name: str, info: og_geosciences.GeographicCoordinateSystemInfo3D
84+
# ) -> None:
85+
# builder = self.builder()
86+
# og_geosciences.assign_brep_geographic_coordinate_system_info(
87+
# self.brep, builder, crs_name, info
88+
# )
89+
90+
# def convert_crs(
91+
# self, crs_name: str, info: og_geosciences.GeographicCoordinateSystemInfo3D
92+
# ) -> None:
93+
# builder = self.builder()
94+
# og_geosciences.convert_brep_coordinate_reference_system(
95+
# self.brep, builder, crs_name, info
96+
# )
97+
98+
# def create_crs(
99+
# self, crs_name: str, input: og.CoordinateSystem2D, output: og.CoordinateSystem2D
100+
# ) -> None:
101+
# builder = self.builder()
102+
# og.create_brep_coordinate_system(self.brep, builder, crs_name, input, output)
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Standard library imports
2+
from __future__ import annotations
3+
4+
# Third party imports
5+
import opengeode as og
6+
import opengeode_geosciences as og_geosciences
7+
import geode_viewables as viewables
8+
9+
# Local application imports
10+
from .types import GeodeModelType
11+
from .geode_section import GeodeSection
12+
13+
14+
class GeodeCrossSection(GeodeSection):
15+
cross_section: og_geosciences.CrossSection
16+
17+
def __init__(
18+
self, cross_section: og_geosciences.CrossSection | None = None
19+
) -> None:
20+
self.cross_section = (
21+
cross_section
22+
if cross_section is not None
23+
else og_geosciences.CrossSection()
24+
)
25+
super().__init__(self.cross_section)
26+
27+
@classmethod
28+
def geode_model_type(cls) -> GeodeModelType:
29+
return "CrossSection"
30+
31+
def native_extension(self) -> str:
32+
return self.cross_section.native_extension()
33+
34+
def builder(self) -> og_geosciences.CrossSectionBuilder:
35+
return og_geosciences.CrossSectionBuilder(self.cross_section)
36+
37+
@classmethod
38+
def load_model(cls, filename: str) -> GeodeCrossSection:
39+
return GeodeCrossSection(og_geosciences.load_cross_section(filename))
40+
41+
@classmethod
42+
def additional_files(cls, filename: str) -> og.AdditionalFiles:
43+
return og_geosciences.cross_section_additional_files(filename)
44+
45+
@classmethod
46+
def is_loadable(cls, filename: str) -> og.Percentage:
47+
return og_geosciences.is_cross_section_loadable(filename)
48+
49+
@classmethod
50+
def input_extensions(cls) -> list[str]:
51+
return og_geosciences.CrossSectionInputFactory.list_creators()
52+
53+
@classmethod
54+
def output_extensions(cls) -> list[str]:
55+
return og_geosciences.CrossSectionOutputFactory.list_creators()
56+
57+
@classmethod
58+
def object_priority(cls, filename: str) -> int:
59+
return og_geosciences.cross_section_object_priority(filename)
60+
61+
def is_saveable(self, filename: str) -> bool:
62+
return og_geosciences.is_cross_section_saveable(self.cross_section, filename)
63+
64+
def save(self, filename: str) -> list[str]:
65+
return og_geosciences.save_cross_section(self.cross_section, filename)
66+
67+
def save_viewable(self, filename_without_extension: str) -> str:
68+
return viewables.save_viewable_cross_section(
69+
self.cross_section, filename_without_extension
70+
)
71+
72+
def save_light_viewable(self, filename_without_extension: str) -> str:
73+
return viewables.save_light_viewable_cross_section(
74+
self.cross_section, filename_without_extension
75+
)
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Standard library imports
2+
from __future__ import annotations
3+
4+
# Third party imports
5+
import opengeode as og
6+
import opengeode_inspector as og_inspector
7+
import geode_viewables as viewables
8+
9+
# Local application imports
10+
from .types import GeodeMeshType
11+
from .geode_graph import GeodeGraph
12+
13+
14+
class GeodeEdgedCurve2D(GeodeGraph):
15+
edged_curve: og.EdgedCurve2D
16+
17+
def __init__(self, edged_curve: og.EdgedCurve2D | None = None) -> None:
18+
self.edged_curve = edged_curve if edged_curve is not None else og.EdgedCurve2D()
19+
super().__init__(self.edged_curve)
20+
21+
@classmethod
22+
def geode_mesh_type(cls) -> GeodeMeshType:
23+
return "EdgedCurve2D"
24+
25+
def native_extension(self) -> str:
26+
return self.edged_curve.native_extension()
27+
28+
@classmethod
29+
def is_3D(cls) -> bool:
30+
return False
31+
32+
@classmethod
33+
def is_viewable(cls) -> bool:
34+
return False
35+
36+
def builder(self) -> og.EdgedCurveBuilder2D:
37+
return og.EdgedCurveBuilder2D(self.edged_curve)
38+
39+
@classmethod
40+
def load_mesh(cls, filename: str) -> GeodeEdgedCurve2D:
41+
return GeodeEdgedCurve2D(og.load_edged_curve2D(filename))
42+
43+
@classmethod
44+
def additional_files(cls, filename: str) -> og.AdditionalFiles:
45+
return og.edged_curve_additional_files2D(filename)
46+
47+
@classmethod
48+
def is_loadable(cls, filename: str) -> og.Percentage:
49+
return og.is_edged_curve_loadable2D(filename)
50+
51+
@classmethod
52+
def input_extensions(cls) -> list[str]:
53+
return og.EdgedCurveInputFactory2D.list_creators()
54+
55+
@classmethod
56+
def output_extensions(cls) -> list[str]:
57+
return og.EdgedCurveOutputFactory2D.list_creators()
58+
59+
@classmethod
60+
def object_priority(cls, filename: str) -> int:
61+
return og.edged_curve_object_priority2D(filename)
62+
63+
def is_saveable(self, filename: str) -> bool:
64+
return og.is_edged_curve_saveable2D(self.edged_curve, filename)
65+
66+
def save(self, filename: str) -> list[str]:
67+
return og.save_edged_curve2D(self.edged_curve, filename)
68+
69+
def save_viewable(self, filename_without_extension: str) -> str:
70+
return viewables.save_viewable_edged_curve2D(
71+
self.edged_curve, filename_without_extension
72+
)
73+
74+
def save_light_viewable(self, filename_without_extension: str) -> str:
75+
return viewables.save_light_viewable_edged_curve2D(
76+
self.edged_curve, filename_without_extension
77+
)
78+
79+
def inspect(self) -> og_inspector.EdgedCurveInspectionResult:
80+
return og_inspector.inspect_edged_curve2D(self.edged_curve)
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Standard library imports
2+
from __future__ import annotations
3+
4+
# Third party imports
5+
import opengeode as og
6+
import opengeode_inspector as og_inspector
7+
import geode_viewables as viewables
8+
9+
# Local application imports
10+
from .types import GeodeMeshType
11+
from .geode_graph import GeodeGraph
12+
13+
14+
class GeodeEdgedCurve3D(GeodeGraph):
15+
edged_curve: og.EdgedCurve3D
16+
17+
def __init__(self, edged_curve: og.EdgedCurve3D | None = None) -> None:
18+
self.edged_curve = edged_curve if edged_curve is not None else og.EdgedCurve3D()
19+
super().__init__(self.edged_curve)
20+
21+
@classmethod
22+
def geode_mesh_type(cls) -> GeodeMeshType:
23+
return "EdgedCurve3D"
24+
25+
def native_extension(self) -> str:
26+
return self.edged_curve.native_extension()
27+
28+
@classmethod
29+
def is_3D(cls) -> bool:
30+
return False
31+
32+
@classmethod
33+
def is_viewable(cls) -> bool:
34+
return False
35+
36+
def builder(self) -> og.EdgedCurveBuilder3D:
37+
return og.EdgedCurveBuilder3D(self.edged_curve)
38+
39+
@classmethod
40+
def load_mesh(cls, filename: str) -> GeodeEdgedCurve3D:
41+
return GeodeEdgedCurve3D(og.load_edged_curve3D(filename))
42+
43+
@classmethod
44+
def additional_files(cls, filename: str) -> og.AdditionalFiles:
45+
return og.edged_curve_additional_files3D(filename)
46+
47+
@classmethod
48+
def is_loadable(cls, filename: str) -> og.Percentage:
49+
return og.is_edged_curve_loadable3D(filename)
50+
51+
@classmethod
52+
def input_extensions(cls) -> list[str]:
53+
return og.EdgedCurveInputFactory3D.list_creators()
54+
55+
@classmethod
56+
def output_extensions(cls) -> list[str]:
57+
return og.EdgedCurveOutputFactory3D.list_creators()
58+
59+
@classmethod
60+
def object_priority(cls, filename: str) -> int:
61+
return og.edged_curve_object_priority3D(filename)
62+
63+
def is_saveable(self, filename: str) -> bool:
64+
return og.is_edged_curve_saveable3D(self.edged_curve, filename)
65+
66+
def save(self, filename: str) -> list[str]:
67+
return og.save_edged_curve3D(self.edged_curve, filename)
68+
69+
def save_viewable(self, filename_without_extension: str) -> str:
70+
return viewables.save_viewable_edged_curve3D(
71+
self.edged_curve, filename_without_extension
72+
)
73+
74+
def save_light_viewable(self, filename_without_extension: str) -> str:
75+
return viewables.save_light_viewable_edged_curve3D(
76+
self.edged_curve, filename_without_extension
77+
)
78+
79+
def inspect(self) -> og_inspector.EdgedCurveInspectionResult:
80+
return og_inspector.inspect_edged_curve3D(self.edged_curve)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Standard library imports
2+
from __future__ import annotations
3+
4+
# Third party imports
5+
import opengeode as og
6+
import opengeode_inspector as og_inspector
7+
import geode_viewables as viewables
8+
9+
# Local application imports
10+
from .types import GeodeMeshType
11+
from .geode_vertex_set import GeodeVertexSet
12+
13+
14+
class GeodeGraph(GeodeVertexSet):
15+
graph: og.Graph
16+
17+
def __init__(self, graph: og.Graph | None = None) -> None:
18+
self.graph = graph if graph is not None else og.Graph()
19+
super().__init__(self.graph)
20+
21+
@classmethod
22+
def geode_mesh_type(cls) -> GeodeMeshType:
23+
return "Graph"
24+
25+
def native_extension(self) -> str:
26+
return self.graph.native_extension()
27+
28+
@classmethod
29+
def is_3D(cls) -> bool:
30+
return False
31+
32+
@classmethod
33+
def is_viewable(cls) -> bool:
34+
return False
35+
36+
def builder(self) -> og.GraphBuilder:
37+
return og.GraphBuilder(self.graph)
38+
39+
@classmethod
40+
def load_mesh(cls, filename: str) -> GeodeGraph:
41+
return GeodeGraph(og.load_graph(filename))
42+
43+
@classmethod
44+
def additional_files(cls, filename: str) -> og.AdditionalFiles:
45+
return og.graph_additional_files(filename)
46+
47+
@classmethod
48+
def is_loadable(cls, filename: str) -> og.Percentage:
49+
return og.is_graph_loadable(filename)
50+
51+
@classmethod
52+
def input_extensions(cls) -> list[str]:
53+
return og.GraphInputFactory.list_creators()
54+
55+
@classmethod
56+
def output_extensions(cls) -> list[str]:
57+
return og.GraphOutputFactory.list_creators()
58+
59+
@classmethod
60+
def object_priority(cls, filename: str) -> int:
61+
return og.graph_object_priority(filename)
62+
63+
def is_saveable(self, filename: str) -> bool:
64+
return og.is_graph_saveable(self.graph, filename)
65+
66+
def save(self, filename: str) -> list[str]:
67+
return og.save_graph(self.graph, filename)
68+
69+
def save_viewable(self, filename_without_extension: str) -> str:
70+
return ""
71+
72+
def save_light_viewable(self, filename_without_extension: str) -> str:
73+
return ""
74+
75+
def inspect(self) -> object:
76+
return None

0 commit comments

Comments
 (0)