hub/city_model_structure/transport/traffic_node.py

89 lines
2.0 KiB
Python
Raw Normal View History

2021-08-17 12:52:48 -04:00
"""
2021-10-18 16:07:18 -04:00
TrafficNode module
2021-08-17 12:52:48 -04:00
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
2021-08-17 13:30:51 -04:00
2021-08-17 12:52:48 -04:00
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):
"""
2021-10-18 16:07:18 -04:00
TrafficNode class
2021-08-17 12:52:48 -04:00
"""
2021-08-17 13:30:51 -04:00
def __init__(self, name, coordinates, node_type='TrafficNode', edges=None, prohibitions=None, connections=None):
2021-08-17 12:52:48 -04:00
super().__init__(name, edges)
if connections is None:
connections = []
if prohibitions is None:
prohibitions = []
self._coordinates = coordinates
self._prohibitions = prohibitions
self._connections = connections
2021-08-17 13:30:51 -04:00
self._node_type = node_type
@property
def node_type(self):
"""
Get node type
2021-08-17 13:30:51 -04:00
:return: str
"""
return self._node_type
2021-08-17 12:52:48 -04:00
@property
def coordinates(self) -> Point:
"""
Get node coordinates
2021-08-17 12:52:48 -04:00
:return: Point
"""
return self._coordinates
@coordinates.setter
def coordinates(self, value):
"""
Set node coordinates
2021-08-17 12:52:48 -04:00
:param value: Point
"""
self._coordinates = value
@property
2021-09-22 07:25:53 -04:00
def prohibitions(self) -> [(Edge, Edge)]:
2021-08-17 12:52:48 -04:00
"""
Get node prohibitions
:return: [(Edge, Edge)]
2021-08-17 12:52:48 -04:00
"""
return self._prohibitions
@prohibitions.setter
def prohibitions(self, value):
"""
Set node prohibitions
:param value: [(Edge, Edge)]
2021-08-17 12:52:48 -04:00
"""
self._prohibitions = value
@property
def connections(self) -> List[Connection]:
"""
Get node connections
:return: [Connection]
2021-08-17 12:52:48 -04:00
"""
return self._connections
@connections.setter
def connections(self, value):
"""
Set node connections
:param value: [Connection]
2021-08-17 12:52:48 -04:00
"""
self._connections = value