84 lines
2.1 KiB
Python
84 lines
2.1 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, 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
|
|
|
|
@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
|
|
|
|
|
|
|
|
|
|
"""
|
|
Type
|
|
enum ( "priority", "traffic_light", "right_before_left", "unregulated", "priority_stop", "traffic_light_unregulated", "allway_stop", "rail_signal", "zipper", "traffic_light_right_on_red", "rail_crossing")
|
|
:return: enum
|
|
"""
|