hub/city_model_structure/transport/traffic_node.py

85 lines
2.0 KiB
Python
Raw Normal View History

2021-08-17 12:52:48 -04:00
"""
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
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):
"""
Node class
"""
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):
"""
The name of a node type
:return: str
"""
return self._node_type
2021-08-17 12:52:48 -04:00
@property
def coordinates(self) -> Point:
"""
The x,y,z - Node coordinates
:return: Point
"""
return self._coordinates
@coordinates.setter
def coordinates(self, value):
"""
The x,y,z - Node coordinates setter
:param value: Point
"""
self._coordinates = value
@property
def prohibitions(self) -> List[(Edge, Edge)]:
"""
return a list of forbidden edges tuples meaning you can not move from the first edge to the second
"""
return self._prohibitions
@prohibitions.setter
def prohibitions(self, value):
"""
Set the prohibitions tuples for this node
"""
self._prohibitions = value
@property
def connections(self) -> List[Connection]:
"""
Return a list of connections for the node
"""
return self._connections
@connections.setter
def connections(self, value):
"""
Set the connections for this node
"""
self._connections = value