• 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::geographic_point_circle</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_point_square.html" title="strategy::buffer::point_square">
10<link rel="next" href="strategy_buffer_side_straight.html" title="strategy::buffer::side_straight">
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_point_square.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_side_straight.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_geographic_point_circle"></a><a class="link" href="strategy_buffer_geographic_point_circle.html" title="strategy::buffer::geographic_point_circle">strategy::buffer::geographic_point_circle</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="idm45635670065152"></a><a class="indexterm" name="idm45635670064464"></a><a class="indexterm" name="idm45635670063776"></a>
31Create a circular buffer around a point, on the Earth.
32        </p>
33<h6>
34<a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.h0"></a>
35          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.description"></a></span><a class="link" href="strategy_buffer_geographic_point_circle.html#geometry.reference.strategies.strategy_buffer_geographic_point_circle.description">Description</a>
36        </h6>
37<p>
38          This strategy can be used as PointStrategy for the buffer algorithm. It
39          creates a circular buffer around a point, on the Earth. It can be applied
40          for points and multi_points.
41        </p>
42<h6>
43<a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.h1"></a>
44          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.synopsis"></a></span><a class="link" href="strategy_buffer_geographic_point_circle.html#geometry.reference.strategies.strategy_buffer_geographic_point_circle.synopsis">Synopsis</a>
45        </h6>
46<p>
47</p>
48<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">FormulaPolicy</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Spheroid</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">CalculationType</span><span class="special">&gt;</span>
49<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">geographic_point_circle</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_geographic_point_circle.h2"></a>
58          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.template_parameter_s_"></a></span><a class="link" href="strategy_buffer_geographic_point_circle.html#geometry.reference.strategies.strategy_buffer_geographic_point_circle.template_parameter_s_">Template
59          parameter(s)</a>
60        </h6>
61<div class="informaltable"><table class="table">
62<colgroup>
63<col>
64<col>
65<col>
66</colgroup>
67<thead><tr>
68<th>
69                  <p>
70                    Parameter
71                  </p>
72                </th>
73<th>
74                  <p>
75                    Default
76                  </p>
77                </th>
78<th>
79                  <p>
80                    Description
81                  </p>
82                </th>
83</tr></thead>
84<tbody>
85<tr>
86<td>
87                  <p>
88                    typename FormulaPolicy
89                  </p>
90                </td>
91<td>
92                  <p>
93                    strategy::andoyer
94                  </p>
95                </td>
96<td>
97                </td>
98</tr>
99<tr>
100<td>
101                  <p>
102                    typename Spheroid
103                  </p>
104                </td>
105<td>
106                  <p>
107                    srs::spheroid&lt;double&gt;
108                  </p>
109                </td>
110<td>
111                </td>
112</tr>
113<tr>
114<td>
115                  <p>
116                    typename CalculationType
117                  </p>
118                </td>
119<td>
120                  <p>
121                    void
122                  </p>
123                </td>
124<td>
125                </td>
126</tr>
127</tbody>
128</table></div>
129<h6>
130<a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.h3"></a>
131          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.constructor_s_"></a></span><a class="link" href="strategy_buffer_geographic_point_circle.html#geometry.reference.strategies.strategy_buffer_geographic_point_circle.constructor_s_">Constructor(s)</a>
132        </h6>
133<div class="informaltable"><table class="table">
134<colgroup>
135<col>
136<col>
137<col>
138</colgroup>
139<thead><tr>
140<th>
141                  <p>
142                    Function
143                  </p>
144                </th>
145<th>
146                  <p>
147                    Description
148                  </p>
149                </th>
150<th>
151                  <p>
152                    Parameters
153                  </p>
154                </th>
155</tr></thead>
156<tbody><tr>
157<td>
158                  <p>
159</p>
160<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">geographic_point_circle</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">count</span> <span class="special">=</span> <span class="number">90</span><span class="special">)</span></pre>
161<p>
162                  </p>
163                </td>
164<td>
165                  <p>
166                    Constructs the strategy.
167                  </p>
168                </td>
169<td>
170                  <p>
171                    <span class="bold"><strong>std::size_t</strong></span>: <span class="emphasis"><em>count</em></span>:
172                    number of points for the created circle (if count is smaller
173                    than 3, count is internally set to 3)
174                  </p>
175                </td>
176</tr></tbody>
177</table></div>
178<h6>
179<a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.h4"></a>
180          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.header"></a></span><a class="link" href="strategy_buffer_geographic_point_circle.html#geometry.reference.strategies.strategy_buffer_geographic_point_circle.header">Header</a>
181        </h6>
182<p>
183          <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">geographic</span><span class="special">/</span><span class="identifier">buffer_point_circle</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
184        </p>
185<h6>
186<a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.h5"></a>
187          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.example"></a></span><a class="link" href="strategy_buffer_geographic_point_circle.html#geometry.reference.strategies.strategy_buffer_geographic_point_circle.example">Example</a>
188        </h6>
189<p>
190          Shows how the point_circle strategy, for the Earth, can be used as a PointStrategy
191          to create circular buffers around points
192        </p>
193<p>
194</p>
195<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>
196<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
197
198<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
199<span class="special">{</span>
200    <span class="keyword">namespace</span> <span class="identifier">bg</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">;</span>
201
202    <span class="keyword">typedef</span> <span class="identifier">bg</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">point</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="identifier">bg</span><span class="special">::</span><span class="identifier">cs</span><span class="special">::</span><span class="identifier">geographic</span><span class="special">&lt;</span><span class="identifier">bg</span><span class="special">::</span><span class="identifier">degree</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">point</span><span class="special">;</span>
203
204    <span class="comment">// Declare the geographic_point_circle strategy (with 36 points)</span>
205    <span class="comment">// Default template arguments (taking Andoyer strategy)</span>
206    <span class="identifier">bg</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">geographic_point_circle</span><span class="special">&lt;&gt;</span> <span class="identifier">point_strategy</span><span class="special">(</span><span class="number">36</span><span class="special">);</span>
207
208    <span class="comment">// Declare the distance strategy (one kilometer, around the point, on Earth)</span>
209    <span class="identifier">bg</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">1000.0</span><span class="special">);</span>
210
211    <span class="comment">// Declare other necessary strategies, unused for point</span>
212    <span class="identifier">bg</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>
213    <span class="identifier">bg</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>
214    <span class="identifier">bg</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>
215
216    <span class="comment">// Declare/fill a point on Earth, near Amsterdam</span>
217    <span class="identifier">point</span> <span class="identifier">p</span><span class="special">;</span>
218    <span class="identifier">bg</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span><span class="string">"POINT(4.9 52.1)"</span><span class="special">,</span> <span class="identifier">p</span><span class="special">);</span>
219
220    <span class="comment">// Create the buffer of a point on the Earth</span>
221    <span class="identifier">bg</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">bg</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="special">&gt;</span> <span class="identifier">result</span><span class="special">;</span>
222    <span class="identifier">bg</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">result</span><span class="special">,</span>
223                <span class="identifier">distance_strategy</span><span class="special">,</span> <span class="identifier">side_strategy</span><span class="special">,</span>
224                <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>
225
226    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Area: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">bg</span><span class="special">::</span><span class="identifier">area</span><span class="special">(</span><span class="identifier">result</span><span class="special">)</span> <span class="special">/</span> <span class="special">(</span><span class="number">1000</span> <span class="special">*</span> <span class="number">1000</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" square kilometer"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
227
228    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
229<span class="special">}</span>
230</pre>
231<p>
232        </p>
233<p>
234          Output:
235        </p>
236<pre class="programlisting">Area: 3.12542 square kilometer
237</pre>
238<h6>
239<a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.h6"></a>
240          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_geographic_point_circle.see_also"></a></span><a class="link" href="strategy_buffer_geographic_point_circle.html#geometry.reference.strategies.strategy_buffer_geographic_point_circle.see_also">See
241          also</a>
242        </h6>
243<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
244<li class="listitem">
245              <a class="link" href="../algorithms/buffer/buffer_7_with_strategies.html" title="buffer (with strategies)">buffer
246              (with strategies)</a>
247            </li>
248<li class="listitem">
249              <a class="link" href="strategy_buffer_point_circle.html" title="strategy::buffer::point_circle">point_circle</a>
250            </li>
251<li class="listitem">
252              <a class="link" href="strategy_buffer_point_square.html" title="strategy::buffer::point_square">point_square</a>
253            </li>
254</ul></div>
255</div>
256<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
257<td align="left"></td>
258<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
259      Wulkiewicz, Oracle and/or its affiliates<p>
260        Distributed under the Boost Software License, Version 1.0. (See accompanying
261        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>)
262      </p>
263</div></td>
264</tr></table>
265<hr>
266<div class="spirit-nav">
267<a accesskey="p" href="strategy_buffer_point_square.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_side_straight.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
268</div>
269</body>
270</html>
271