Struct map_model::Intersection

source ·
pub struct Intersection {
Show 13 fields pub id: IntersectionID, pub polygon: Polygon, pub turns: Vec<Turn>, pub elevation: Distance, pub kind: IntersectionKind, pub control: IntersectionControl, pub orig_id: NodeID, pub incoming_lanes: Vec<LaneID>, pub outgoing_lanes: Vec<LaneID>, pub roads: Vec<RoadID>, pub modal_filter: Option<DiagonalFilter>, pub merged: bool, pub movements: BTreeMap<MovementID, Movement>,
}
Expand description

An intersection connects roads. Most have >2 roads and are controlled by stop signs or traffic signals. Roads that lead to the boundary of the map end at border intersections, with only that one road attached.

Fields§

§id: IntersectionID§polygon: Polygon

This needs to be in clockwise orientation, or later rendering of sidewalk corners breaks.

§turns: Vec<Turn>§elevation: Distance§kind: IntersectionKind§control: IntersectionControl§orig_id: NodeID§incoming_lanes: Vec<LaneID>

Note that a lane may belong to both incoming_lanes and outgoing_lanes.

§outgoing_lanes: Vec<LaneID>§roads: Vec<RoadID>§modal_filter: Option<DiagonalFilter>§merged: bool

Was a short road adjacent to this intersection merged?

§movements: BTreeMap<MovementID, Movement>

Implementations§

source§

impl Intersection

source

pub fn is_border(&self) -> bool

source

pub fn is_incoming_border(&self) -> bool

source

pub fn is_outgoing_border(&self) -> bool

source

pub fn is_closed(&self) -> bool

source

pub fn is_stop_sign(&self) -> bool

source

pub fn is_traffic_signal(&self) -> bool

source

pub fn is_light_rail(&self, map: &Map) -> bool

source

pub fn is_private(&self, map: &Map) -> bool

source

pub fn is_footway(&self, map: &Map) -> bool

source

pub fn is_cycleway(&self, map: &Map) -> bool

source

pub fn is_degenerate(&self) -> bool

Does this intersection only connect two road segments? Then usually, the intersection only exists to mark the road name or lanes changing.

source

pub fn is_deadend_for_driving(&self, map: &Map) -> bool

Does this intersection connect to only a single driveable road segment?

source

pub fn is_deadend_for_everyone(&self) -> bool

Ignoring mode of travel, is this intersection only connected to one road?

source

pub fn get_incoming_lanes( &self, map: &Map, constraints: PathConstraints ) -> Vec<LaneID>

source

pub fn get_outgoing_lanes( &self, map: &Map, constraints: PathConstraints ) -> Vec<LaneID>

Strict for bikes. If there are bike lanes, not allowed to use other lanes.

source

pub fn get_zorder(&self, map: &Map) -> isize

Higher numbers get drawn on top

source

pub fn get_rank(&self, map: &Map) -> RoadRank

source

pub fn get_road_sides_sorted(&self, map: &Map) -> Vec<RoadSideID>

source

pub fn get_sorted_incoming_roads(&self, map: &Map) -> Vec<RoadID>

Return all incoming roads to an intersection, sorted by angle. This skips one-way roads outbound from the intersection, since no turns originate from those anyway. This allows heuristics for a 3-way intersection to not care if one of the roads happens to be a dual carriageway (split into two one-ways).

source

pub fn some_outgoing_road(&self, map: &Map) -> Option<DirectedRoadID>

source

pub fn some_incoming_road(&self, map: &Map) -> Option<DirectedRoadID>

source

pub fn name(&self, lang: Option<&String>, map: &Map) -> String

source

pub fn turn_to_movement( &self, turn: TurnID ) -> (MovementID, CompressedMovementID)

Don’t call for SharedSidewalkCorners

source

pub fn find_road_between<'a>( &self, other: IntersectionID, map: &'a Map ) -> Option<&'a Road>

Trait Implementations§

source§

impl Clone for Intersection

source§

fn clone(&self) -> Intersection

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Intersection

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Intersection

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Intersection

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,