mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 00:12:55 +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 abstutil::{retain_btreemap, Timer};
|
||||||
use clipping::CPolygon;
|
use clipping::CPolygon;
|
||||||
use geom::{GPSBounds, PolyLine, Polygon, Pt2D};
|
use geom::{PolyLine, Polygon, Pt2D};
|
||||||
use map_model::{raw_data, IntersectionType};
|
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");
|
timer.start("clipping map to boundary");
|
||||||
let bounds = map.get_gps_bounds();
|
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;
|
map.areas = result_areas;
|
||||||
|
|
||||||
timer.stop("clipping map to boundary");
|
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 {
|
pub fn convert(flags: &Flags, timer: &mut abstutil::Timer) -> raw_data::Map {
|
||||||
let elevation = Elevation::new(&flags.elevation).expect("loading .hgt failed");
|
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(
|
let mut map =
|
||||||
osm::osm_to_raw_roads(&flags.osm, timer),
|
split_ways::split_up_roads(osm::osm_to_raw_roads(&flags.osm, timer), &elevation, timer);
|
||||||
boundary_polygon,
|
map.boundary_polygon = read_osmosis_polygon(&flags.clip);
|
||||||
&elevation,
|
clip::clip_map(&mut map, timer);
|
||||||
timer,
|
|
||||||
);
|
|
||||||
let gps_bounds = clip::clip_map(&mut map, timer);
|
|
||||||
remove_disconnected::remove_disconnected_roads(&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 {
|
if flags.fast_dev {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
// Do this after removing stuff.
|
||||||
|
let gps_bounds = map.get_gps_bounds();
|
||||||
|
|
||||||
if !flags.residential_buildings.is_empty() {
|
if !flags.residential_buildings.is_empty() {
|
||||||
handle_residences(&mut map, &gps_bounds, &flags.residential_buildings, timer);
|
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::Building>,
|
||||||
Vec<raw_data::Area>,
|
Vec<raw_data::Area>,
|
||||||
),
|
),
|
||||||
boundary_polygon: Vec<LonLat>,
|
|
||||||
elevation: &srtm::Elevation,
|
elevation: &srtm::Elevation,
|
||||||
timer: &mut Timer,
|
timer: &mut Timer,
|
||||||
) -> raw_data::Map {
|
) -> raw_data::Map {
|
||||||
@ -61,7 +60,6 @@ pub fn split_up_roads(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut map = raw_data::Map::blank();
|
let mut map = raw_data::Map::blank();
|
||||||
map.boundary_polygon = boundary_polygon;
|
|
||||||
map.buildings = buildings;
|
map.buildings = buildings;
|
||||||
map.areas = areas;
|
map.areas = areas;
|
||||||
// All of the roundabout points will just keep moving the intersection
|
// All of the roundabout points will just keep moving the intersection
|
||||||
|
Loading…
Reference in New Issue
Block a user