Commit Graph

2967 Commits

Author SHA1 Message Date
Dustin Carlino
c6ec390d0e Pass around NeighborhoodID when switching between states. This
1) will support modifying boundaries and not getting state out-of-sync
2) vastly simplifies switching tabs
2022-01-12 14:55:56 +00:00
Dustin Carlino
cb501933fd Implement LTN undo/redo... and actually just handle undo, for
simplicity, and because repeating an undid (??) action is easy
2022-01-12 14:34:10 +00:00
Dustin Carlino
e0b18d6d07 Organize modal filter code before big changes 2022-01-12 13:55:50 +00:00
Dustin Carlino
6826145de2 Stub out a UI for undo/redo in LTN
(Rebuilding panels at the right time is the bulk of the change here)
2022-01-12 13:47:49 +00:00
Dustin Carlino
7d4a377173 Draw cell borders in different styles -- kind of necessary with the only-one-border schemes. 2022-01-12 13:07:35 +00:00
Dustin Carlino
c6787f0a80 Fix an edge case in the only-one-border LTN heuristic 2022-01-12 12:33:55 +00:00
Dustin Carlino
c024a484e3 Fix too-quick push on last commit, and restore the draw streets toggle broken a few commits ago 2022-01-12 12:25:36 +00:00
Dustin Carlino
30fc96bdd0 An automatic LTN heuristic that closes all but one border 2022-01-12 12:23:20 +00:00
Dustin Carlino
47930e714f Emphasize boundary roads in the browse neighborhood view 2022-01-11 10:35:59 +00:00
Dustin Carlino
5f3bb8897d Draw disconnected cells as red, to shout 'problem' 2022-01-11 10:05:16 +00:00
Dustin Carlino
c3b74d1358 Stop using red as a cell color; it really shouts 'problem' 2022-01-11 10:02:48 +00:00
Dustin Carlino
b28093f2a8 Draw all filters in the browse neighborhood screen 2022-01-11 09:58:23 +00:00
Dustin Carlino
afc9846c1c Try a brute-force search for the best single filter placement. Also not
great.
2022-01-11 09:40:54 +00:00
Dustin Carlino
65899f3a79 First tentative experiments in automatic filter placement -- the greedy
approach
2022-01-11 08:40:56 +00:00
Dustin Carlino
8ff4c41ea1 Some useful debugging / correctness steps towards more robust blockfinding. [rebuild] [release]
I have another branch that handles roads without sidewalks on one side
-- it helps in some cases, but regresses in others, so not merging it
yet. But taking a smaller step and bringing in some stricter common
endpoint logic from there.

Bringing in some useful intermediate changes
2022-01-09 11:07:10 +00:00
Dustin Carlino
e1d88f10ad Detect bad intersection polygons 2022-01-06 11:08:22 +00:00
Dustin Carlino
2356cee1db When tracing perimeters, allow doubling back at a dead-end with exactly
1 lane (usually a cycleway or footway). This correctly produces a few
more blocks in some maps -- as the goldenfile diff (and manual
verificaton) shows!

Also allow jumping from LTN browse to debug mode, to conveniently work
on blockfinding problems.
2022-01-06 10:16:11 +00:00
Dustin Carlino
045b82be4e Don't crash when no rat runs exist 2022-01-03 09:36:34 +00:00
Dustin Carlino
8d0b891406 Prevent neighborhood_containing from crashing in North Leeds. [rebuild] [release] 2022-01-02 17:48:25 +00:00
Dustin Carlino
803f387428 Only allow adding/removing blocks adjacent to the current neighborhood's perimeter. This will make it much easier to incrementally transfer ownership of each block to different neighborhoods, and it also helps prevent the user from creating some invalid results. The UX of trying to do something invalid is a little clunky, but it's usable. [rebuild] [release] 2022-01-02 17:35:40 +00:00
Dustin Carlino
af08ff4e74 Show the (original) partitioning by color in the boundary selection UI 2022-01-02 09:50:06 +00:00
Dustin Carlino
f6274e868f Make the LTN browse state operate off a per-session partitioning 2022-01-02 09:13:33 +00:00
Dustin Carlino
8aa58000ed Slightly improve LTN adjust boundary screen:
- better instructions
- can just tap the add/remove keys, in addition to holding and painting
2022-01-01 18:30:25 +00:00
Dustin Carlino
7d6f133f1c Make the LTN tool handle roads that already ban cars.
- Don't allow filtering them
- Don't cross them when calculating cell connectivity
- Create special green cells for them, and don't count towards the
  disconnected warning
