pub struct Map {
Show 21 fields pub(crate) roads: Vec<Road>, pub(crate) intersections: Vec<Intersection>, pub(crate) buildings: Vec<Building>, pub(crate) transit_stops: BTreeMap<TransitStopID, TransitStop>, pub(crate) transit_routes: Vec<TransitRoute>, pub(crate) areas: Vec<Area>, pub(crate) parking_lots: Vec<ParkingLot>, pub(crate) boundary_polygon: Polygon, pub(crate) stop_signs: BTreeMap<IntersectionID, ControlStopSign>, pub(crate) traffic_signals: BTreeMap<IntersectionID, ControlTrafficSignal>, pub(crate) gps_bounds: GPSBounds, pub(crate) bounds: Bounds, pub(crate) config: MapConfig, pub(crate) pathfinder: Pathfinder, pub(crate) pathfinder_dirty: bool, pub(crate) routing_params: RoutingParams, pub(crate) zones: Vec<Zone>, pub(crate) name: MapName, pub(crate) edits: MapEdits, pub(crate) edits_generation: usize, pub(crate) road_to_buildings: MultiMap<RoadID, BuildingID>,
}

Fields

roads: Vec<Road>intersections: Vec<Intersection>buildings: Vec<Building>transit_stops: BTreeMap<TransitStopID, TransitStop>transit_routes: Vec<TransitRoute>areas: Vec<Area>parking_lots: Vec<ParkingLot>boundary_polygon: Polygonstop_signs: BTreeMap<IntersectionID, ControlStopSign>traffic_signals: BTreeMap<IntersectionID, ControlTrafficSignal>gps_bounds: GPSBoundsbounds: Boundsconfig: MapConfigpathfinder: Pathfinderpathfinder_dirty: boolrouting_params: RoutingParamszones: Vec<Zone>name: MapNameedits: MapEditsedits_generation: usizeroad_to_buildings: MultiMap<RoadID, BuildingID>

Implementations

Panics on borders

Returns (changed_roads, deleted_lanes, deleted_turns, added_turns, changed_intersections)

A hack. Use this to apply edits, then save the map anyway, pretending like the edits came from raw data.

This can expensive, so don’t constantly do it while editing in the UI. But this must happen before the simulation resumes.

Since the player is in the middle of editing, the signal may not be valid. Don’t go through the entire apply_edits flow.

If you need to regenerate anything when the map is edited, use this key to detect edits.

Load a map from a local serialized Map or RawMap. Note this won’t work on web. This should only be used by non-UI tools.

After deserializing a map directly, call this after.

Just for temporary std::mem::replace tricks.

Public for importer. Do not abuse!

The turns may belong to two different intersections!

Find all movements from one road to another that’re usable by someone.

This and all_outgoing_borders are expensive to constantly repeat

Cars trying to park near this building should head for the driving lane returned here, then start their search. Some parking lanes are connected to driving lanes that’re “parking blackholes” – if there are no free spots on that lane, then the roads force cars to a border.

Return the cost of a single path, and also a mapping from every directed road to the cost of getting there from the same start. This can be used to understand why an alternative route wasn’t chosen.

None for SharedSidewalkCorners and turns not belonging to traffic signals

Normally after applying edits, you must call recalculate_pathfinding_after_edits. Alternatively, you can keep the old pathfinder exactly as it is. Use with caution – the pathfinder and the map may be out-of-sync in arbitrary ways.

Simple search along undirected roads. Expresses the result as a sequence of roads and a sequence of intersections.

Simple search along directed roads, weighted by distance. Expresses the result as a sequence of roads and a sequence of intersections.

Unlike the main pathfinding methods, this starts and ends at intersections. The first and last step can be on any road connected to the intersection.

Returns the routing params baked into the map.

Finds the road directly connecting two intersections.

Returns the highest elevation in the map

Does a turn at a stop sign go from a smaller to a larger road? (Note this doesn’t look at unprotected movements in traffic signals, since we don’t yet have good heuristics for when those exist)

Modifies the map in-place, removing parts not essential for the bike network tool.

Modifies the map in-place, removing buildings.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. 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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.