River.py 1.37 KiB
# -*- 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