ltn::logic::turn_restrictions

Struct FocusedTurns

Source
pub struct FocusedTurns {
    pub from_r: RoadID,
    pub i: IntersectionID,
    pub hull: Polygon,
    pub possible_t: HashSet<RoadID>,
    pub restricted_t: HashSet<RoadID>,
}
Expand description

An attempt to standardise language around turn restrictions. NOTE AT PRESENT THIS IS ASPIRATIONAL - DO NOT ASSUME THAT THE RELEVANT CODE ADHERES TO THESE RULES Future refactoring should migrate to these conventions.

§Summary:

    {connected} == { permitted ∪ opposing_oneway ∪ restricted_turn }

    {possible_turns} == { connected - opposing_oneways } == { permitted + restricted_turns }

§Details:

When moving (or attempting to move) from “RoadA” to “RoadB” the follow terms should be used: “from_r” = RoadA “target_r” = RoadB “connected” = RoadB will be a member of “connected” if RoadB share a common intersection with RoadA, or is part of a shared complicated turn with RoadA. The legality of driving from RoadA to RoadB is not a concern for “connected”. “Connected” is the superset of all the other categories listed here. “permitted” = RoadB is a member of “permitted”, if RoadB is a member of “connected” and it is legal to drive from RoadA to RoadB. Lane-level restrictions are not considered, so as long as some route from one or more driving Lanes in RoadA to one or more Lanes in RoadB then RoadB is considered “permitted”. “opposing_oneways” = RoadB is oneway for driving, and driving from RoadA to RoadB would result in driving the wrong way along RoadB. “restricted_turns” = RoadB will be a member of “restricted_turns” if all of these are true: a) RoadB is a member of “connected” b) There is explicitly tagged turn restriction which prohibits traffic turning from RoadA to RoadB, OR there is an explicitly tagged turn restriction which mandates traffic from RoadA must turn onto a different road to RoadB. c) RoadB is not a member of “opposing_oneways” “possible_turns” = These are turns that would be possible if all turn restrictions where removed.

§Notes:

  • RoadA will NOT be a member of any of the groups connected, permitted, opposing_oneway, restricted_turn even if a no U-turns restriction exists
  • In reality a road/turn maybe signposted by both turn restrictions and oneway restrictions. Following (OSM practise)[https://wiki.openstreetmap.org/wiki/Relation:restriction#When_to_map] it is not necessary mark turn restrictions when they are already implied by opposing oneway restrictions. We treat “banned_turn” and “opposing_oneway” as mutually exclusive.

§Discouraged terms:

“prohibited_turn” => use “restricted_turn” instead. “banned_turns” => use “restricted_turn” instead where practical. “Banned” is used elsewhere in A/BStreet, (ie RestrictionType::BanTurns) but within the LTN tool “restricted” is preferred, as it is more consistent with the road.restricted_turns and road.complicated_turn_restrictions as well the general OSM tagging. “src_r” and “dst_r” => use “from_r” and “target_r” instead. (“src_r” and “dst_r” are too similar to road.src_i and road.dst_i which are conceptually very different).

Fields§

§from_r: RoadID§i: IntersectionID§hull: Polygon§possible_t: HashSet<RoadID>§restricted_t: HashSet<RoadID>

Implementations§

Source§

impl FocusedTurns

Source

pub fn new(r: RoadID, clicked_pt: Pt2D, map: &Map) -> Self

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

§

fn is_within(&self, b: &G2) -> bool