This commit is contained in:
dabreegster 2020-10-06 21:08:11 +00:00
parent afd043d8c0
commit 898c2839cb
18 changed files with 278 additions and 25 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `map` mod in crate `game`."><meta name="keywords" content="rust, rustlang, rust-lang, map"><title>game::layer::map - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../game/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Module map</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class='location'><a href='../../index.html'>game</a>::<wbr><a href='../index.html'>layer</a></p><script>window.sidebarCurrent = {name: 'map', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/game/layer/map.rs.html#1-332' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../index.html'>game</a>::<wbr><a href='../index.html'>layer</a>::<wbr><a class="mod" href=''>map</a></span></h1><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.BikeNetwork.html" title='game::layer::map::BikeNetwork struct'>BikeNetwork</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.Static.html" title='game::layer::map::Static struct'>Static</a></td><td class='docblock-short'></td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../";window.currentCrate = "game";</script><script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `map` mod in crate `game`."><meta name="keywords" content="rust, rustlang, rust-lang, map"><title>game::layer::map - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../game/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Module map</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class='location'><a href='../../index.html'>game</a>::<wbr><a href='../index.html'>layer</a></p><script>window.sidebarCurrent = {name: 'map', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/game/layer/map.rs.html#1-447' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../index.html'>game</a>::<wbr><a href='../index.html'>layer</a>::<wbr><a class="mod" href=''>map</a></span></h1><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.BikeNetwork.html" title='game::layer::map::BikeNetwork struct'>BikeNetwork</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.CongestionCaps.html" title='game::layer::map::CongestionCaps struct'>CongestionCaps</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.Static.html" title='game::layer::map::Static struct'>Static</a></td><td class='docblock-short'></td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../";window.currentCrate = "game";</script><script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>

View File