2021-12-31 16:28:51 +00:00
Dustin Carlino
332e88f235 Don't color adjacent LTN cells the same; it's that sort of combination
of misleading and preventable so as to merit a fix
2021-12-31 15:21:52 +00:00
Dustin Carlino
b8f4550824 Draw filtered streets with two colors when there's a filter on them.
This actually revealed that find_cells was a bit wrong -- when a filter
is in the middle of a cell, one half of it wasn't assigned anywhere
2021-12-31 11:53:47 +00:00
Dustin Carlino
bffa469396 Print LTN pathfinding info in the panel, not a tooltip. The tooltips
clash with clicking on roads to filter them, and probably weren't
terribly discoverable anyway.
2021-12-29 18:23:33 +00:00
Dustin Carlino
6219c7f584 Fix crash in LTN pathfinding when deleting waypoints 2021-12-29 17:38:38 +00:00
Dustin Carlino
f7f23465c1 Edit modal filters from within the pathfinding view too.
Slow implementation, but at least it works
2021-12-29 13:14:44 +00:00
Dustin Carlino
fbc847f48c Share modal filter management between connectivity and rat run states 2021-12-29 12:38:11 +00:00
Dustin Carlino
1e414d0f31 Share the panel style too for pathfinding. (It was a bigger change, easier to separate) 2021-12-29 11:54:12 +00:00
Dustin Carlino
4264682be8 Share a panel style for 2/3 of the per-neighborhood states 2021-12-29 11:46:29 +00:00
Dustin Carlino
ecd69e48a9 Refine the rat run algorithm: don't look for paths between different cells. That forces weird U-turns, using cul-de-sacs, using the perimeter road, etc 2021-12-29 10:28:53 +00:00
Dustin Carlino
451a4f1a5d Warn when a cell is totally cut off with too many filters 2021-12-29 10:11:25 +00:00
Dustin Carlino
352b97828a Track where cells touch the neighborhood boundary 2021-12-29 10:01:39 +00:00
Marcel Dejean
cfe248fdab Include contraflow turns in get_turns_for, get_turns_from_lane,
Change get_next_turns_and_lanes (unused) to not take intersection, then fix uses of get_turns_from for sidewalks to use it

Add get_next_turns_and_lanes_for and use for floodfill
2021-12-20 23:11:36 +00:00
Marcel Dejean
65f086ecb3 PathStep::ContraflowTurn to allow walking turns both ways
* Also implement ContraflowMovement for pathfinder v2
* Change uses of Turn to Turn | ContraflowTurn
* Reverse contraflowturn geometry when tracing pathstep
* Don't start or end a path in a ContraflowTurn either
2021-12-20 23:11:36 +00:00
Dustin Carlino
fd852795c2 Make the rat-run detector respect modal filters.
Overall results still not right, but getting closer. Some "rat-runs"
retained will only be in the neighborhood out of "necessity" -- they
should maybe be totally filtered out for the heatmap counts.
2021-12-19 12:27:33 +00:00
Dustin Carlino
83bf6953d1 Rank each street inside a neighborhood as quiet/busy, based on the number of rat-runs through it.
Show this through a heatmap and tooltips
2021-12-19 12:06:42 +00:00
Dustin Carlino
5542632d61 Take a third stab at finding rat runs in a neighborhood. This new
definition finds all entrances and exits to a neighborhood, grouped by
the name of the perimeter road they connect to. Then the shortest
driving path between every pair is found, and the results are sorted to
emphasize paths that spend most of the time inside the neighborhood.

This new version doesn't crash and seems to produce reasonable results
everywhere I've looked.

It doesn't yet pay attention to the modal filters people have created,
or summarize which roads are likely to be quiet or not.
2021-12-19 11:24:11 +00:00
Dustin Carlino
904ba3c249 Don't even allow selecting intersections that aren't 4-way, since no diagonal filters can be manipulated there. 2021-12-19 10:28:50 +00:00
Dustin Carlino
f0a1110d04 Draw planters when zoomed in. Icon by Trang 2021-12-17 13:31:49 +00:00
Dustin Carlino
eb4060b071 Improve LTN tool rendering when zoomed in. Outlines around selected
objects are less thick and opaque, to cover up less of the road.
2021-12-17 11:37:54 +00:00
Dustin Carlino
4e79d19765 Revert "When calculating LTN cells, don't cross bike-only roads."
This reverts commit 02420f920e.

