hub/city_model_structure/transport/traffic_node.py

89 lines
2.0 KiB
Python

"""
Node module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Contributor Milad milad.aghamohamadnia@concordia.ca
Contributor Guille guille.gutierrezmorote@concordia.ca
"""
from typing import List
from city_model_structure.attributes.edge import Edge
from city_model_structure.attributes.node import Node
from city_model_structure.attributes.point import Point
from city_model_structure.transport.connection import Connection
class TrafficNode(Node):
"""
Node class
"""
def __init__(self, name, coordinates, node_type='TrafficNode', edges=None, prohibitions=None, connections=None):
super().__init__(name, edges)
if connections is None:
connections = []
if prohibitions is None:
prohibitions = []
self._coordinates = coordinates
self._prohibitions = prohibitions
self._connections = connections
self._node_type = node_type
@property
def node_type(self):
"""
Get node type
:return: str
"""
return self._node_type
@property
def coordinates(self) -> Point:
"""
Get node coordinates
:return: Point
"""
return self._coordinates
@coordinates.setter
def coordinates(self, value):
"""
Set node coordinates
:param value: Point
"""
self._coordinates = value
@property
def prohibitions(self) -> List[(Edge, Edge)]:
"""
Get node prohibitions
:return: [(Edge, Edge)]
"""
return self._prohibitions
@prohibitions.setter
def prohibitions(self, value):
"""
Set node prohibitions
:param value: [(Edge, Edge)]
"""
self._prohibitions = value
@property
def connections(self) -> List[Connection]:
"""
Get node connections
:return: [Connection]
"""
return self._connections
@connections.setter
def connections(self, value):
"""
Set node connections
:param value: [Connection]
"""
self._connections = value