105 lines
1.9 KiB
Python
105 lines
1.9 KiB
Python
|
"""
|
||
|
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
|
||
|
"""
|
||
|
|
||
|
from typing import List, TypeVar
|
||
|
|
||
|
Edge = TypeVar['Edge']
|
||
|
Node = TypeVar['Node']
|
||
|
|
||
|
|
||
|
class Crossing:
|
||
|
"""
|
||
|
Crossing class
|
||
|
"""
|
||
|
|
||
|
def __init__(self):
|
||
|
self._node = None
|
||
|
self._edges = None
|
||
|
self._priority = None
|
||
|
self._width = None
|
||
|
self._shape = None
|
||
|
|
||
|
@property
|
||
|
def node(self) -> Node:
|
||
|
"""
|
||
|
The node at which this crossing is located
|
||
|
:return: Node
|
||
|
"""
|
||
|
return self._node
|
||
|
|
||
|
@node.setter
|
||
|
def node(self, value):
|
||
|
"""
|
||
|
The node at which this crossing is located setter
|
||
|
:param value: Node
|
||
|
"""
|
||
|
self._node = value
|
||
|
|
||
|
@property
|
||
|
def edges(self) -> List[Edge]:
|
||
|
"""
|
||
|
The (road) edges which are crossed
|
||
|
:return: [Edge]
|
||
|
"""
|
||
|
return self._edges
|
||
|
|
||
|
@edges.setter
|
||
|
def edges(self, value):
|
||
|
"""
|
||
|
The (road) edges which are crossed setter
|
||
|
:param value: [Edge]
|
||
|
"""
|
||
|
self._edges = value
|
||
|
|
||
|
@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
|