Struct map_model::ControlTrafficSignal [−][src]
pub struct ControlTrafficSignal { pub id: IntersectionID, pub stages: Vec<Stage>, pub offset: Duration, pub movements: BTreeMap<MovementID, Movement>, }
A traffic signal consists of a sequence of Stages that repeat in a cycle. Most Stages last for a fixed duration. During a single Stage, some movements are protected (can proceed with the highest priority), while others are permitted (have to yield before proceeding).
Fields
id: IntersectionID
stages: Vec<Stage>
offset: Duration
movements: BTreeMap<MovementID, Movement>
Implementations
impl ControlTrafficSignal
[src]
impl ControlTrafficSignal
[src]pub fn new(map: &Map, id: IntersectionID) -> ControlTrafficSignal
[src]
pub(crate) fn validating_new(
map: &Map,
id: IntersectionID
) -> ControlTrafficSignal
[src]
map: &Map,
id: IntersectionID
) -> ControlTrafficSignal
Only call this variant while importing the map, to enforce that baked-in signal config is valid.
pub fn get_possible_policies(
map: &Map,
id: IntersectionID
) -> Vec<(String, ControlTrafficSignal)>
[src]
map: &Map,
id: IntersectionID
) -> Vec<(String, ControlTrafficSignal)>
pub fn get_min_crossing_time(&self, idx: usize) -> Duration
[src]
pub fn validate(&self) -> Result<()>
[src]
pub fn convert_to_ped_scramble(&mut self) -> bool
[src]
Move crosswalks from stages, adding them to an all-walk as last stage. This may promote yields to protected. True is returned if any stages were added or modified.
pub fn convert_to_ped_scramble_without_promotion(&mut self) -> bool
[src]
Move crosswalks from stages, adding them to an all-walk as last stage. This does not promote yields to protected. True is returned if any stages were added or modified.
fn internal_convert_to_ped_scramble(
&mut self,
promote_yield_to_protected: bool
) -> bool
[src]
&mut self,
promote_yield_to_protected: bool
) -> bool
pub fn adjust_major_minor_timing(
&mut self,
major: Duration,
minor: Duration,
map: &Map
) -> Result<()>
[src]
&mut self,
major: Duration,
minor: Duration,
map: &Map
) -> Result<()>
Modifies the fixed timing of all stages, applying either a major or minor duration, depending on the relative rank of the roads involved in the intersection. If this transformation couldn’t be applied, returns an error. Even if an error is returned, the signal may have been changed – so only call this on a cloned signal.
pub fn turn_to_movement(&self, turn: TurnID) -> MovementID
[src]
pub fn missing_turns(&self) -> BTreeSet<MovementID>
[src]
pub fn compressed_id(&self, turn: TurnID) -> CompressedMovementID
[src]
pub fn simple_cycle_duration(&self) -> Duration
[src]
How long a full cycle of the signal lasts, assuming no actuated timings.
impl ControlTrafficSignal
[src]
impl ControlTrafficSignal
[src]pub fn export(&self, map: &Map) -> TrafficSignal
[src]
pub(crate) fn import(
raw: TrafficSignal,
id: IntersectionID,
map: &Map
) -> Result<ControlTrafficSignal>
[src]
raw: TrafficSignal,
id: IntersectionID,
map: &Map
) -> Result<ControlTrafficSignal>
Trait Implementations
impl Clone for ControlTrafficSignal
[src]
impl Clone for ControlTrafficSignal
[src]fn clone(&self) -> ControlTrafficSignal
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'de> Deserialize<'de> for ControlTrafficSignal
[src]
impl<'de> Deserialize<'de> for ControlTrafficSignal
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<ControlTrafficSignal> for ControlTrafficSignal
[src]
impl PartialEq<ControlTrafficSignal> for ControlTrafficSignal
[src]fn eq(&self, other: &ControlTrafficSignal) -> bool
[src]
fn ne(&self, other: &ControlTrafficSignal) -> bool
[src]
impl Serialize for ControlTrafficSignal
[src]
impl Serialize for ControlTrafficSignal
[src]impl StructuralPartialEq for ControlTrafficSignal
[src]
Auto Trait Implementations
impl RefUnwindSafe for ControlTrafficSignal
impl Send for ControlTrafficSignal
impl Sync for ControlTrafficSignal
impl Unpin for ControlTrafficSignal
impl UnwindSafe for ControlTrafficSignal
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,