Commit Graph

63 Commits

Author SHA1 Message Date
Dustin Carlino
14bea3a4be Split out a raw_map crate from map_model. RawMap is the thing we turn
OSM and other raw input into and store, before later converting to a
Map.

Why?

- build-time performance: while iterating on geometry problems, map_editor in release mode took 33s to build before, 11s now that the crate is split
- better layering: operations on a RawMap are becoming increasingly distinct from later transformations on the bigger map model
- this helps tease apart the dependencies of the intersection polygon algorithm for #846
- this will make it simpler to cutover to osm2lanes for https://github.com/a-b-street/osm2lanes/issues/71

There's further reorganization in raw_map and map_model that'll follow,
but the main work is done here.
2022-02-19 17:39:28 +00:00
Dustin Carlino
b969dbffe1 Save LTN binary proposals on web, invoking the sacred base64 dance to
work with browser local storage. #856

... and redraw filters after loading a proposal, which I broke a few
days ago
2022-02-10 17:38:08 +00:00
Dustin Carlino
060decbdd3 Put a minimal UI around saving/loading LTN proposals 2022-01-31 13:30:55 +00:00
Dustin Carlino
f8dfe32c04 Save LTN edits to files and load from CLI. No proper UI yet, and the
format isn't future-proof at all.
2022-01-31 13:30:55 +00:00
Dustin Carlino
bd340a1970 Switch from std::fs to fs_err. When files aren't found, the error message actually includes the path! 2022-01-17 17:30:51 +00:00
Dustin Carlino
d3ff9d3412 Fix c08484505e, which broke listing files
in a directory! This impacted loading newly imported maps and finding
Seattle/UK scenario files.
2022-01-11 15:33:11 +00:00
Dustin Carlino
c08484505e Ignore hidden files like .DS_Store, fixing #832 2022-01-05 12:47:28 +00:00
Dustin Carlino
13f24e5cb2 Adding context with filenames/URLs to some methods in abstio. #801
It's extremely unergonomic to do this. Issues:

1) Hard to keep track of which Results include good context and which
   don't. Make a new type?
2) Lack of try blocks forcing use of closures
3) async try blocks aren't stabilized
2021-11-11 10:16:40 -08:00
Dustin Carlino
9f86365cf6 Upgrade to rust 1.56 and cutover to rust edition 2021 2021-10-21 09:38:06 -07:00
Dustin Carlino
915b902c9a
Warn the user before doing expensive mode shift calculations. #448 (#774) 2021-10-11 15:10:28 -07:00
Michael Kirk
476f19142f
Consistent panel width (#772)
* reorder tabs: plan trip before adding lanes

This order of tasks should be more logical for most people.

* Copy tweaks

"trip" is better than "route" since you don't pick the route, only the
start/end points. The route is inferred based on the available roads.

* Smaller elevation plot

it was much wider than any other UI element, meaning the column
dramatically jumps sizes when switching to this tab.

* better align line-plot x-axis

* Avoid jittering UI while switching through tabs.

* fixup! Avoid jittering UI while switching through tabs.

* fixup! Copy tweaks

* fixup! reorder tabs: plan trip before adding lanes

* fixup! Copy tweaks
2021-10-11 15:02:41 -07:00
Dustin Carlino
be9ba5a80e Clean up the absurd number of Seattle maps. Ideally we'd have some way
to further organize them by purpose, but for the moment, two problems:

1) the city picker UI is getting way too crowded
2) on native, the initial download is up to 145MB

Removing:

- the 3 Aurora maps and Green Lake, added for the ARC workshop, but no
  longer the most active of collaborations
- Ballard is now subsumed by central Seattle -- the only advantage would
  be keeping its full scenario of walking and transit trips, but the
  simulation is horribly gridlocked there anyway
- the Rainier Valley map, originally meant for an SNG traffic light
  timing study
- the larger udistrict map
2021-10-11 14:37:59 -07:00
Dustin Carlino
755e723251 Get some different boundaries set up in Seattle, to support the bike
network tool reasonably on the web. #743, #746

I'm declaring the budget to be 20MB gzipped map files.

- north and south seattle boundaries extended a bit
- central seattle added
- stripping out unused pathfinding data for walking and transit to
  squeeze down the size. avoiding crashes for empty pathfinding -- if
  you try to simulate a minified map, most trips will just fail
