-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeode_section.py
More file actions
118 lines (89 loc) · 3.7 KB
/
geode_section.py
File metadata and controls
118 lines (89 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Standard library imports
from __future__ import annotations
# Third party imports
import opengeode as og
import opengeode_geosciences as og_geosciences
import opengeode_inspector as og_inspector
import geode_viewables as viewables
# Local application imports
from .types import GeodeModelType
from .geode_model import GeodeModel, ComponentRegistry
class GeodeSection(GeodeModel):
section: og.Section
def __init__(self, section: og.Section | None = None) -> None:
self.section = section if section is not None else og.Section()
super().__init__(self.section)
@classmethod
def geode_object_type(cls) -> GeodeModelType:
return "Section"
def native_extension(self) -> str:
return self.section.native_extension()
@classmethod
def is_3D(cls) -> bool:
return False
@classmethod
def is_viewable(cls) -> bool:
return True
def builder(self) -> og.SectionBuilder:
return og.SectionBuilder(self.section)
@classmethod
def load(cls, filename: str) -> GeodeSection:
return GeodeSection(og.load_section(filename))
@classmethod
def additional_files(cls, filename: str) -> og.AdditionalFiles:
return og.section_additional_files(filename)
@classmethod
def is_loadable(cls, filename: str) -> og.Percentage:
return og.is_section_loadable(filename)
@classmethod
def input_extensions(cls) -> list[str]:
return og.SectionInputFactory.list_creators()
@classmethod
def output_extensions(cls) -> list[str]:
return og.SectionOutputFactory.list_creators()
@classmethod
def object_priority(cls, filename: str) -> int:
return og.section_object_priority(filename)
def is_saveable(self, filename: str) -> bool:
return og.is_section_saveable(self.section, filename)
def save(self, filename: str) -> list[str]:
return og.save_section(self.section, filename)
def save_viewable(self, filename_without_extension: str) -> str:
return viewables.save_viewable_section(self.section, filename_without_extension)
def save_light_viewable(self, filename_without_extension: str) -> str:
return viewables.save_light_viewable_section(
self.section, filename_without_extension
)
def mesh_components(self) -> ComponentRegistry:
return self.section.mesh_components()
def collection_components(self) -> ComponentRegistry:
return self.section.collection_components()
def boundaries(self, id: og.uuid) -> list[og.ComponentID]:
return self.section.boundaries(id)
def internals(self, id: og.uuid) -> list[og.ComponentID]:
return self.section.internals(id)
def items(self, id: og.uuid) -> list[og.ComponentID]:
return self.section.items(id)
def inspect(self) -> og_inspector.SectionInspectionResult:
return og_inspector.inspect_section(self.section)
def assign_crs(
self, crs_name: str, info: og_geosciences.GeographicCoordinateSystemInfo
) -> None:
builder = self.builder()
og_geosciences.assign_section_geographic_coordinate_system_info(
self.section, builder, crs_name, info
)
def convert_crs(
self, crs_name: str, info: og_geosciences.GeographicCoordinateSystemInfo
) -> None:
builder = self.builder()
og_geosciences.convert_section_coordinate_reference_system(
self.section, builder, crs_name, info
)
def create_crs(
self, crs_name: str, input: og.CoordinateSystem2D, output: og.CoordinateSystem2D
) -> None:
builder = self.builder()
og.create_section_coordinate_system(
self.section, builder, crs_name, input, output
)