mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-26 16:02:23 +03:00
recalculate bounds after clipping and removing stuff. neighborhoods break otherwise.
This commit is contained in:
parent
05e1398a3d
commit
0d107df0da
@ -1,9 +1,9 @@
|
||||
use abstutil::{retain_btreemap, Timer};
|
||||
use clipping::CPolygon;
|
||||
use geom::{GPSBounds, PolyLine, Polygon, Pt2D};
|
||||
use geom::{PolyLine, Polygon, Pt2D};
|
||||
use map_model::{raw_data, IntersectionType};
|
||||
|
||||
pub fn clip_map(map: &mut raw_data::Map, timer: &mut Timer) -> GPSBounds {
|
||||
pub fn clip_map(map: &mut raw_data::Map, timer: &mut Timer) {
|
||||
timer.start("clipping map to boundary");
|
||||
let bounds = map.get_gps_bounds();
|
||||
|
||||
@ -127,5 +127,4 @@ pub fn clip_map(map: &mut raw_data::Map, timer: &mut Timer) -> GPSBounds {
|
||||
map.areas = result_areas;
|
||||
|
||||
timer.stop("clipping map to boundary");
|
||||
bounds
|
||||
}
|
||||
|
@ -64,22 +64,18 @@ pub struct Flags {
|
||||
|
||||
pub fn convert(flags: &Flags, timer: &mut abstutil::Timer) -> raw_data::Map {
|
||||
let elevation = Elevation::new(&flags.elevation).expect("loading .hgt failed");
|
||||
let boundary_polygon = read_osmosis_polygon(&flags.clip);
|
||||
|
||||
let mut map = split_ways::split_up_roads(
|
||||
osm::osm_to_raw_roads(&flags.osm, timer),
|
||||
boundary_polygon,
|
||||
&elevation,
|
||||
timer,
|
||||
);
|
||||
let gps_bounds = clip::clip_map(&mut map, timer);
|
||||
let mut map =
|
||||
split_ways::split_up_roads(osm::osm_to_raw_roads(&flags.osm, timer), &elevation, timer);
|
||||
map.boundary_polygon = read_osmosis_polygon(&flags.clip);
|
||||
clip::clip_map(&mut map, timer);
|
||||
remove_disconnected::remove_disconnected_roads(&mut map, timer);
|
||||
// TODO Shouldn't we recalculate the gps_bounds after removing stuff? Or just base it off the
|
||||
// boundary polygon?
|
||||
|
||||
if flags.fast_dev {
|
||||
return map;
|
||||
}
|
||||
// Do this after removing stuff.
|
||||
let gps_bounds = map.get_gps_bounds();
|
||||
|
||||
if !flags.residential_buildings.is_empty() {
|
||||
handle_residences(&mut map, &gps_bounds, &flags.residential_buildings, timer);
|
||||
|
@ -10,7 +10,6 @@ pub fn split_up_roads(
|
||||
Vec<raw_data::Building>,
|
||||
Vec<raw_data::Area>,
|
||||
),
|
||||
boundary_polygon: Vec<LonLat>,
|
||||
elevation: &srtm::Elevation,
|
||||
timer: &mut Timer,
|
||||
) -> raw_data::Map {
|
||||
@ -61,7 +60,6 @@ pub fn split_up_roads(
|
||||
}
|
||||
|
||||
let mut map = raw_data::Map::blank();
|
||||
map.boundary_polygon = boundary_polygon;
|
||||
map.buildings = buildings;
|
||||
map.areas = areas;
|
||||
// All of the roundabout points will just keep moving the intersection
|
||||
|
Loading…
Reference in New Issue
Block a user