mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 06:55:40 +03:00
Start a tool to compress Map files by removing information unnecessary to the bike network tool. #746
Just a modest start, switching from CHs to Dijkstra's for pathfinding. Not uploading the minified result yet.
This commit is contained in:
parent
1c756befa8
commit
f83168184d
15
importer/src/bin/minify_map.rs
Normal file
15
importer/src/bin/minify_map.rs
Normal file
@ -0,0 +1,15 @@
|
||||
//! Removes nonessential parts of a Map, for the bike network tool.
|
||||
|
||||
use abstutil::{CmdArgs, Timer};
|
||||
use map_model::Map;
|
||||
|
||||
fn main() {
|
||||
let mut args = CmdArgs::new();
|
||||
let mut timer = Timer::new("minify map");
|
||||
let mut map = Map::load_synchronously(args.required_free(), &mut timer);
|
||||
args.done();
|
||||
|
||||
map.minify(&mut timer);
|
||||
// This also changes the name, so this won't overwrite anything
|
||||
map.save();
|
||||
}
|
@ -818,4 +818,18 @@ impl Map {
|
||||
&& from.get_detailed_rank() < to.get_detailed_rank()
|
||||
&& self.get_i(from.common_endpt(to)).is_stop_sign()
|
||||
}
|
||||
|
||||
/// Modifies the map in-place, removing parts not essential for the bike network tool. Also
|
||||
/// modifies the name.
|
||||
pub fn minify(&mut self, timer: &mut Timer) {
|
||||
self.name.map = format!("minified_{}", self.name.map);
|
||||
|
||||
// Don't need CHs
|
||||
self.pathfinder = Pathfinder::new(
|
||||
self,
|
||||
self.routing_params().clone(),
|
||||
crate::pathfind::CreateEngine::Dijkstra,
|
||||
timer,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user