hub/city_model_structure/transport/join.py
2021-08-17 12:52:48 -04:00

50 lines
1.2 KiB
Python

"""
Join 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.node import Node
from city_model_structure.transport.traffic_node import TrafficNode
class Join(TrafficNode):
"""
Join class
"""
def __init__(self, name, coordinates, nodes=None):
self._nodes = nodes
edges = None
prohibitions = None
connections = None
if self._nodes is not None:
edges = []
prohibitions = []
connections = []
for node in self._nodes:
edges = edges + node.edges
prohibitions = prohibitions + node.prohibitions
connections = connections + node.connections
super().__init__(name, coordinates, edges, prohibitions, connections)
@property
def nodes(self) -> List[Node]:
"""
List of nodes which are very close together forming a big cluster
:return: [Node]
"""
return self._nodes
@nodes.setter
def nodes(self, value):
"""
List of nodes setter
:param value: [Node]
"""
self._nodes = value