mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-21 13:21:45 +03:00
25 lines
23 KiB
HTML
25 lines
23 KiB
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 `AppLike` trait in crate `map_gui`."><meta name="keywords" content="rust, rustlang, rust-lang, AppLike"><title>map_gui::AppLike - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
|
||
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
|
||
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[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">☰</div><a href='../map_gui/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Trait AppLike</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.cs">cs</a><a href="#tymethod.draw_map">draw_map</a><a href="#tymethod.draw_with_opts">draw_with_opts</a><a href="#tymethod.make_warper">make_warper</a><a href="#tymethod.map">map</a><a href="#tymethod.map_switched">map_switched</a><a href="#tymethod.mut_cs">mut_cs</a><a href="#tymethod.mut_draw_map">mut_draw_map</a><a href="#tymethod.mut_opts">mut_opts</a><a href="#tymethod.opts">opts</a><a href="#tymethod.sim">sim</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.change_color_scheme">change_color_scheme</a><a href="#method.current_stage_and_remaining_time">current_stage_and_remaining_time</a><a href="#method.sim_time">sim_time</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>map_gui</a></p><script>window.sidebarCurrent = {name: 'AppLike', ty: 'trait', 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><span class="help-button">?</span>
|
||
<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'>−</span>]</a></span><a class='srclink' href='../src/map_gui/lib.rs.html#28-73' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>map_gui</a>::<wbr><a class="trait" href=''>AppLike</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait AppLike {
|
||
fn <a href='#tymethod.map' class='fnname'>map</a>(&self) -> &<a class="struct" href="../map_model/struct.Map.html" title="struct map_model::Map">Map</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.sim' class='fnname'>sim</a>(&self) -> &<a class="struct" href="../sim/sim/struct.Sim.html" title="struct sim::sim::Sim">Sim</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.cs' class='fnname'>cs</a>(&self) -> &<a class="struct" href="../map_gui/colors/struct.ColorScheme.html" title="struct map_gui::colors::ColorScheme">ColorScheme</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.mut_cs' class='fnname'>mut_cs</a>(&mut self) -> &mut <a class="struct" href="../map_gui/colors/struct.ColorScheme.html" title="struct map_gui::colors::ColorScheme">ColorScheme</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.draw_map' class='fnname'>draw_map</a>(&self) -> &<a class="struct" href="../map_gui/render/struct.DrawMap.html" title="struct map_gui::render::DrawMap">DrawMap</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.mut_draw_map' class='fnname'>mut_draw_map</a>(&mut self) -> &mut <a class="struct" href="../map_gui/render/struct.DrawMap.html" title="struct map_gui::render::DrawMap">DrawMap</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.opts' class='fnname'>opts</a>(&self) -> &<a class="struct" href="../map_gui/options/struct.Options.html" title="struct map_gui::options::Options">Options</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.mut_opts' class='fnname'>mut_opts</a>(&mut self) -> &mut <a class="struct" href="../map_gui/options/struct.Options.html" title="struct map_gui::options::Options">Options</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.map_switched' class='fnname'>map_switched</a>(<br> &mut self, <br> ctx: &mut EventCtx<'_>, <br> map: <a class="struct" href="../map_model/struct.Map.html" title="struct map_model::Map">Map</a>, <br> timer: &mut <a class="struct" href="../abstutil/time/struct.Timer.html" title="struct abstutil::time::Timer">Timer</a><'_><br> );
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.draw_with_opts' class='fnname'>draw_with_opts</a>(&self, g: &mut GfxCtx<'_>, opts: <a class="struct" href="../map_gui/render/struct.DrawOptions.html" title="struct map_gui::render::DrawOptions">DrawOptions</a>);
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.make_warper' class='fnname'>make_warper</a>(<br> &mut self, <br> ctx: &EventCtx<'_>, <br> pt: <a class="struct" href="../geom/pt/struct.Pt2D.html" title="struct geom::pt::Pt2D">Pt2D</a>, <br> target_cam_zoom: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>>, <br> id: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="../map_gui/enum.ID.html" title="enum map_gui::ID">ID</a>><br> ) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn State<Self>><br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>;
|
||
|
||
fn <a href='#method.sim_time' class='fnname'>sim_time</a>(&self) -> <a class="struct" href="../geom/time/struct.Time.html" title="struct geom::time::Time">Time</a> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.current_stage_and_remaining_time' class='fnname'>current_stage_and_remaining_time</a>(<br> &self, <br> id: <a class="struct" href="../map_model/objects/intersection/struct.IntersectionID.html" title="struct map_model::objects::intersection::IntersectionID">IntersectionID</a><br> ) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../geom/duration/struct.Duration.html" title="struct geom::duration::Duration">Duration</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.change_color_scheme' class='fnname'>change_color_scheme</a>(<br> &mut self, <br> ctx: &mut EventCtx<'_>, <br> cs: <a class="enum" href="../map_gui/colors/enum.ColorSchemeChoice.html" title="enum map_gui::colors::ColorSchemeChoice">ColorSchemeChoice</a><br> ) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
|
||
}</pre></div><div class='docblock'><p>An application wishing to use the tools in this crate has to implement this on the struct that
|
||
implements <code>widgetry::SharedAppState</code>, so that the tools here can access the map. See
|
||
<code>SimpleApp</code> for an example implementation.</p>
|
||
</div><h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.map' class='method'><code>fn <a href='#tymethod.map' class='fnname'>map</a>(&self) -> &<a class="struct" href="../map_model/struct.Map.html" title="struct map_model::Map">Map</a></code></h3><h3 id='tymethod.sim' class='method'><code>fn <a href='#tymethod.sim' class='fnname'>sim</a>(&self) -> &<a class="struct" href="../sim/sim/struct.Sim.html" title="struct sim::sim::Sim">Sim</a></code></h3><h3 id='tymethod.cs' class='method'><code>fn <a href='#tymethod.cs' class='fnname'>cs</a>(&self) -> &<a class="struct" href="../map_gui/colors/struct.ColorScheme.html" title="struct map_gui::colors::ColorScheme">ColorScheme</a></code></h3><h3 id='tymethod.mut_cs' class='method'><code>fn <a href='#tymethod.mut_cs' class='fnname'>mut_cs</a>(&mut self) -> &mut <a class="struct" href="../map_gui/colors/struct.ColorScheme.html" title="struct map_gui::colors::ColorScheme">ColorScheme</a></code></h3><h3 id='tymethod.draw_map' class='method'><code>fn <a href='#tymethod.draw_map' class='fnname'>draw_map</a>(&self) -> &<a class="struct" href="../map_gui/render/struct.DrawMap.html" title="struct map_gui::render::DrawMap">DrawMap</a></code></h3><h3 id='tymethod.mut_draw_map' class='method'><code>fn <a href='#tymethod.mut_draw_map' class='fnname'>mut_draw_map</a>(&mut self) -> &mut <a class="struct" href="../map_gui/render/struct.DrawMap.html" title="struct map_gui::render::DrawMap">DrawMap</a></code></h3><h3 id='tymethod.opts' class='method'><code>fn <a href='#tymethod.opts' class='fnname'>opts</a>(&self) -> &<a class="struct" href="../map_gui/options/struct.Options.html" title="struct map_gui::options::Options">Options</a></code></h3><h3 id='tymethod.mut_opts' class='method'><code>fn <a href='#tymethod.mut_opts' class='fnname'>mut_opts</a>(&mut self) -> &mut <a class="struct" href="../map_gui/options/struct.Options.html" title="struct map_gui::options::Options">Options</a></code></h3><h3 id='tymethod.map_switched' class='method'><code>fn <a href='#tymethod.map_switched' class='fnname'>map_switched</a>(<br> &mut self, <br> ctx: &mut EventCtx<'_>, <br> map: <a class="struct" href="../map_model/struct.Map.html" title="struct map_model::Map">Map</a>, <br> timer: &mut <a class="struct" href="../abstutil/time/struct.Timer.html" title="struct abstutil::time::Timer">Timer</a><'_><br>)</code></h3><h3 id='tymethod.draw_with_opts' class='method'><code>fn <a href='#tymethod.draw_with_opts' class='fnname'>draw_with_opts</a>(&self, g: &mut GfxCtx<'_>, opts: <a class="struct" href="../map_gui/render/struct.DrawOptions.html" title="struct map_gui::render::DrawOptions">DrawOptions</a>)</code></h3><h3 id='tymethod.make_warper' class='method'><code>fn <a href='#tymethod.make_warper' class='fnname'>make_warper</a>(<br> &mut self, <br> ctx: &EventCtx<'_>, <br> pt: <a class="struct" href="../geom/pt/struct.Pt2D.html" title="struct geom::pt::Pt2D">Pt2D</a>, <br> target_cam_zoom: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>>, <br> id: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="../map_gui/enum.ID.html" title="enum map_gui::ID">ID</a>><br>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn State<Self>> <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Create a <code>widgetry::State</code> that warps to the given point.</p>
|
||
</div></div><span class='loading-content'>Loading content...</span><h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.sim_time' class='method'><code>fn <a href='#method.sim_time' class='fnname'>sim_time</a>(&self) -> <a class="struct" href="../geom/time/struct.Time.html" title="struct geom::time::Time">Time</a></code></h3><h3 id='method.current_stage_and_remaining_time' class='method'><code>fn <a href='#method.current_stage_and_remaining_time' class='fnname'>current_stage_and_remaining_time</a>(<br> &self, <br> id: <a class="struct" href="../map_model/objects/intersection/struct.IntersectionID.html" title="struct map_model::objects::intersection::IntersectionID">IntersectionID</a><br>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../geom/duration/struct.Duration.html" title="struct geom::duration::Duration">Duration</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></h3><h3 id='method.change_color_scheme' class='method'><code>fn <a href='#method.change_color_scheme' class='fnname'>change_color_scheme</a>(<br> &mut self, <br> ctx: &mut EventCtx<'_>, <br> cs: <a class="enum" href="../map_gui/colors/enum.ColorSchemeChoice.html" title="enum map_gui::colors::ColorSchemeChoice">ColorSchemeChoice</a><br>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></h3><div class='docblock'><p>Change the color scheme. Idempotent. Return true if there was a change.</p>
|
||
</div></div><span class='loading-content'>Loading content...</span><h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-AppLike' class='impl'><code class='in-band'>impl<T> AppLike for <a class="struct" href="../map_gui/struct.SimpleApp.html" title="struct map_gui::SimpleApp">SimpleApp</a><T></code><a href='#impl-AppLike' class='anchor'></a><a class='srclink' href='../src/map_gui/simple_app.rs.html#203-279' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.map' class="method hidden"><code>fn <a href='#method.map' class='fnname'>map</a>(&self) -> &<a class="struct" href="../map_model/struct.Map.html" title="struct map_model::Map">Map</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#205-207' title='goto source code'>[src]</a></h4><h4 id='method.sim' class="method hidden"><code>fn <a href='#method.sim' class='fnname'>sim</a>(&self) -> &<a class="struct" href="../sim/sim/struct.Sim.html" title="struct sim::sim::Sim">Sim</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#209-211' title='goto source code'>[src]</a></h4><h4 id='method.cs' class="method hidden"><code>fn <a href='#method.cs' class='fnname'>cs</a>(&self) -> &<a class="struct" href="../map_gui/colors/struct.ColorScheme.html" title="struct map_gui::colors::ColorScheme">ColorScheme</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#213-215' title='goto source code'>[src]</a></h4><h4 id='method.mut_cs' class="method hidden"><code>fn <a href='#method.mut_cs' class='fnname'>mut_cs</a>(&mut self) -> &mut <a class="struct" href="../map_gui/colors/struct.ColorScheme.html" title="struct map_gui::colors::ColorScheme">ColorScheme</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#217-219' title='goto source code'>[src]</a></h4><h4 id='method.draw_map' class="method hidden"><code>fn <a href='#method.draw_map' class='fnname'>draw_map</a>(&self) -> &<a class="struct" href="../map_gui/render/struct.DrawMap.html" title="struct map_gui::render::DrawMap">DrawMap</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#221-223' title='goto source code'>[src]</a></h4><h4 id='method.mut_draw_map' class="method hidden"><code>fn <a href='#method.mut_draw_map' class='fnname'>mut_draw_map</a>(&mut self) -> &mut <a class="struct" href="../map_gui/render/struct.DrawMap.html" title="struct map_gui::render::DrawMap">DrawMap</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#225-227' title='goto source code'>[src]</a></h4><h4 id='method.opts' class="method hidden"><code>fn <a href='#method.opts' class='fnname'>opts</a>(&self) -> &<a class="struct" href="../map_gui/options/struct.Options.html" title="struct map_gui::options::Options">Options</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#229-231' title='goto source code'>[src]</a></h4><h4 id='method.mut_opts' class="method hidden"><code>fn <a href='#method.mut_opts' class='fnname'>mut_opts</a>(&mut self) -> &mut <a class="struct" href="../map_gui/options/struct.Options.html" title="struct map_gui::options::Options">Options</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#233-235' title='goto source code'>[src]</a></h4><h4 id='method.map_switched' class="method hidden"><code>fn <a href='#method.map_switched' class='fnname'>map_switched</a>(<br> &mut self, <br> ctx: &mut EventCtx<'_>, <br> map: <a class="struct" href="../map_model/struct.Map.html" title="struct map_model::Map">Map</a>, <br> timer: &mut <a class="struct" href="../abstutil/time/struct.Timer.html" title="struct abstutil::time::Timer">Timer</a><'_><br>)</code><a class='srclink' href='../src/map_gui/simple_app.rs.html#237-242' title='goto source code'>[src]</a></h4><h4 id='method.draw_with_opts' class="method hidden"><code>fn <a href='#method.draw_with_opts' class='fnname'>draw_with_opts</a>(&self, g: &mut GfxCtx<'_>, opts: <a class="struct" href="../map_gui/render/struct.DrawOptions.html" title="struct map_gui::render::DrawOptions">DrawOptions</a>)</code><a class='srclink' href='../src/map_gui/simple_app.rs.html#244-250' title='goto source code'>[src]</a></h4><h4 id='method.make_warper' class="method hidden"><code>fn <a href='#method.make_warper' class='fnname'>make_warper</a>(<br> &mut self, <br> ctx: &EventCtx<'_>, <br> pt: <a class="struct" href="../geom/pt/struct.Pt2D.html" title="struct geom::pt::Pt2D">Pt2D</a>, <br> target_cam_zoom: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>>, <br> _: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="../map_gui/enum.ID.html" title="enum map_gui::ID">ID</a>><br>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn State<<a class="struct" href="../map_gui/struct.SimpleApp.html" title="struct map_gui::SimpleApp">SimpleApp</a><T>>></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#252-262' title='goto source code'>[src]</a></h4><h4 id='method.sim_time-1' class="method hidden"><code>fn <a href='#method.sim_time-1' class='fnname'>sim_time</a>(&self) -> <a class="struct" href="../geom/time/struct.Time.html" title="struct geom::time::Time">Time</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#264-266' title='goto source code'>[src]</a></h4><h4 id='method.current_stage_and_remaining_time-1' class="method hidden"><code>fn <a href='#method.current_stage_and_remaining_time-1' class='fnname'>current_stage_and_remaining_time</a>(<br> &self, <br> id: <a class="struct" href="../map_model/objects/intersection/struct.IntersectionID.html" title="struct map_model::objects::intersection::IntersectionID">IntersectionID</a><br>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../geom/duration/struct.Duration.html" title="struct geom::duration::Duration">Duration</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a class='srclink' href='../src/map_gui/simple_app.rs.html#268-278' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript" src="../implementors/map_gui/trait.AppLike.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "map_gui";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |