1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>is_simple (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="../is_simple.html" title="is_simple"> 9<link rel="prev" href="../is_simple.html" title="is_simple"> 10<link rel="next" href="is_simple_1.html" title="is_simple"> 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="../is_simple.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../is_simple.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="is_simple_1.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.is_simple.is_simple_2_with_strategy"></a><a class="link" href="is_simple_2_with_strategy.html" title="is_simple (with strategy)">is_simple 28 (with strategy)</a> 29</h5></div></div></div> 30<p> 31 <a class="indexterm" name="idm45635694898000"></a> 32Checks if a geometry is simple. 33 </p> 34<h6> 35<a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.h0"></a> 36 <span class="phrase"><a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.synopsis"></a></span><a class="link" href="is_simple_2_with_strategy.html#geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.synopsis">Synopsis</a> 37 </h6> 38<p> 39</p> 40<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">Strategy</span><span class="special">></span> 41<span class="keyword">bool</span> <span class="identifier">is_simple</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">Strategy</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">strategy</span><span class="special">)</span></pre> 42<p> 43 </p> 44<h6> 45<a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.h1"></a> 46 <span class="phrase"><a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.parameters"></a></span><a class="link" href="is_simple_2_with_strategy.html#geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.parameters">Parameters</a> 47 </h6> 48<div class="informaltable"><table class="table"> 49<colgroup> 50<col> 51<col> 52<col> 53<col> 54</colgroup> 55<thead><tr> 56<th> 57 <p> 58 Type 59 </p> 60 </th> 61<th> 62 <p> 63 Concept 64 </p> 65 </th> 66<th> 67 <p> 68 Name 69 </p> 70 </th> 71<th> 72 <p> 73 Description 74 </p> 75 </th> 76</tr></thead> 77<tbody> 78<tr> 79<td> 80 <p> 81 Geometry const & 82 </p> 83 </td> 84<td> 85 <p> 86 Any type fulfilling a Geometry Concept 87 </p> 88 </td> 89<td> 90 <p> 91 geometry 92 </p> 93 </td> 94<td> 95 <p> 96 A model of the specified concept 97 </p> 98 </td> 99</tr> 100<tr> 101<td> 102 <p> 103 Strategy const & 104 </p> 105 </td> 106<td> 107 <p> 108 Any type fulfilling a Is_simple Strategy Concept 109 </p> 110 </td> 111<td> 112 <p> 113 strategy 114 </p> 115 </td> 116<td> 117 <p> 118 The strategy which will be used for is_simple calculations 119 </p> 120 </td> 121</tr> 122</tbody> 123</table></div> 124<h6> 125<a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.h2"></a> 126 <span class="phrase"><a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.returns"></a></span><a class="link" href="is_simple_2_with_strategy.html#geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.returns">Returns</a> 127 </h6> 128<p> 129 Returns true if the geometry is simple 130 </p> 131<h6> 132<a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.h3"></a> 133 <span class="phrase"><a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.header"></a></span><a class="link" href="is_simple_2_with_strategy.html#geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.header">Header</a> 134 </h6> 135<p> 136 Either 137 </p> 138<p> 139 <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> 140 </p> 141<p> 142 Or 143 </p> 144<p> 145 <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">is_simple</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> 146 </p> 147<h6> 148<a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.h4"></a> 149 <span class="phrase"><a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.conformance"></a></span><a class="link" href="is_simple_2_with_strategy.html#geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.conformance">Conformance</a> 150 </h6> 151<p> 152 The function is_simple implements function IsSimple from the <a href="http://www.opengeospatial.org/standards/sfa" target="_top">OGC 153 Simple Feature Specification</a>. 154 </p> 155<h6> 156<a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.h5"></a> 157 <span class="phrase"><a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.supported_geometries"></a></span><a class="link" href="is_simple_2_with_strategy.html#geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.supported_geometries">Supported 158 geometries</a> 159 </h6> 160<div class="informaltable"><table class="table"> 161<colgroup> 162<col> 163<col> 164</colgroup> 165<thead><tr> 166<th> 167 <p> 168 Geometry 169 </p> 170 </th> 171<th> 172 <p> 173 Status 174 </p> 175 </th> 176</tr></thead> 177<tbody> 178<tr> 179<td> 180 <p> 181 Point 182 </p> 183 </td> 184<td> 185 <p> 186 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 187 </p> 188 </td> 189</tr> 190<tr> 191<td> 192 <p> 193 Segment 194 </p> 195 </td> 196<td> 197 <p> 198 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 199 </p> 200 </td> 201</tr> 202<tr> 203<td> 204 <p> 205 Box 206 </p> 207 </td> 208<td> 209 <p> 210 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 211 </p> 212 </td> 213</tr> 214<tr> 215<td> 216 <p> 217 Linestring 218 </p> 219 </td> 220<td> 221 <p> 222 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 223 </p> 224 </td> 225</tr> 226<tr> 227<td> 228 <p> 229 Ring 230 </p> 231 </td> 232<td> 233 <p> 234 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 235 </p> 236 </td> 237</tr> 238<tr> 239<td> 240 <p> 241 Polygon 242 </p> 243 </td> 244<td> 245 <p> 246 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 247 </p> 248 </td> 249</tr> 250<tr> 251<td> 252 <p> 253 MultiPoint 254 </p> 255 </td> 256<td> 257 <p> 258 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 259 </p> 260 </td> 261</tr> 262<tr> 263<td> 264 <p> 265 MultiLinestring 266 </p> 267 </td> 268<td> 269 <p> 270 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 271 </p> 272 </td> 273</tr> 274<tr> 275<td> 276 <p> 277 MultiPolygon 278 </p> 279 </td> 280<td> 281 <p> 282 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 283 </p> 284 </td> 285</tr> 286<tr> 287<td> 288 <p> 289 Variant 290 </p> 291 </td> 292<td> 293 <p> 294 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 295 </p> 296 </td> 297</tr> 298</tbody> 299</table></div> 300<h6> 301<a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.h6"></a> 302 <span class="phrase"><a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.complexity"></a></span><a class="link" href="is_simple_2_with_strategy.html#geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.complexity">Complexity</a> 303 </h6> 304<p> 305 Constant-time for points, segments and boxes 306 </p> 307<p> 308 Linear for rings, polygons and multi-polygons 309 </p> 310<p> 311 Linearithmic for multi-points, linestrings and multi-linestrings 312 </p> 313<h6> 314<a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.h7"></a> 315 <span class="phrase"><a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.example"></a></span><a class="link" href="is_simple_2_with_strategy.html#geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.example">Example</a> 316 </h6> 317<p> 318 Checks whether a geometry is simple 319 </p> 320<p> 321</p> 322<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> 323 324<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> 325<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> 326<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">linestring</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 327<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">multi_linestring</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 328 329 330<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> 331<span class="special">{</span> 332 <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_type</span><span class="special">;</span> 333 <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"><</span><span class="identifier">point_type</span><span class="special">></span> <span class="identifier">linestring_type</span><span class="special">;</span> 334 <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">multi_linestring</span><span class="special"><</span><span class="identifier">linestring_type</span><span class="special">></span> <span class="identifier">multi_linestring_type</span><span class="special">;</span> 335 336 <span class="identifier">multi_linestring_type</span> <span class="identifier">multi_linestring</span><span class="special">;</span> 337 <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((0 0,0 10,10 10,10 0,0 0),(10 10,20 20))"</span><span class="special">,</span> <span class="identifier">multi_linestring</span><span class="special">);</span> 338 339 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"is simple? "</span> 340 <span class="special"><<</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">is_simple</span><span class="special">(</span><span class="identifier">multi_linestring</span><span class="special">)</span> <span class="special">?</span> <span class="string">"yes"</span> <span class="special">:</span> <span class="string">"no"</span><span class="special">)</span> 341 <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> 342 343 <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> 344<span class="special">}</span> 345</pre> 346<p> 347 </p> 348<p> 349 Output: 350 </p> 351<pre class="programlisting">is simple? no 352 353<img src="../../../../img/algorithms/is_simple_example.png" alt="is_simple_example"> 354 355</pre> 356<h6> 357<a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.h8"></a> 358 <span class="phrase"><a name="geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.see_also"></a></span><a class="link" href="is_simple_2_with_strategy.html#geometry.reference.algorithms.is_simple.is_simple_2_with_strategy.see_also">See 359 also</a> 360 </h6> 361<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 362 <a class="link" href="../is_valid.html" title="is_valid">is_valid</a> 363 </li></ul></div> 364</div> 365<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 366<td align="left"></td> 367<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam 368 Wulkiewicz, Oracle and/or its affiliates<p> 369 Distributed under the Boost Software License, Version 1.0. (See accompanying 370 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>) 371 </p> 372</div></td> 373</tr></table> 374<hr> 375<div class="spirit-nav"> 376<a accesskey="p" href="../is_simple.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../is_simple.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="is_simple_1.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 377</div> 378</body> 379</html> 380