geometry/doc/doxygen_output/html/group__compare.html
Barend Gehrels 363580fbf6 Added old doxygen docs
[SVN r59777]
2010-02-20 15:57:12 +00:00

100 lines
5.5 KiB
HTML
Raw Blame History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Geometry (aka GGL, Generic Geometry Library)</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head>
<table cellpadding="2" width="100%">
<tbody>
<tr>
<td valign="top">
<img alt="Boost.Geometry" src="images/ggl-logo-big.png" height="80" width="200">
&nbsp;&nbsp;
</td>
<td valign="top" align="right">
<a href="http://www.boost.org">
<img alt="Boost C++ Libraries" src="images/accepted_by_boost.png" height="80" width="230" border="0">
</a>
</td>
</tr>
</tbody>
</table>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>compare: define compare functors for points</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1geometry_1_1equal__to.html">boost::geometry::equal_to&lt; Point, Dimension, Strategy &gt;</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Equal To functor, to compare if points are equal. <a href="structboost_1_1geometry_1_1equal__to.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1geometry_1_1greater.html">boost::geometry::greater&lt; Point, Dimension, Strategy &gt;</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Greater functor. <a href="structboost_1_1geometry_1_1greater.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1geometry_1_1less.html">boost::geometry::less&lt; Point, Dimension, Strategy &gt;</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Less functor, to sort points in ascending order. <a href="structboost_1_1geometry_1_1less.html#_details">More...</a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The compare policies enable to compare points in a way that they can be compared in many functions of the standard library.<p>
The functors do have an optional second template argument, <b>dimension</b>. If dimension is specified, comparison is only done on that dimension.<p>
This is useful for (a.o.):<ul>
<li>std::sort (use geometry::less&lt;P&gt; or geometry::greater&lt;P&gt; or geometry::less&lt;P, 1&gt;)</li><li>std::map (use geometry::less&lt;P&gt;)</li><li>std::unique_copy (use geometry::equal_to&lt;P&gt;)</li></ul>
<p>
<dl class="user" compact><dt><b>Geometries:</b></dt><dd><ul>
<li><b>point</b> </li></ul>
</dd></dl>
<dl class="user" compact><dt><b>Example:</b></dt><dd>Example showing how geometry::less can be used <div class="fragment"><pre class="fragment">{
<span class="keyword">typedef</span> boost::tuple&lt;double, double&gt; P;
std::vector&lt;P&gt; line;
line.push_back(boost::make_tuple(8.1, 1.9));
line.push_back(boost::make_tuple(4.2, 7.5));
line.push_back(boost::make_tuple(2.3, 3.6));
std::sort(line.begin(), line.end(), <a class="code" href="structboost_1_1geometry_1_1less.html" title="Less functor, to sort points in ascending order.">boost::geometry::less&lt;P&gt;</a>());
<span class="comment">// Display ordered points</span>
BOOST_FOREACH(P <span class="keyword">const</span>&amp; p, line)
{
std::cout &lt;&lt; <a class="code" href="group__utility.html#g62cc5db4d3bb1147591298b3500f8f1a" title="Main DSV-streaming function.">boost::geometry::dsv</a>(p) &lt;&lt; std::endl;
}
</pre></div></dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>There is a boolean function <a class="el" href="group__equals.html">equals</a> as well, which returns true or false if a geometry is spatially equal to another geometry. That one is defined for OGC compatibility, while these ones are defined for compatibility with the std:: library. These ones are functors, operating on the same geometry type (currently only the point-type), the equals function is a free function operating on different point types or even different geometry types (a linestring can be spatially equal to a multi-linestring). </dd></dl>
</div>
<hr size="1">
<table width="100%">
<tbody>
<tr>
<td align="left"><small>
<p>December 1, 2009</p>
</small></td>
<td align="right">
<small>Copyright <20> 1995-2009 Barend Gehrels, Geodan, Amsterdam<br>
Copyright <20> 2008-2009 Bruno Lalande, Paris<br>
Copyright <20> 2009 Mateusz Loskot, Cadcorp, London<br>
</small>
</td>
</tr>
</tbody>
</table>
<address style="text-align: right;"><small>
Documentation is generated by&nbsp;<a href="http://www.doxygen.org/index.html">Doxygen</a>
</small></address>
</body>
</html>