pub struct PathV2 {
steps: Vec<PathStepV2>,
req: PathRequest,
cost: Duration,
uber_turns: Vec<UberTurnV2>,
orig_start_lane: LaneID,
}
Expand description
A path between two endpoints for a particular mode. This representation is immutable and doesn’t prescribe specific lanes and turns to follow.
Fields§
§steps: Vec<PathStepV2>
§req: PathRequest
§cost: Duration
§uber_turns: Vec<UberTurnV2>
§orig_start_lane: LaneID
Implementations§
source§impl PathV2
impl PathV2
pub(crate) fn new( map: &Map, steps: Vec<PathStepV2>, req: PathRequest, cost: Duration, uber_turns: Vec<UberTurnV2> ) -> PathV2
sourcepub fn from_roads(
roads: Vec<DirectedRoadID>,
req: PathRequest,
cost: Duration,
uber_turns: Vec<UberTurnV2>,
map: &Map
) -> PathV2
pub fn from_roads( roads: Vec<DirectedRoadID>, req: PathRequest, cost: Duration, uber_turns: Vec<UberTurnV2>, map: &Map ) -> PathV2
Vehicle implementations often just calculate the sequence of roads. Turn that into PathStepV2 here.
sourcepub fn get_req(&self) -> &PathRequest
pub fn get_req(&self) -> &PathRequest
The original PathRequest used to produce this path.
sourcepub fn get_steps(&self) -> &Vec<PathStepV2>
pub fn get_steps(&self) -> &Vec<PathStepV2>
All steps in this path.
sourcepub fn get_cost(&self) -> Duration
pub fn get_cost(&self) -> Duration
The time needed to perform this path. This time is not a lower bound; physically following the path might be faster. This time incorporates costs like using sub-optimal lanes, taking difficult turns, and crossing private roads (which are modelled with a large penalty!)
sourcepub fn estimate_duration(
&self,
map: &Map,
max_speed: Option<Speed>,
main_road_penalty: Option<f64>
) -> Duration
pub fn estimate_duration( &self, map: &Map, max_speed: Option<Speed>, main_road_penalty: Option<f64> ) -> Duration
Estimate how long following the path will take in the best case, assuming no traffic, delay at intersections, elevation, or penalties for crossing private roads. To determine the speed along each step, the agent’s optional max_speed must be known.
TODO Hack. The one use of this actually needs to apply main_road_penalty. We want to omit some penalties, but use others. Come up with a better way of expressing this.
sourcepub fn into_v1(self, map: &Map) -> Result<Path>
pub fn into_v1(self, map: &Map) -> Result<Path>
Transform a sequence of roads representing a path into the current lane-based path, by picking particular lanes and turns to use.
fn into_v1_walking(self, map: &Map) -> Result<Path>
pub fn crosses_road(&self, r: RoadID) -> bool
sourcepub fn trace_v2(&self, map: &Map) -> Result<Polygon>
pub fn trace_v2(&self, map: &Map) -> Result<Polygon>
Draws the thickened path, matching entire roads. Ignores the path’s exact starting and ending distance. Doesn’t handle contraflow yet.
sourcepub fn trace_all_polygons(&self, map: &Map) -> Vec<Polygon>
pub fn trace_all_polygons(&self, map: &Map) -> Vec<Polygon>
Returns polygons covering the entire path. Ignores the path’s exact starting and ending distance.