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):
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get whether the pedestrians have priority over the vehicles
|
2021-08-06 12:28:20 -04:00
|
|
|
:return: bool
|
|
|
|
"""
|
|
|
|
return self._priority
|
|
|
|
|
|
|
|
@priority.setter
|
|
|
|
def priority(self, value):
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Set whether the pedestrians have priority over the vehicles
|
2021-08-06 12:28:20 -04:00
|
|
|
:param value: bool
|
|
|
|
"""
|
2021-09-13 15:14:54 -04:00
|
|
|
self._priority = bool(value)
|
2021-08-06 12:28:20 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def width(self):
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get crossing width in meters
|
2021-08-06 12:28:20 -04:00
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self._width
|
|
|
|
|
|
|
|
@width.setter
|
|
|
|
def width(self, value):
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Set crossing width in meters
|
2021-08-06 12:28:20 -04:00
|
|
|
:param value: float
|
|
|
|
"""
|
2021-09-13 15:14:54 -04:00
|
|
|
self._width = float(value)
|
2021-08-06 12:28:20 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def shape(self) -> List[List[float]]:
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get the list of positions
|
2021-08-06 12:28:20 -04:00
|
|
|
:return: [[x, y, (z)]]
|
|
|
|
"""
|
|
|
|
return self._shape
|
|
|
|
|
|
|
|
@shape.setter
|
|
|
|
def shape(self, value):
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Set the list of positions
|
2021-08-06 12:28:20 -04:00
|
|
|
:param value: [[x, y, (z)]]
|
|
|
|
"""
|
2021-09-13 15:14:54 -04:00
|
|
|
self._shape = [[float(i) for i in value]]
|