136 lines
2.8 KiB
Python
136 lines
2.8 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):
|
|
"""
|
|
The name of a edge type
|
|
:return: str
|
|
"""
|
|
return self._edge_type
|
|
|
|
@property
|
|
def lanes(self) -> List[Lane]:
|
|
"""
|
|
List of lanes on an edge
|
|
:return: List[Lane]
|
|
"""
|
|
return self._lanes
|
|
|
|
@lanes.setter
|
|
def lanes(self, value):
|
|
"""
|
|
List of lanes on an edge setter
|
|
:param value: List[Lane]
|
|
"""
|
|
self._lanes = value
|
|
|
|
@property
|
|
def priority(self):
|
|
"""
|
|
A number, which determines 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):
|
|
"""
|
|
Priority setter
|
|
:param value: int
|
|
"""
|
|
self._priority = value
|
|
|
|
@property
|
|
def speed(self):
|
|
"""
|
|
The speed limit in m/s
|
|
:return: float
|
|
"""
|
|
return self._speed
|
|
|
|
@speed.setter
|
|
def speed(self, value):
|
|
"""
|
|
The speed limit in m/s setter
|
|
:param value: float
|
|
"""
|
|
self._speed = value
|
|
|
|
@property
|
|
def length(self):
|
|
"""
|
|
Length in m
|
|
:return: float
|
|
"""
|
|
return self._length
|
|
|
|
@length.setter
|
|
def length(self, value):
|
|
"""
|
|
Length in m setter
|
|
:param value: float
|
|
"""
|
|
self._length = value
|
|
|
|
@property
|
|
def allows(self) -> List[str]:
|
|
"""
|
|
List of allowed vehicle classes
|
|
:return: [str]
|
|
"""
|
|
return self._allows
|
|
|
|
@allows.setter
|
|
def allows(self, value):
|
|
"""
|
|
List of allowed vehicle classes setter
|
|
:param value: [str]
|
|
"""
|
|
self._allows = value
|
|
|
|
@property
|
|
def disallows(self) -> List[str]:
|
|
"""
|
|
List of not allowed vehicle classes
|
|
:return: [str]
|
|
"""
|
|
return self._disallows
|
|
|
|
@disallows.setter
|
|
def disallows(self, value):
|
|
"""
|
|
List of not allowed vehicle classes setter
|
|
:param value: [str]
|
|
"""
|
|
self._disallows = value
|