2021-08-06 12:28:20 -04:00
|
|
|
"""
|
|
|
|
Crossing 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:49:12 -04:00
|
|
|
Contributor Guille guille.gutierrezmorote@concordia.ca
|
2021-08-06 12:28:20 -04:00
|
|
|
"""
|
|
|
|
|
2021-08-17 12:49:12 -04:00
|
|
|
from typing import List
|
|
|
|
from city_model_structure.transport.traffic_node import TrafficNode
|
2021-08-06 12:28:20 -04:00
|
|
|
|
|
|
|
|
2021-08-17 12:49:12 -04:00
|
|
|
class Crossing(TrafficNode):
|
2021-08-06 12:28:20 -04:00
|
|
|
"""
|
|
|
|
Crossing class
|
|
|
|
"""
|
|
|
|
|
2021-08-17 12:49:12 -04:00
|
|
|
def __init__(self, name, coordinates, priority, width, shape=None, edges=None):
|
2021-08-17 13:30:51 -04:00
|
|
|
super().__init__(name, coordinates, edges=edges, node_type='Crossing')
|
2021-08-17 12:49:12 -04:00
|
|
|
self._priority = priority
|
|
|
|
self._width = width
|
|
|
|
self._shape = shape
|
2021-08-06 12:28:20 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def priority(self):
|
|
|
|
"""
|
|
|
|
Whether the pedestrians have priority over the vehicles (automatically set to true at tls-controlled intersections).
|
|
|
|
:return: bool
|
|
|
|
"""
|
|
|
|
return self._priority
|
|
|
|
|
|
|
|
@priority.setter
|
|
|
|
def priority(self, value):
|
|
|
|
"""
|
|
|
|
Priority setter
|
|
|
|
:param value: bool
|
|
|
|
"""
|
|
|
|
self._priority = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def width(self):
|
|
|
|
"""
|
|
|
|
Width in m
|
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self._width
|
|
|
|
|
|
|
|
@width.setter
|
|
|
|
def width(self, value):
|
|
|
|
"""
|
|
|
|
Width in m setter
|
|
|
|
:param value: float
|
|
|
|
"""
|
|
|
|
self._width = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def shape(self) -> List[List[float]]:
|
|
|
|
"""
|
|
|
|
List of positions (positions in m)
|
|
|
|
:return: [[x, y, (z)]]
|
|
|
|
"""
|
|
|
|
return self._shape
|
|
|
|
|
|
|
|
@shape.setter
|
|
|
|
def shape(self, value):
|
|
|
|
"""
|
|
|
|
List of positions setter
|
|
|
|
:param value: [[x, y, (z)]]
|
|
|
|
"""
|
|
|
|
self._shape = value
|