mirror of https://gitlab.com/pamhyr/pamhyr2
76 lines
1.7 KiB
Python
76 lines
1.7 KiB
Python
# -*- 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
|
|
|
|
from Model.BoundaryCondition.BoundaryCondition import (
|
|
BoundaryCondition
|
|
)
|
|
from Model.BoundaryCondition.BoundaryConditionList import (
|
|
BoundaryConditionList
|
|
)
|
|
|
|
|
|
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
|
|
self._boundary_condition = BoundaryConditionList()
|
|
|
|
@property
|
|
def boundary_condition(self):
|
|
return self._boundary_condition.copy()
|
|
|
|
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
|