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
impl FocusedTurns
Auto Trait Implementations§
impl Freeze for FocusedTurns
impl RefUnwindSafe for FocusedTurns
impl Send for FocusedTurns
impl Sync for FocusedTurns
impl Unpin for FocusedTurns
impl UnwindSafe for FocusedTurns
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.