|
| 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) |
0 commit comments