pub struct LaneSpec {
pub lt: LaneType,
pub dir: Direction,
pub width: Distance,
pub allowed_turns: EnumSet<TurnDirection>,
}
Fields§
§lt: LaneType
§dir: Direction
§width: Distance
§allowed_turns: EnumSet<TurnDirection>
Turn restrictions for this lane. An empty set represents that no restrictions are indicated
(though local rules might still dictate restrictions).
Turns for specific vehicle types (turn:bus:lanes
and such) are not yet captured.
Implementations§
§impl LaneSpec
impl LaneSpec
pub fn maybe_add_bike_lanes( lanes_ltr: &mut Vec<LaneSpec>, buffer_type: Option<BufferType>, driving_side: DrivingSide )
§impl LaneSpec
impl LaneSpec
pub fn add_new_lane(
lanes_ltr: &mut Vec<LaneSpec>,
lt: LaneType,
highway_type: &str,
driving_side: DrivingSide
) -> usize
pub fn add_new_lane( lanes_ltr: &mut Vec<LaneSpec>, lt: LaneType, highway_type: &str, driving_side: DrivingSide ) -> usize
Returns the index where the new lane was inserted
§impl LaneSpec
impl LaneSpec
pub fn toggle_road_direction(
lanes_ltr: &mut Vec<LaneSpec>,
driving_side: DrivingSide
)
pub fn toggle_road_direction( lanes_ltr: &mut Vec<LaneSpec>, driving_side: DrivingSide )
Convert the driving lanes of a road between one-way forwards, one-way backwards, and bidirectional. It should be idempotent to apply this 3 times in a row. Even when an existing one-way street is narrow, it can be made bidirectional by splitting into two very narrow lanes.
§impl LaneSpec
impl LaneSpec
pub fn create_for_test(input_lt: &str, input_dir: &str) -> Vec<LaneSpec>
pub fn create_for_test(input_lt: &str, input_dir: &str) -> Vec<LaneSpec>
Transforms a string describing lane types and directions, like “spddps” and “vv^^^^^”, into a list of LaneSpecs. Useful for unit tests.
pub fn check_lanes_ltr(
actual_lanes_ltr: &[LaneSpec],
description: String,
input_lt: &str,
input_dir: &str,
expected_lt: &str,
expected_dir: &str,
ok: &mut bool
)
pub fn check_lanes_ltr( actual_lanes_ltr: &[LaneSpec], description: String, input_lt: &str, input_dir: &str, expected_lt: &str, expected_dir: &str, ok: &mut bool )
This is meant for table-driven unit tests. Call this on the transformed / output lanes. If
the lanes don’t match, ok
will be set to false and appropriate errors will be printed.
§impl LaneSpec
impl LaneSpec
pub fn typical_lane_widths(
lt: LaneType,
highway_type: &str
) -> Vec<(Distance, &'static str)>
pub fn typical_lane_widths( lt: LaneType, highway_type: &str ) -> Vec<(Distance, &'static str)>
For a given lane type, returns some likely widths. This may depend on the OSM highway type of the road. The first value returned will be used as a default.
pub fn typical_lane_width(lt: LaneType) -> Distance
pub fn typical_lane_width(lt: LaneType) -> Distance
Pick a reasonable default for a lane width, without any context on locale or tags.
pub fn oneway_for_driving(lanes: &[LaneSpec]) -> Option<Direction>
pub fn oneway_for_driving(lanes: &[LaneSpec]) -> Option<Direction>
None if bidirectional. If it’s one-way, which direction is that relative to the road? (Usually forwards)