@ -1 +1 @@
initSidebarItems({"struct":[["BikeNetwork",""],["Static",""]]});
initSidebarItems({"struct":[["BikeNetwork",""],["CongestionCaps",""],["Static",""]]});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `BUILT_TIME_UTC` constant in crate `game`."><meta name="keywords" content="rust, rustlang, rust-lang, BUILT_TIME_UTC"><title>game::pregame::built_info::BUILT_TIME_UTC - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../game/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='../../index.html'>game</a>::<wbr><a href='../index.html'>pregame</a>::<wbr><a href='index.html'>built_info</a></p><script>window.sidebarCurrent = {name: 'BUILT_TIME_UTC', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-f6fed54f819b9442/out/built.rs.html#49' title='goto source code'>[src]</a></span><span class='in-band'>Constant <a href='../../index.html'>game</a>::<wbr><a href='../index.html'>pregame</a>::<wbr><a href='index.html'>built_info</a>::<wbr><a class="constant" href=''>BUILT_TIME_UTC</a></span></h1><pre class='rust const'>pub const BUILT_TIME_UTC: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;Tue, 06 Oct 2020 20:30:31 +0000&quot;;</pre><div class='docblock'><p>The built-time in RFC2822, UTC</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `BUILT_TIME_UTC` constant in crate `game`."><meta name="keywords" content="rust, rustlang, rust-lang, BUILT_TIME_UTC"><title>game::pregame::built_info::BUILT_TIME_UTC - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../game/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='../../index.html'>game</a>::<wbr><a href='../index.html'>pregame</a>::<wbr><a href='index.html'>built_info</a></p><script>window.sidebarCurrent = {name: 'BUILT_TIME_UTC', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-f6fed54f819b9442/out/built.rs.html#49' title='goto source code'>[src]</a></span><span class='in-band'>Constant <a href='../../index.html'>game</a>::<wbr><a href='../index.html'>pregame</a>::<wbr><a href='index.html'>built_info</a>::<wbr><a class="constant" href=''>BUILT_TIME_UTC</a></span></h1><pre class='rust const'>pub const BUILT_TIME_UTC: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;Tue, 06 Oct 2020 21:05:28 +0000&quot;;</pre><div class='docblock'><p>The built-time in RFC2822, UTC</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../";window.currentCrate = "game";</script><script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -111,7 +111,7 @@
<span class="doccomment">/// The output of `rustdoc -V`</span>
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">RUSTDOC_VERSION</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;rustdoc 1.46.0 (04488afe3 2020-08-24)&quot;</span>;
<span class="doccomment">/// The built-time in RFC2822, UTC</span>
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">BUILT_TIME_UTC</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;Tue, 06 Oct 2020 20:30:31 +0000&quot;</span>;
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">BUILT_TIME_UTC</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;Tue, 06 Oct 2020 21:05:28 +0000&quot;</span>;
<span class="doccomment">/// The target architecture, given by `cfg!(target_arch)`.</span>
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">CFG_TARGET_ARCH</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;x86_64&quot;</span>;
<span class="doccomment">/// The endianness, given by `cfg!(target_endian)`.</span>

View File

@ -330,10 +330,125 @@
<span id="330">330</span>
<span id="331">331</span>
<span id="332">332</span>
<span id="333">333</span>
<span id="334">334</span>
<span id="335">335</span>
<span id="336">336</span>
<span id="337">337</span>
<span id="338">338</span>
<span id="339">339</span>
<span id="340">340</span>
<span id="341">341</span>
<span id="342">342</span>
<span id="343">343</span>
<span id="344">344</span>
<span id="345">345</span>
<span id="346">346</span>
<span id="347">347</span>
<span id="348">348</span>
<span id="349">349</span>
<span id="350">350</span>
<span id="351">351</span>
<span id="352">352</span>
<span id="353">353</span>
<span id="354">354</span>
<span id="355">355</span>
<span id="356">356</span>
<span id="357">357</span>
<span id="358">358</span>
<span id="359">359</span>
<span id="360">360</span>
<span id="361">361</span>
<span id="362">362</span>
<span id="363">363</span>
<span id="364">364</span>
<span id="365">365</span>
<span id="366">366</span>
<span id="367">367</span>
<span id="368">368</span>
<span id="369">369</span>
<span id="370">370</span>
<span id="371">371</span>
<span id="372">372</span>
<span id="373">373</span>
<span id="374">374</span>
<span id="375">375</span>
<span id="376">376</span>
<span id="377">377</span>
<span id="378">378</span>
<span id="379">379</span>
<span id="380">380</span>
<span id="381">381</span>
<span id="382">382</span>
<span id="383">383</span>
<span id="384">384</span>
<span id="385">385</span>
<span id="386">386</span>
<span id="387">387</span>
<span id="388">388</span>
<span id="389">389</span>
<span id="390">390</span>
<span id="391">391</span>
<span id="392">392</span>
<span id="393">393</span>
<span id="394">394</span>
<span id="395">395</span>
<span id="396">396</span>
<span id="397">397</span>
<span id="398">398</span>
<span id="399">399</span>
<span id="400">400</span>
<span id="401">401</span>
<span id="402">402</span>
<span id="403">403</span>
<span id="404">404</span>
<span id="405">405</span>
<span id="406">406</span>
<span id="407">407</span>
<span id="408">408</span>
<span id="409">409</span>
<span id="410">410</span>
<span id="411">411</span>
<span id="412">412</span>
<span id="413">413</span>
<span id="414">414</span>
<span id="415">415</span>
<span id="416">416</span>
<span id="417">417</span>
<span id="418">418</span>
<span id="419">419</span>
<span id="420">420</span>
<span id="421">421</span>
<span id="422">422</span>
<span id="423">423</span>
<span id="424">424</span>
<span id="425">425</span>
<span id="426">426</span>
<span id="427">427</span>
<span id="428">428</span>
<span id="429">429</span>
<span id="430">430</span>
<span id="431">431</span>
<span id="432">432</span>
<span id="433">433</span>
<span id="434">434</span>
<span id="435">435</span>
<span id="436">436</span>
<span id="437">437</span>
<span id="438">438</span>
<span id="439">439</span>
<span id="440">440</span>
<span id="441">441</span>
<span id="442">442</span>
<span id="443">443</span>
<span id="444">444</span>
<span id="445">445</span>
<span id="446">446</span>
<span id="447">447</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="ident">abstutil</span>::<span class="ident">Counter</span>;
<span class="kw">use</span> <span class="ident">abstutil</span>::{<span class="ident">prettyprint_usize</span>, <span class="ident">Counter</span>};
<span class="kw">use</span> <span class="ident">geom</span>::{<span class="ident">Distance</span>, <span class="ident">Time</span>};
<span class="kw">use</span> <span class="ident">map_model</span>::<span class="ident">LaneType</span>;
<span class="kw">use</span> <span class="ident">map_model</span>::{<span class="ident">LaneType</span>, <span class="ident">PathConstraints</span>};
<span class="kw">use</span> <span class="ident">sim</span>::<span class="ident">AgentType</span>;
<span class="kw">use</span> <span class="ident">widgetry</span>::{
<span class="ident">Btn</span>, <span class="ident">Color</span>, <span class="ident">Drawable</span>, <span class="ident">EventCtx</span>, <span class="ident">GfxCtx</span>, <span class="ident">HorizontalAlignment</span>, <span class="ident">Key</span>, <span class="ident">Line</span>, <span class="ident">Panel</span>, <span class="ident">Text</span>, <span class="ident">TextExt</span>,
@ -342,7 +457,7 @@
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">app</span>::<span class="ident">App</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">common</span>::{<span class="ident">ColorDiscrete</span>, <span class="ident">ColorLegend</span>, <span class="ident">ColorNetwork</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">helpers</span>::<span class="ident">amenity_type</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">helpers</span>::{<span class="ident">amenity_type</span>, <span class="ident">ID</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">layer</span>::{<span class="ident">Layer</span>, <span class="ident">LayerOutcome</span>};
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">BikeNetwork</span> {
@ -663,5 +778,120 @@
)
}
}
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">CongestionCaps</span> {
<span class="ident">panel</span>: <span class="ident">Panel</span>,
<span class="ident">time</span>: <span class="ident">Time</span>,
<span class="ident">unzoomed</span>: <span class="ident">Drawable</span>,
<span class="ident">zoomed</span>: <span class="ident">Drawable</span>,
<span class="ident">tooltip</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">Text</span><span class="op">&gt;</span>,
}
<span class="kw">impl</span> <span class="ident">Layer</span> <span class="kw">for</span> <span class="ident">CongestionCaps</span> {
<span class="kw">fn</span> <span class="ident">name</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="lifetime">&#39;static</span> <span class="ident">str</span><span class="op">&gt;</span> {
<span class="prelude-val">Some</span>(<span class="string">&quot;congestion caps&quot;</span>)
}
<span class="kw">fn</span> <span class="ident">event</span>(
<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>,
<span class="ident">ctx</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>,
<span class="ident">app</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">App</span>,
<span class="ident">minimap</span>: <span class="kw-2">&amp;</span><span class="ident">Panel</span>,
) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">LayerOutcome</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">recalc_tooltip</span> <span class="op">=</span> <span class="bool-val">false</span>;
<span class="kw">if</span> <span class="ident">app</span>.<span class="ident">primary</span>.<span class="ident">sim</span>.<span class="ident">time</span>() <span class="op">!</span><span class="op">=</span> <span class="self">self</span>.<span class="ident">time</span> {
<span class="kw-2">*</span><span class="self">self</span> <span class="op">=</span> <span class="ident">CongestionCaps</span>::<span class="ident">new</span>(<span class="ident">ctx</span>, <span class="ident">app</span>);
<span class="ident">recalc_tooltip</span> <span class="op">=</span> <span class="bool-val">true</span>;
}
<span class="comment">// Show a tooltip with count, only when unzoomed</span>
<span class="kw">if</span> <span class="ident">ctx</span>.<span class="ident">canvas</span>.<span class="ident">cam_zoom</span> <span class="op">&lt;</span> <span class="ident">app</span>.<span class="ident">opts</span>.<span class="ident">min_zoom_for_detail</span> {
<span class="kw">if</span> <span class="ident">ctx</span>.<span class="ident">redo_mouseover</span>() <span class="op">|</span><span class="op">|</span> <span class="ident">recalc_tooltip</span> {
<span class="self">self</span>.<span class="ident">tooltip</span> <span class="op">=</span> <span class="prelude-val">None</span>;
<span class="kw">match</span> <span class="ident">app</span>.<span class="ident">mouseover_unzoomed_roads_and_intersections</span>(<span class="ident">ctx</span>) {
<span class="prelude-val">Some</span>(<span class="ident">ID</span>::<span class="ident">Road</span>(<span class="ident">r</span>)) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cap</span>) <span class="op">=</span> <span class="ident">app</span>
.<span class="ident">primary</span>
.<span class="ident">map</span>
.<span class="ident">get_r</span>(<span class="ident">r</span>)
.<span class="ident">access_restrictions</span>
.<span class="ident">cap_vehicles_per_hour</span>
{
<span class="self">self</span>.<span class="ident">tooltip</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Text</span>::<span class="ident">from</span>(<span class="ident">Line</span>(<span class="macro">format</span><span class="macro">!</span>(
<span class="string">&quot;Cap of {} vehicles per hour&quot;</span>,
<span class="ident">prettyprint_usize</span>(<span class="ident">cap</span>)
))));
}
}
<span class="kw">_</span> <span class="op">=</span><span class="op">&gt;</span> {}
}
}
} <span class="kw">else</span> {
<span class="self">self</span>.<span class="ident">tooltip</span> <span class="op">=</span> <span class="prelude-val">None</span>;
}
<span class="ident">Layer</span>::<span class="ident">simple_event</span>(<span class="ident">ctx</span>, <span class="ident">minimap</span>, <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">panel</span>)
}
<span class="kw">fn</span> <span class="ident">draw</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">g</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">GfxCtx</span>, <span class="ident">app</span>: <span class="kw-2">&amp;</span><span class="ident">App</span>) {
<span class="self">self</span>.<span class="ident">panel</span>.<span class="ident">draw</span>(<span class="ident">g</span>);
<span class="kw">if</span> <span class="ident">g</span>.<span class="ident">canvas</span>.<span class="ident">cam_zoom</span> <span class="op">&lt;</span> <span class="ident">app</span>.<span class="ident">opts</span>.<span class="ident">min_zoom_for_detail</span> {
<span class="ident">g</span>.<span class="ident">redraw</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">unzoomed</span>);
} <span class="kw">else</span> {
<span class="ident">g</span>.<span class="ident">redraw</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">zoomed</span>);
}
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="kw-2">ref</span> <span class="ident">txt</span>) <span class="op">=</span> <span class="self">self</span>.<span class="ident">tooltip</span> {
<span class="ident">g</span>.<span class="ident">draw_mouse_tooltip</span>(<span class="ident">txt</span>.<span class="ident">clone</span>());
}
}
<span class="kw">fn</span> <span class="ident">draw_minimap</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">g</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">GfxCtx</span>) {
<span class="ident">g</span>.<span class="ident">redraw</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">unzoomed</span>);
}
}
<span class="kw">impl</span> <span class="ident">CongestionCaps</span> {
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">ctx</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="ident">app</span>: <span class="kw-2">&amp;</span><span class="ident">App</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">CongestionCaps</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">colorer</span> <span class="op">=</span> <span class="ident">ColorNetwork</span>::<span class="ident">new</span>(<span class="ident">app</span>);
<span class="kw">let</span> <span class="ident">map</span> <span class="op">=</span> <span class="kw-2">&amp;</span><span class="ident">app</span>.<span class="ident">primary</span>.<span class="ident">map</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">num_roads</span> <span class="op">=</span> <span class="number">0</span>;
<span class="kw">for</span> <span class="ident">r</span> <span class="kw">in</span> <span class="ident">map</span>.<span class="ident">all_roads</span>() {
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cap</span>) <span class="op">=</span> <span class="ident">r</span>.<span class="ident">access_restrictions</span>.<span class="ident">cap_vehicles_per_hour</span> {
<span class="ident">num_roads</span> <span class="op">+</span><span class="op">=</span> <span class="number">1</span>;
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">l</span>) <span class="op">=</span> <span class="ident">r</span>
.<span class="ident">all_lanes</span>()
.<span class="ident">into_iter</span>()
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">l</span><span class="op">|</span> <span class="ident">PathConstraints</span>::<span class="ident">Car</span>.<span class="ident">can_use</span>(<span class="ident">map</span>.<span class="ident">get_l</span>(<span class="kw-2">*</span><span class="ident">l</span>), <span class="ident">map</span>))
{
<span class="kw">let</span> <span class="ident">current</span> <span class="op">=</span> <span class="ident">app</span>.<span class="ident">primary</span>.<span class="ident">sim</span>.<span class="ident">get_cap_counter</span>(<span class="ident">l</span>);
<span class="kw">let</span> <span class="ident">pct</span> <span class="op">=</span> ((<span class="ident">current</span> <span class="kw">as</span> <span class="ident">f64</span>) <span class="op">/</span> (<span class="ident">cap</span> <span class="kw">as</span> <span class="ident">f64</span>)).<span class="ident">min</span>(<span class="number">1.0</span>);
<span class="ident">colorer</span>.<span class="ident">add_r</span>(<span class="ident">r</span>.<span class="ident">id</span>, <span class="ident">app</span>.<span class="ident">cs</span>.<span class="ident">good_to_bad_red</span>.<span class="ident">eval</span>(<span class="ident">pct</span>));
}
}
}
<span class="kw">let</span> <span class="ident">panel</span> <span class="op">=</span> <span class="ident">Panel</span>::<span class="ident">new</span>(<span class="ident">Widget</span>::<span class="ident">col</span>(<span class="macro">vec</span><span class="macro">!</span>[
<span class="ident">Widget</span>::<span class="ident">row</span>(<span class="macro">vec</span><span class="macro">!</span>[
<span class="ident">Widget</span>::<span class="ident">draw_svg</span>(<span class="ident">ctx</span>, <span class="string">&quot;system/assets/tools/layers.svg&quot;</span>),
<span class="string">&quot;Congestion caps&quot;</span>.<span class="ident">draw_text</span>(<span class="ident">ctx</span>),
<span class="ident">Btn</span>::<span class="ident">plaintext</span>(<span class="string">&quot;X&quot;</span>)
.<span class="ident">build</span>(<span class="ident">ctx</span>, <span class="string">&quot;close&quot;</span>, <span class="ident">Key</span>::<span class="ident">Escape</span>)
.<span class="ident">align_right</span>(),
]),
<span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;{} roads have caps&quot;</span>, <span class="ident">prettyprint_usize</span>(<span class="ident">num_roads</span>)).<span class="ident">draw_text</span>(<span class="ident">ctx</span>),
<span class="ident">ColorLegend</span>::<span class="ident">gradient</span>(<span class="ident">ctx</span>, <span class="kw-2">&amp;</span><span class="ident">app</span>.<span class="ident">cs</span>.<span class="ident">good_to_bad_red</span>, <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;available&quot;</span>, <span class="string">&quot;full&quot;</span>]),
]))
.<span class="ident">aligned</span>(<span class="ident">HorizontalAlignment</span>::<span class="ident">Right</span>, <span class="ident">VerticalAlignment</span>::<span class="ident">Center</span>)
.<span class="ident">build</span>(<span class="ident">ctx</span>);
<span class="kw">let</span> (<span class="ident">unzoomed</span>, <span class="ident">zoomed</span>) <span class="op">=</span> <span class="ident">colorer</span>.<span class="ident">build</span>(<span class="ident">ctx</span>);
<span class="ident">CongestionCaps</span> {
<span class="ident">panel</span>,
<span class="ident">time</span>: <span class="ident">app</span>.<span class="ident">primary</span>.<span class="ident">sim</span>.<span class="ident">time</span>(),
<span class="ident">unzoomed</span>,
<span class="ident">zoomed</span>,
<span class="ident">tooltip</span>: <span class="prelude-val">None</span>,
}
}
}
</pre></div>
</section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../";window.currentCrate = "game";</script><script src="../../../main.js"></script><script src="../../../source-script.js"></script><script src="../../../source-files.js"></script><script defer src="../../../search-index.js"></script></body></html>

