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