Did not mean to push this yet, sorry!
2021-12-16 14:02:41 +00:00
Dustin Carlino
02420f920e When calculating LTN cells, don't cross bike-only roads. 2021-12-16 14:02:21 +00:00
Dustin Carlino
e77ce12537 Draw custom LTN boundaries, by painting blocks. #794
Still need to think through the UX of how to manage custom boundaries
and incorporate them in the "browse neighborhoods" screen.
2021-12-14 10:33:42 -08:00
Dustin Carlino
611ca97a28 Conveniently jump from the main apps to the RawMap editor, to debug geometry more fluidly 2021-12-11 11:24:37 +00:00
Dustin Carlino
ec9ed9c64c Import a small slice of Kennington with a very representative set of London-specific map model issues. Add it to the screenshot tests, replacing Great Kneighton as the GB test. And trim out lakeslice from the test; we don't need quite so much redundancy for Seattle. 2021-12-09 14:31:20 +00:00
Dustin Carlino
56a42f9f21 Fix crash in ungap's route sketcher. If you drag intermediate waypoints
such that the path is impossible, don't move the waypoint.
2021-12-07 15:25:46 +00:00
Dustin Carlino
fc674df9ac Cleaning up the map_model transit representation a bit. #372 2021-12-07 03:10:38 -08:00
Dustin Carlino
6e11c386ac Mechanical refactor: bus {stop, route} -> transit. #372
(Mostly renaming map_model code everywhere, not yet sim layer and above)
2021-12-07 03:10:38 -08:00
Dustin Carlino
7eba7a10cf Update map URL in the LTN tool. #766
It's increasingly lucrative to try refactoring this.
2021-12-05 14:13:57 +00:00
Dustin Carlino
8318bbf5d2 Fix clippy warnings. [rebuild] [release] 2021-12-05 12:29:35 +00:00
Dustin Carlino
815ae47e02 Model diagonal LTN filters. #794 [rebuild] [release]
Only supported at 4-way intersections currently.
2021-11-21 12:55:50 -08:00
Dustin Carlino
8e7d54f135 Add some explanation to the LTN route tool 2021-11-21 11:54:29 -08:00
Dustin Carlino
41dfabe28f Clean up from past few days:
- upload the GTFS files now being imported
- disable the half-started area-based traffic spawner
2021-11-21 10:58:00 -08:00
Andrew Wei
65f187f250
Adding main road penalty to ltn (#810) 2021-11-20 15:28:59 -08:00
Dustin Carlino
3d228861b2 Prototype a tool to spawn traffic between two areas. One intended use is
to manually sketch traffic patterns that try to cut through LTNs.

Just get the UI selection stuff going for now
2021-11-20 12:26:42 -08:00
Dustin Carlino
42e6efd962 Place modal filters where you click on a road, not arbitrarily in the middle. (Written with Andrew pair programming during Hack to Give Thanks) 2021-11-20 11:18:38 -08:00
Dustin Carlino
27894c02cb Road labels don't need to be shown zoomed-in for LTN 2021-11-17 08:00:58 -08:00
Dustin Carlino
7d6b720099 Add a search button to the LTN tool, because I really don't know my London street names yet 2021-11-16 15:13:12 -08:00
Dustin Carlino
81af262511 Fix the query params, update to the 0.3 link after all 2021-11-14 17:47:37 -08:00
Dustin Carlino
29fbf74c2d Show two LTN routes, to show effects of the new filters 2021-11-11 14:42:31 -08:00
Dustin Carlino
08223efed5 Whoops, forgot to not leak all the RAMs 2021-11-11 14:10:42 -08:00
Dustin Carlino
006839aec2 Make the LTN router actually avoid modal filters.
Accomplishing this through RoutingParams, rather than actually editing
the map. I don't want to commit to a map model representation of modal
filters and actually edit the map until we think through diagonal
filters. This effectively revives pathfind_avoiding_roads from the old
congestion capping experiment, but organized better.
2021-11-11 14:03:11 -08:00
Dustin Carlino
69ca5d60a4 Draw the neighborhood and modal filters in the 2 sub-states (rat runs, route tool). Not going to expose all the controls from the main view yet, until we understand the UX workflow a bit more. 2021-11-11 13:47:34 -08:00
Dustin Carlino
cf81200991 Refactoring the game crate's initial setup, to make special modes more explicit. #745 2021-11-11 13:23:42 -08:00
Dustin Carlino
0f76109ebf Convert game from CmdArgs to structopt in a brute-force way. #745 2021-11-11 12:58:57 -08:00
Dustin Carlino
2f18e4badc Remove broken code for Leaflet-named screenshots. #440
Gave up on Leaflet in favor of Mapbox GL, and the math was always wrong
here anyway.
2021-11-11 09:02:29 -08:00
Dustin Carlino
5888536aef Start a tool to route through or around an LTN. Just the skeleton reused
from Ungap the Map...
2021-11-10 12:00:59 -08:00
Dustin Carlino
684f9cc4cc A road with a modal filter belongs partially to two cells 2021-11-10 11:14:47 -08:00
Dustin Carlino
e999cd70af More explicitly store the position of a modal filter. This is a
precursor to fine-tuning that position and also to making roads with
filters belong to two cells, not become their own.
2021-11-09 11:47:29 -08:00
Dustin Carlino
c9d3c29a66 Working on rat runs:
- use movements, not turns
- adjust cost for entry/exit (but the costs still seem incorrect)
- fix the infinite loop in the floodfill
2021-11-09 11:26:58 -08:00
Dustin Carlino
cb3693bd7a Refactor: DirectedRoadID.road, not .id 2021-11-09 10:48:39 -08:00
Dustin Carlino
3903f3b564 Refactor vehicle_cost to include zone_cost, like the docs say it does 2021-11-09 10:34:50 -08:00
Dustin Carlino
57b40701a8 Working on rat-run detection:
- split the algorithm / UI module
- start and end the path just outside the neighborhood
2021-11-09 10:29:00 -08:00
Dustin Carlino
c76d0b9070 Round of clippy (and reverting a temporary bit that broke challenge modes) [rebuild] [release] 2021-11-07 12:04:55 -08:00
Dustin Carlino
98d1f2cd9f Prototype rat-run detection again. Not working yet, so leaving disabled. #794 2021-11-07 12:02:16 -08:00
Dustin Carlino
c0200bd3d7 Draw traffic cells as areas, using a simple grid diffusion. #794 2021-11-07 10:21:26 -08:00
Dustin Carlino
6b766ea750 Don't erase modal filters when switching neighborhoods 2021-11-06 15:58:28 -07:00
Dustin Carlino
7e07bac35a Make all of the secondary menu screens follow the style of the new title screen. Simplify things like the strange challenge picker UI by using the section styling. 2021-11-06 10:33:11 -07:00
Dustin Carlino
f751b7d54b Removing the pregame color scheme 2021-11-06 10:33:11 -07:00
Dustin Carlino
2fbc950da5 Switch to a consolidated title screen that switches between all the
apps. #780
2021-11-06 10:33:11 -07:00
Marcel Dejean
826acac086
structopt changed underscore options to hyphen (#798) 2021-11-05 07:27:34 -07:00
Dustin Carlino
a329915ef6 Start over with the LTN tool. #794
- Use the new blockfinder to initially classify neighborhoods
- Calculate cells within a neighborhood, and update them based on road
  filters
- For the moment, remove the tool that shows example rat runs
2021-11-04 17:28:51 -07:00
Dustin Carlino
2c08d62318 Track interior roads as we merge perimeters. It's much easier to retain this as we build it up, instead of later figuring out which side of a perimeter is the inside or outside. 2021-11-03 13:38:38 -07:00
Dustin Carlino
1c748cf304 Clump neighborhoods just by road rank. Bike-only pieces are usually an existing modal filter. So they're expected to be somewhere in the interior of a neighborhood. 2021-11-02 19:48:18 -07:00
Dustin Carlino
401d5fe297 Make it even easier to debug block order 2021-11-02 16:31:29 -07:00
Dustin Carlino
f4e0b4b1e3 Log warnings to explain why merging blocks fails 2021-11-02 13:42:25 -07:00
Dustin Carlino
478e6f28c4 Fix a silly bug with assigned block coloring getting lost 2021-11-02 12:21:32 -07:00
Dustin Carlino
2917361417 More aggressive block merging 2021-11-01 17:09:50 -07:00
Dustin Carlino
cfec9a2049 Avoid block merge crashes! But some neighborhoods don't get fully
merged.

Also make all the blockfinding algorithms deterministic, for easier
debugging.
2021-11-01 16:56:42 -07:00
Dustin Carlino
108f6a6fc2 Refactor blockfinding APIs to prep for actually merging everything in a
single neighborhood.
2021-11-01 15:49:56 -07:00
Dustin Carlino
a996b891ab Improve the algorithm for merging adjacent blocks. It now handles
internal dead-ends and blocks that share a sequence of common roads.

Still not robust enough, but huge step forwards.
2021-11-01 14:37:49 -07:00
Dustin Carlino
00df96f173
Render A/B Street's lanes and traffic simulation on top of Mapbox GL (#788)
[rebuild] [release]
2021-10-31 13:52:58 -07:00
Dustin Carlino
1eb7ec7ddf Detect perimeters hitting map boundaries upfront. This lets us more
easily work with perimeters and only transform to blocks when we need to
last minute. As a happy side effect, it vastly speeds up blockfinding --
the slowdown was attempting to mangle geometry for the huge broken
perimeters near boundaries!

Also improve the incremental merge debug UI
2021-10-29 16:43:35 -07:00
Dustin Carlino
d44fa4eb03 Use the road labels in the LTN tool too. Focus on one neighborhood's
roads.
2021-10-29 12:48:09 -07:00
Dustin Carlino
32fc46831b Draw arrows to show entrances/exits to a LTN.
(and rename Line::reverse for consistency with PolyLine)
2021-10-29 12:25:30 -07:00
Dustin Carlino
e62a41d45b Color adjacent blocks differently 2021-10-28 15:10:50 -07:00
Dustin Carlino
5e5e411de8
Detect neighborhoods with the new block abstraction (#793) 2021-10-28 10:11:57 -07:00