Struct map_model::objects::road::Road[][src]

pub struct Road {
Show 16 fields pub id: RoadID, pub osm_tags: Tags, pub turn_restrictions: Vec<(RestrictionType, RoadID)>, pub complicated_turn_restrictions: Vec<(RoadID, RoadID)>, pub orig_id: OriginalRoad, pub speed_limit: Speed, pub access_restrictions: AccessRestrictions, pub zorder: isize, pub percent_incline: f64, pub lanes: Vec<Lane>, pub center_pts: PolyLine, pub untrimmed_center_pts: PolyLine, pub src_i: IntersectionID, pub dst_i: IntersectionID, pub crosswalk_forward: bool, pub crosswalk_backward: bool,
}
Expand description

A Road represents a segment between exactly two Intersections. It contains Lanes as children.

Fields

id: RoadIDosm_tags: Tagsturn_restrictions: Vec<(RestrictionType, RoadID)>

self is ‘from’

complicated_turn_restrictions: Vec<(RoadID, RoadID)>

self is ‘from’. (via, to). Only BanTurns.

orig_id: OriginalRoadspeed_limit: Speedaccess_restrictions: AccessRestrictionszorder: isizepercent_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: Vec<Lane>

Invariant: A road must contain at least one child. These are ordered from the left side of the road to the right, with that orientation determined by the direction of center_pts.

center_pts: PolyLine

The physical center of the road, including sidewalks, after trimming to account for the intersection geometry. The order implies road orientation.

untrimmed_center_pts: PolyLine

Like center_pts, but before any trimming for intersection geometry. This is preserved so that when modifying road width, intersection polygons can be calculated correctly.

src_i: IntersectionIDdst_i: IntersectionIDcrosswalk_forward: bool

Is there a tagged crosswalk near each end of the road?

crosswalk_backward: bool

Implementations

Gets the left PolyLine of the road

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!

Includes off-side

This is the FIRST yellow line where the direction of the road changes. If multiple direction changes happen, the result is kind of arbitrary.

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.

Returns the other intersection of this road, panicking if this road doesn’t connect to the input TODO This should use CommonEndpoint

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.

Get the DirectedRoadID pointing to the intersection. Panics if the intersection isn’t an endpoint.

Get the DirectedRoadID pointing from the intersection. Panics if the intersection isn’t an endpoint.

Returns all lanes located between l1 and l2, exclusive.

A simple classification of if the directed road is stressful or not for cycling. Arterial roads without a bike lane match this. Why arterial, instead of looking at speed limits? Even on arterial roads with official speed limits lowered, in practice vehicles still travel at the speed suggested by the design of the road.

These are ordered from closest to center lane (left-most when driving on the right) to farthest (sidewalk)

Returns lanes from the “center” going out

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.