mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 23:15:24 +03:00
Refactor RawMap saving
This commit is contained in:
parent
66220e0a57
commit
8faab3592a
@ -79,8 +79,7 @@ pub fn osm_to_raw(name: &str, timer: &mut Timer, config: &ImporterConfiguration)
|
||||
},
|
||||
timer,
|
||||
);
|
||||
let output = abstutil::path(format!("input/raw_maps/{}.bin", name));
|
||||
abstutil::write_binary(output, &map);
|
||||
map.save();
|
||||
}
|
||||
|
||||
// Modify the filtered KML of planning areas with the number of residents from a different dataset.
|
||||
|
@ -42,6 +42,5 @@ pub fn osm_to_raw(name: &str, timer: &mut abstutil::Timer, config: &ImporterConf
|
||||
},
|
||||
timer,
|
||||
);
|
||||
let output = abstutil::path(format!("input/raw_maps/{}.bin", name));
|
||||
abstutil::write_binary(output, &map);
|
||||
map.save();
|
||||
}
|
||||
|
@ -41,6 +41,5 @@ pub fn osm_to_raw(name: &str, timer: &mut abstutil::Timer, config: &ImporterConf
|
||||
},
|
||||
timer,
|
||||
);
|
||||
let output = abstutil::path(format!("input/raw_maps/{}.bin", name));
|
||||
abstutil::write_binary(output, &map);
|
||||
map.save();
|
||||
}
|
||||
|
@ -225,11 +225,8 @@ fn oneshot(osm_path: String, clip: Option<String>, drive_on_right: bool, build_c
|
||||
},
|
||||
&mut timer,
|
||||
);
|
||||
|
||||
// Often helpful to save intermediate representation in case user
|
||||
// wants to load into map_editor
|
||||
abstutil::write_binary(abstutil::path_raw_map(&name), &raw);
|
||||
|
||||
// Often helpful to save intermediate representation in case user wants to load into map_editor
|
||||
raw.save();
|
||||
let map = map_model::Map::create_from_raw(raw, build_ch, &mut timer);
|
||||
timer.start("save map");
|
||||
map.save();
|
||||
|
@ -102,8 +102,7 @@ pub fn osm_to_raw(name: &str, timer: &mut abstutil::Timer, config: &ImporterConf
|
||||
},
|
||||
timer,
|
||||
);
|
||||
let output = abstutil::path(format!("input/raw_maps/{}.bin", name));
|
||||
abstutil::write_binary(output, &map);
|
||||
map.save();
|
||||
}
|
||||
|
||||
// Download and pre-process data needed to generate Seattle scenarios.
|
||||
|
@ -41,6 +41,5 @@ pub fn osm_to_raw(name: &str, timer: &mut abstutil::Timer, config: &ImporterConf
|
||||
},
|
||||
timer,
|
||||
);
|
||||
let output = abstutil::path(format!("input/raw_maps/{}.bin", name));
|
||||
abstutil::write_binary(output, &map);
|
||||
map.save();
|
||||
}
|
||||
|
@ -38,6 +38,5 @@ pub fn osm_to_raw(name: &str, timer: &mut abstutil::Timer, config: &ImporterConf
|
||||
},
|
||||
timer,
|
||||
);
|
||||
let output = abstutil::path(format!("input/raw_maps/{}.bin", name));
|
||||
abstutil::write_binary(output, &map);
|
||||
map.save();
|
||||
}
|
||||
|
@ -171,6 +171,13 @@ impl RawMap {
|
||||
debug,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn save(&self) {
|
||||
abstutil::write_binary(
|
||||
abstutil::path(format!("input/raw_maps/{}.bin", self.name)),
|
||||
self,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Mutations and supporting queries
|
||||
|
Loading…
Reference in New Issue
Block a user