Struct map_model::Road [−][src]
A Road represents a segment between exactly two Intersections. It contains Lanes as children.
Fields
id: RoadID
turn_restrictions: Vec<(RestrictionType, RoadID)>
self is 'from'
complicated_turn_restrictions: Vec<(RoadID, RoadID)>
self is 'from'. (via, to). Only BanTurns.
orig_id: OriginalRoad
speed_limit: Speed
access_restrictions: AccessRestrictions
zorder: isize
percent_incline: f64
[-1.0, 1.0] theoretically, but in practice, about [-0.25, 0.25]. 0 is flat, positive is uphill from src_i -> dst_i, negative is downhill.
lanes_ltr: Vec<(LaneID, Direction, LaneType)>
Invariant: A road must contain at least one child
center_pts: PolyLine
The physical center of the road, including sidewalks, after trimming. The order implies road orientation. No edits ever change this.
src_i: IntersectionID
dst_i: IntersectionID
Implementations
impl Road
[src]
pub fn lanes_ltr(&self) -> Vec<(LaneID, Direction, LaneType)>
[src]
Returns all lanes from the left side of the road to right. Left/right is determined by the orientation of center_pts.
pub fn lane_specs(&self, map: &Map) -> Vec<LaneSpec>
[src]
pub fn get_left_side(&self, map: &Map) -> PolyLine
[src]
pub fn offset(&self, lane: LaneID) -> usize
[src]
Counting from the left side of the road
pub(crate) fn dir_and_offset(&self, lane: LaneID) -> (Direction, usize)
[src]
lane must belong to this road. Offset 0 is the centermost lane on each side of a road, then
it counts up from there. Note this is a different offset than offset
!
pub fn parking_to_driving(&self, parking: LaneID, map: &Map) -> Option<LaneID>
[src]
pub(crate) fn speed_limit_from_osm(&self) -> Speed
[src]
pub fn find_closest_lane<F: Fn(&Lane) -> bool>(
&self,
from: LaneID,
filter: F,
map: &Map
) -> Option<LaneID>
[src]
&self,
from: LaneID,
filter: F,
map: &Map
) -> Option<LaneID>
Includes off-side
pub fn all_lanes(&self) -> Vec<LaneID>
[src]
pub fn get_dir_change_pl(&self, map: &Map) -> PolyLine
[src]
This is the FIRST yellow line where the direction of the road changes. If multiple direction changes happen, the result is kind of arbitrary.
pub fn get_half_width(&self, map: &Map) -> Distance
[src]
pub fn get_width(&self, map: &Map) -> Distance
[src]
pub fn get_thick_polygon(&self, map: &Map) -> Polygon
[src]
pub fn get_half_polygon(&self, dir: Direction, map: &Map) -> Result<Polygon>
[src]
Creates the thick polygon representing one half of the road. For roads with multipe direction changes (like a two-way cycletrack adjacent to a regular two-way road), the results are probably weird.
pub fn get_name(&self, lang: Option<&String>) -> String
[src]
pub fn get_rank(&self) -> RoadRank
[src]
pub fn get_detailed_rank(&self) -> usize
[src]
pub fn all_bus_stops(&self, map: &Map) -> Vec<BusStopID>
[src]
pub fn is_light_rail(&self) -> bool
[src]
pub fn is_footway(&self) -> bool
[src]
pub fn is_service(&self) -> bool
[src]
pub fn is_cycleway(&self) -> bool
[src]
pub fn common_endpt(&self, other: &Road) -> IntersectionID
[src]
pub fn is_private(&self) -> bool
[src]
pub(crate) fn access_restrictions_from_osm(&self) -> AccessRestrictions
[src]
pub fn get_zone<'a>(&self, map: &'a Map) -> Option<&'a Zone>
[src]
pub fn is_extremely_short(&self) -> bool
[src]
Many roads wind up with almost no length, due to their representation in OpenStreetMap. In reality, these segments are likely located within the interior of an intersection. This method uses a hardcoded threshold to detect these cases.
pub(crate) fn create_lanes(
&self,
lane_specs_ltr: Vec<LaneSpec>,
lane_id_counter: &mut usize
) -> Vec<Lane>
[src]
&self,
lane_specs_ltr: Vec<LaneSpec>,
lane_id_counter: &mut usize
) -> Vec<Lane>
impl Road
[src]
pub(crate) fn children_forwards(&self) -> Vec<(LaneID, LaneType)>
[src]
These are ordered from closest to center lane (left-most when driving on the right) to farthest (sidewalk)
pub(crate) fn children_backwards(&self) -> Vec<(LaneID, LaneType)>
[src]
pub(crate) fn children(&self, dir: Direction) -> Vec<(LaneID, LaneType)>
[src]
pub(crate) fn incoming_lanes(
&self,
i: IntersectionID
) -> Vec<(LaneID, LaneType)>
[src]
&self,
i: IntersectionID
) -> Vec<(LaneID, LaneType)>
Returns lanes from the "center" going out
pub(crate) fn outgoing_lanes(
&self,
i: IntersectionID
) -> Vec<(LaneID, LaneType)>
[src]
&self,
i: IntersectionID
) -> Vec<(LaneID, LaneType)>
Returns lanes from the "center" going out
Trait Implementations
impl Debug for Road
[src]
impl<'de> Deserialize<'de> for Road
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Road
[src]
Auto Trait Implementations
impl RefUnwindSafe for Road
[src]
impl Send for Road
[src]
impl Sync for Road
[src]
impl Unpin for Road
[src]
impl UnwindSafe for Road
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> 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> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,