""" 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 Contributor Guille guille.gutierrezmorote@concordia.ca """ from typing import List from city_model_structure.transport.traffic_node import TrafficNode class Crossing(TrafficNode): """ Crossing class """ def __init__(self, name, coordinates, priority, width, shape=None, edges=None): super().__init__(name, coordinates, edges=edges, node_type='Crossing') self._priority = priority self._width = width self._shape = shape @property def priority(self): """ Get whether the pedestrians have priority over the vehicles :return: bool """ return self._priority @priority.setter def priority(self, value): """ Set whether the pedestrians have priority over the vehicles :param value: bool """ self._priority = bool(value) @property def width(self): """ Get crossing width in meters :return: float """ return self._width @width.setter def width(self, value): """ Set crossing width in meters :param value: float """ self._width = float(value) @property def shape(self) -> List[List[float]]: """ Get the list of positions :return: [[x, y, (z)]] """ return self._shape @shape.setter def shape(self, value): """ Set the list of positions :param value: [[x, y, (z)]] """ self._shape = [[float(i) for i in value]]