1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>closure</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="../core.html" title="Core Metafunctions"> 9<link rel="prev" href="../core.html" title="Core Metafunctions"> 10<link rel="next" href="coordinate_system.html" title="coordinate_system"> 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="../core.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../core.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="coordinate_system.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.core.closure"></a><a class="link" href="closure.html" title="closure">closure</a> 28</h4></div></div></div> 29<p> 30 <a class="indexterm" name="idm45635684462160"></a> 31Metafunction defining <span class="bold"><strong>value</strong></span> as the closure 32 (clockwise, counterclockwise) of the specified geometry type. 33 </p> 34<h6> 35<a name="geometry.reference.core.closure.h0"></a> 36 <span class="phrase"><a name="geometry.reference.core.closure.synopsis"></a></span><a class="link" href="closure.html#geometry.reference.core.closure.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> 41<span class="keyword">struct</span> <span class="identifier">closure</span> 42<span class="special">{</span> 43 <span class="comment">// ...</span> 44<span class="special">};</span> 45</pre> 46<p> 47 </p> 48<h6> 49<a name="geometry.reference.core.closure.h1"></a> 50 <span class="phrase"><a name="geometry.reference.core.closure.template_parameter_s_"></a></span><a class="link" href="closure.html#geometry.reference.core.closure.template_parameter_s_">Template 51 parameter(s)</a> 52 </h6> 53<div class="informaltable"><table class="table"> 54<colgroup> 55<col> 56<col> 57</colgroup> 58<thead><tr> 59<th> 60 <p> 61 Parameter 62 </p> 63 </th> 64<th> 65 <p> 66 Description 67 </p> 68 </th> 69</tr></thead> 70<tbody><tr> 71<td> 72 <p> 73 typename Geometry 74 </p> 75 </td> 76<td> 77 <p> 78 Any type fulfilling a Geometry Concept 79 </p> 80 </td> 81</tr></tbody> 82</table></div> 83<h6> 84<a name="geometry.reference.core.closure.h2"></a> 85 <span class="phrase"><a name="geometry.reference.core.closure.header"></a></span><a class="link" href="closure.html#geometry.reference.core.closure.header">Header</a> 86 </h6> 87<p> 88 Either 89 </p> 90<p> 91 <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> 92 </p> 93<p> 94 Or 95 </p> 96<p> 97 <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">core</span><span class="special">/</span><span class="identifier">closure</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> 98 </p> 99<div class="note"><table border="0" summary="Note"> 100<tr> 101<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td> 102<th align="left">Note</th> 103</tr> 104<tr><td align="left" valign="top"><p> 105 The closure is defined for any geometry type, but only has a real meaning 106 for areal geometry types (ring, polygon, multi_polygon) 107 </p></td></tr> 108</table></div> 109<h6> 110<a name="geometry.reference.core.closure.h3"></a> 111 <span class="phrase"><a name="geometry.reference.core.closure.complexity"></a></span><a class="link" href="closure.html#geometry.reference.core.closure.complexity">Complexity</a> 112 </h6> 113<p> 114 Compile time 115 </p> 116<h6> 117<a name="geometry.reference.core.closure.h4"></a> 118 <span class="phrase"><a name="geometry.reference.core.closure.example"></a></span><a class="link" href="closure.html#geometry.reference.core.closure.example">Example</a> 119 </h6> 120<p> 121 Examine if a polygon is defined as "should be closed" 122 </p> 123<p> 124</p> 125<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> 126 127<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> 128<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> 129<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> 130 131<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> 132<span class="special">{</span> 133 <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> 134 <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"><</span><span class="identifier">point_type</span><span class="special">></span> <span class="identifier">polygon_type</span><span class="special">;</span> 135 136 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">closure_selector</span> <span class="identifier">clos</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">closure</span><span class="special"><</span><span class="identifier">polygon_type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">;</span> 137 138 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"closure: "</span> <span class="special"><<</span> <span class="identifier">clos</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> 139 <span class="special"><<</span> <span class="string">"(open = "</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">open</span> 140 <span class="special"><<</span> <span class="string">", closed = "</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">closed</span> 141 <span class="special"><<</span> <span class="string">") "</span><span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> 142 143 <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> 144<span class="special">}</span> 145</pre> 146<p> 147 </p> 148<p> 149 Output: 150 </p> 151<pre class="programlisting">closure: 1 152(open = 0, closed = 1) 153</pre> 154<h6> 155<a name="geometry.reference.core.closure.h5"></a> 156 <span class="phrase"><a name="geometry.reference.core.closure.see_also"></a></span><a class="link" href="closure.html#geometry.reference.core.closure.see_also">See 157 also</a> 158 </h6> 159<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 160 <a class="link" href="../enumerations/closure_selector.html" title="closure_selector">The 161 closure_selector enumeration</a> 162 </li></ul></div> 163</div> 164<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 165<td align="left"></td> 166<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam 167 Wulkiewicz, Oracle and/or its affiliates<p> 168 Distributed under the Boost Software License, Version 1.0. (See accompanying 169 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>) 170 </p> 171</div></td> 172</tr></table> 173<hr> 174<div class="spirit-nav"> 175<a accesskey="p" href="../core.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../core.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="coordinate_system.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 176</div> 177</body> 178</html> 179