• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>num_interior_rings</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="../algorithms.html" title="Algorithms">
9<link rel="prev" href="num_geometries.html" title="num_geometries">
10<link rel="next" href="num_points.html" title="num_points">
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="num_geometries.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../algorithms.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="num_points.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.algorithms.num_interior_rings"></a><a class="link" href="num_interior_rings.html" title="num_interior_rings">num_interior_rings</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="idm45635691693248"></a>
31Calculates the number of interior rings of a geometry.
32        </p>
33<h6>
34<a name="geometry.reference.algorithms.num_interior_rings.h0"></a>
35          <span class="phrase"><a name="geometry.reference.algorithms.num_interior_rings.description"></a></span><a class="link" href="num_interior_rings.html#geometry.reference.algorithms.num_interior_rings.description">Description</a>
36        </h6>
37<p>
38          The free function num_interior_rings calculates the number of interior
39          rings of a geometry.
40        </p>
41<h6>
42<a name="geometry.reference.algorithms.num_interior_rings.h1"></a>
43          <span class="phrase"><a name="geometry.reference.algorithms.num_interior_rings.synopsis"></a></span><a class="link" href="num_interior_rings.html#geometry.reference.algorithms.num_interior_rings.synopsis">Synopsis</a>
44        </h6>
45<p>
46</p>
47<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Geometry</span><span class="special">&gt;</span>
48<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">num_interior_rings</span><span class="special">(</span><span class="identifier">Geometry</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">geometry</span><span class="special">)</span></pre>
49<p>
50        </p>
51<h6>
52<a name="geometry.reference.algorithms.num_interior_rings.h2"></a>
53          <span class="phrase"><a name="geometry.reference.algorithms.num_interior_rings.parameters"></a></span><a class="link" href="num_interior_rings.html#geometry.reference.algorithms.num_interior_rings.parameters">Parameters</a>
54        </h6>
55<div class="informaltable"><table class="table">
56<colgroup>
57<col>
58<col>
59<col>
60<col>
61</colgroup>
62<thead><tr>
63<th>
64                  <p>
65                    Type
66                  </p>
67                </th>
68<th>
69                  <p>
70                    Concept
71                  </p>
72                </th>
73<th>
74                  <p>
75                    Name
76                  </p>
77                </th>
78<th>
79                  <p>
80                    Description
81                  </p>
82                </th>
83</tr></thead>
84<tbody><tr>
85<td>
86                  <p>
87                    Geometry const &amp;
88                  </p>
89                </td>
90<td>
91                  <p>
92                    Any type fulfilling a Geometry Concept
93                  </p>
94                </td>
95<td>
96                  <p>
97                    geometry
98                  </p>
99                </td>
100<td>
101                  <p>
102                    A model of the specified concept
103                  </p>
104                </td>
105</tr></tbody>
106</table></div>
107<h6>
108<a name="geometry.reference.algorithms.num_interior_rings.h3"></a>
109          <span class="phrase"><a name="geometry.reference.algorithms.num_interior_rings.returns"></a></span><a class="link" href="num_interior_rings.html#geometry.reference.algorithms.num_interior_rings.returns">Returns</a>
110        </h6>
111<p>
112          The calculated number of interior rings
113        </p>
114<h6>
115<a name="geometry.reference.algorithms.num_interior_rings.h4"></a>
116          <span class="phrase"><a name="geometry.reference.algorithms.num_interior_rings.header"></a></span><a class="link" href="num_interior_rings.html#geometry.reference.algorithms.num_interior_rings.header">Header</a>
117        </h6>
118<p>
119          Either
120        </p>
121<p>
122          <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">hpp</span><span class="special">&gt;</span></code>
123        </p>
124<p>
125          Or
126        </p>
127<p>
128          <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">algorithms</span><span class="special">/</span><span class="identifier">num_interior_rings</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
129        </p>
130<h6>
131<a name="geometry.reference.algorithms.num_interior_rings.h5"></a>
132          <span class="phrase"><a name="geometry.reference.algorithms.num_interior_rings.conformance"></a></span><a class="link" href="num_interior_rings.html#geometry.reference.algorithms.num_interior_rings.conformance">Conformance</a>
133        </h6>
134<p>
135          The function num_interior_ring implements function NumInteriorRing from
136          the <a href="http://www.opengeospatial.org/standards/sfa" target="_top">OGC Simple
137          Feature Specification</a>.
138        </p>
139<div class="note"><table border="0" summary="Note">
140<tr>
141<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
142<th align="left">Note</th>
143</tr>
144<tr><td align="left" valign="top"><p>
145            Boost.Geometry adds an "s"
146          </p></td></tr>
147</table></div>
148<h6>
149<a name="geometry.reference.algorithms.num_interior_rings.h6"></a>
150          <span class="phrase"><a name="geometry.reference.algorithms.num_interior_rings.behavior"></a></span><a class="link" href="num_interior_rings.html#geometry.reference.algorithms.num_interior_rings.behavior">Behavior</a>
151        </h6>
152<div class="informaltable"><table class="table">
153<colgroup>
154<col>
155<col>
156</colgroup>
157<thead><tr>
158<th>
159                  <p>
160                    Case
161                  </p>
162                </th>
163<th>
164                  <p>
165                    Behavior
166                  </p>
167                </th>
168</tr></thead>
169<tbody>
170<tr>
171<td>
172                  <p>
173                    Polygon
174                  </p>
175                </td>
176<td>
177                  <p>
178                    Returns the number of its interior rings
179                  </p>
180                </td>
181</tr>
182<tr>
183<td>
184                  <p>
185                    Multi Polygon
186                  </p>
187                </td>
188<td>
189                  <p>
190                    Returns the number of the interior rings of all polygons
191                  </p>
192                </td>
193</tr>
194<tr>
195<td>
196                  <p>
197                    Other geometries
198                  </p>
199                </td>
200<td>
201                  <p>
202                    Returns 0
203                  </p>
204                </td>
205</tr>
206</tbody>
207</table></div>
208<h6>
209<a name="geometry.reference.algorithms.num_interior_rings.h7"></a>
210          <span class="phrase"><a name="geometry.reference.algorithms.num_interior_rings.complexity"></a></span><a class="link" href="num_interior_rings.html#geometry.reference.algorithms.num_interior_rings.complexity">Complexity</a>
211        </h6>
212<p>
213          Constant
214        </p>
215<h6>
216<a name="geometry.reference.algorithms.num_interior_rings.h8"></a>
217          <span class="phrase"><a name="geometry.reference.algorithms.num_interior_rings.examples"></a></span><a class="link" href="num_interior_rings.html#geometry.reference.algorithms.num_interior_rings.examples">Examples</a>
218        </h6>
219<p>
220          Get the number of interior rings in a multi-polygon
221        </p>
222<p>
223</p>
224<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
225
226<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>
227<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>
228<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">polygon</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
229<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">multi_polygon</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
230
231
232<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
233<span class="special">{</span>
234    <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>
235        <span class="special">&lt;</span>
236            <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>
237                <span class="special">&lt;</span>
238                    <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>
239                <span class="special">&gt;</span>
240        <span class="special">&gt;</span> <span class="identifier">mp</span><span class="special">;</span>
241    <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">"MULTIPOLYGON(((0 0,0 10,10 0,0 0),(1 1,1 9,9 1,1 1)),((10 10,10 7,7 10,10 10)))"</span><span class="special">,</span> <span class="identifier">mp</span><span class="special">);</span>
242    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Number of interior rings: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">num_interior_rings</span><span class="special">(</span><span class="identifier">mp</span><span class="special">)</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>
243
244    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
245<span class="special">}</span>
246</pre>
247<p>
248        </p>
249<p>
250          Output:
251        </p>
252<pre class="programlisting">Number of interior rings: 1
253</pre>
254</div>
255<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
256<td align="left"></td>
257<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
258      Wulkiewicz, Oracle and/or its affiliates<p>
259        Distributed under the Boost Software License, Version 1.0. (See accompanying
260        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>)
261      </p>
262</div></td>
263</tr></table>
264<hr>
265<div class="spirit-nav">
266<a accesskey="p" href="num_geometries.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../algorithms.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="num_points.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
267</div>
268</body>
269</html>
270