Struct map_model::PathV2

source ·
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

source

pub(crate) fn new( map: &Map, steps: Vec<PathStepV2>, req: PathRequest, cost: Duration, uber_turns: Vec<UberTurnV2> ) -> PathV2

source

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.

source

pub fn get_req(&self) -> &PathRequest

The original PathRequest used to produce this path.

source

pub fn get_steps(&self) -> &Vec<PathStepV2>

All steps in this path.

source

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!)

source

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.

source

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.

source

fn into_v1_walking(self, map: &Map) -> Result<Path>

source

pub fn crosses_road(&self, r: RoadID) -> bool

source

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.

source

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.

Trait Implementations§

source§

impl Clone for PathV2

source§

fn clone(&self) -> PathV2

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 PathV2

source§

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

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

impl<'de> Deserialize<'de> for PathV2

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 PathV2

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§

§

impl Freeze for PathV2

§

impl RefUnwindSafe for PathV2

§

impl Send for PathV2

§

impl Sync for PathV2

§

impl Unpin for PathV2

§

impl UnwindSafe for PathV2

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