city_retrofit/city_model_structure/transport/join.py

50 lines
1.2 KiB
Python
Raw Normal View History

"""
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
2021-08-17 12:52:48 -04:00
Contributor Guille guille.gutierrezmorote@concordia.ca
"""
2021-08-17 12:52:48 -04:00
from typing import List
2021-08-17 12:52:48 -04:00
from city_model_structure.attributes.node import Node
from city_model_structure.transport.traffic_node import TrafficNode
2021-08-17 12:52:48 -04:00
class Join(TrafficNode):
"""
Join class
"""
2021-08-17 12:52:48 -04:00
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