first commit
This commit is contained in:
47
helix/models/dxf/graph_direction.py
Normal file
47
helix/models/dxf/graph_direction.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class GraphDirection(Enum):
|
||||
North = (0, 1)
|
||||
NorthEast = (1, 1)
|
||||
East = (1, 0)
|
||||
SouthEast = (1, -1)
|
||||
South = (0, -1)
|
||||
SouthWest = (-1, -1)
|
||||
West = (-1, 0)
|
||||
NorthWest = (-1, 1)
|
||||
|
||||
@classmethod
|
||||
def values(cls):
|
||||
return [
|
||||
cls.North.value,
|
||||
cls.NorthEast.value,
|
||||
cls.East.value,
|
||||
cls.SouthEast.value,
|
||||
cls.South.value,
|
||||
cls.SouthWest.value,
|
||||
cls.West.value,
|
||||
cls.NorthWest.value
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def ordinal_directions(cls):
|
||||
return [
|
||||
cls.North,
|
||||
cls.East,
|
||||
cls.South,
|
||||
cls.West
|
||||
]
|
||||
|
||||
def opposite_direction(self):
|
||||
return {
|
||||
GraphDirection.North: GraphDirection.South,
|
||||
GraphDirection.NorthEast: GraphDirection.SouthWest,
|
||||
GraphDirection.East: GraphDirection.West,
|
||||
GraphDirection.SouthEast: GraphDirection.NorthWest,
|
||||
GraphDirection.South: GraphDirection.North,
|
||||
GraphDirection.SouthWest: GraphDirection.NorthEast,
|
||||
GraphDirection.West: GraphDirection.East,
|
||||
GraphDirection.NorthWest: GraphDirection.SouthEast
|
||||
}[self]
|
||||
|
||||
Reference in New Issue
Block a user