An error occurred while loading the file. Please try again.
-
Pierre-Antoine Rouby authored8782056b
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
# -*- coding: utf-8 -*-
from Model.Network.Node import Node
from Model.Network.Edge import Edge
from Model.Network.Graph import Graph
from Model.Geometry.Profile import Profile
from Model.Geometry.Reach import Reach
class RiverNode(Node):
def __init__(self, id:str, name:str,
x:float, y:float):
super(RiverNode, self).__init__(
id, name,
x, y
)
self._locker = None
@property
def locker(self):
return self._locker
@locker.setter
def locker(self, locker):
self._locker = locker
class RiverReach(Edge):
def __init__(self, id:str, name:str,
node1:RiverNode = None,
node2:RiverNode = None):
super(RiverReach, self).__init__(
id, name,
node1, node2
)
self._reach = Reach(self)
@property
def reach(self):
return self._reach
class River(Graph):
def __init__(self):
super(River, self).__init__()
# Replace Node and Edge ctor by custom ctor
self._node_ctor = RiverNode
self._edge_ctor = RiverReach
self._current_reach = None
def has_current_reach(self):
return self._current_reach is not None
def current_reach(self):
return self._current_reach
def set_current_reach(self, reach):
self._current_reach = reach