View File

@ -388,11 +388,8 @@
<span class="ident">btn</span>(<span class="string">&quot;backpressure&quot;</span>, <span class="ident">Key</span>::<span class="ident">Z</span>),
<span class="ident">btn</span>(<span class="string">&quot;elevation&quot;</span>, <span class="ident">Key</span>::<span class="ident">V</span>),
<span class="ident">btn</span>(<span class="string">&quot;parking efficiency&quot;</span>, <span class="ident">Key</span>::<span class="ident">O</span>),
<span class="kw">if</span> <span class="ident">app</span>.<span class="ident">opts</span>.<span class="ident">dev</span> {
<span class="ident">btn</span>(<span class="string">&quot;blackholes&quot;</span>, <span class="ident">Key</span>::<span class="ident">L</span>)
} <span class="kw">else</span> {
<span class="ident">Widget</span>::<span class="ident">nothing</span>()
},
<span class="ident">btn</span>(<span class="string">&quot;blackholes&quot;</span>, <span class="ident">Key</span>::<span class="ident">L</span>),
<span class="ident">btn</span>(<span class="string">&quot;congestion caps&quot;</span>, <span class="ident">Key</span>::<span class="ident">C</span>),
<span class="kw">if</span> <span class="ident">app</span>.<span class="ident">primary</span>.<span class="ident">sim</span>.<span class="ident">get_pandemic_model</span>().<span class="ident">is_some</span>() {
<span class="ident">btn</span>(<span class="string">&quot;pandemic model&quot;</span>, <span class="ident">Key</span>::<span class="ident">Y</span>)
} <span class="kw">else</span> {
@ -402,7 +399,7 @@
<span class="ident">Widget</span>::<span class="ident">col</span>(<span class="macro">vec</span><span class="macro">!</span>[
<span class="string">&quot;Data&quot;</span>.<span class="ident">draw_text</span>(<span class="ident">ctx</span>),
<span class="ident">btn</span>(<span class="string">&quot;traffic signal demand&quot;</span>, <span class="ident">Key</span>::<span class="ident">M</span>),
<span class="ident">btn</span>(<span class="string">&quot;commuter patterns&quot;</span>, <span class="ident">Key</span>::<span class="ident">C</span>),
<span class="ident">btn</span>(<span class="string">&quot;commuter patterns&quot;</span>, <span class="ident">Key</span>::<span class="ident">R</span>),
]),
])
.<span class="ident">evenly_spaced</span>(),
@ -458,6 +455,9 @@
<span class="string">&quot;blackholes&quot;</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">app</span>.<span class="ident">layer</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Box</span>::<span class="ident">new</span>(<span class="ident">map</span>::<span class="ident">Static</span>::<span class="ident">blackholes</span>(<span class="ident">ctx</span>, <span class="ident">app</span>)));
}
<span class="string">&quot;congestion caps&quot;</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">app</span>.<span class="ident">layer</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Box</span>::<span class="ident">new</span>(<span class="ident">map</span>::<span class="ident">CongestionCaps</span>::<span class="ident">new</span>(<span class="ident">ctx</span>, <span class="ident">app</span>)));
}
<span class="string">&quot;parking occupancy&quot;</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">app</span>.<span class="ident">layer</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Box</span>::<span class="ident">new</span>(<span class="ident">parking</span>::<span class="ident">Occupancy</span>::<span class="ident">new</span>(
<span class="ident">ctx</span>, <span class="ident">app</span>, <span class="bool-val">true</span>, <span class="bool-val">true</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>,