2021-10-11 14:06:49 -07:00
Dustin Carlino
2234c52cc6 Allow routes to be saved in the bike network tool. #743
Some UX clunkiness:
- not allowing custom names yet
- no autosave
- the left/right arrows can silently eat the current route
2021-09-03 12:23:58 -07:00
Dustin Carlino
43f532027e Handle HTTP errors to proposal API 2021-08-18 13:18:09 -07:00
Dustin Carlino
90a1d2ff83 Initially launch with edits loaded remotely 2021-08-16 16:00:01 -07:00
Dustin Carlino
090256668e Get the HTTP POST working on wasm too 2021-08-16 14:22:57 -07:00
Dustin Carlino
2956fabd49 On web, list player data from local storage. This lets people load proposals that they've previously saved. 2021-08-16 10:51:24 -07:00
Dustin Carlino
f6a94e8a58 Allow DrawWithTooltip to return custom data instead of string labels.
CloneableAny revived from e35c69f6f3
2021-07-18 14:14:19 -07:00
Dustin Carlino
66be29d752 Import a new city using Overpass, instead of Geofabrik + clipping. #523
The returned XML seems to be missing lots of stuff, but it's much faster
and wasn't hard to wire up. I'll look into fixing the query...
2021-07-12 14:06:54 -07:00
Dustin Carlino
4aa971e34e Add a new importer mode to do Raw->Map in parallel. Occasionally useful
now that my faster machine works again.

