1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>envelope (with strategy)</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="../envelope.html" title="envelope"> 9<link rel="prev" href="../envelope.html" title="envelope"> 10<link rel="next" href="envelope_2.html" title="envelope"> 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="../envelope.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../envelope.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="envelope_2.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy"></a><a class="link" href="envelope_3_with_strategy.html" title="envelope (with strategy)">envelope 28 (with strategy)</a> 29</h5></div></div></div> 30<p> 31 <a class="indexterm" name="idm45635698473360"></a> 32Calculates the envelope (with strategy) of a geometry. 33 </p> 34<h6> 35<a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.h0"></a> 36 <span class="phrase"><a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.description"></a></span><a class="link" href="envelope_3_with_strategy.html#geometry.reference.algorithms.envelope.envelope_3_with_strategy.description">Description</a> 37 </h6> 38<p> 39 The free function envelope calculates the envelope (also known as axis 40 aligned bounding box, aabb, or minimum bounding rectangle, mbr) of a 41 geometry. 42 </p> 43<h6> 44<a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.h1"></a> 45 <span class="phrase"><a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.synopsis"></a></span><a class="link" href="envelope_3_with_strategy.html#geometry.reference.algorithms.envelope.envelope_3_with_strategy.synopsis">Synopsis</a> 46 </h6> 47<p> 48</p> 49<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Geometry</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Box</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Strategy</span><span class="special">></span> 50<span class="keyword">void</span> <span class="identifier">envelope</span><span class="special">(</span><span class="identifier">Geometry</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">geometry</span><span class="special">,</span> <span class="identifier">Box</span> <span class="special">&</span> <span class="identifier">mbr</span><span class="special">,</span> <span class="identifier">Strategy</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">strategy</span><span class="special">)</span></pre> 51<p> 52 </p> 53<h6> 54<a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.h2"></a> 55 <span class="phrase"><a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.parameters"></a></span><a class="link" href="envelope_3_with_strategy.html#geometry.reference.algorithms.envelope.envelope_3_with_strategy.parameters">Parameters</a> 56 </h6> 57<div class="informaltable"><table class="table"> 58<colgroup> 59<col> 60<col> 61<col> 62<col> 63</colgroup> 64<thead><tr> 65<th> 66 <p> 67 Type 68 </p> 69 </th> 70<th> 71 <p> 72 Concept 73 </p> 74 </th> 75<th> 76 <p> 77 Name 78 </p> 79 </th> 80<th> 81 <p> 82 Description 83 </p> 84 </th> 85</tr></thead> 86<tbody> 87<tr> 88<td> 89 <p> 90 Geometry const & 91 </p> 92 </td> 93<td> 94 <p> 95 Any type fulfilling a Geometry Concept 96 </p> 97 </td> 98<td> 99 <p> 100 geometry 101 </p> 102 </td> 103<td> 104 <p> 105 A model of the specified concept 106 </p> 107 </td> 108</tr> 109<tr> 110<td> 111 <p> 112 Box & 113 </p> 114 </td> 115<td> 116 <p> 117 Any type fulfilling a Box Concept 118 </p> 119 </td> 120<td> 121 <p> 122 mbr 123 </p> 124 </td> 125<td> 126 <p> 127 A model of the specified Box Concept which is set to the envelope 128 </p> 129 </td> 130</tr> 131<tr> 132<td> 133 <p> 134 Strategy const & 135 </p> 136 </td> 137<td> 138 <p> 139 Any type fulfilling a Envelope Strategy Concept 140 </p> 141 </td> 142<td> 143 <p> 144 strategy 145 </p> 146 </td> 147<td> 148 <p> 149 The strategy which will be used for envelope calculations 150 </p> 151 </td> 152</tr> 153</tbody> 154</table></div> 155<h6> 156<a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.h3"></a> 157 <span class="phrase"><a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.header"></a></span><a class="link" href="envelope_3_with_strategy.html#geometry.reference.algorithms.envelope.envelope_3_with_strategy.header">Header</a> 158 </h6> 159<p> 160 Either 161 </p> 162<p> 163 <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</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">></span></code> 164 </p> 165<p> 166 Or 167 </p> 168<p> 169 <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">algorithms</span><span class="special">/</span><span class="identifier">envelope</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> 170 </p> 171<h6> 172<a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.h4"></a> 173 <span class="phrase"><a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.conformance"></a></span><a class="link" href="envelope_3_with_strategy.html#geometry.reference.algorithms.envelope.envelope_3_with_strategy.conformance">Conformance</a> 174 </h6> 175<p> 176 The function envelope implements function Envelope from the <a href="http://www.opengeospatial.org/standards/sfa" target="_top">OGC 177 Simple Feature Specification</a>. 178 </p> 179<h6> 180<a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.h5"></a> 181 <span class="phrase"><a name="geometry.reference.algorithms.envelope.envelope_3_with_strategy.example"></a></span><a class="link" href="envelope_3_with_strategy.html#geometry.reference.algorithms.envelope.envelope_3_with_strategy.example">Example</a> 182 </h6> 183<p> 184 Shows how to calculate the bounding box of a polygon 185 </p> 186<p> 187</p> 188<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> 189 190<span class="preprocessor">#include</span> <span class="special"><</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">></span> 191<span class="preprocessor">#include</span> <span class="special"><</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">box</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 192<span class="preprocessor">#include</span> <span class="special"><</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">></span> 193<span class="preprocessor">#include</span> <span class="special"><</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">polygon</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 194 195 196<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> 197<span class="special">{</span> 198 <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"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">point</span><span class="special">;</span> 199 200 <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"><</span><span class="identifier">point</span><span class="special">></span> <span class="identifier">polygon</span><span class="special">;</span> 201 202 <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> 203 <span class="string">"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"</span> 204 <span class="string">"(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))"</span><span class="special">,</span> <span class="identifier">polygon</span><span class="special">);</span> 205 206 <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">box</span><span class="special"><</span><span class="identifier">point</span><span class="special">></span> <span class="identifier">box</span><span class="special">;</span> 207 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">envelope</span><span class="special">(</span><span class="identifier">polygon</span><span class="special">,</span> <span class="identifier">box</span><span class="special">);</span> 208 209 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"envelope:"</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">dsv</span><span class="special">(</span><span class="identifier">box</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> 210 211 212 <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> 213<span class="special">}</span> 214</pre> 215<p> 216 </p> 217<p> 218 Output: 219 </p> 220<pre class="programlisting">envelope:((2, 0.7), (5.4, 3)) 221 222<img src="../../../../img/algorithms/envelope.png" alt="envelope"> 223</pre> 224</div> 225<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 226<td align="left"></td> 227<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam 228 Wulkiewicz, Oracle and/or its affiliates<p> 229 Distributed under the Boost Software License, Version 1.0. (See accompanying 230 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>) 231 </p> 232</div></td> 233</tr></table> 234<hr> 235<div class="spirit-nav"> 236<a accesskey="p" href="../envelope.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../envelope.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="envelope_2.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 237</div> 238</body> 239</html> 240