-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeode_graph.py
More file actions
81 lines (58 loc) · 2.2 KB
/
Copy pathgeode_graph.py
File metadata and controls
81 lines (58 loc) · 2.2 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
# Standard library imports
from __future__ import annotations
# Third party imports
import opengeode as og
# Local application imports
from .types import GeodeMeshType, ViewerElementsType
from .geode_vertex_set import GeodeVertexSet
class GeodeGraph(GeodeVertexSet):
graph: og.Graph
def __init__(self, graph: og.Graph | None = None) -> None:
self.graph = graph if graph is not None else og.Graph.create()
super().__init__(self.graph)
@classmethod
def geode_object_type(cls) -> GeodeMeshType:
return "Graph"
@classmethod
def viewer_elements_type(cls) -> ViewerElementsType:
return "edges"
def native_extension(self) -> str:
return self.graph.native_extension()
@classmethod
def is_3D(cls) -> bool:
return False
@classmethod
def is_viewable(cls) -> bool:
return False
def builder(self) -> og.GraphBuilder:
return og.GraphBuilder.create(self.graph)
@classmethod
def load(cls, filename: str) -> GeodeGraph:
return GeodeGraph(og.load_graph(filename))
@classmethod
def additional_files(cls, filename: str) -> og.AdditionalFiles:
return og.graph_additional_files(filename)
@classmethod
def is_loadable(cls, filename: str) -> og.Percentage:
return og.is_graph_loadable(filename)
@classmethod
def input_extensions(cls) -> list[str]:
return og.GraphInputFactory.list_creators()
@classmethod
def output_extensions(cls) -> list[str]:
return og.GraphOutputFactory.list_creators()
@classmethod
def object_priority(cls, filename: str) -> int:
return og.graph_object_priority(filename)
def is_saveable(self, filename: str) -> bool:
return og.is_graph_saveable(self.graph, filename)
def save(self, filename: str) -> list[str]:
return og.save_graph(self.graph, filename)
def save_viewable(self, filename_without_extension: str) -> str:
return ""
def save_light_viewable(self, filename_without_extension: str) -> str:
return ""
def inspect(self) -> object:
return None
def edge_attribute_manager(self) -> og.AttributeManager:
return self.graph.edge_attribute_manager()