mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 17:37:22 +03:00
slight fixup to drawmap ctor
This commit is contained in:
parent
8e1af1f4ea
commit
2eb0193fb3
@ -95,11 +95,10 @@ wait slow down even more -- before any of this change, lanes on adjacent roads s
|
||||
---> option 1: module per object type, geometry and graph squished together
|
||||
- option 2: try to separate the graph/geom stuff within map model.
|
||||
- CLEANUP: no more 'extern crate' in non lib
|
||||
|
||||
|
||||
- CLEANUP: gps to screen in map upfront, dont plumb along gps pts for bldg/parcel/etc, so bounds should become private.
|
||||
- pt2d should no longer represent gps
|
||||
|
||||
|
||||
- CLEANUP: bldg front path should happen upfront, not in render
|
||||
- THEN: express the proto -> runtime map loading as a sequence of phases
|
||||
- keep doing the current road trimming for the moment
|
||||
|
@ -27,9 +27,7 @@ pub struct DrawMap {
|
||||
|
||||
impl DrawMap {
|
||||
// Also returns the center of the map in map-space
|
||||
pub fn new(map: &Map) -> (DrawMap, Bounds, Pt2D) {
|
||||
let bounds = map.get_gps_bounds();
|
||||
|
||||
pub fn new(map: &Map) -> (DrawMap, Pt2D) {
|
||||
let mut roads: Vec<DrawRoad> = Vec::new();
|
||||
for r in map.all_roads() {
|
||||
roads.push(DrawRoad::new(r));
|
||||
@ -74,6 +72,7 @@ impl DrawMap {
|
||||
.collect();
|
||||
|
||||
// min_y here due to the wacky y inversion
|
||||
let bounds = map.get_gps_bounds();
|
||||
let max_screen_pt =
|
||||
geometry::gps_to_screen_space(&Pt2D::new(bounds.max_x, bounds.min_y), &bounds);
|
||||
let map_bbox = Rect {
|
||||
@ -119,7 +118,6 @@ impl DrawMap {
|
||||
buildings_quadtree,
|
||||
parcels_quadtree,
|
||||
},
|
||||
bounds,
|
||||
Pt2D::new(max_screen_pt.x() / 2.0, max_screen_pt.y() / 2.0),
|
||||
)
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ impl UI {
|
||||
println!("Opening {}", abst_path);
|
||||
let data = map_model::load_pb(abst_path).expect("Couldn't load pb");
|
||||
let map = map_model::Map::new(&data);
|
||||
let (draw_map, _, center_pt) = render::DrawMap::new(&map);
|
||||
let (draw_map, center_pt) = render::DrawMap::new(&map);
|
||||
let control_map = ControlMap::new(&map);
|
||||
|
||||
let steepness_viz = SteepnessVisualizer::new(&map);
|
||||
|
Loading…
Reference in New Issue
Block a user