improving debugging of extra shapes

This commit is contained in:
Dustin Carlino 2018-10-30 13:23:19 -07:00
parent a6bc3ed2a0
commit de8f6760b6
3 changed files with 12 additions and 16 deletions

View File

@ -132,5 +132,5 @@ fn parse_pt(input: &str, gps_bounds: &GPSBounds) -> Option<Pt2D> {
// TODO only for Street_Signs.kml; this is temporary to explore stuff
fn is_interesting_sign(attributes: &BTreeMap<String, String>) -> bool {
attributes.get("CATEGORY") == Some(&"REGMIS".to_string())
true || attributes.get("CATEGORY") == Some(&"REGMIS".to_string())
}

View File

@ -31,7 +31,7 @@ impl ID {
}
}
pub fn debug(&self, map: &Map, control_map: &ControlMap, sim: &mut Sim) {
pub fn debug(&self, map: &Map, control_map: &ControlMap, sim: &mut Sim, draw_map: &DrawMap) {
match *self {
ID::Lane(id) => {
map.get_l(id).dump_debug();
@ -57,7 +57,11 @@ impl ID {
ID::Pedestrian(id) => {
sim.debug_ped(id);
}
ID::ExtraShape(_) => {}
ID::ExtraShape(_) => {
for line in draw_map.get_obj(*self).tooltip_lines(map).into_iter() {
println!("{}", line);
}
}
ID::Parcel(id) => {
map.get_p(id).dump_debug();
}

View File

@ -17,15 +17,7 @@ impl DebugObjectsState {
impl Plugin for DebugObjectsState {
fn event(&mut self, ctx: PluginCtx) -> bool {
let (selected, input, map, sim, control_map) = (
ctx.primary.current_selection,
ctx.input,
&ctx.primary.map,
&mut ctx.primary.sim,
&ctx.primary.control_map,
);
let new_state = if let Some(id) = selected {
let new_state = if let Some(id) = ctx.primary.current_selection {
// Don't break out of the tooltip state
if let DebugObjectsState::Tooltip(_) = self {
DebugObjectsState::Tooltip(id)
@ -41,14 +33,14 @@ impl Plugin for DebugObjectsState {
match self {
DebugObjectsState::Empty => {}
DebugObjectsState::Selected(id) => {
if input.key_pressed(Key::LCtrl, &format!("Hold Ctrl to show {:?}'s tooltip", id)) {
if ctx.input.key_pressed(Key::LCtrl, &format!("Hold Ctrl to show {:?}'s tooltip", id)) {
new_state = Some(DebugObjectsState::Tooltip(*id));
} else if input.key_pressed(Key::D, "debug") {
id.debug(map, control_map, sim);
} else if ctx.input.key_pressed(Key::D, "debug") {
id.debug(&ctx.primary.map, &ctx.primary.control_map, &mut ctx.primary.sim, &ctx.primary.draw_map);
}
}
DebugObjectsState::Tooltip(id) => {
if input.key_released(Key::LCtrl) {
if ctx.input.key_released(Key::LCtrl) {
new_state = Some(DebugObjectsState::Selected(*id));
}
}