Pamhyr2/src/Model/River.py

92 lines
2.4 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.BoundaryConditionList import BoundaryConditionList
from Model.LateralContribution.LateralContributionList import LateralContributionList
from Model.Stricklers.StricklersList import StricklersList
from Model.Section.SectionList import SectionList
class RiverNode(Node):
def __init__(self, id:str, name:str,
x:float, y:float,
status = None):
super(RiverNode, self).__init__(
id, name,
x, y,
status = status
)
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,
status = None):
super(RiverReach, self).__init__(
id, name,
node1, node2,
status = status
)
self._reach = Reach(status=self._status, parent=self)
@property
def reach(self):
return self._reach
class River(Graph):
def __init__(self, status=None):
super(River, self).__init__(status=status)
# Replace Node and Edge ctor by custom ctor
self._node_ctor = RiverNode
self._edge_ctor = RiverReach
self._current_reach = None
self._boundary_condition = BoundaryConditionList(status=self._status)
self._lateral_contribution = LateralContributionList(status=self._status)
self._stricklers = StricklersList(status=self._status)
self._sections = SectionList(status=self._status)
@property
def boundary_condition(self):
return self._boundary_condition
@property
def lateral_contribution(self):
return self._lateral_contribution
@property
def stricklers(self):
return self._stricklers
@property
def sections(self):
return self._sections
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