• 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_round</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_join_miter.html" title="strategy::buffer::join_miter">
10<link rel="next" href="strategy_buffer_end_flat.html" title="strategy::buffer::end_flat">
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_join_miter.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_end_flat.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_round"></a><a class="link" href="strategy_buffer_end_round.html" title="strategy::buffer::end_round">strategy::buffer::end_round</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="idm45635671112448"></a><a class="indexterm" name="idm45635671111760"></a><a class="indexterm" name="idm45635671111072"></a>
31Let the buffer create rounded ends.
32        </p>
33<h6>
34<a name="geometry.reference.strategies.strategy_buffer_end_round.h0"></a>
35          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_round.description"></a></span><a class="link" href="strategy_buffer_end_round.html#geometry.reference.strategies.strategy_buffer_end_round.description">Description</a>
36        </h6>
37<p>
38          This strategy can be used as EndStrategy for the buffer algorithm. It creates
39          a rounded 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_round.h1"></a>
45          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_round.synopsis"></a></span><a class="link" href="strategy_buffer_end_round.html#geometry.reference.strategies.strategy_buffer_end_round.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_round</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_round.h2"></a>
58          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_round.constructor_s_"></a></span><a class="link" href="strategy_buffer_end_round.html#geometry.reference.strategies.strategy_buffer_end_round.constructor_s_">Constructor(s)</a>
59        </h6>
60<div class="informaltable"><table class="table">
61<colgroup>
62<col>
63<col>
64<col>
65</colgroup>
66<thead><tr>
67<th>
68                  <p>
69                    Function
70                  </p>
71                </th>
72<th>
73                  <p>
74                    Description
75                  </p>
76                </th>
77<th>
78                  <p>
79                    Parameters
80                  </p>
81                </th>
82</tr></thead>
83<tbody><tr>
84<td>
85                  <p>
86</p>
87<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">end_round</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">points_per_circle</span> <span class="special">=</span> <span class="number">90</span><span class="special">)</span></pre>
88<p>
89                  </p>
90                </td>
91<td>
92                  <p>
93                    Constructs the strategy.
94                  </p>
95                </td>
96<td>
97                  <p>
98                    <span class="bold"><strong>std::size_t</strong></span>: <span class="emphasis"><em>points_per_circle</em></span>:
99                    points which would be used for a full circle (if points_per_circle
100                    is smaller than 4, it is internally set to 4)
101                  </p>
102                </td>
103</tr></tbody>
104</table></div>
105<h6>
106<a name="geometry.reference.strategies.strategy_buffer_end_round.h3"></a>
107          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_round.header"></a></span><a class="link" href="strategy_buffer_end_round.html#geometry.reference.strategies.strategy_buffer_end_round.header">Header</a>
108        </h6>
109<p>
110          <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_round</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
111        </p>
112<h6>
113<a name="geometry.reference.strategies.strategy_buffer_end_round.h4"></a>
114          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_round.example"></a></span><a class="link" href="strategy_buffer_end_round.html#geometry.reference.strategies.strategy_buffer_end_round.example">Example</a>
115        </h6>
116<p>
117          Shows how the end_round strategy can be used as a EndStrategy to create
118          rounded ends
119        </p>
120<p>
121</p>
122<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>
123<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>
124<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>
125
126
127<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
128<span class="special">{</span>
129    <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>
130    <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>
131    <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>
132
133    <span class="comment">// Declare the round-end strategy with 36 points for a full circle</span>
134    <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_round</span> <span class="identifier">end_strategy</span><span class="special">(</span><span class="number">36</span><span class="special">);</span>
135
136    <span class="comment">// Declare other strategies</span>
137    <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>
138    <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>
139    <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>
140    <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>
141
142    <span class="comment">// Declare/fill a multi linestring</span>
143    <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>
144    <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>
145
146    <span class="comment">// Create the buffered geometry with rounded ends</span>
147    <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>
148    <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>
149                <span class="identifier">distance_strategy</span><span class="special">,</span> <span class="identifier">side_strategy</span><span class="special">,</span>
150                <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>
151
152
153    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
154<span class="special">}</span>
155</pre>
156<p>
157        </p>
158<h6>
159<a name="geometry.reference.strategies.strategy_buffer_end_round.h5"></a>
160          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_round.output"></a></span><a class="link" href="strategy_buffer_end_round.html#geometry.reference.strategies.strategy_buffer_end_round.output">Output</a>
161        </h6>
162<p>
163          <span class="inlinemediaobject"><img src="../../../img/strategies/buffer_end_round.png" alt="buffer_end_round"></span>
164        </p>
165<h6>
166<a name="geometry.reference.strategies.strategy_buffer_end_round.h6"></a>
167          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_end_round.see_also"></a></span><a class="link" href="strategy_buffer_end_round.html#geometry.reference.strategies.strategy_buffer_end_round.see_also">See
168          also</a>
169        </h6>
170<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
171<li class="listitem">
172              <a class="link" href="../algorithms/buffer/buffer_7_with_strategies.html" title="buffer (with strategies)">buffer
173              (with strategies)</a>
174            </li>
175<li class="listitem">
176              <a class="link" href="strategy_buffer_end_flat.html" title="strategy::buffer::end_flat">end_flat</a>
177            </li>
178</ul></div>
179</div>
180<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
181<td align="left"></td>
182<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
183      Wulkiewicz, Oracle and/or its affiliates<p>
184        Distributed under the Boost Software License, Version 1.0. (See accompanying
185        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>)
186      </p>
187</div></td>
188</tr></table>
189<hr>
190<div class="spirit-nav">
191<a accesskey="p" href="strategy_buffer_join_miter.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_end_flat.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
192</div>
193</body>
194</html>
195