mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-28 08:53:26 +03:00
passing ctx to both plugins and renderers, so we can debug lanes
This commit is contained in:
parent
269642a984
commit
008c63cd1a
@ -995,7 +995,9 @@ Alright, replan yet again.
|
||||
|
||||
- deal with overlapping keys that still kinda happen (sim ctrl, escape game)
|
||||
- bug: do need to recalculate current_selection whenever anything potentially changes camera, like follow
|
||||
- then rethink colors, with simplified single plugin
|
||||
- plugin trait, color(id) -> Option<Color>. parallel list of box plugins (or, a fxn that takes the idx)
|
||||
= then rethink colors, with simplified single plugin
|
||||
= plugin trait, color(id) -> Option<Color>. parallel list of box plugins (or, a fxn that takes the idx)
|
||||
- refactor to one color_blah method
|
||||
- handle the two color things... just buildings?
|
||||
- and see how much boilerplate a new type would need, by adding bus stops and water/parks
|
||||
- consider merging control map into map
|
||||
|
@ -1,5 +1,8 @@
|
||||
use colors::ColorScheme;
|
||||
use control::ControlMap;
|
||||
use ezgui::Canvas;
|
||||
use kml::ExtraShapeID;
|
||||
use map_model::{BuildingID, IntersectionID, LaneID, ParcelID, TurnID};
|
||||
use map_model::{BuildingID, IntersectionID, LaneID, Map, ParcelID, TurnID};
|
||||
use sim::{CarID, PedestrianID};
|
||||
|
||||
#[derive(Clone, Copy, Hash, PartialEq, Eq, Debug)]
|
||||
@ -13,3 +16,11 @@ pub enum ID {
|
||||
ExtraShape(ExtraShapeID),
|
||||
Parcel(ParcelID),
|
||||
}
|
||||
|
||||
// For plugins and rendering. Not sure what module this should live in, here seems fine.
|
||||
pub struct Ctx<'a> {
|
||||
pub cs: &'a ColorScheme,
|
||||
pub map: &'a Map,
|
||||
pub control_map: &'a ControlMap,
|
||||
pub canvas: &'a Canvas,
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
use colors::Colors;
|
||||
use ezgui::UserInput;
|
||||
use graphics::types::Color;
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use piston::input::Key;
|
||||
use plugins::{Colorizer, Ctx};
|
||||
use plugins::Colorizer;
|
||||
|
||||
// TODO have some UI for editing these rules and saving them
|
||||
pub struct OsmClassifier {
|
||||
|
@ -4,9 +4,9 @@ use colors::Colors;
|
||||
use ezgui::UserInput;
|
||||
use graphics::types::Color;
|
||||
use map_model::{LaneID, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use piston::input::Key;
|
||||
use plugins::{Colorizer, Ctx};
|
||||
use plugins::Colorizer;
|
||||
use std::collections::{HashSet, VecDeque};
|
||||
|
||||
// Keeps track of state so this can be interactively visualized
|
||||
|
@ -16,20 +16,11 @@ pub mod turn_colors;
|
||||
pub mod turn_cycler;
|
||||
pub mod warp;
|
||||
|
||||
use colors::ColorScheme;
|
||||
use control::ControlMap;
|
||||
use graphics::types::Color;
|
||||
use map_model::Map;
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
|
||||
pub trait Colorizer {
|
||||
fn color_for(&self, _obj: ID, _ctx: Ctx) -> Option<Color> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Ctx<'a> {
|
||||
pub cs: &'a ColorScheme,
|
||||
pub map: &'a Map,
|
||||
pub control_map: &'a ControlMap,
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
use colors::{ColorScheme, Colors};
|
||||
use ezgui::{TextBox, UserInput};
|
||||
use graphics::types::Color;
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use piston::input::Key;
|
||||
use plugins::{Colorizer, Ctx};
|
||||
use plugins::Colorizer;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
pub enum SearchState {
|
||||
|
@ -2,9 +2,9 @@ use colors::Colors;
|
||||
use ezgui::UserInput;
|
||||
use graphics::types::Color;
|
||||
use map_model::LaneID;
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use piston::input::Key;
|
||||
use plugins::{Colorizer, Ctx};
|
||||
use plugins::Colorizer;
|
||||
use sim::{AgentID, Sim};
|
||||
use std::collections::HashSet;
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
use ezgui::UserInput;
|
||||
use graphics::types::Color;
|
||||
use map_model::{Lane, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use piston::input::Key;
|
||||
use plugins::{Colorizer, Ctx};
|
||||
use plugins::Colorizer;
|
||||
use std::f64;
|
||||
|
||||
pub struct SteepnessVisualizer {
|
||||
|
@ -7,9 +7,9 @@ use ezgui::UserInput;
|
||||
use graphics::types::Color;
|
||||
use map_model::IntersectionID;
|
||||
use map_model::Map;
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use piston::input::Key;
|
||||
use plugins::{Colorizer, Ctx};
|
||||
use plugins::Colorizer;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub enum StopSignEditor {
|
||||
|
@ -7,9 +7,9 @@ use control::ControlMap;
|
||||
use ezgui::UserInput;
|
||||
use graphics::types::Color;
|
||||
use map_model::{IntersectionID, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use piston::input::Key;
|
||||
use plugins::{Colorizer, Ctx};
|
||||
use plugins::Colorizer;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub enum TrafficSignalEditor {
|
||||
|
@ -5,9 +5,9 @@ use control::ControlMap;
|
||||
use ezgui::{GfxCtx, UserInput};
|
||||
use graphics::types::Color;
|
||||
use map_model::{IntersectionID, LaneID, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use piston::input::Key;
|
||||
use plugins::{Colorizer, Ctx};
|
||||
use plugins::Colorizer;
|
||||
use render::DrawMap;
|
||||
use sim::Sim;
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright 2018 Google LLC, licensed under http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
use aabb_quadtree::geom::Rect;
|
||||
use colors::{ColorScheme, Colors};
|
||||
use colors::Colors;
|
||||
use ezgui::GfxCtx;
|
||||
use geom::{PolyLine, Polygon, Pt2D};
|
||||
use graphics;
|
||||
use map_model::{Building, BuildingID, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use render::{get_bbox, RenderOptions, Renderable, BUILDING_BOUNDARY_THICKNESS};
|
||||
use std::f64;
|
||||
|
||||
@ -40,13 +40,13 @@ impl Renderable for DrawBuilding {
|
||||
}
|
||||
|
||||
// TODO need two colors here
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, cs: &ColorScheme) {
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, ctx: Ctx) {
|
||||
//g.draw_polygon(boundary_color, &self.boundary_polygon);
|
||||
g.draw_polygon(opts.color, &self.fill_polygon);
|
||||
|
||||
// TODO tune width
|
||||
g.draw_line(
|
||||
&graphics::Line::new_round(cs.get(Colors::BuildingPath), 1.0),
|
||||
&graphics::Line::new_round(ctx.cs.get(Colors::BuildingPath), 1.0),
|
||||
self.front_path,
|
||||
);
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
use aabb_quadtree::geom::Rect;
|
||||
use colors::ColorScheme;
|
||||
use dimensioned::si;
|
||||
use ezgui::GfxCtx;
|
||||
use geom::{Polygon, Pt2D};
|
||||
use graphics;
|
||||
use map_model::{geometry, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use render::{get_bbox, RenderOptions, Renderable};
|
||||
use sim::{CarID, DrawCarInput};
|
||||
|
||||
@ -99,7 +98,7 @@ impl Renderable for DrawCar {
|
||||
ID::Car(self.id)
|
||||
}
|
||||
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, _cs: &ColorScheme) {
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, _ctx: Ctx) {
|
||||
g.draw_polygon(opts.color, &self.body_polygon);
|
||||
for p in &self.window_polygons {
|
||||
g.draw_polygon([0.0, 0.0, 0.0, 1.0], p);
|
||||
|
@ -1,10 +1,9 @@
|
||||
use aabb_quadtree::geom::Rect;
|
||||
use colors::ColorScheme;
|
||||
use ezgui::GfxCtx;
|
||||
use geom::{Polygon, Pt2D};
|
||||
use kml::{ExtraShape, ExtraShapeGeom, ExtraShapeID};
|
||||
use map_model::{geometry, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use render::{
|
||||
get_bbox, RenderOptions, Renderable, EXTRA_SHAPE_POINT_RADIUS, EXTRA_SHAPE_THICKNESS,
|
||||
};
|
||||
@ -45,7 +44,7 @@ impl Renderable for DrawExtraShape {
|
||||
ID::ExtraShape(self.id)
|
||||
}
|
||||
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, _cs: &ColorScheme) {
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, _ctx: Ctx) {
|
||||
match self.shape {
|
||||
Shape::Polygon(ref p) => g.draw_polygon(opts.color, &p),
|
||||
Shape::Circle(c) => g.draw_ellipse(opts.color, c),
|
||||
|
@ -1,14 +1,14 @@
|
||||
// Copyright 2018 Google LLC, licensed under http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
use aabb_quadtree::geom::Rect;
|
||||
use colors::{ColorScheme, Colors};
|
||||
use colors::Colors;
|
||||
use dimensioned::si;
|
||||
use ezgui::GfxCtx;
|
||||
use geom::{Line, Polygon, Pt2D};
|
||||
use graphics;
|
||||
use graphics::math::Vec2d;
|
||||
use map_model::{geometry, Intersection, IntersectionID, LaneType, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use render::{get_bbox, DrawLane, RenderOptions, Renderable};
|
||||
use std::f64;
|
||||
|
||||
@ -50,20 +50,20 @@ impl DrawIntersection {
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_stop_sign(&self, g: &mut GfxCtx, cs: &ColorScheme) {
|
||||
fn draw_stop_sign(&self, g: &mut GfxCtx, ctx: Ctx) {
|
||||
// TODO rotate it
|
||||
g.draw_polygon(
|
||||
cs.get(Colors::StopSignBackground),
|
||||
ctx.cs.get(Colors::StopSignBackground),
|
||||
&geometry::regular_polygon(self.center, 8, 1.5),
|
||||
);
|
||||
// TODO draw "STOP"
|
||||
}
|
||||
|
||||
fn draw_traffic_signal(&self, g: &mut GfxCtx, cs: &ColorScheme) {
|
||||
fn draw_traffic_signal(&self, g: &mut GfxCtx, ctx: Ctx) {
|
||||
let radius = 0.5;
|
||||
|
||||
g.draw_rectangle(
|
||||
cs.get(Colors::TrafficSignalBox),
|
||||
ctx.cs.get(Colors::TrafficSignalBox),
|
||||
[
|
||||
self.center.x() - (2.0 * radius),
|
||||
self.center.y() - (4.0 * radius),
|
||||
@ -73,17 +73,17 @@ impl DrawIntersection {
|
||||
);
|
||||
|
||||
g.draw_ellipse(
|
||||
cs.get(Colors::TrafficSignalYellow),
|
||||
ctx.cs.get(Colors::TrafficSignalYellow),
|
||||
geometry::make_circle(self.center, radius),
|
||||
);
|
||||
|
||||
g.draw_ellipse(
|
||||
cs.get(Colors::TrafficSignalGreen),
|
||||
ctx.cs.get(Colors::TrafficSignalGreen),
|
||||
geometry::make_circle(self.center.offset(0.0, radius * 2.0), radius),
|
||||
);
|
||||
|
||||
g.draw_ellipse(
|
||||
cs.get(Colors::TrafficSignalRed),
|
||||
ctx.cs.get(Colors::TrafficSignalRed),
|
||||
geometry::make_circle(self.center.offset(0.0, radius * -2.0), radius),
|
||||
);
|
||||
}
|
||||
@ -94,11 +94,11 @@ impl Renderable for DrawIntersection {
|
||||
ID::Intersection(self.id)
|
||||
}
|
||||
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, cs: &ColorScheme) {
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, ctx: Ctx) {
|
||||
g.draw_polygon(opts.color, &self.polygon);
|
||||
|
||||
let crosswalk_marking = graphics::Line::new(
|
||||
cs.get(Colors::Crosswalk),
|
||||
ctx.cs.get(Colors::Crosswalk),
|
||||
// TODO move this somewhere
|
||||
0.25,
|
||||
);
|
||||
@ -112,9 +112,9 @@ impl Renderable for DrawIntersection {
|
||||
}
|
||||
|
||||
if self.has_traffic_signal {
|
||||
self.draw_traffic_signal(g, cs);
|
||||
self.draw_traffic_signal(g, ctx);
|
||||
} else {
|
||||
self.draw_stop_sign(g, cs);
|
||||
self.draw_stop_sign(g, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
// Copyright 2018 Google LLC, licensed under http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
use aabb_quadtree::geom::Rect;
|
||||
use colors::{ColorScheme, Colors};
|
||||
use colors::Colors;
|
||||
use control::ControlMap;
|
||||
use dimensioned::si;
|
||||
use ezgui::{Canvas, GfxCtx};
|
||||
use ezgui::GfxCtx;
|
||||
use geom::{Line, Polygon, Pt2D};
|
||||
use graphics;
|
||||
use map_model;
|
||||
use map_model::{geometry, LaneID};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use render::{get_bbox, RenderOptions, Renderable, PARCEL_BOUNDARY_THICKNESS};
|
||||
|
||||
const MIN_ZOOM_FOR_LANE_MARKERS: f64 = 5.0;
|
||||
@ -88,14 +88,12 @@ impl DrawLane {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO can't easily call this with generic quadtree
|
||||
#[allow(dead_code)]
|
||||
fn draw_debug(&self, g: &mut GfxCtx, canvas: &Canvas, cs: &ColorScheme, l: &map_model::Lane) {
|
||||
fn draw_debug(&self, g: &mut GfxCtx, ctx: Ctx) {
|
||||
let line =
|
||||
graphics::Line::new_round(cs.get(Colors::Debug), PARCEL_BOUNDARY_THICKNESS / 2.0);
|
||||
let circle_color = cs.get(Colors::BrightDebug);
|
||||
graphics::Line::new_round(ctx.cs.get(Colors::Debug), PARCEL_BOUNDARY_THICKNESS / 2.0);
|
||||
let circle_color = ctx.cs.get(Colors::BrightDebug);
|
||||
|
||||
for pair in l.lane_center_pts.points().windows(2) {
|
||||
for pair in ctx.map.get_l(self.id).lane_center_pts.points().windows(2) {
|
||||
let (pt1, pt2) = (pair[0], pair[1]);
|
||||
g.draw_line(&line, [pt1.x(), pt1.y(), pt2.x(), pt2.y()]);
|
||||
g.draw_ellipse(circle_color, geometry::make_circle(pt1, 0.4));
|
||||
@ -103,7 +101,8 @@ impl DrawLane {
|
||||
}
|
||||
|
||||
for pt in &self.draw_id_at {
|
||||
canvas.draw_text_at(g, &vec![format!("{}", self.id.0)], pt.x(), pt.y());
|
||||
ctx.canvas
|
||||
.draw_text_at(g, &vec![format!("{}", self.id.0)], pt.x(), pt.y());
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,15 +121,15 @@ impl Renderable for DrawLane {
|
||||
ID::Lane(self.id)
|
||||
}
|
||||
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, cs: &ColorScheme) {
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, ctx: Ctx) {
|
||||
g.draw_polygon(opts.color, &self.polygon);
|
||||
|
||||
if opts.cam_zoom >= MIN_ZOOM_FOR_LANE_MARKERS {
|
||||
for m in &self.markings {
|
||||
let line = if m.round {
|
||||
graphics::Line::new_round(cs.get(m.color), m.thickness)
|
||||
graphics::Line::new_round(ctx.cs.get(m.color), m.thickness)
|
||||
} else {
|
||||
graphics::Line::new(cs.get(m.color), m.thickness)
|
||||
graphics::Line::new(ctx.cs.get(m.color), m.thickness)
|
||||
};
|
||||
for pts in &m.lines {
|
||||
g.draw_line(&line, *pts);
|
||||
@ -139,8 +138,7 @@ impl Renderable for DrawLane {
|
||||
}
|
||||
|
||||
if opts.debug_mode {
|
||||
// TODO Don't have canvas and map available in draw()...
|
||||
//self.draw_debug(g, canvas, cs, map.get_l(self.id));
|
||||
self.draw_debug(g, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,11 @@ mod pedestrian;
|
||||
mod turn;
|
||||
|
||||
use aabb_quadtree::geom::{Point, Rect};
|
||||
use colors::ColorScheme;
|
||||
use ezgui::GfxCtx;
|
||||
use geom::{Bounds, Pt2D};
|
||||
use graphics::types::Color;
|
||||
use map_model::{geometry, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
pub use render::car::DrawCar;
|
||||
pub use render::lane::DrawLane;
|
||||
pub use render::map::DrawMap;
|
||||
@ -50,7 +49,7 @@ pub fn get_bbox(b: &Bounds) -> Rect {
|
||||
|
||||
pub trait Renderable {
|
||||
fn get_id(&self) -> ID;
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, cs: &ColorScheme);
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, ctx: Ctx);
|
||||
// TODO Maybe return Bounds
|
||||
fn get_bbox(&self) -> Rect;
|
||||
fn contains_pt(&self, pt: Pt2D) -> bool;
|
||||
|
@ -1,11 +1,10 @@
|
||||
// Copyright 2018 Google LLC, licensed under http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
use aabb_quadtree::geom::Rect;
|
||||
use colors::ColorScheme;
|
||||
use ezgui::GfxCtx;
|
||||
use geom::{PolyLine, Polygon, Pt2D};
|
||||
use map_model::{Map, Parcel, ParcelID};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use render::{get_bbox, RenderOptions, Renderable, PARCEL_BOUNDARY_THICKNESS};
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -32,7 +31,7 @@ impl Renderable for DrawParcel {
|
||||
ID::Parcel(self.id)
|
||||
}
|
||||
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, _cs: &ColorScheme) {
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, _ctx: Ctx) {
|
||||
g.draw_polygon(opts.color, &self.fill_polygon);
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
use aabb_quadtree::geom::Rect;
|
||||
use colors::ColorScheme;
|
||||
use ezgui::GfxCtx;
|
||||
use geom::Pt2D;
|
||||
use graphics;
|
||||
use map_model::{geometry, Map};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use render::{RenderOptions, Renderable};
|
||||
use sim::{DrawPedestrianInput, PedestrianID};
|
||||
|
||||
@ -41,7 +40,7 @@ impl Renderable for DrawPedestrian {
|
||||
ID::Pedestrian(self.id)
|
||||
}
|
||||
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, _cs: &ColorScheme) {
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, _ctx: Ctx) {
|
||||
g.draw_ellipse(opts.color, self.circle);
|
||||
|
||||
// TODO tune color, sizes
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright 2018 Google LLC, licensed under http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
use aabb_quadtree::geom::Rect;
|
||||
use colors::{ColorScheme, Colors};
|
||||
use colors::Colors;
|
||||
use dimensioned::si;
|
||||
use ezgui::GfxCtx;
|
||||
use geom::Pt2D;
|
||||
@ -9,7 +9,7 @@ use graphics;
|
||||
use graphics::math::Vec2d;
|
||||
use graphics::types::Color;
|
||||
use map_model::{geometry, Map, Turn, TurnID};
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use render::{
|
||||
RenderOptions, Renderable, BIG_ARROW_TIP_LENGTH, TURN_ICON_ARROW_LENGTH,
|
||||
TURN_ICON_ARROW_THICKNESS, TURN_ICON_ARROW_TIP_LENGTH,
|
||||
@ -78,8 +78,8 @@ impl Renderable for DrawTurn {
|
||||
ID::Turn(self.id)
|
||||
}
|
||||
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, cs: &ColorScheme) {
|
||||
g.draw_ellipse(cs.get(Colors::TurnIconCircle), self.icon_circle);
|
||||
fn draw(&self, g: &mut GfxCtx, opts: RenderOptions, ctx: Ctx) {
|
||||
g.draw_ellipse(ctx.cs.get(Colors::TurnIconCircle), self.icon_circle);
|
||||
|
||||
g.draw_arrow(
|
||||
&graphics::Line::new_round(opts.color, TURN_ICON_ARROW_THICKNESS),
|
||||
|
@ -13,7 +13,7 @@ use graphics::types::Color;
|
||||
use kml;
|
||||
use map_model;
|
||||
use map_model::IntersectionID;
|
||||
use objects::ID;
|
||||
use objects::{Ctx, ID};
|
||||
use piston::input::{Key, MouseCursorEvent};
|
||||
use piston::window::Size;
|
||||
use plugins::classification::OsmClassifier;
|
||||
@ -33,7 +33,7 @@ use plugins::traffic_signal_editor::TrafficSignalEditor;
|
||||
use plugins::turn_colors::TurnColors;
|
||||
use plugins::turn_cycler::TurnCyclerState;
|
||||
use plugins::warp::WarpState;
|
||||
use plugins::{Colorizer, Ctx};
|
||||
use plugins::Colorizer;
|
||||
use render::{DrawMap, RenderOptions};
|
||||
use sim;
|
||||
use sim::{CarID, CarState, PedestrianID, Sim};
|
||||
@ -332,6 +332,7 @@ impl UI {
|
||||
cs: &self.cs,
|
||||
map: &self.map,
|
||||
control_map: &self.control_map,
|
||||
canvas: &self.canvas,
|
||||
},
|
||||
) {
|
||||
return c;
|
||||
@ -363,6 +364,7 @@ impl UI {
|
||||
cs: &self.cs,
|
||||
map: &self.map,
|
||||
control_map: &self.control_map,
|
||||
canvas: &self.canvas,
|
||||
},
|
||||
) {
|
||||
return c;
|
||||
@ -395,6 +397,7 @@ impl UI {
|
||||
cs: &self.cs,
|
||||
map: &self.map,
|
||||
control_map: &self.control_map,
|
||||
canvas: &self.canvas,
|
||||
},
|
||||
) {
|
||||
return c;
|
||||
@ -417,6 +420,7 @@ impl UI {
|
||||
cs: &self.cs,
|
||||
map: &self.map,
|
||||
control_map: &self.control_map,
|
||||
canvas: &self.canvas,
|
||||
},
|
||||
) {
|
||||
return c;
|
||||
@ -437,6 +441,7 @@ impl UI {
|
||||
cs: &self.cs,
|
||||
map: &self.map,
|
||||
control_map: &self.control_map,
|
||||
canvas: &self.canvas,
|
||||
},
|
||||
) {
|
||||
return c;
|
||||
@ -476,6 +481,7 @@ impl UI {
|
||||
cs: &self.cs,
|
||||
map: &self.map,
|
||||
control_map: &self.control_map,
|
||||
canvas: &self.canvas,
|
||||
},
|
||||
) {
|
||||
return c;
|
||||
@ -502,6 +508,7 @@ impl UI {
|
||||
cs: &self.cs,
|
||||
map: &self.map,
|
||||
control_map: &self.control_map,
|
||||
canvas: &self.canvas,
|
||||
},
|
||||
) {
|
||||
return c;
|
||||
@ -620,7 +627,16 @@ impl UI {
|
||||
cam_zoom: self.canvas.cam_zoom,
|
||||
debug_mode: self.layers.debug_mode.is_enabled(),
|
||||
};
|
||||
obj.draw(g, opts, &self.cs);
|
||||
obj.draw(
|
||||
g,
|
||||
opts,
|
||||
Ctx {
|
||||
cs: &self.cs,
|
||||
map: &self.map,
|
||||
control_map: &self.control_map,
|
||||
canvas: &self.canvas,
|
||||
},
|
||||
);
|
||||
}
|
||||
for obj in dynamics.into_iter() {
|
||||
let color = match obj.get_id() {
|
||||
@ -633,7 +649,16 @@ impl UI {
|
||||
cam_zoom: self.canvas.cam_zoom,
|
||||
debug_mode: self.layers.debug_mode.is_enabled(),
|
||||
};
|
||||
obj.draw(g, opts, &self.cs);
|
||||
obj.draw(
|
||||
g,
|
||||
opts,
|
||||
Ctx {
|
||||
cs: &self.cs,
|
||||
map: &self.map,
|
||||
control_map: &self.control_map,
|
||||
canvas: &self.canvas,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
self.turn_cycler.draw(
|
||||
|
Loading…
Reference in New Issue
Block a user