Struct map_model::Map[][src]

pub struct Map {
    roads: Vec<Road>,
    lanes: BTreeMap<LaneID, Lane>,
    lane_id_counter: usize,
    intersections: Vec<Intersection>,
    turns: BTreeMap<TurnID, Turn>,
    buildings: Vec<Building>,
    bus_stops: BTreeMap<BusStopID, BusStop>,
    bus_routes: Vec<BusRoute>,
    areas: Vec<Area>,
    parking_lots: Vec<ParkingLot>,
    boundary_polygon: Polygon,
    stop_signs: BTreeMap<IntersectionID, ControlStopSign>,
    traffic_signals: BTreeMap<IntersectionID, ControlTrafficSignal>,
    gps_bounds: GPSBounds,
    bounds: Bounds,
    config: MapConfig,
    pathfinder: Pathfinder,
    pathfinder_dirty: bool,
    routing_params: RoutingParams,
    zones: Vec<Zone>,
    name: MapName,
    edits: MapEdits,
}

Fields

roads: Vec<Road>lanes: BTreeMap<LaneID, Lane>lane_id_counter: usizeintersections: Vec<Intersection>turns: BTreeMap<TurnID, Turn>buildings: Vec<Building>bus_stops: BTreeMap<BusStopID, BusStop>bus_routes: Vec<BusRoute>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: MapEdits

Implementations

impl Map[src]

pub fn new_edits(&self) -> MapEdits[src]

pub fn get_edits(&self) -> &MapEdits[src]

pub fn unsaved_edits(&self) -> bool[src]

pub fn get_r_edit(&self, r: RoadID) -> EditRoad[src]

pub fn edit_road_cmd<F: Fn(&mut EditRoad)>(&self, r: RoadID, f: F) -> EditCmd[src]

pub fn get_i_edit(&self, i: IntersectionID) -> EditIntersection[src]

Panics on borders

pub fn save_edits(&self)[src]

pub fn must_apply_edits(&mut self, new_edits: MapEdits) -> EditEffects[src]

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

pub fn try_apply_edits(&mut self, new_edits: MapEdits)[src]

fn apply_edits(
    &mut self,
    new_edits: MapEdits,
    enforce_valid: bool
) -> EditEffects
[src]

