Optionally skip removing disconnected streets from the graph. For osm2streets tests, often our small clipped area looks very disconnected. https://github.com/a-b-street/osm2streets/issues/8

This commit is contained in:
Dustin Carlino 2022-05-21 13:20:57 +01:00
parent 150ec77f85
commit 8b71885b04
3 changed files with 8 additions and 3 deletions

View File

@ -270,7 +270,7 @@ impl State<App> for MainState {
}
"simplify RawMap" => {
ctx.loading_screen("simplify", |ctx, timer| {
app.model.map.run_all_simplifications(false, timer);
app.model.map.run_all_simplifications(false, true, timer);
app.model.recreate_world(ctx, timer);
});
}

View File

@ -43,7 +43,7 @@ pub struct RawToMapOptions {
impl Map {
pub fn create_from_raw(mut raw: RawMap, opts: RawToMapOptions, timer: &mut Timer) -> Map {
raw.run_all_simplifications(opts.consolidate_all_intersections, timer);
raw.run_all_simplifications(opts.consolidate_all_intersections, true, timer);
timer.start("raw_map to InitialMap");
let gps_bounds = raw.gps_bounds.clone();

View File

@ -11,6 +11,8 @@ mod shrink_roads;
mod snappy;
impl RawMap {
// TODO I suspect we'll soon take a full struct of options, maybe even a list of transformation
// enums to run in order
/// Run a sequence of transformations to the RawMap before converting it to a full Map.
///
/// We don't want to run these during the OSM->RawMap import stage, because we want to use the
@ -18,6 +20,7 @@ impl RawMap {
pub fn run_all_simplifications(
&mut self,
consolidate_all_intersections: bool,
remove_disconnected: bool,
timer: &mut Timer,
) {
timer.start("simplify RawMap");
@ -36,7 +39,9 @@ impl RawMap {
collapse_intersections::trim_deadends(self);
timer.stop("trimming dead-end cycleways (round 2)");
remove_disconnected::remove_disconnected_roads(self, timer);
if remove_disconnected {
remove_disconnected::remove_disconnected_roads(self, timer);
}
timer.start("merging short roads");
find_short_roads::find_short_roads(self, consolidate_all_intersections);