Refactor RawMap saving

This commit is contained in:
Dustin Carlino 2020-09-22 15:49:02 -07:00
parent 66220e0a57
commit 8faab3592a
8 changed files with 15 additions and 17 deletions

View File

@ -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.

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();

View File

@ -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.

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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