Running importer jobs in parallel is actually super hard, because
there's async stuff thrown in there now to download files.
2021-07-06 16:21:42 -07:00
Dustin Carlino
70a9508415 Change the CityPicker to merge the list of maps and cities from the local filesystem and the manifest.
This fixes various problems when importing local maps (in new or
existing cities) and getting out of sync with the manifest.
2021-06-25 19:37:42 -07:00
Dustin Carlino
76aba75082 Update links to docs after some reorg in the other repo 2021-06-12 13:38:38 -07:00
Dustin Carlino
cc344af231 Add a file-picker UI to import JSON scenarios easily 2021-05-24 14:55:11 -07:00
Dustin Carlino
5fca901e4c Give up on Docker and AWS Batch to bulk import cities. Switch to static
sharding with GCE instead. #326
2021-05-18 09:50:28 -07:00
Vinzent Steinberg
446a21696d
Fix most clippy warnings (#646)
* More conventional spelling of acronym identifiers

* `new` -> `new_state`

* Remove redundant field name

* Remove needless `collect`

* `to_controls` -> `make_controls`

* Simplify long if statement

* Fix module inception

* Simplify chained if let

* Return directly instead of creating a binding

* Disable clippy warning about `borrow` method

Implementing the `Borrow` trait instead would result in excessive type
annotations.

* Fix most remaining clippy warnings

* Allow clippy::type_complexity

* Fix bad merge from web editor

* Run cargo fmt

* Suppress large_enum_variant warnings

* Rename FYI state to ShowMessage

* Fix upper_case_acronyms warnings

Co-authored-by: Dustin Carlino <dabreegster@gmail.com>
2021-05-14 17:31:32 -07:00
Vinzent Steinberg
fd3b0e2a14
Fix compilation failures and most clippy warnings (#642)
* abstutil: Fix compilation failure

* map_gui: Fix compilation

* traffic_signal_data: Fix compilation failure

* map_model: Fix compilation failure

* abstutil: Fix doctests

* abstio: Fix most clippy warnings

* abstutil: Fix most clippy warnings

* collisions: Fix clippy warning

* convert_osm: Fix clippy warnings

* sim: Fix most clippy warnings

* geom: Fix clippy warnings

* kml: Fix clippy warnings

* map_model: Fix most clippy warnings

* fifteen_min: Fix clippy warnings

* game: Fix many clippy warnings

* Disable some noisy clippy warnings

* headless: Fix clippy warnings

* importer: Fix clippy warnings

* map_editor: Fix clippy warnings

* map_gui: Fix clippy warnings

* osm_viewer: Fix clippy warnings

* parking_mapper: Fix most clippy warnings

* popdat: Fix clippy warnings

* santa: Fix clippy warnings

* sumo: Fix clippy warnings

* traffic_seitan: Fix clippy warning

* updater: Fix clippy warnings

* widgetry: Fix clippy warnings

* tests: Fix some clippy warnings

* Fix compilation on stable Rust

* Simplify unwrapping

* Make use of `Entry` more readable

* Fix formatting

* Fix code that was broken in the refactoring

* Apply cargo +stable fmt

* Fix code that was broken in the refactoring, second try

* Remove `Default` impls that are equivalent to `new`

* Remove obsolete clippy wrapper

* Avoid turbofish

* Prefer `unwrap_or_else` over allowing `clippy::or_fun_call`

* Remove redundant `into_iter`

* Fix typo

* Prefer `&& false` over commenting code out

* Fix some clippy warnings

Co-authored-by: Dustin Carlino <dabreegster@gmail.com>
2021-05-14 08:32:56 -07:00
Dustin Carlino
66fa5c9862 Trim down the number of shared input files downloaded; only Seattle and GB need some of the big ones. #326 2021-05-06 17:35:58 -07:00
Dustin Carlino
a2f08dcc52 Fix huge_seattle data pack issue introduced a few commits ago 2021-04-20 16:10:17 -07:00
Dustin Carlino
8f70f9f9e9 In the city picker, list all cities from data/MANIFEST, whether or not they exist locally. Prompt to download when needed. 2021-04-20 16:10:17 -07:00
Dustin Carlino
37b1eef4b0 Clarify mpsc API 2021-04-19 17:55:42 -07:00
Dustin Carlino
faaa4162fa Async map downloader for native, using the existing FutureLoader. Can
only print progress to the console, not the loading screen.
2021-04-19 17:55:42 -07:00
Dustin Carlino
da80aa5a71 Refactor abstio download helpers to plumb progress somewhere 2021-04-19 17:55:42 -07:00
Michael Kirk
4f81f186af
embed mode and reworked web build system (#592)
* root element id from Settings, respect element size

* Plumb assets root via settings

* adapt crates to new wasm api

* more FileLoader cleanup

* use tsc bin from node_modules

* avoid spurious unlink errors

GNU Make considers the src/*/wasm_pkg targets as intermediate build
files and attempted to `rm` them. We can stop that my marking them as
`.PRECIOUS`

https://www.gnu.org/software/make/manual/html_node/Special-Targets.html

* `open` doesn't work on Linux

We could do something with xdg-open, but meh, not worth having platform
dependent logic for this.

* fix typo, clarify instructions

* make server compatible with older python install on linux

* revert change - we dont want to include music on web

the leading "-" means exclude a subdir of an included dir.

* better wrap of comments

* fix misfire in copy/pasted comment

* update docs
2021-04-01 19:31:02 -07:00
Dustin Carlino
ce473928fa Use u64 to describe number of bytes in the Manifest, now that we have a massive GeoTIFF in there that breaks wasm's 2^32 usize limit. #586 2021-03-24 21:23:38 -07:00
Dustin Carlino
a0c82088b9 Use our native download function instead of external curl command from the importer. #523
This forces the main importer to include tokio and propagate async a
bit. That seems worth it.

Also removed the quiet param from the download helpers; we always want
progress.
2021-03-17 10:29:28 -07:00
Dustin Carlino
2e7d6eeb34 Fix the progress bar in the UI; now the line-rewriting more or less
works! #523
2021-03-16 18:08:58 -07:00
Dustin Carlino
9c526d1000 Fix the spazzy download progress bar; I forgot to flush stdout. #523 2021-03-16 12:36:02 -07:00
Dustin Carlino
77709a24d6 Refactor a method to asynchronously download a file on native, with a simple progress bar. #523
Use it in the updater and all the importer tools. Only place it's not
used yet is parking_mapper and the in-game updater.  [rebuild]

Also make the RunCommand state understand the control code for erasing
the current line. It... sort of works.
2021-03-15 19:51:45 -07:00
Dustin Carlino
8be24bf007 Use AsRef<str> in more widgetry methods, getting rid of &format at many
call-sites. #253

To make some of these work, changed Label to store a String. Ultimately
it gets transformed into Text, so we need to allocate eventually.
2021-03-11 11:29:18 -08:00
Dustin Carlino
9c2c8bbd8f Change some uses of Into<String> to AsRef<str>, to avoid allocations. #253
I manually audited all uses. I kept Into<String> when we really do wind
up storing a String.
2021-03-11 11:29:18 -08:00
Dustin Carlino
f0b522f89a Figure out which files are in the us/huge_seattle DataPack more consistently. This'll now work from the proposals screen. 2021-03-10 12:40:55 -08:00
Dustin Carlino
92b89001ab Move road safety data to a new data/input/shared directory, so we can stop duplicating files common to many cities. About to use this for OD and zone data too. #556 2021-03-05 09:50:18 -08:00
Dustin Carlino
dd42acdc28 Refactor a CityName::seattle() 2021-03-03 18:08:06 -08:00
Dustin Carlino
006ae01216 Move 4 Seattle maps into the us/huge_seattle category to reduce the size
of the binary releases. [rebuild]

Handle this special case in the city picker UI, prompting the player to
do the extra download. NOT yet handling the same for the community
proposal screen -- player will just see a missing file error.
2021-03-03 18:03:15 -08:00
Dustin Carlino
357ba15afe Add back the zcool font so the Taipei map renders names. But this time, asynchronously load the font instead of bundling it in system assets and increasing the .wasm size. #535
Temporarily take on some technical debt with the new RawFileLoader...
2021-02-25 15:25:47 -08:00
Dustin Carlino
8bee003808 Fix a few stray warnings from rustc, and improve a panic error message when data/system gets unexpected directory names 2021-02-23 11:16:43 -08:00
Dustin Carlino
bc2767b89e Refactor lots of places that construct paths to the data/input dir, which is always organized by city. This would've made the previous change way easier. #326 2021-02-13 18:30:01 -08:00
Dustin Carlino
39f5d50fcd The grand country split. #326
City names are now disambiguated by a two-letter country code. This
commit handles almost everything needed to make this transition. Main
next steps are fixing up map edits automatically and making the city
picker UI understand the extra level of hierarchy.

A little bit of fallout: lakeslice gridlocks again; this regression is
actually from the recent traffic signal changes, but I'm just now
regenerating everything. Will fix soon.
2021-02-13 15:45:59 -08:00
Dustin Carlino
73e405e382 Upgrade most dependencies 2021-02-03 18:13:06 -08:00