mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-23 08:54:30 +03:00
deploy: b7172f876d
This commit is contained in:
parent
cc974675e4
commit
e2eabdb69f
@ -5,5 +5,5 @@
|
||||
</a><div class="sidebar-elems"><h2 class="location"><a href="index.html">In geom::polygon</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../geom/index.html"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><button type="button" id="help-button" title="help">?</button><div id="settings-menu" tabindex="-1">
|
||||
<a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div>
|
||||
</div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
|
||||
<h1 class="fqn"><span class="in-band">Function <a href="../index.html">geom</a>::<wbr><a href="index.html">polygon</a>::<wbr><a class="fn" href="#">from_multi</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../src/geom/polygon.rs.html#576-582">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust fn"><code>fn from_multi(multi: MultiPolygon) -> <a class="type" href="https://docs.rs/anyhow/1.0.41/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.63.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="struct.Polygon.html" title="struct geom::polygon::Polygon">Polygon</a>>></code></pre></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="geom" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.63.0 (4b91a6ea7 2022-08-08)" ></div>
|
||||
<h1 class="fqn"><span class="in-band">Function <a href="../index.html">geom</a>::<wbr><a href="index.html">polygon</a>::<wbr><a class="fn" href="#">from_multi</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../src/geom/polygon.rs.html#568-574">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust fn"><code>fn from_multi(multi: MultiPolygon) -> <a class="type" href="https://docs.rs/anyhow/1.0.41/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.63.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="struct.Polygon.html" title="struct geom::polygon::Polygon">Polygon</a>>></code></pre></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="geom" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.63.0 (4b91a6ea7 2022-08-08)" ></div>
|
||||
</body></html>
|
@ -5,7 +5,7 @@
|
||||
</a><h2 class="location"><a href="#">Module polygon</a></h2><div class="sidebar-elems"><section><div class="block"><ul><li><a href="#structs">Structs</a></li><li><a href="#functions">Functions</a></li></ul></div></section></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../geom/index.html"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><button type="button" id="help-button" title="help">?</button><div id="settings-menu" tabindex="-1">
|
||||
<a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div>
|
||||
</div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
|
||||
<h1 class="fqn"><span class="in-band">Module <a href="../index.html">geom</a>::<wbr><a class="mod" href="#">polygon</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../src/geom/polygon.rs.html#1-582">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2>
|
||||
<h1 class="fqn"><span class="in-band">Module <a href="../index.html">geom</a>::<wbr><a class="mod" href="#">polygon</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../src/geom/polygon.rs.html#1-574">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Polygon.html" title="geom::polygon::Polygon struct">Polygon</a></div><div class="item-right docblock-short"></div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.from_multi.html" title="geom::polygon::from_multi fn">from_multi</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="geom" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.63.0 (4b91a6ea7 2022-08-08)" ></div>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,6 +5,6 @@
|
||||
</a><div class="sidebar-elems"><h2 class="location"><a href="index.html">In map_gui::tools::title_screen::built_info</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../../map_gui/index.html"><img class="rust-logo" src="../../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><button type="button" id="help-button" title="help">?</button><div id="settings-menu" tabindex="-1">
|
||||
<a href="../../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../../wheel.svg"></a></div>
|
||||
</div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
|
||||
<h1 class="fqn"><span class="in-band">Constant <a href="../../../index.html">map_gui</a>::<wbr><a href="../../index.html">tools</a>::<wbr><a href="../index.html">title_screen</a>::<wbr><a href="index.html">built_info</a>::<wbr><a class="constant" href="#">BUILT_TIME_UTC</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../../../src/map_gui/home/runner/work/abstreet/abstreet/target/debug/build/map_gui-e828072489b7169e/out/built.rs.html#78">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust const"><code>pub const BUILT_TIME_UTC: &<a class="primitive" href="https://doc.rust-lang.org/1.63.0/std/primitive.str.html">str</a> = r"Sat, 03 Sep 2022 12:49:01 +0000";</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The build time in RFC2822, UTC.</p>
|
||||
<h1 class="fqn"><span class="in-band">Constant <a href="../../../index.html">map_gui</a>::<wbr><a href="../../index.html">tools</a>::<wbr><a href="../index.html">title_screen</a>::<wbr><a href="index.html">built_info</a>::<wbr><a class="constant" href="#">BUILT_TIME_UTC</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../../../src/map_gui/home/runner/work/abstreet/abstreet/target/debug/build/map_gui-e828072489b7169e/out/built.rs.html#78">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust const"><code>pub const BUILT_TIME_UTC: &<a class="primitive" href="https://doc.rust-lang.org/1.63.0/std/primitive.str.html">str</a> = r"Sat, 03 Sep 2022 13:00:22 +0000";</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The build time in RFC2822, UTC.</p>
|
||||
</div></details></section></div></main><div id="rustdoc-vars" data-root-path="../../../../" data-current-crate="map_gui" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.63.0 (4b91a6ea7 2022-08-08)" ></div>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
@ -578,14 +578,6 @@
|
||||
<span id="572">572</span>
|
||||
<span id="573">573</span>
|
||||
<span id="574">574</span>
|
||||
<span id="575">575</span>
|
||||
<span id="576">576</span>
|
||||
<span id="577">577</span>
|
||||
<span id="578">578</span>
|
||||
<span id="579">579</span>
|
||||
<span id="580">580</span>
|
||||
<span id="581">581</span>
|
||||
<span id="582">582</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">anyhow::Result</span>;
|
||||
@ -677,7 +669,8 @@
|
||||
}
|
||||
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">get_bounds</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">Bounds</span> {
|
||||
<span class="ident">Bounds::from</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">points</span>)
|
||||
<span class="comment">// Interiors should always be strictly contained within the polygon's exterior</span>
|
||||
<span class="ident">Bounds::from</span>(<span class="self">self</span>.<span class="ident">get_outer_ring</span>().<span class="ident">points</span>())
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Transformations must preserve Rings.</span>
|
||||
@ -945,8 +938,7 @@
|
||||
|
||||
<span class="doccomment">/// Doesn't handle multiple crossings in and out.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">clip_polyline</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">input</span>: <span class="kw-2">&</span><span class="ident">PolyLine</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Vec</span><span class="op"><</span><span class="ident">Pt2D</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">ring</span> <span class="op">=</span> <span class="ident">Ring::must_new</span>(<span class="self">self</span>.<span class="ident">points</span>.<span class="ident">clone</span>());
|
||||
<span class="kw">let</span> <span class="ident">hits</span> <span class="op">=</span> <span class="ident">ring</span>.<span class="ident">all_intersections</span>(<span class="ident">input</span>);
|
||||
<span class="kw">let</span> <span class="ident">hits</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">get_outer_ring</span>().<span class="ident">all_intersections</span>(<span class="ident">input</span>);
|
||||
|
||||
<span class="kw">if</span> <span class="ident">hits</span>.<span class="ident">is_empty</span>() {
|
||||
<span class="comment">// All the points must be inside, or none</span>
|
||||
@ -976,7 +968,7 @@
|
||||
|
||||
<span class="comment">// TODO Only handles a few cases</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">clip_ring</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">input</span>: <span class="kw-2">&</span><span class="ident">Ring</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Vec</span><span class="op"><</span><span class="ident">Pt2D</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">ring</span> <span class="op">=</span> <span class="ident">Ring::must_new</span>(<span class="self">self</span>.<span class="ident">points</span>.<span class="ident">clone</span>());
|
||||
<span class="kw">let</span> <span class="ident">ring</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">get_outer_ring</span>();
|
||||
<span class="kw">let</span> <span class="ident">hits</span> <span class="op">=</span> <span class="ident">ring</span>.<span class="ident">all_intersections</span>(<span class="kw-2">&</span><span class="ident">PolyLine::unchecked_new</span>(<span class="ident">input</span>.<span class="ident">clone</span>().<span class="ident">into_points</span>()));
|
||||
|
||||
<span class="kw">if</span> <span class="ident">hits</span>.<span class="ident">is_empty</span>() {
|
||||
@ -1009,31 +1001,23 @@
|
||||
<span class="prelude-val">None</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// If the polygon is just a single outer ring, produces a GeoJSON polygon. Otherwise, produces</span>
|
||||
<span class="doccomment">/// a GeoJSON multipolygon consisting of individual triangles. Optionally map the world-space</span>
|
||||
<span class="doccomment">/// points back to GPS.</span>
|
||||
<span class="doccomment">/// Optionally map the world-space points back to GPS.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">to_geojson</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">gps</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">GPSBounds</span><span class="op">></span>) -> <span class="ident">geojson::Geometry</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Ok</span>(<span class="ident">ring</span>) <span class="op">=</span> <span class="ident">Ring::new</span>(<span class="self">self</span>.<span class="ident">points</span>.<span class="ident">clone</span>()) {
|
||||
<span class="kw">return</span> <span class="ident">ring</span>.<span class="ident">to_geojson</span>(<span class="ident">gps</span>);
|
||||
<span class="kw">use</span> <span class="ident">geo::MapCoordsInPlace</span>;
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">geom</span>: <span class="ident">geo::Geometry</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">to_geo</span>().<span class="ident">into</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">gps_bounds</span>) <span class="op">=</span> <span class="ident">gps</span> {
|
||||
<span class="ident">geom</span>.<span class="ident">map_coords_in_place</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> {
|
||||
<span class="kw">let</span> <span class="ident">gps</span> <span class="op">=</span> <span class="ident">Pt2D::new</span>(<span class="ident">c</span>.<span class="ident">x</span>, <span class="ident">c</span>.<span class="ident">y</span>).<span class="ident">to_gps</span>(<span class="ident">gps_bounds</span>);
|
||||
(<span class="ident">gps</span>.<span class="ident">x</span>(), <span class="ident">gps</span>.<span class="ident">y</span>()).<span class="ident">into</span>()
|
||||
});
|
||||
}
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">polygons</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
|
||||
<span class="kw">for</span> <span class="ident">triangle</span> <span class="kw">in</span> <span class="self">self</span>.<span class="ident">triangles</span>() {
|
||||
<span class="kw">let</span> <span class="ident">raw_pts</span> <span class="op">=</span> <span class="macro">vec!</span>[<span class="ident">triangle</span>.<span class="ident">pt1</span>, <span class="ident">triangle</span>.<span class="ident">pt2</span>, <span class="ident">triangle</span>.<span class="ident">pt3</span>, <span class="ident">triangle</span>.<span class="ident">pt1</span>];
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">pts</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">gps</span>) <span class="op">=</span> <span class="ident">gps</span> {
|
||||
<span class="kw">for</span> <span class="ident">pt</span> <span class="kw">in</span> <span class="ident">gps</span>.<span class="ident">convert_back</span>(<span class="kw-2">&</span><span class="ident">raw_pts</span>) {
|
||||
<span class="ident">pts</span>.<span class="ident">push</span>(<span class="macro">vec!</span>[<span class="ident">pt</span>.<span class="ident">x</span>(), <span class="ident">pt</span>.<span class="ident">y</span>()]);
|
||||
}
|
||||
} <span class="kw">else</span> {
|
||||
<span class="kw">for</span> <span class="ident">pt</span> <span class="kw">in</span> <span class="ident">raw_pts</span> {
|
||||
<span class="ident">pts</span>.<span class="ident">push</span>(<span class="macro">vec!</span>[<span class="ident">pt</span>.<span class="ident">x</span>(), <span class="ident">pt</span>.<span class="ident">y</span>()]);
|
||||
}
|
||||
}
|
||||
<span class="ident">polygons</span>.<span class="ident">push</span>(<span class="macro">vec!</span>[<span class="ident">pts</span>]);
|
||||
<span class="ident">geojson::Geometry</span> {
|
||||
<span class="ident">bbox</span>: <span class="prelude-val">None</span>,
|
||||
<span class="ident">value</span>: <span class="ident">geojson::Value::from</span>(<span class="kw-2">&</span><span class="ident">geom</span>),
|
||||
<span class="ident">foreign_members</span>: <span class="prelude-val">None</span>,
|
||||
}
|
||||
|
||||
<span class="ident">geojson::Geometry::new</span>(<span class="ident">geojson::Value::MultiPolygon</span>(<span class="ident">polygons</span>))
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Extracts all polygons from raw bytes representing a GeoJSON file, along with the string</span>
|
||||
|
@ -180,7 +180,7 @@
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">RUSTDOC_VERSION</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">r"rustdoc 1.63.0 (4b91a6ea7 2022-08-08)"</span>;
|
||||
<span class="attribute">#[<span class="ident">doc</span><span class="op">=</span><span class="string">r#"The build time in RFC2822, UTC."#</span>]</span>
|
||||
<span class="attribute">#[<span class="ident">allow</span>(<span class="ident">dead_code</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">BUILT_TIME_UTC</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">r"Sat, 03 Sep 2022 12:49:01 +0000"</span>;
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">BUILT_TIME_UTC</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">r"Sat, 03 Sep 2022 13:00:22 +0000"</span>;
|
||||
<span class="attribute">#[<span class="ident">doc</span><span class="op">=</span><span class="string">r#"The target architecture, given by `CARGO_CFG_TARGET_ARCH`."#</span>]</span>
|
||||
<span class="attribute">#[<span class="ident">allow</span>(<span class="ident">dead_code</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">CFG_TARGET_ARCH</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">r"x86_64"</span>;
|
||||
|
Loading…
Reference in New Issue
Block a user