• 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::distance_asymmetric</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_distance_symmetric.html" title="strategy::buffer::distance_symmetric">
10<link rel="next" href="strategy_buffer_point_circle.html" title="strategy::buffer::point_circle">
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_distance_symmetric.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_point_circle.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_distance_asymmetric"></a><a class="link" href="strategy_buffer_distance_asymmetric.html" title="strategy::buffer::distance_asymmetric">strategy::buffer::distance_asymmetric</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="idm45635670586192"></a><a class="indexterm" name="idm45635670585504"></a><a class="indexterm" name="idm45635670584816"></a>
31Let the buffer for linestrings be asymmetric.
32        </p>
33<h6>
34<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h0"></a>
35          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.synopsis"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.synopsis">Synopsis</a>
36        </h6>
37<p>
38</p>
39<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">NumericType</span><span class="special">&gt;</span>
40<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">distance_asymmetric</span>
41<span class="special">{</span>
42  <span class="comment">// ...</span>
43<span class="special">};</span>
44</pre>
45<p>
46        </p>
47<h6>
48<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h1"></a>
49          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.template_parameter_s_"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.template_parameter_s_">Template
50          parameter(s)</a>
51        </h6>
52<div class="informaltable"><table class="table">
53<colgroup>
54<col>
55<col>
56</colgroup>
57<thead><tr>
58<th>
59                  <p>
60                    Parameter
61                  </p>
62                </th>
63<th>
64                  <p>
65                    Description
66                  </p>
67                </th>
68</tr></thead>
69<tbody><tr>
70<td>
71                  <p>
72                    typename NumericType
73                  </p>
74                </td>
75<td>
76                  <p>
77                    numerical type (int, double, ttmath, ...)
78                  </p>
79                </td>
80</tr></tbody>
81</table></div>
82<h6>
83<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h2"></a>
84          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.constructor_s_"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.constructor_s_">Constructor(s)</a>
85        </h6>
86<div class="informaltable"><table class="table">
87<colgroup>
88<col>
89<col>
90<col>
91</colgroup>
92<thead><tr>
93<th>
94                  <p>
95                    Function
96                  </p>
97                </th>
98<th>
99                  <p>
100                    Description
101                  </p>
102                </th>
103<th>
104                  <p>
105                    Parameters
106                  </p>
107                </th>
108</tr></thead>
109<tbody><tr>
110<td>
111                  <p>
112</p>
113<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">distance_asymmetric</span><span class="special">(</span><span class="identifier">NumericType</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">left</span><span class="special">,</span> <span class="identifier">NumericType</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">right</span><span class="special">)</span></pre>
114<p>
115                  </p>
116                </td>
117<td>
118                  <p>
119                    Constructs the strategy, two distances must be specified.
120                  </p>
121                </td>
122<td>
123                  <p>
124                    <span class="bold"><strong>NumericType const &amp;</strong></span>: <span class="emphasis"><em>left</em></span>:
125                    The distance (or radius) of the buffer on the left side
126                  </p>
127                  <p>
128                    <span class="bold"><strong>NumericType const &amp;</strong></span>: <span class="emphasis"><em>right</em></span>:
129                    The distance on the right side
130                  </p>
131                </td>
132</tr></tbody>
133</table></div>
134<h6>
135<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h3"></a>
136          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.header"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.header">Header</a>
137        </h6>
138<p>
139          <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">agnostic</span><span class="special">/</span><span class="identifier">buffer_distance_asymmetric</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
140        </p>
141<h6>
142<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h4"></a>
143          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.example"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.example">Example</a>
144        </h6>
145<p>
146          Shows how the distance_asymmetric strategy can be used as a DistanceStrategy
147          to create asymmetric buffers
148        </p>
149<p>
150</p>
151<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>
152<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>
153<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>
154
155
156<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
157<span class="special">{</span>
158    <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>
159    <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>
160    <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>
161
162    <span class="comment">// Declare the asymmetric distance strategy</span>
163    <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_asymmetric</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> <span class="number">0.5</span><span class="special">);</span>
164
165    <span class="comment">// Declare other strategies</span>
166    <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>
167    <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>
168    <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>
169    <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>
170
171    <span class="comment">// Declare/fill a multi linestring</span>
172    <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>
173    <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>
174
175    <span class="comment">// Create the buffered geometry with left/right a different distance</span>
176    <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>
177    <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>
178                <span class="identifier">distance_strategy</span><span class="special">,</span> <span class="identifier">side_strategy</span><span class="special">,</span>
179                <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>
180
181
182    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
183<span class="special">}</span>
184</pre>
185<p>
186        </p>
187<h6>
188<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h5"></a>
189          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.output"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.output">Output</a>
190        </h6>
191<p>
192          <span class="inlinemediaobject"><img src="../../../img/strategies/buffer_distance_asymmetric.png" alt="buffer_distance_asymmetric"></span>
193        </p>
194<h6>
195<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h6"></a>
196          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.see_also"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.see_also">See
197          also</a>
198        </h6>
199<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
200<li class="listitem">
201              <a class="link" href="../algorithms/buffer/buffer_7_with_strategies.html" title="buffer (with strategies)">buffer
202              (with strategies)</a>
203            </li>
204<li class="listitem">
205              <a class="link" href="strategy_buffer_distance_symmetric.html" title="strategy::buffer::distance_symmetric">distance_symmetric</a>
206            </li>
207</ul></div>
208</div>
209<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
210<td align="left"></td>
211<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
212      Wulkiewicz, Oracle and/or its affiliates<p>
213        Distributed under the Boost Software License, Version 1.0. (See accompanying
214        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>)
215      </p>
216</div></td>
217</tr></table>
218<hr>
219<div class="spirit-nav">
220<a accesskey="p" href="strategy_buffer_distance_symmetric.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_point_circle.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
221</div>
222</body>
223</html>
224