Color intersections in the ungap tool, so the coloring looks less

choppy.

Remove the "click to zoom" -- it's too easy to accidentally do this.
This commit is contained in:
Dustin Carlino 2021-08-15 11:05:17 -07:00
parent ae490b54c9
commit 07e738905c
3 changed files with 25 additions and 19 deletions

View File

@ -104,6 +104,15 @@ impl RouteSketcher {
let mut batch = GeomBatch::new();
// Draw the confirmed route
for pair in self.route.full_path.windows(2) {
// TODO Inefficient!
let r = map.find_road_between(pair[0], pair[1]).unwrap();
batch.push(Color::RED.alpha(0.5), map.get_r(r).get_thick_polygon(map));
}
for i in &self.route.full_path {
batch.push(Color::RED.alpha(0.5), map.get_i(*i).polygon.clone());
}
let mut cnt = 0;
for i in &self.route.waypoints {
cnt += 1;
@ -118,11 +127,6 @@ impl RouteSketcher {
.centered_on(map.get_i(*i).polygon.center()),
);
}
for pair in self.route.full_path.windows(2) {
// TODO Inefficient!
let r = map.find_road_between(pair[0], pair[1]).unwrap();
batch.push(Color::RED.alpha(0.5), map.get_r(r).get_thick_polygon(map));
}
// Draw the current operation
if let Mode::Hovering(i) = self.mode {
@ -131,10 +135,15 @@ impl RouteSketcher {
Circle::new(map.get_i(i).polygon.center(), Distance::meters(10.0)).to_polygon(),
);
if self.route.waypoints.len() == 1 {
if let Some((roads, _)) = map.simple_path_btwn(self.route.waypoints[0], i) {
if let Some((roads, intersections)) =
map.simple_path_btwn(self.route.waypoints[0], i)
{
for r in roads {
batch.push(Color::BLUE.alpha(0.5), map.get_r(r).get_thick_polygon(map));
}
for i in intersections {
batch.push(Color::BLUE.alpha(0.5), map.get_i(i).polygon.clone());
}
}
}
}

View File

@ -1,4 +1,5 @@
use std::cell::RefCell;
use std::collections::HashMap;
use geom::{Circle, Distance, Pt2D};
use map_model::{LaneType, PathConstraints, Road};
@ -81,6 +82,7 @@ impl DrawNetworkLayer {
// Thicker lines as we zoom out. Scale up to 5x. Never shrink past the road's actual width
let thickness = (0.5 / zoom).max(1.0);
let mut intersections = HashMap::new();
for r in map.all_roads() {
let mut bike_lane = false;
let mut buffer = false;
@ -108,6 +110,14 @@ impl DrawNetworkLayer {
color,
r.center_pts.make_polygons(thickness * r.get_width(map)),
);
// Arbitrarily pick a color when two different types of roads meet
intersections.insert(r.src_i, color);
intersections.insert(r.dst_i, color);
}
for (i, color) in intersections {
// No clear way to thicken the intersection at different zoom levels
batch.push(color, map.get_i(i).polygon.clone());
}
g.upload(batch)

View File

@ -122,19 +122,6 @@ impl State<App> for ExploreMap {
}
}
// Click to zoom in somewhere
if let Some(pt) = ctx.canvas.get_cursor_in_map_space() {
if ctx.canvas.cam_zoom < app.opts.min_zoom_for_detail && ctx.normal_left_click() {
return Transition::Push(Warping::new_state(
ctx,
pt,
Some(10.0),
None,
&mut app.primary,
));
}
}
if let Outcome::Clicked(x) = self.top_panel.event(ctx) {
match x.as_ref() {
"about A/B Street" => {