137 lines
2.9 KiB
Python
137 lines
2.9 KiB
Python
"""
|
|
Edge 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.transport.lane import Lane
|
|
|
|
|
|
class TrafficEdge(Edge):
|
|
"""
|
|
Edge class
|
|
Each edge is unidirectional and starts at the "from" node and ends at the "to" node
|
|
"""
|
|
|
|
def __init__(self, name, nodes, priority, speed, lanes, length, allows=None, disallows=None, sidewalk_width=None,
|
|
edge_type='TrafficEdge'):
|
|
super().__init__(name, nodes)
|
|
self._edge_type = edge_type
|
|
self._lanes = lanes
|
|
self._priority = priority
|
|
self._speed = speed
|
|
self._length = length
|
|
self._allows = allows
|
|
self._disallows = disallows
|
|
self._sidewalk_width = sidewalk_width
|
|
|
|
@property
|
|
def edge_type(self):
|
|
"""
|
|
Get the edge type
|
|
:return: str
|
|
"""
|
|
return self._edge_type
|
|
|
|
@property
|
|
def lanes(self) -> List[Lane]:
|
|
"""
|
|
Get the lanes on an edge
|
|
:return: List[Lane]
|
|
"""
|
|
return self._lanes
|
|
|
|
@lanes.setter
|
|
def lanes(self, value):
|
|
"""
|
|
Set the lanes on an edge
|
|
:param value: List[Lane]
|
|
"""
|
|
self._lanes = value
|
|
|
|
@property
|
|
def priority(self):
|
|
"""
|
|
Get the priority between different road types.
|
|
It starts with one; higher numbers represent more important roads.
|
|
:return: int
|
|
"""
|
|
return self._priority
|
|
|
|
@priority.setter
|
|
def priority(self, value):
|
|
"""
|
|
Set the priority between different road types.
|
|
It starts with one; higher numbers represent more important roads.
|
|
:param value: int
|
|
"""
|
|
self._priority = value
|
|
|
|
@property
|
|
def speed(self):
|
|
"""
|
|
Get he speed limit in m/s
|
|
:return: float
|
|
"""
|
|
return self._speed
|
|
|
|
@speed.setter
|
|
def speed(self, value):
|
|
"""
|
|
Set the speed limit in m/s
|
|
:param value: float
|
|
"""
|
|
self._speed = value
|
|
|
|
@property
|
|
def length(self):
|
|
"""
|
|
Get the lane length in meters
|
|
:return: float
|
|
"""
|
|
return self._length
|
|
|
|
@length.setter
|
|
def length(self, value):
|
|
"""
|
|
Set the lane length in meters
|
|
:param value: float
|
|
"""
|
|
self._length = value
|
|
|
|
@property
|
|
def allows(self) -> List[str]:
|
|
"""
|
|
Get the list of allowed vehicle classes
|
|
:return: [str]
|
|
"""
|
|
return self._allows
|
|
|
|
@allows.setter
|
|
def allows(self, value):
|
|
"""
|
|
Set the list of allowed vehicle classes
|
|
:param value: [str]
|
|
"""
|
|
self._allows = value
|
|
|
|
@property
|
|
def disallows(self) -> List[str]:
|
|
"""
|
|
Get the list of not allowed vehicle classes
|
|
:return: [str]
|
|
"""
|
|
return self._disallows
|
|
|
|
@disallows.setter
|
|
def disallows(self, value):
|
|
"""
|
|
Set the list of not allowed vehicle classes
|
|
:param value: [str]
|
|
"""
|
|
self._disallows = value
|