pub struct MapEdits {
pub edits_name: String,
pub commands: Vec<EditCmd>,
pub merge_zones: bool,
pub changed_roads: BTreeSet<RoadID>,
pub original_intersections: BTreeMap<IntersectionID, EditIntersection>,
pub original_crosswalks: BTreeMap<IntersectionID, EditCrosswalks>,
pub changed_routes: BTreeSet<TransitRouteID>,
pub proposal_description: Vec<String>,
pub proposal_link: Option<String>,
}
Expand description
Represents changes to a map. Note this isn’t serializable – that’s what PermanentMapEdits
does.
Fields
edits_name: String
commands: Vec<EditCmd>
A stack, oldest edit is first. The same intersection may be edited multiple times in this stack, until compress() happens.
merge_zones: bool
If false, adjacent roads with the same AccessRestrictions will not be merged into the same Zone; every Road will be its own Zone. This is used to experiment with a per-road cap. Note this is a map-wide setting.
changed_roads: BTreeSet<RoadID>
Derived from commands, kept up to date by update_derived
original_intersections: BTreeMap<IntersectionID, EditIntersection>
original_crosswalks: BTreeMap<IntersectionID, EditCrosswalks>
changed_routes: BTreeSet<TransitRouteID>
proposal_description: Vec<String>
Some edits are included in the game by default, in data/system/proposals, as “community proposals.” They require a description and may have a link to a write-up.
proposal_link: Option<String>
Implementations
sourceimpl MapEdits
impl MapEdits
sourcepub fn to_permanent(&self, map: &Map) -> PermanentMapEdits
pub fn to_permanent(&self, map: &Map) -> PermanentMapEdits
Encode the edits in a permanent format, referring to more-stable OSM IDs.
sourceimpl MapEdits
impl MapEdits
pub(crate) fn new() -> MapEdits
sourcepub fn load_from_file(
map: &Map,
path: String,
timer: &mut Timer<'_>
) -> Result<MapEdits>
pub fn load_from_file(
map: &Map,
path: String,
timer: &mut Timer<'_>
) -> Result<MapEdits>
Load map edits from a JSON file. Strip out any commands that’re broken because they don’t match the current map. If the resulting edits are totally empty, consider that a failure – the edits likely don’t cover this map at all.
sourcepub fn load_from_bytes(map: &Map, bytes: Vec<u8>) -> Result<MapEdits>
pub fn load_from_bytes(map: &Map, bytes: Vec<u8>) -> Result<MapEdits>
Load map edits from the given JSON bytes. Strip out any commands that’re broken because they don’t match the current map. If the resulting edits are totally empty, consider that a failure – the edits likely don’t cover this map at all.
fn save(&self, map: &Map)
fn update_derived(&mut self, map: &Map)
sourcepub fn changed_lanes(&self, map: &Map) -> (BTreeSet<LaneID>, BTreeSet<RoadID>)
pub fn changed_lanes(&self, map: &Map) -> (BTreeSet<LaneID>, BTreeSet<RoadID>)
Pick apart changed_roads and figure out if an entire road was edited, or just a few lanes. Doesn’t return deleted lanes.
sourcepub fn get_checksum(&self, map: &Map) -> String
pub fn get_checksum(&self, map: &Map) -> String
Produces an md5sum of the contents of the edits.
Trait Implementations
impl StructuralPartialEq for MapEdits
Auto Trait Implementations
impl RefUnwindSafe for MapEdits
impl Send for MapEdits
impl Sync for MapEdits
impl Unpin for MapEdits
impl UnwindSafe for MapEdits
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more