Don't draw building paths in the OSM viewer. They're messy and don't reveal anything semantically interesting, whereas in A/B Street it's kind of important to see which road a trip will begin/end at for buildings on corners

This commit is contained in:
Dustin Carlino 2020-10-28 12:17:05 -07:00
parent 0167b4be31
commit 37896c9d37
4 changed files with 26 additions and 19 deletions

View File

@ -221,7 +221,9 @@ impl App {
match obj.get_id() {
ID::Building(_) => {
if !drawn_all_buildings {
g.redraw(&draw_map.draw_all_building_paths);
if opts.show_building_paths {
g.redraw(&draw_map.draw_all_building_paths);
}
g.redraw(&draw_map.draw_all_buildings);
g.redraw(&draw_map.draw_all_building_outlines);
drawn_all_buildings = true;

View File

@ -4,16 +4,17 @@ use abstutil::{prettyprint_usize, Counter};
use geom::ArrowCap;
use map_model::osm;
use widgetry::{
lctrl, Btn, Checkbox, Color, Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key,
Line, Outcome, Panel, State, Text, TextExt, VerticalAlignment, Widget,
lctrl, Btn, Checkbox, Color, DrawBaselayer, Drawable, EventCtx, GeomBatch, GfxCtx,
HorizontalAlignment, Key, Line, Outcome, Panel, State, Text, TextExt, VerticalAlignment,
Widget,
};
use crate::app::App;
use crate::app::{App, ShowEverything};
use crate::common::{CityPicker, Minimap, Navigator};
use crate::game::{PopupMsg, Transition};
use crate::helpers::{nice_map_name, open_browser, ID};
use crate::options::OptionsPanel;
use crate::render::BIG_ARROW_THICKNESS;
use crate::render::{DrawOptions, BIG_ARROW_THICKNESS};
use crate::sandbox::TurnExplorer;
pub struct Viewer {
@ -334,7 +335,15 @@ impl State<App> for Viewer {
Transition::Keep
}
fn draw_baselayer(&self) -> DrawBaselayer {
DrawBaselayer::Custom
}
fn draw(&self, g: &mut GfxCtx, app: &App) {
let mut opts = DrawOptions::new();
opts.show_building_paths = false;
app.draw(g, opts, &ShowEverything::new());
self.top_panel.draw(g);
self.minimap.draw(g, app);
if let Some(ref d) = self.fixed_object_outline {

View File

@ -68,19 +68,23 @@ fn draw_vehicle(
}
}
// TODO Borrow, don't clone, and fix up lots of places storing indirect things to populate
// DrawOptions.
#[derive(Clone)]
/// Control how the map is drawn.
pub struct DrawOptions {
/// Don't draw the current traffic signal state.
pub suppress_traffic_signal_details: Vec<IntersectionID>,
/// Label every building.
pub label_buildings: bool,
/// Draw building paths.
pub show_building_paths: bool,
}
impl DrawOptions {
/// Default options for drawing a map.
pub fn new() -> DrawOptions {
DrawOptions {
suppress_traffic_signal_details: Vec::new(),
label_buildings: false,
show_building_paths: true,
}
}
}

View File

@ -7,16 +7,14 @@ use geom::{Distance, PolyLine, Polygon, Time};
use map_model::{osm, BuildingID, BuildingType, IntersectionID, LaneID, Map, RoadID, TurnType};
use sim::{TripEndpoint, TripInfo, TripMode};
use widgetry::{
Btn, Checkbox, Color, DrawBaselayer, Drawable, EventCtx, GeomBatch, GfxCtx,
HorizontalAlignment, Key, Line, Outcome, Panel, RewriteColor, Slider, State, Text, TextExt,
VerticalAlignment, Widget,
Btn, Checkbox, Color, Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key, Line,
Outcome, Panel, RewriteColor, Slider, State, Text, TextExt, VerticalAlignment, Widget,
};
use crate::app::{App, ShowEverything};
use crate::app::App;
use crate::common::{ColorLegend, CommonState};
use crate::game::Transition;
use crate::helpers::checkbox_per_mode;
use crate::render::DrawOptions;
pub struct CommuterPatterns {
bldg_to_block: HashMap<BuildingID, BlockID>,
@ -442,13 +440,7 @@ impl State<App> for CommuterPatterns {
Transition::Keep
}
fn draw_baselayer(&self) -> DrawBaselayer {
DrawBaselayer::Custom
}
fn draw(&self, g: &mut GfxCtx, app: &App) {
app.draw(g, DrawOptions::new(), &ShowEverything::new());
g.redraw(&self.draw_all_blocks);
g.redraw(&self.current_block.1);