• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>strategy::buffer::end_flat</title>
5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../index.html" title="Chapter 1. Geometry">
8<link rel="up" href="../strategies.html" title="Strategies">
9<link rel="prev" href="strategy_buffer_end_round.html" title="strategy::buffer::end_round">
10<link rel="next" href="strategy_buffer_distance_symmetric.html" title="strategy::buffer::distance_symmetric">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="strategy_buffer_end_round.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../strategies.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="strategy_buffer_distance_symmetric.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="geometry.reference.strategies.strategy_buffer_end_flat"></a><a class="link" href="strategy_buffer_end_flat.html" title="strategy::buffer::end_flat">strategy::buffer::end_flat</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="idm45635670933040"></a><a class="indexterm" name="idm45635670932352"></a><a class="indexterm" name="idm45635670931664"></a>
31Let the buffer create flat ends.
32        </p>
33<h6>
34<a name="geometry.reference.strategies.strategy_buffer_end_flat.h0"></a>
35          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_flat.description"></a></span><a class="link" href="strategy_buffer_end_flat.html#geometry.reference.strategies.strategy_buffer_end_flat.description">Description</a>
36        </h6>
37<p>
38          This strategy can be used as EndStrategy for the buffer algorithm. It creates
39          a flat end for each linestring-end. It can be applied for (multi)linestrings.
40          Also it is applicable for spikes in (multi)polygons. This strategy is only
41          applicable for Cartesian coordinate systems.
42        </p>
43<h6>
44<a name="geometry.reference.strategies.strategy_buffer_end_flat.h1"></a>
45          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_flat.synopsis"></a></span><a class="link" href="strategy_buffer_end_flat.html#geometry.reference.strategies.strategy_buffer_end_flat.synopsis">Synopsis</a>
46        </h6>
47<p>
48</p>
49<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">end_flat</span>
50<span class="special">{</span>
51  <span class="comment">// ...</span>
52<span class="special">};</span>
53</pre>
54<p>
55        </p>
56<h6>
57<a name="geometry.reference.strategies.strategy_buffer_end_flat.h2"></a>
58          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_flat.header"></a></span><a class="link" href="strategy_buffer_end_flat.html#geometry.reference.strategies.strategy_buffer_end_flat.header">Header</a>
59        </h6>
60<p>
61          <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">strategies</span><span class="special">/</span><span class="identifier">cartesian</span><span class="special">/</span><span class="identifier">buffer_end_flat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
62        </p>
63<h6>
64<a name="geometry.reference.strategies.strategy_buffer_end_flat.h3"></a>
65          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_flat.example"></a></span><a class="link" href="strategy_buffer_end_flat.html#geometry.reference.strategies.strategy_buffer_end_flat.example">Example</a>
66        </h6>
67<p>
68          Shows how the end_flat strategy can be used as a EndStrategy to create
69          flat ends
70        </p>
71<p>
72</p>
73<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
74<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">point_xy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
75<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
76
77
78<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
79<span class="special">{</span>
80    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">d2</span><span class="special">::</span><span class="identifier">point_xy</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">point</span><span class="special">;</span>
81    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">linestring</span><span class="special">&lt;</span><span class="identifier">point</span><span class="special">&gt;</span> <span class="identifier">linestring</span><span class="special">;</span>
82    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">polygon</span><span class="special">&lt;</span><span class="identifier">point</span><span class="special">&gt;</span> <span class="identifier">polygon</span><span class="special">;</span>
83
84    <span class="comment">// Declare the flat-end strategy</span>
85    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">end_flat</span> <span class="identifier">end_strategy</span><span class="special">;</span>
86
87    <span class="comment">// Declare other strategies</span>
88    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">distance_symmetric</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">distance_strategy</span><span class="special">(</span><span class="number">1.0</span><span class="special">);</span>
89    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">side_straight</span> <span class="identifier">side_strategy</span><span class="special">;</span>
90    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">join_round</span> <span class="identifier">join_strategy</span><span class="special">;</span>
91    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">point_circle</span> <span class="identifier">point_strategy</span><span class="special">;</span>
92
93    <span class="comment">// Declare/fill a multi linestring</span>
94    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">multi_linestring</span><span class="special">&lt;</span><span class="identifier">linestring</span><span class="special">&gt;</span> <span class="identifier">ml</span><span class="special">;</span>
95    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span><span class="string">"MULTILINESTRING((3 5,5 10,7 5),(7 7,11 10,15 7,19 10))"</span><span class="special">,</span> <span class="identifier">ml</span><span class="special">);</span>
96
97    <span class="comment">// Create the buffered geometry with flat ends</span>
98    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">multi_polygon</span><span class="special">&lt;</span><span class="identifier">polygon</span><span class="special">&gt;</span> <span class="identifier">result</span><span class="special">;</span>
99    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">ml</span><span class="special">,</span> <span class="identifier">result</span><span class="special">,</span>
100                <span class="identifier">distance_strategy</span><span class="special">,</span> <span class="identifier">side_strategy</span><span class="special">,</span>
101                <span class="identifier">join_strategy</span><span class="special">,</span> <span class="identifier">end_strategy</span><span class="special">,</span> <span class="identifier">point_strategy</span><span class="special">);</span>
102
103
104    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
105<span class="special">}</span>
106</pre>
107<p>
108        </p>
109<h6>
110<a name="geometry.reference.strategies.strategy_buffer_end_flat.h4"></a>
111          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_flat.output"></a></span><a class="link" href="strategy_buffer_end_flat.html#geometry.reference.strategies.strategy_buffer_end_flat.output">Output</a>
112        </h6>
113<p>
114          <span class="inlinemediaobject"><img src="../../../img/strategies/buffer_end_flat.png" alt="buffer_end_flat"></span>
115        </p>
116<h6>
117<a name="geometry.reference.strategies.strategy_buffer_end_flat.h5"></a>
118          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_flat.see_also"></a></span><a class="link" href="strategy_buffer_end_flat.html#geometry.reference.strategies.strategy_buffer_end_flat.see_also">See
119          also</a>
120        </h6>
121<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
122<li class="listitem">
123              <a class="link" href="../algorithms/buffer/buffer_7_with_strategies.html" title="buffer (with strategies)">buffer
124              (with strategies)</a>
125            </li>
126<li class="listitem">
127              <a class="link" href="strategy_buffer_end_round.html" title="strategy::buffer::end_round">end_round</a>
128            </li>
129</ul></div>
130</div>
131<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
132<td align="left"></td>
133<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
134      Wulkiewicz, Oracle and/or its affiliates<p>
135        Distributed under the Boost Software License, Version 1.0. (See accompanying
136        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
137      </p>
138</div></td>
139</tr></table>
140<hr>
141<div class="spirit-nav">
142<a accesskey="p" href="strategy_buffer_end_round.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../strategies.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="strategy_buffer_distance_symmetric.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
143</div>
144</body>
145</html>
146