pub fn recalculate_pathfinding_after_edits(&mut self, timer: &mut Timer<'_>)[src]

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

pub fn incremental_edit_traffic_signal(&mut self, signal: ControlTrafficSignal)[src]

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

impl Map[src]

pub fn create_from_raw(
    raw: RawMap,
    build_ch: bool,
    keep_bldg_tags: bool,
    timer: &mut Timer<'_>
) -> Map
[src]

impl Map[src]

pub fn import_minimal(
    name: MapName,
    bounds: Bounds,
    gps_bounds: GPSBounds,
    intersections: Vec<Intersection>,
    roads: Vec<Road>,
    lanes: Vec<Lane>,
    turns: Vec<Turn>
) -> Map
[src]

Use for creating a map directly from some external format, not from a RawMap.

impl Map[src]

pub fn load_synchronously(path: String, timer: &mut Timer<'_>) -> Map[src]

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.

pub fn map_loaded_directly(&mut self)[src]

After deserializing a map directly, call this after.

pub fn blank() -> Map[src]

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

pub fn all_roads(&self) -> &Vec<Road>[src]

pub fn all_lanes(&self) -> &BTreeMap<LaneID, Lane>[src]

pub fn all_intersections(&self) -> &Vec<Intersection>[src]

pub fn all_turns(&self) -> &BTreeMap<TurnID, Turn>[src]

pub fn all_buildings(&self) -> &Vec<Building>[src]

pub fn all_areas(&self) -> &Vec<Area>[src]

pub fn all_parking_lots(&self) -> &Vec<ParkingLot>[src]

pub fn all_zones(&self) -> &Vec<Zone>[src]

pub fn maybe_get_r(&self, id: RoadID) -> Option<&Road>[src]

pub fn maybe_get_l(&self, id: LaneID) -> Option<&Lane>[src]

pub fn maybe_get_i(&self, id: IntersectionID) -> Option<&Intersection>[src]

pub fn maybe_get_t(&self, id: TurnID) -> Option<&Turn>[src]

pub fn maybe_get_b(&self, id: BuildingID) -> Option<&Building>[src]

pub fn maybe_get_pl(&self, id: ParkingLotID) -> Option<&ParkingLot>[src]

pub fn maybe_get_a(&self, id: AreaID) -> Option<&Area>[src]

pub fn maybe_get_bs(&self, id: BusStopID) -> Option<&BusStop>[src]

pub fn maybe_get_stop_sign(
    &self,
    id: IntersectionID
) -> Option<&ControlStopSign>
[src]

pub fn maybe_get_traffic_signal(
    &self,
    id: IntersectionID
) -> Option<&ControlTrafficSignal>
[src]

pub fn maybe_get_br(&self, route: BusRouteID) -> Option<&BusRoute>[src]

pub fn get_r(&self, id: RoadID) -> &Road[src]

pub fn get_l(&self, id: LaneID) -> &Lane[src]

pub fn get_i(&self, id: IntersectionID) -> &Intersection[src]

pub fn get_t(&self, id: TurnID) -> &Turn[src]

pub fn get_b(&self, id: BuildingID) -> &Building[src]

pub fn get_a(&self, id: AreaID) -> &Area[src]

pub fn get_pl(&self, id: ParkingLotID) -> &ParkingLot[src]

pub fn get_stop_sign(&self, id: IntersectionID) -> &ControlStopSign[src]

pub fn get_traffic_signal(&self, id: IntersectionID) -> &ControlTrafficSignal[src]

pub fn get_turns_in_intersection(&self, id: IntersectionID) -> Vec<&Turn>[src]

pub fn get_turns_from_lane(&self, l: LaneID) -> Vec<&Turn>[src]

The turns may belong to two different intersections!

pub fn get_turns_to_lane(&self, l: LaneID) -> Vec<&Turn>[src]

pub fn get_turn_between(
    &self,
    from: LaneID,
    to: LaneID,
    parent: IntersectionID
) -> Option<TurnID>
[src]

pub fn get_next_turns_and_lanes(
    &self,
    from: LaneID,
    parent: IntersectionID
) -> Vec<(&Turn, &Lane)>
[src]

pub fn get_turns_for(
    &self,
    from: LaneID,
    constraints: PathConstraints
) -> Vec<&Turn>
[src]

pub fn get_movements_for(
    &self,
    from: DirectedRoadID,
    constraints: PathConstraints
) -> Vec<MovementID>
[src]

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

pub fn get_next_roads(&self, from: RoadID) -> BTreeSet<RoadID>[src]

pub fn get_parent(&self, id: LaneID) -> &Road[src]

pub fn get_gps_bounds(&self) -> &GPSBounds[src]

pub fn get_bounds(&self) -> &Bounds[src]

pub fn get_city_name(&self) -> &CityName[src]

pub fn get_name(&self) -> &MapName[src]

pub fn all_bus_stops(&self) -> &BTreeMap<BusStopID, BusStop>[src]

pub fn get_bs(&self, stop: BusStopID) -> &BusStop[src]

pub fn get_br(&self, route: BusRouteID) -> &BusRoute[src]

pub fn all_bus_routes(&self) -> &Vec<BusRoute>[src]

pub fn get_bus_route(&self, name: &str) -> Option<&BusRoute>[src]

pub fn get_routes_serving_stop(&self, stop: BusStopID) -> Vec<&BusRoute>[src]

pub fn building_to_road(&self, id: BuildingID) -> &Road[src]

pub fn all_incoming_borders(&self) -> Vec<&Intersection>[src]

This and all_outgoing_borders are expensive to constantly repeat

pub fn all_outgoing_borders(&self) -> Vec<&Intersection>[src]

pub(crate) fn all_directed_roads_for(
    &self,
    constraints: PathConstraints
) -> Vec<DirectedRoadID>
[src]

Find all directed roads usable by somebody.

pub fn save(&self)[src]

pub fn find_driving_lane_near_building(&self, b: BuildingID) -> LaneID[src]

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.

pub fn get_boundary_polygon(&self) -> &Polygon[src]

pub fn pathfind(&self, req: PathRequest) -> Result<Path>[src]

pub fn pathfind_avoiding_roads(
    &self,
    req: PathRequest,
    avoid: BTreeSet<RoadID>
) -> Result<Path>
[src]

pub fn pathfind_with_params(
    &self,
    req: PathRequest,
    params: &RoutingParams
) -> Result<Path>
[src]

pub fn should_use_transit(
    &self,
    start: Position,
    end: Position
) -> Option<(BusStopID, Option<BusStopID>, BusRouteID)>
[src]

pub fn get_movement(&self, t: TurnID) -> Option<MovementID>[src]

pub fn find_r_by_osm_id(&self, id: OriginalRoad) -> Result<RoadID>[src]

pub fn find_i_by_osm_id(&self, id: NodeID) -> Result<IntersectionID>[src]

pub fn find_b_by_osm_id(&self, id: OsmID) -> Option<BuildingID>[src]

pub fn find_br(&self, id: RelationID) -> Option<BusRouteID>[src]

pub fn hack_override_offstreet_spots(&mut self, spots_per_bldg: usize)[src]

pub fn hack_override_offstreet_spots_individ(
    &mut self,
    b: BuildingID,
    spots: usize
)
[src]

pub fn hack_override_bldg_type(
    &mut self,
    b: BuildingID,
    bldg_type: BuildingType
)
[src]

pub fn hack_override_orig_spawn_times(
    &mut self,
    br: BusRouteID,
    times: Vec<Time>
)
[src]

pub fn hack_add_area(
    &mut self,
    area_type: AreaType,
    polygon: Polygon,
    osm_tags: Tags
)
[src]

pub fn hack_override_routing_params(
    &mut self,
    routing_params: RoutingParams,
    timer: &mut Timer<'_>
)
[src]

pub fn get_languages(&self) -> BTreeSet<&str>[src]

pub fn get_config(&self) -> &MapConfig[src]

pub fn simple_path_btwn(
    &self,
    i1: IntersectionID,
    i2: IntersectionID
) -> Option<Vec<RoadID>>
[src]

Simple search along undirected roads

pub fn routing_params(&self) -> &RoutingParams[src]

Returns the routing params baked into the map.

Trait Implementations

impl<'de> Deserialize<'de> for Map[src]

impl Serialize for Map[src]

Auto Trait Implementations

impl RefUnwindSafe for Map

impl Send for Map

impl Sync for Map

impl Unpin for Map

impl UnwindSafe for Map

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,