mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-13 00:22:10 +00:00
Files structure rearranged to better reflect namespace strcture. Some classes moved to different namespaces.
[SVN r82536]
This commit is contained in:
@@ -38,7 +38,7 @@ Predefined algorithms with run-time parameters are:
|
||||
The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (called Indexables). It also handles [^`std::pair<Indexable, T>`] and [^`boost::tuple<Indexable, ...>`]. For example, if [^`std::pair<Box, int>`] is stored in the container, the default translator translates from [^`std::pair<Box, int> const&`] to [^`Box const&`].
|
||||
|
||||
[heading Header]
|
||||
`#include <boost/geometry/extensions/index/rtree/rtree.hpp>`
|
||||
`#include <boost/geometry/extensions/index/rtree.hpp>`
|
||||
|
||||
[heading Synopsis]
|
||||
[pre
|
||||
@@ -89,29 +89,29 @@ The Translator translates from Value to Indexable each time r-tree requires it.
|
||||
|
||||
[heading Member(s)]
|
||||
[table
|
||||
[[Modifier][Function][Description]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]]
|
||||
[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 `box()`]][Returns the box containing all values stored in the container. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]]
|
||||
[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]]
|
||||
[[Function][Description]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 `box()`]][Returns the box containing all values stored in the container. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]]
|
||||
[[[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]]
|
||||
]
|
||||
|
||||
[#classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b]
|
||||
@@ -124,8 +124,7 @@ The constructor.
|
||||
`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``explicit ``[heading Parameter(s)]
|
||||
[heading Parameter(s)]
|
||||
[table
|
||||
[[Type][Name][Description]]
|
||||
[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]]
|
||||
@@ -208,8 +207,7 @@ The constructor.
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``explicit ``[heading Parameter(s)]
|
||||
[heading Parameter(s)]
|
||||
[table
|
||||
[[Type][Name][Description]]
|
||||
[[`Range const &`][ `rng` ][The range of Values. ]]
|
||||
@@ -633,8 +631,7 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `spatial_query``(``Predicates const &` `pred``,` `OutIter` `out_it``)`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Parameter(s)]
|
||||
[heading Parameter(s)]
|
||||
[table
|
||||
[[Type][Name][Description]]
|
||||
[[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]]
|
||||
@@ -686,8 +683,7 @@ MinRelation and MaxRelation describes bounds and can be generated by following f
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Parameter(s)]
|
||||
[heading Parameter(s)]
|
||||
[table
|
||||
[[Type][Name][Description]]
|
||||
[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point.]]
|
||||
@@ -753,8 +749,7 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Parameter(s)]
|
||||
[heading Parameter(s)]
|
||||
[table
|
||||
[[Type][Name][Description]]
|
||||
[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]]
|
||||
@@ -804,8 +799,7 @@ MinRelation and MaxRelation describes bounds and can be generated by following f
|
||||
`OutIter` `out_it``)`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Parameter(s)]
|
||||
[heading Parameter(s)]
|
||||
[table
|
||||
[[Type][Name][Description]]
|
||||
[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]]
|
||||
@@ -875,8 +869,7 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[
|
||||
`OutIter` `out_it``)`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Parameter(s)]
|
||||
[heading Parameter(s)]
|
||||
[table
|
||||
[[Type][Name][Description]]
|
||||
[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point ]]
|
||||
@@ -901,8 +894,7 @@ Returns the number of stored values.
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `size``()`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Returns]
|
||||
[heading Returns]
|
||||
The number of stored values.
|
||||
[heading Throws]
|
||||
Nothing.
|
||||
@@ -919,8 +911,7 @@ Query if the container is empty.
|
||||
`bool` `empty``()`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Returns]
|
||||
[heading Returns]
|
||||
true if the container is empty.
|
||||
[heading Throws]
|
||||
Nothing.
|
||||
@@ -953,8 +944,7 @@ Returns the box containing all values stored in the container. If the container
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d box_type]]` const &` `box``()`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Returns]
|
||||
[heading Returns]
|
||||
The box containing all values stored in the container or an invalid box if there are no values in the container.
|
||||
[heading Throws]
|
||||
Nothing.
|
||||
@@ -972,8 +962,7 @@ For indexable_type it returns the number of values which indexables equals the p
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `count``(``ValueOrIndexable const &` `vori``)`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Parameter(s)]
|
||||
[heading Parameter(s)]
|
||||
[table
|
||||
[[Type][Name][Description]]
|
||||
[[`ValueOrIndexable const &`][ `vori` ][The value or indexable which will be counted.]]
|
||||
@@ -995,8 +984,7 @@ Returns parameters.
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``()`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Returns]
|
||||
[heading Returns]
|
||||
The parameters object.
|
||||
[heading Throws]
|
||||
Nothing.
|
||||
@@ -1013,8 +1001,7 @@ Returns the translator object.
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``()`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Returns]
|
||||
[heading Returns]
|
||||
The translator object.
|
||||
[heading Throws]
|
||||
Nothing.
|
||||
@@ -1031,8 +1018,7 @@ Returns allocator used by the rtree.
|
||||
[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `get_allocator``()`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``const ``[heading Returns]
|
||||
[heading Returns]
|
||||
The allocator.
|
||||
[heading Throws]
|
||||
If allocator copy constructor throws.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Linear r-tree creation algorithm parameters.
|
||||
|
||||
[heading Header]
|
||||
`#include <boost/geometry/extensions/index/rtree/options.hpp>`
|
||||
`#include <boost/geometry/extensions/index/parameters.hpp>`
|
||||
|
||||
[heading Synopsis]
|
||||
[pre
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Quadratic r-tree creation algorithm parameters.
|
||||
|
||||
[heading Header]
|
||||
`#include <boost/geometry/extensions/index/rtree/options.hpp>`
|
||||
`#include <boost/geometry/extensions/index/parameters.hpp>`
|
||||
|
||||
[heading Synopsis]
|
||||
[pre
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
R*-tree creation algorithm parameters.
|
||||
|
||||
[heading Header]
|
||||
`#include <boost/geometry/extensions/index/rtree/options.hpp>`
|
||||
`#include <boost/geometry/extensions/index/parameters.hpp>`
|
||||
|
||||
[heading Synopsis]
|
||||
[pre
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Linear r-tree creation algorithm parameters.
|
||||
|
||||
[heading Header]
|
||||
`#include <boost/geometry/extensions/index/rtree/options.hpp>`
|
||||
`#include <boost/geometry/extensions/index/parameters.hpp>`
|
||||
|
||||
[heading Synopsis]
|
||||
[pre
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Quadratic r-tree creation algorithm parameters.
|
||||
|
||||
[heading Header]
|
||||
`#include <boost/geometry/extensions/index/rtree/options.hpp>`
|
||||
`#include <boost/geometry/extensions/index/parameters.hpp>`
|
||||
|
||||
[heading Synopsis]
|
||||
[pre
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
R*-tree creation algorithm parameters.
|
||||
|
||||
[heading Header]
|
||||
`#include <boost/geometry/extensions/index/rtree/options.hpp>`
|
||||
`#include <boost/geometry/extensions/index/parameters.hpp>`
|
||||
|
||||
[heading Synopsis]
|
||||
[pre
|
||||
|
||||
@@ -43,8 +43,7 @@ The constructor.
|
||||
`index``(``Container const &` `c``)`
|
||||
]
|
||||
|
||||
[heading Modifier(s)]
|
||||
``explicit ``[heading Parameter(s)]
|
||||
[heading Parameter(s)]
|
||||
[table
|
||||
[[Type][Name][Description]]
|
||||
[[`Container const &`][ `c` ][The container which stores indexed values. ]]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Introduction</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="prev" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>R-tree</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="prev" href="introduction.html" title="Introduction">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Creation and modification</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="rtree_quickstart.html" title="Quick Start">
|
||||
@@ -55,7 +55,7 @@
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">rtree</span><span class="special"><</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Parameters</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">=</span> <span class="identifier">translator</span><span class="special">::</span><span class="identifier">def</span><span class="special"><</span><span class="identifier">Value</span><span class="special">>,</span> <span class="identifier">Allocator</span><span class="special">></span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">Value</span><span class="special">></span> <span class="special">></span>
|
||||
</pre>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">Value</code> - type of object which will be stored in the container,
|
||||
</li>
|
||||
@@ -90,7 +90,7 @@
|
||||
be handled by the default <code class="computeroutput">Translator</code> - <code class="computeroutput"><span class="identifier">index</span><span class="special">::</span><span class="identifier">translator</span><span class="special">::</span><span class="identifier">def</span><span class="special"><</span>Value<span class="special">></span></code>
|
||||
are defined as follows:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">Indexable <span class="special">=</span> <a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_point.html" target="_top">Point</a>
|
||||
<span class="special">|</span> <a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a></code>
|
||||
@@ -116,7 +116,7 @@
|
||||
A <code class="computeroutput">Translator</code> is a type which knows how to handle <code class="computeroutput">Value</code>s.
|
||||
It has two purposes:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
it translates <code class="computeroutput">Value</code> to a more suitable <code class="computeroutput">Indexable</code>
|
||||
type which is needed by most of operations,
|
||||
@@ -134,7 +134,7 @@
|
||||
<p>
|
||||
If comparison of two <code class="computeroutput">Value</code>s is required, the default translator:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
for <code class="computeroutput"><a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_point.html" target="_top">Point</a></code>
|
||||
and <code class="computeroutput"><a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a></code>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Introduction</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="../r_tree.html" title="R-tree">
|
||||
@@ -28,10 +28,10 @@
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
R-tree is a tree data structure used for spatial searching. It was proposed
|
||||
by Antonin Guttman in 1984 <a href="#ftn.geometry_index.r_tree.introduction.f0" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f0"></a>[1]</sup></a> as an expansion of B-tree for multi-dimensional data. It may
|
||||
by Antonin Guttman in 1984 <sup>[<a name="geometry_index.r_tree.introduction.f0" href="#ftn.geometry_index.r_tree.introduction.f0" class="footnote">1</a>]</sup> as an expansion of B-tree for multi-dimensional data. It may
|
||||
be used to store points or volumetric data in order to perform a spatial
|
||||
query later. This query may return objects that are inside some area or are
|
||||
close to some point in space <a href="#ftn.geometry_index.r_tree.introduction.f1" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f1"></a>[2]</sup></a>.
|
||||
close to some point in space <sup>[<a name="geometry_index.r_tree.introduction.f1" href="#ftn.geometry_index.r_tree.introduction.f1" class="footnote">2</a>]</sup>.
|
||||
</p>
|
||||
<p>
|
||||
The R-tree structure is presented on the image below. Each R-tree's node
|
||||
@@ -51,7 +51,7 @@
|
||||
</p>
|
||||
<p>
|
||||
The R-tree is a self-balanced data structure. The key part of balancing algorithm
|
||||
is node splitting algorithm <a href="#ftn.geometry_index.r_tree.introduction.f2" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f2"></a>[3]</sup></a> <a href="#ftn.geometry_index.r_tree.introduction.f3" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f3"></a>[4]</sup></a>. Each algorithm produces different splits so the internal structure
|
||||
is node splitting algorithm <sup>[<a name="geometry_index.r_tree.introduction.f2" href="#ftn.geometry_index.r_tree.introduction.f2" class="footnote">3</a>]</sup> <sup>[<a name="geometry_index.r_tree.introduction.f3" href="#ftn.geometry_index.r_tree.introduction.f3" class="footnote">4</a>]</sup>. Each algorithm produces different splits so the internal structure
|
||||
of a tree may be different for each one of them. In general more complex
|
||||
algorithms analyses elements better and produces less overlapping nodes.
|
||||
In the searching process less nodes must be traversed in order to find desired
|
||||
@@ -179,13 +179,13 @@
|
||||
</table></div>
|
||||
<h5>
|
||||
<a name="geometry_index.r_tree.introduction.h0"></a>
|
||||
<span class="phrase"><a name="geometry_index.r_tree.introduction.implementation_details"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.implementation_details">Implementation
|
||||
<span><a name="geometry_index.r_tree.introduction.implementation_details"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.implementation_details">Implementation
|
||||
details</a>
|
||||
</h5>
|
||||
<p>
|
||||
Key features of this implementation of the R-tree are:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
capable to store arbitrary Value type,
|
||||
</li>
|
||||
@@ -207,7 +207,7 @@
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="geometry_index.r_tree.introduction.h1"></a>
|
||||
<span class="phrase"><a name="geometry_index.r_tree.introduction.contributors"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.contributors">Contributors</a>
|
||||
<span><a name="geometry_index.r_tree.introduction.contributors"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.contributors">Contributors</a>
|
||||
</h5>
|
||||
<p>
|
||||
The spatial index was originally started by Federico J. Fernandez during
|
||||
@@ -215,7 +215,7 @@
|
||||
</p>
|
||||
<h5>
|
||||
<a name="geometry_index.r_tree.introduction.h2"></a>
|
||||
<span class="phrase"><a name="geometry_index.r_tree.introduction.spatial_thanks"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.spatial_thanks">Spatial
|
||||
<span><a name="geometry_index.r_tree.introduction.spatial_thanks"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.spatial_thanks">Spatial
|
||||
thanks</a>
|
||||
</h5>
|
||||
<p>
|
||||
@@ -224,20 +224,20 @@
|
||||
list for their help.
|
||||
</p>
|
||||
<div class="footnotes">
|
||||
<br><hr style="width:100; align:left;">
|
||||
<div id="ftn.geometry_index.r_tree.introduction.f0" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f0" class="para"><sup class="para">[1] </sup></a>
|
||||
<br><hr width="100" align="left">
|
||||
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f0" href="#geometry_index.r_tree.introduction.f0" class="para">1</a>] </sup>
|
||||
Guttman, A. (1984). <span class="emphasis"><em>R-Trees: A Dynamic Index Structure for Spatial
|
||||
Searching</em></span>
|
||||
</p></div>
|
||||
<div id="ftn.geometry_index.r_tree.introduction.f1" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f1" class="para"><sup class="para">[2] </sup></a>
|
||||
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f1" href="#geometry_index.r_tree.introduction.f1" class="para">2</a>] </sup>
|
||||
Cheung, K.; Fu, A. (1998). <span class="emphasis"><em>Enhanced Nearest Neighbour Search
|
||||
on the R-tree</em></span>
|
||||
</p></div>
|
||||
<div id="ftn.geometry_index.r_tree.introduction.f2" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f2" class="para"><sup class="para">[3] </sup></a>
|
||||
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f2" href="#geometry_index.r_tree.introduction.f2" class="para">3</a>] </sup>
|
||||
Greene, D. (1989). <span class="emphasis"><em>An implementation and performance analysis
|
||||
of spatial data access methods</em></span>
|
||||
</p></div>
|
||||
<div id="ftn.geometry_index.r_tree.introduction.f3" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f3" class="para"><sup class="para">[4] </sup></a>
|
||||
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f3" href="#geometry_index.r_tree.introduction.f3" class="para">4</a>] </sup>
|
||||
Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). <span class="emphasis"><em>The
|
||||
R*-tree: an efficient and robust access method for points and rectangles</em></span>
|
||||
</p></div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Nearest neighbours queries</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="spatial_queries.html" title="Spatial queries">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Quick Start</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="introduction.html" title="Introduction">
|
||||
@@ -39,7 +39,7 @@
|
||||
<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>
|
||||
<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">box</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
|
||||
<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">extensions</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">rtree</span><span class="special">/</span><span class="identifier">rtree</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
<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">extensions</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">rtree</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
|
||||
<span class="comment">// to store queries results</span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
|
||||
@@ -150,7 +150,7 @@
|
||||
</p>
|
||||
<h4>
|
||||
<a name="geometry_index.r_tree.rtree_quickstart.h0"></a>
|
||||
<span class="phrase"><a name="geometry_index.r_tree.rtree_quickstart.more"></a></span><a class="link" href="rtree_quickstart.html#geometry_index.r_tree.rtree_quickstart.more">More</a>
|
||||
<span><a name="geometry_index.r_tree.rtree_quickstart.more"></a></span><a class="link" href="rtree_quickstart.html#geometry_index.r_tree.rtree_quickstart.more">More</a>
|
||||
</h4>
|
||||
<p>
|
||||
More information about the R-tree implementation, other algorithms and queries
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Spatial queries</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="creation_and_modification.html" title="Creation and modification">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Chapter 1. Geometry Index</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="next" href="geometry_index/introduction.html" title="Introduction">
|
||||
</head>
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: January 17, 2013 at 17:06:52 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: January 18, 2013 at 20:09:35 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
||||
19
doc/src/examples/Jamfile.v2
Normal file
19
doc/src/examples/Jamfile.v2
Normal file
@@ -0,0 +1,19 @@
|
||||
# Boost.Geometry Index
|
||||
#
|
||||
# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
|
||||
#
|
||||
# Use, modification and distribution is subject to the Boost Software License,
|
||||
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import testing ;
|
||||
|
||||
project boost-geometry-index-doc-src-examples
|
||||
:
|
||||
requirements
|
||||
<include>../../..
|
||||
#<include>../../../boost/geometry/extensions/contrib/ttmath
|
||||
<toolset>msvc:<asynch-exceptions>on
|
||||
;
|
||||
|
||||
build-project rtree ;
|
||||
14
doc/src/examples/rtree/Jamfile.v2
Normal file
14
doc/src/examples/rtree/Jamfile.v2
Normal file
@@ -0,0 +1,14 @@
|
||||
# Boost.Geometry Index
|
||||
#
|
||||
# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
|
||||
#
|
||||
# Use, modification and distribution is subject to the Boost Software License,
|
||||
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
project boost-geometry-index-doc-src-examples-rtree
|
||||
: # requirements
|
||||
;
|
||||
|
||||
exe quick_start : quick_start.cpp ;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree.hpp>
|
||||
|
||||
// to store queries results
|
||||
#include <vector>
|
||||
|
||||
@@ -0,0 +1,866 @@
|
||||
// Boost.Geometry Index
|
||||
//
|
||||
// Spatial index distance predicates, calculators and checkers
|
||||
// used in nearest query - specialized for envelopes
|
||||
//
|
||||
// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
|
||||
//
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_DISTANCE_PREDICATES_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_DISTANCE_PREDICATES_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp>
|
||||
#include <boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp>
|
||||
#include <boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/detail/tuples.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/detail/tags.hpp>
|
||||
|
||||
// TODO - optimization
|
||||
// For Boxes and Points all types of distances may be calculated
|
||||
// - near, far and centroid. For points those are the same distance
|
||||
// calculate them for Boxes only!
|
||||
// for Points calculate only 1 distance
|
||||
|
||||
namespace boost { namespace geometry { namespace index { namespace detail {
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// relations
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename T>
|
||||
struct to_nearest
|
||||
{
|
||||
to_nearest(T const& v) : value(v) {}
|
||||
T value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct to_centroid
|
||||
{
|
||||
to_centroid(T const& v) : value(v) {}
|
||||
T value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct to_furthest
|
||||
{
|
||||
to_furthest(T const& v) : value(v) {}
|
||||
T value;
|
||||
};
|
||||
|
||||
// tags
|
||||
|
||||
struct to_nearest_tag {};
|
||||
struct to_centroid_tag {};
|
||||
struct to_furthest_tag {};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// relation traits and access
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename T>
|
||||
struct relation
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef to_nearest_tag tag;
|
||||
static inline T const& value(T const& v) { return v; }
|
||||
static inline T & value(T & v) { return v; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct relation< to_nearest<T> >
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef to_nearest_tag tag;
|
||||
static inline T const& value(to_nearest<T> const& r) { return r.value; }
|
||||
static inline T & value(to_nearest<T> & r) { return r.value; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct relation< to_centroid<T> >
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef to_centroid_tag tag;
|
||||
static inline T const& value(to_centroid<T> const& r) { return r.value; }
|
||||
static inline T & value(to_centroid<T> & r) { return r.value; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct relation< to_furthest<T> >
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef to_furthest_tag tag;
|
||||
static inline T const& value(to_furthest<T> const& r) { return r.value; }
|
||||
static inline T & value(to_furthest<T> & r) { return r.value; }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// distance predicates
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename PointRelation>
|
||||
struct unbounded
|
||||
: nonassignable
|
||||
{
|
||||
inline explicit unbounded(PointRelation const& pr)
|
||||
: point_relation(pr)
|
||||
{}
|
||||
|
||||
PointRelation point_relation;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation>
|
||||
struct min_bounded
|
||||
: nonassignable
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, point_type>::type distance_type;
|
||||
|
||||
inline min_bounded(PointRelation const& pr, MinRelation const& min_rel)
|
||||
: point_relation(pr)
|
||||
, comparable_min(
|
||||
relation<MinRelation>::value(min_rel) *
|
||||
relation<MinRelation>::value(min_rel) )
|
||||
{}
|
||||
|
||||
PointRelation point_relation;
|
||||
distance_type comparable_min;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation>
|
||||
struct max_bounded
|
||||
: nonassignable
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, point_type>::type distance_type;
|
||||
|
||||
inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel)
|
||||
: point_relation(pr)
|
||||
, comparable_max(
|
||||
relation<MaxRelation>::value(max_rel) *
|
||||
relation<MaxRelation>::value(max_rel) )
|
||||
{}
|
||||
|
||||
PointRelation point_relation;
|
||||
distance_type comparable_max;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation>
|
||||
struct bounded
|
||||
: nonassignable
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, point_type>::type distance_type;
|
||||
|
||||
inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel)
|
||||
: point_relation(pr)
|
||||
, comparable_min(
|
||||
relation<MinRelation>::value(min_rel) *
|
||||
relation<MinRelation>::value(min_rel) )
|
||||
, comparable_max(
|
||||
relation<MaxRelation>::value(max_rel) *
|
||||
relation<MaxRelation>::value(max_rel) )
|
||||
{}
|
||||
|
||||
PointRelation point_relation;
|
||||
distance_type comparable_min;
|
||||
distance_type comparable_max;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// point_relation trait
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename PointRelation>
|
||||
struct point_relation
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
template <typename PointRelation>
|
||||
struct point_relation< detail::unbounded<PointRelation> >
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation>
|
||||
struct point_relation< detail::min_bounded<PointRelation, MinRelation> >
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation>
|
||||
struct point_relation< detail::max_bounded<PointRelation, MaxRelation> >
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation>
|
||||
struct point_relation< detail::bounded<PointRelation, MinRelation, MaxRelation> >
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// helpers
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
// algorithms
|
||||
|
||||
// cdist
|
||||
|
||||
template <typename T, typename Tag>
|
||||
struct cdist
|
||||
{
|
||||
T value;
|
||||
};
|
||||
|
||||
// cdist_merge
|
||||
|
||||
template <typename CDistTuple, typename CDist>
|
||||
struct cdist_merge
|
||||
{
|
||||
typedef typename detail::tuples::add_unique<
|
||||
CDistTuple,
|
||||
CDist
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <typename T, typename Tag, typename OtherTag>
|
||||
struct cdist_merge<
|
||||
cdist<T, Tag>,
|
||||
cdist<T, OtherTag> >
|
||||
{
|
||||
typedef boost::tuple<
|
||||
cdist<T, Tag>,
|
||||
cdist<T, OtherTag>
|
||||
> type;
|
||||
};
|
||||
|
||||
template <typename T, typename Tag>
|
||||
struct cdist_merge<
|
||||
cdist<T, Tag>,
|
||||
cdist<T, Tag> >
|
||||
{
|
||||
typedef cdist<T, Tag> type;
|
||||
};
|
||||
|
||||
// cdist_value_type
|
||||
|
||||
template <typename CDistTuple>
|
||||
struct cdist_value
|
||||
{
|
||||
typedef typename cdist_value<
|
||||
typename boost::tuples::element<0, CDistTuple>::type
|
||||
>::type type;
|
||||
|
||||
template <typename Tag>
|
||||
static inline type & get(CDistTuple & cdtup)
|
||||
{
|
||||
return boost::get<
|
||||
tuples::find_index<
|
||||
CDistTuple,
|
||||
cdist<type, Tag>
|
||||
>::value
|
||||
>(cdtup).value;
|
||||
}
|
||||
|
||||
template <typename Tag>
|
||||
static inline type const& get(CDistTuple const& cdtup)
|
||||
{
|
||||
return boost::get<
|
||||
tuples::find_index<
|
||||
CDistTuple,
|
||||
cdist<type, Tag>
|
||||
>::value
|
||||
>(cdtup).value;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename Tag>
|
||||
struct cdist_value<
|
||||
cdist<T, Tag>
|
||||
>
|
||||
{
|
||||
typedef T type;
|
||||
|
||||
template <typename Tag2>
|
||||
static inline type & get(cdist<T, Tag> & cd)
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(tuples::equal< cdist<T, Tag2>, cdist<T, Tag> >::value),
|
||||
TAGS_DO_NOT_MATCH,
|
||||
(cdist_value));
|
||||
|
||||
return cd.value;
|
||||
}
|
||||
|
||||
template <typename Tag2>
|
||||
static inline type const& get(cdist<T, Tag> const& cd)
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(tuples::equal< cdist<T, Tag2>, cdist<T, Tag> >::value),
|
||||
TAGS_DO_NOT_MATCH,
|
||||
(cdist_value));
|
||||
|
||||
return cd.value;
|
||||
}
|
||||
};
|
||||
|
||||
// distances_calc_impl_rel
|
||||
|
||||
template <typename RelDist>
|
||||
struct distances_calc_impl_rel
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(false),
|
||||
NOT_IMPLEMENTED_FOR_THIS_RELATION,
|
||||
(distances_calc_impl_rel));
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct distances_calc_impl_rel<
|
||||
cdist<T, detail::to_nearest_tag>
|
||||
>
|
||||
{
|
||||
template <typename Point, typename Indexable>
|
||||
typename geometry::default_distance_result<Point, Indexable>::type
|
||||
static inline apply(Point const& p, Indexable const& i)
|
||||
{
|
||||
return index::comparable_distance_near(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct distances_calc_impl_rel<
|
||||
cdist<T, detail::to_centroid_tag>
|
||||
>
|
||||
{
|
||||
template <typename Point, typename Indexable>
|
||||
typename geometry::default_distance_result<Point, Indexable>::type
|
||||
static inline apply(Point const& p, Indexable const& i)
|
||||
{
|
||||
return index::comparable_distance_centroid(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct distances_calc_impl_rel<
|
||||
cdist<T, detail::to_furthest_tag>
|
||||
>
|
||||
{
|
||||
template <typename Point, typename Indexable>
|
||||
typename geometry::default_distance_result<Point, Indexable>::type
|
||||
static inline apply(Point const& p, Indexable const& i)
|
||||
{
|
||||
return index::comparable_distance_far(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
// distances_calc_impl_tuple
|
||||
|
||||
template <typename Distances, typename Point, typename Indexable, size_t N>
|
||||
struct distances_calc_impl_tuple
|
||||
{
|
||||
// TODO MPL ASSERT 0 < N
|
||||
static inline void apply(Distances & d, Point const& p, Indexable const&i)
|
||||
{
|
||||
boost::get<N - 1>(d).value =
|
||||
distances_calc_impl_rel<
|
||||
typename boost::tuples::element<N - 1, Distances>::type
|
||||
>::apply(p, i);
|
||||
|
||||
distances_calc_impl_tuple<
|
||||
Distances,
|
||||
Point,
|
||||
Indexable,
|
||||
N - 1
|
||||
>::apply(d, p, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Distances, typename Point, typename Indexable>
|
||||
struct distances_calc_impl_tuple<Distances, Point, Indexable, 1>
|
||||
{
|
||||
static inline void apply(Distances & d, Point const& p, Indexable const&i)
|
||||
{
|
||||
boost::get<0>(d).value =
|
||||
distances_calc_impl_rel<
|
||||
typename boost::tuples::element<0, Distances>::type
|
||||
>::apply(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
// distances_calc_impl
|
||||
|
||||
template <typename Distances, typename Point, typename Indexable>
|
||||
struct distances_calc_impl
|
||||
{
|
||||
static inline void apply(Distances & d, Point const& p, Indexable const&i)
|
||||
{
|
||||
distances_calc_impl_tuple<
|
||||
Distances,
|
||||
Point,
|
||||
Indexable,
|
||||
boost::tuples::length<Distances>::value
|
||||
>::apply(d, p, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename Tag, typename Point, typename Indexable>
|
||||
struct distances_calc_impl<
|
||||
cdist<T, Tag>,
|
||||
Point,
|
||||
Indexable
|
||||
>
|
||||
{
|
||||
static inline void apply(cdist<T, Tag> & d, Point const& p, Indexable const&i)
|
||||
{
|
||||
d.value = distances_calc_impl_rel<
|
||||
cdist<T, Tag>
|
||||
>::apply(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// distance_calc and distances_predicates_check
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename PointRelation, typename Indexable, typename Tag>
|
||||
struct distances_calc
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(false),
|
||||
NOT_IMPLEMENTED_FOR_THIS_TAG,
|
||||
(distances_calc));
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename Indexable, typename Tag>
|
||||
struct distances_predicates_check
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(false),
|
||||
NOT_IMPLEMENTED_FOR_THIS_TAG,
|
||||
(distances_predicates_check));
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// distance_calc for value_tag
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename PointRelation, typename Indexable>
|
||||
struct distances_calc<PointRelation, Indexable, value_tag>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
|
||||
typedef detail::cdist<distance_type, point_relation_tag> result_type;
|
||||
|
||||
static inline result_type apply(PointRelation const& p, Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(p), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename Indexable>
|
||||
struct distances_calc<
|
||||
detail::unbounded<PointRelation>,
|
||||
Indexable,
|
||||
value_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
|
||||
typedef detail::cdist<distance_type, point_relation_tag> result_type;
|
||||
|
||||
static inline result_type apply(detail::unbounded<PointRelation> const& pp, Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename Indexable>
|
||||
struct distances_calc<
|
||||
detail::min_bounded<PointRelation, MinRelation>,
|
||||
Indexable,
|
||||
value_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
typedef typename detail::relation<MinRelation>::tag min_relation_tag;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
cdist<distance_type, point_relation_tag>,
|
||||
cdist<distance_type, min_relation_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(detail::min_bounded<PointRelation, MinRelation> const& pp, Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation, typename Indexable>
|
||||
struct distances_calc<
|
||||
detail::max_bounded<PointRelation, MaxRelation>,
|
||||
Indexable,
|
||||
value_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
cdist<distance_type, point_relation_tag>,
|
||||
cdist<distance_type, max_relation_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(detail::max_bounded<PointRelation, MaxRelation> const& pp, Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Indexable>
|
||||
struct distances_calc<
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation>,
|
||||
Indexable,
|
||||
value_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
typedef typename detail::relation<MinRelation>::tag min_relation_tag;
|
||||
typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
typename detail::cdist_merge<
|
||||
cdist<distance_type, point_relation_tag>,
|
||||
cdist<distance_type, min_relation_tag>
|
||||
>::type,
|
||||
cdist<distance_type, max_relation_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation> const& pp,
|
||||
Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// distance_predicates_check for value_tag
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename PointRelation, typename Indexable>
|
||||
struct distances_predicates_check<PointRelation, Indexable, value_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(PointRelation const&, Distances const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename Indexable>
|
||||
struct distances_predicates_check<
|
||||
detail::unbounded<PointRelation>,
|
||||
Indexable,
|
||||
value_tag
|
||||
>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(detail::unbounded<PointRelation> const&, Distances const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename Indexable>
|
||||
struct distances_predicates_check<
|
||||
detail::min_bounded<PointRelation, MinRelation>,
|
||||
Indexable,
|
||||
value_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<MinRelation>::tag min_relation_tag;
|
||||
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::min_bounded<PointRelation, MinRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_min <=
|
||||
detail::cdist_value<Distances>::template get<min_relation_tag>(d);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation, typename Indexable>
|
||||
struct distances_predicates_check<
|
||||
detail::max_bounded<PointRelation, MaxRelation>,
|
||||
Indexable,
|
||||
value_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
|
||||
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::max_bounded<PointRelation, MaxRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_max <=
|
||||
detail::cdist_value<Distances>::template get<max_relation_tag>(d);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Indexable>
|
||||
struct distances_predicates_check<
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation>,
|
||||
Indexable,
|
||||
value_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<MinRelation>::tag min_relation_tag;
|
||||
typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
|
||||
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_min
|
||||
<= detail::cdist_value<Distances>::template get<min_relation_tag>(d)
|
||||
&& detail::cdist_value<Distances>::template get<max_relation_tag>(d)
|
||||
<= pred.comparable_max;
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// distance_calc for envelope_tag
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename PointRelation, typename Box>
|
||||
struct distances_calc<
|
||||
PointRelation,
|
||||
Box,
|
||||
envelope_tag>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef detail::cdist<distance_type, detail::to_nearest_tag> result_type;
|
||||
|
||||
static inline result_type apply(PointRelation const& p, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(p), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename Box>
|
||||
struct distances_calc<
|
||||
detail::unbounded<PointRelation>,
|
||||
Box,
|
||||
envelope_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef detail::cdist<distance_type, detail::to_nearest_tag> result_type;
|
||||
|
||||
static inline result_type apply(detail::unbounded<PointRelation> const& pp, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename Box>
|
||||
struct distances_calc<
|
||||
detail::min_bounded<PointRelation, MinRelation>,
|
||||
Box,
|
||||
envelope_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
cdist<distance_type, detail::to_nearest_tag>,
|
||||
cdist<distance_type, detail::to_furthest_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(detail::min_bounded<PointRelation, MinRelation> const& pp, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation, typename Box>
|
||||
struct distances_calc<
|
||||
detail::max_bounded<PointRelation, MaxRelation>,
|
||||
Box,
|
||||
envelope_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef cdist<distance_type, detail::to_nearest_tag> result_type;
|
||||
|
||||
static inline result_type apply(detail::max_bounded<PointRelation, MaxRelation> const& pp, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Box>
|
||||
struct distances_calc<
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation>,
|
||||
Box,
|
||||
envelope_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
cdist<distance_type, detail::to_nearest_tag>,
|
||||
cdist<distance_type, detail::to_furthest_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(detail::bounded<PointRelation, MinRelation, MaxRelation> const& pp, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// distance_predicates_check for envelope_tag
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename PointRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
PointRelation,
|
||||
Box,
|
||||
envelope_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(PointRelation const&, Distances const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
detail::unbounded<PointRelation>,
|
||||
Box,
|
||||
envelope_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::unbounded<PointRelation> const&,
|
||||
Distances const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
detail::min_bounded<PointRelation, MinRelation>,
|
||||
Box,
|
||||
envelope_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::min_bounded<PointRelation, MinRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_min
|
||||
<= cdist_value<Distances>::template get<detail::to_furthest_tag>(d);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
detail::max_bounded<PointRelation, MaxRelation>,
|
||||
Box,
|
||||
envelope_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::max_bounded<PointRelation, MaxRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return cdist_value<Distances>::template get<detail::to_nearest_tag>(d)
|
||||
<= pred.comparable_max;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation>,
|
||||
Box,
|
||||
envelope_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_min
|
||||
<= cdist_value<Distances>::template get<detail::to_furthest_tag>(d)
|
||||
&& cdist_value<Distances>::template get<detail::to_nearest_tag>(d)
|
||||
<= pred.comparable_max;
|
||||
}
|
||||
};
|
||||
|
||||
}}}} // namespace boost::geometry::index::detail
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP
|
||||
@@ -11,13 +11,13 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
namespace boost { namespace geometry { namespace index { namespace detail {
|
||||
|
||||
class nonassignable
|
||||
{
|
||||
nonassignable & operator=(nonassignable const&);
|
||||
};
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
}}}} // namespace boost::geometry::index::detail
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP
|
||||
525
include/boost/geometry/extensions/index/detail/predicates.hpp
Normal file
525
include/boost/geometry/extensions/index/detail/predicates.hpp
Normal file
@@ -0,0 +1,525 @@
|
||||
// Boost.Geometry Index
|
||||
//
|
||||
// Spatial query predicates definition and checks.
|
||||
//
|
||||
// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
|
||||
//
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/predicates.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/tags.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index { namespace detail {
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicates
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
struct empty {};
|
||||
|
||||
template <typename ValuePredicate>
|
||||
struct value
|
||||
{
|
||||
value(ValuePredicate const& vpred) : value_predicate(vpred) {}
|
||||
ValuePredicate value_predicate;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct covered_by
|
||||
{
|
||||
covered_by(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct disjoint
|
||||
{
|
||||
disjoint(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct intersects
|
||||
{
|
||||
intersects(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct overlaps
|
||||
{
|
||||
overlaps(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct touches
|
||||
//{
|
||||
// touches(Geometry const& g) : geometry(g) {}
|
||||
// Geometry geometry;
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct within
|
||||
{
|
||||
within(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_covered_by
|
||||
{
|
||||
not_covered_by(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_disjoint
|
||||
{
|
||||
not_disjoint(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_intersects
|
||||
{
|
||||
not_intersects(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_overlaps
|
||||
{
|
||||
not_overlaps(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct not_touches
|
||||
//{
|
||||
// not_touches(Geometry const& g) : geometry(g) {}
|
||||
// Geometry geometry;
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_within
|
||||
{
|
||||
not_within(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicate_check
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(false),
|
||||
NOT_IMPLEMENTED_FOR_THIS_TAG,
|
||||
(predicate_check));
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicate_check for value
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<Geometry, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, g);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct predicate_check<empty, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(empty const&, Value const&, Indexable const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ValuePredicate>
|
||||
struct predicate_check<value<ValuePredicate>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(value<ValuePredicate> const& p, Value const& v, Indexable const&)
|
||||
{
|
||||
return p.value_predicate(v);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<covered_by<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(covered_by<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<disjoint<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(disjoint<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::disjoint(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<intersects<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(intersects<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<overlaps<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(overlaps<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::overlaps(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct predicate_check<touches<Geometry>, value_tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(touches<Geometry> const& p, Value const&, Indexable const& i)
|
||||
// {
|
||||
// return geometry::touches(i, p.geometry);
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<within<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(within<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::within(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_covered_by<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_covered_by<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_disjoint<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_disjoint<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::disjoint(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_intersects<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_intersects<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_overlaps<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_overlaps<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::overlaps(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct predicate_check<not_touches<Geometry>, value_tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(not_touches<Geometry> const& p, Value const&, Indexable const& i)
|
||||
// {
|
||||
// return !geometry::touches(i, p.geometry);
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_within<Geometry>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_within<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::within(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicates_chec for envelope
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<Geometry, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, g);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct predicate_check<empty, envelope_tag>
|
||||
{
|
||||
template <typename Geometry, typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const&, Value const&, Indexable const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ValuePredicate>
|
||||
struct predicate_check<value<ValuePredicate>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(value<ValuePredicate> const&, Value const&, Box const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<covered_by<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(covered_by<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<disjoint<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(disjoint<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<intersects<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(intersects<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<overlaps<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static inline bool apply(overlaps<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
// TODO: awulkiew - possibly change to the version without border case
|
||||
// e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct predicate_check<touches<Geometry>, envelope_tag>
|
||||
//{
|
||||
// template <typename Value, typename Box>
|
||||
// static bool apply(touches<Geometry> const& p, Value const&, Box const& i)
|
||||
// {
|
||||
// return geometry::intersects(i, p.geometry);
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<within<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(within<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
// TODO: awulkiew - possibly change to the version without border case
|
||||
// e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_covered_by<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_covered_by<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_disjoint<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_disjoint<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::disjoint(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_intersects<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_intersects<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_overlaps<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_overlaps<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct predicate_check<not_touches<Geometry>, envelope_tag>
|
||||
//{
|
||||
// template <typename Value, typename Box>
|
||||
// static bool apply(not_touches<Geometry> const& p, Value const&, Box const& i)
|
||||
// {
|
||||
// return !geometry::intersects(i, p.geometry);
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_within<Geometry>, envelope_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_within<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::within(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicates_check
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename TuplePredicates, typename Tag, unsigned int N>
|
||||
struct predicates_check_tuple
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicates_check_tuple<TuplePredicates, Tag, N - 1>::apply(p, v, i)
|
||||
&& predicate_check<
|
||||
typename boost::tuples::element<N - 1, TuplePredicates>::type,
|
||||
Tag
|
||||
>::apply(boost::get<N - 1>(p), v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename TuplePredicates, typename Tag>
|
||||
struct predicates_check_tuple<TuplePredicates, Tag, 1>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<
|
||||
typename boost::tuples::element<0, TuplePredicates>::type,
|
||||
Tag
|
||||
>::apply(boost::get<0>(p), v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Predicate, typename Tag>
|
||||
struct predicates_check_impl
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(Predicate const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<Predicate, Tag>::apply(p, v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Predicate1, typename Predicate2, typename Tag>
|
||||
struct predicates_check_impl<std::pair<Predicate1, Predicate2>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(std::pair<Predicate1, Predicate2> const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<Predicate1, Tag>::apply(p.first, v, i)
|
||||
&& predicate_check<Predicate2, Tag>::apply(p.second, v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8, typename T9,
|
||||
typename Tag
|
||||
>
|
||||
struct predicates_check_impl<
|
||||
boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> predicates_type;
|
||||
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicates_check_tuple<
|
||||
predicates_type,
|
||||
Tag,
|
||||
boost::tuples::length<predicates_type>::value
|
||||
>::apply(p, v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tag, typename Predicates, typename Value, typename Indexable>
|
||||
inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return detail::predicates_check_impl<Predicates, Tag>
|
||||
::apply(p, v, i);
|
||||
}
|
||||
|
||||
}}}} // namespace boost::geometry::index::detail
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/assert.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/assert.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
namespace boost { namespace geometry { namespace index { namespace detail {
|
||||
|
||||
template <typename Element, size_t Capacity>
|
||||
class pushable_array
|
||||
@@ -166,6 +166,6 @@ private:
|
||||
size_type m_size;
|
||||
};
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
}}}} // namespace boost::geometry::index::detail
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PUSHABLE_ARRAY_HPP
|
||||
@@ -11,6 +11,6 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp>
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP
|
||||
@@ -17,9 +17,9 @@
|
||||
#include <boost/geometry/extensions/index/algorithms/content.hpp>
|
||||
#include <boost/geometry/extensions/index/algorithms/union_content.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -11,19 +11,19 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/concept.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/concept.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/expand.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/destroy.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/dynamic_visitor.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp>
|
||||
#include <boost/geometry/extensions/index/static_vector.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/dynamic_visitor.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/static_vector.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -22,7 +22,7 @@ template <typename Value, typename Parameters, typename Box, typename Allocators
|
||||
struct dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
|
||||
: public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
|
||||
{
|
||||
typedef index::static_vector<
|
||||
typedef detail::static_vector<
|
||||
std::pair<
|
||||
Box,
|
||||
dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag> *
|
||||
@@ -43,7 +43,7 @@ template <typename Value, typename Parameters, typename Box, typename Allocators
|
||||
struct dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
|
||||
: public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
|
||||
{
|
||||
typedef index::static_vector<Value, Parameters::max_elements + 1> elements_type;
|
||||
typedef detail::static_vector<Value, Parameters::max_elements + 1> elements_type;
|
||||
|
||||
template <typename Dummy>
|
||||
inline dynamic_leaf(Dummy) {}
|
||||
@@ -82,16 +82,16 @@ struct visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, IsVisi
|
||||
|
||||
// elements derived type
|
||||
template <typename OldValue, size_t N, typename NewValue>
|
||||
struct container_from_elements_type<index::static_vector<OldValue, N>, NewValue>
|
||||
struct container_from_elements_type<detail::static_vector<OldValue, N>, NewValue>
|
||||
{
|
||||
typedef index::static_vector<NewValue, N> type;
|
||||
typedef detail::static_vector<NewValue, N> type;
|
||||
};
|
||||
|
||||
// allocators
|
||||
|
||||
template <typename Allocator, typename Value, typename Parameters, typename Box>
|
||||
class allocators<Allocator, Value, Parameters, Box, node_d_mem_static_tag>
|
||||
: nonassignable
|
||||
: detail::nonassignable
|
||||
{
|
||||
BOOST_COPYABLE_AND_MOVABLE_ALT(allocators)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/static_visitor.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/static_visitor.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/static_vector.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/static_vector.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/static_visitor.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/static_visitor.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace detail { namespace rtree {
|
||||
template <typename Value, typename Parameters, typename Box, typename Allocators>
|
||||
struct static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
|
||||
{
|
||||
typedef index::static_vector<
|
||||
typedef detail::static_vector<
|
||||
std::pair<
|
||||
Box,
|
||||
typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type *
|
||||
@@ -41,7 +41,7 @@ struct static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_stati
|
||||
template <typename Value, typename Parameters, typename Box, typename Allocators>
|
||||
struct static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
|
||||
{
|
||||
typedef index::static_vector<Value, Parameters::max_elements + 1> elements_type;
|
||||
typedef detail::static_vector<Value, Parameters::max_elements + 1> elements_type;
|
||||
|
||||
template <typename Dummy>
|
||||
inline static_leaf(Dummy) {}
|
||||
155
include/boost/geometry/extensions/index/detail/rtree/options.hpp
Normal file
155
include/boost/geometry/extensions/index/detail/rtree/options.hpp
Normal file
@@ -0,0 +1,155 @@
|
||||
// Boost.Geometry Index
|
||||
//
|
||||
// R-tree options, algorithms, parameters
|
||||
//
|
||||
// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
|
||||
//
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/parameters.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
namespace detail { namespace rtree {
|
||||
|
||||
// InsertTag
|
||||
struct insert_default_tag {};
|
||||
struct insert_reinsert_tag {};
|
||||
|
||||
// ChooseNextNodeTag
|
||||
struct choose_by_content_diff_tag {};
|
||||
struct choose_by_overlap_diff_tag {};
|
||||
|
||||
// SplitTag
|
||||
struct split_default_tag {};
|
||||
//struct split_kmeans_tag {};
|
||||
|
||||
// RedistributeTag
|
||||
struct linear_tag {};
|
||||
struct quadratic_tag {};
|
||||
struct rstar_tag {};
|
||||
|
||||
// NodeTag
|
||||
struct node_d_mem_dynamic_tag {};
|
||||
struct node_d_mem_static_tag {};
|
||||
struct node_s_mem_dynamic_tag {};
|
||||
struct node_s_mem_static_tag {};
|
||||
|
||||
template <typename Parameters, typename InsertTag, typename ChooseNextNodeTag, typename SplitTag, typename RedistributeTag, typename NodeTag>
|
||||
struct options
|
||||
{
|
||||
typedef Parameters parameters_type;
|
||||
typedef InsertTag insert_tag;
|
||||
typedef ChooseNextNodeTag choose_next_node_tag;
|
||||
typedef SplitTag split_tag;
|
||||
typedef RedistributeTag redistribute_tag;
|
||||
typedef NodeTag node_tag;
|
||||
};
|
||||
|
||||
template <typename Parameters>
|
||||
struct options_type
|
||||
{
|
||||
// TODO: awulkiew - use static assert
|
||||
};
|
||||
|
||||
template <size_t MaxElements, size_t MinElements>
|
||||
struct options_type< linear<MaxElements, MinElements> >
|
||||
{
|
||||
typedef options<
|
||||
linear<MaxElements, MinElements>,
|
||||
insert_default_tag,
|
||||
choose_by_content_diff_tag,
|
||||
split_default_tag,
|
||||
linear_tag,
|
||||
node_d_mem_static_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
template <size_t MaxElements, size_t MinElements>
|
||||
struct options_type< quadratic<MaxElements, MinElements> >
|
||||
{
|
||||
typedef options<
|
||||
quadratic<MaxElements, MinElements>,
|
||||
insert_default_tag,
|
||||
choose_by_content_diff_tag,
|
||||
split_default_tag,
|
||||
quadratic_tag,
|
||||
node_d_mem_static_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
template <size_t MaxElements, size_t MinElements, size_t OverlapCostThreshold, size_t ReinsertedElements>
|
||||
struct options_type< rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements> >
|
||||
{
|
||||
typedef options<
|
||||
rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements>,
|
||||
insert_reinsert_tag,
|
||||
choose_by_overlap_diff_tag,
|
||||
split_default_tag,
|
||||
rstar_tag,
|
||||
node_d_mem_static_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
//template <size_t MaxElements, size_t MinElements>
|
||||
//struct options_type< kmeans<MaxElements, MinElements> >
|
||||
//{
|
||||
// typedef options<
|
||||
// kmeans<MaxElements, MinElements>,
|
||||
// insert_default_tag,
|
||||
// choose_by_content_diff_tag, // change it?
|
||||
// split_kmeans_tag,
|
||||
// int, // dummy tag - not used for now
|
||||
// node_d_mem_static_tag
|
||||
// > type;
|
||||
//};
|
||||
|
||||
template <>
|
||||
struct options_type< runtime::linear >
|
||||
{
|
||||
typedef options<
|
||||
runtime::linear,
|
||||
insert_default_tag,
|
||||
choose_by_content_diff_tag,
|
||||
split_default_tag,
|
||||
linear_tag,
|
||||
node_d_mem_dynamic_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct options_type< runtime::quadratic >
|
||||
{
|
||||
typedef options<
|
||||
runtime::quadratic,
|
||||
insert_default_tag,
|
||||
choose_by_content_diff_tag,
|
||||
split_default_tag,
|
||||
quadratic_tag,
|
||||
node_d_mem_dynamic_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct options_type< runtime::rstar >
|
||||
{
|
||||
typedef options<
|
||||
runtime::rstar,
|
||||
insert_reinsert_tag,
|
||||
choose_by_overlap_diff_tag,
|
||||
split_default_tag,
|
||||
rstar_tag,
|
||||
node_d_mem_dynamic_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
}} // namespace detail::rtree
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP
|
||||
@@ -11,6 +11,6 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp>
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP
|
||||
@@ -16,9 +16,9 @@
|
||||
#include <boost/geometry/extensions/index/algorithms/content.hpp>
|
||||
#include <boost/geometry/extensions/index/algorithms/union_content.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include <boost/geometry/extensions/index/algorithms/intersection_content.hpp>
|
||||
#include <boost/geometry/extensions/index/algorithms/union_content.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -426,7 +426,7 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators>
|
||||
template <typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
|
||||
class insert<Element, Value, Options, Translator, Box, Allocators, insert_reinsert_tag>
|
||||
: public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
|
||||
, index::nonassignable
|
||||
, index::detail::nonassignable
|
||||
{
|
||||
typedef typename Options::parameters_type parameters_type;
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/nonassignable.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/nonassignable.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/algorithms/intersection_content.hpp>
|
||||
#include <boost/geometry/extensions/index/algorithms/union_content.hpp>
|
||||
#include <boost/geometry/extensions/index/algorithms/margin.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace rstar {
|
||||
|
||||
template <typename Element, typename Translator, size_t Corner, size_t AxisIndex>
|
||||
class element_axis_corner_less
|
||||
: index::nonassignable
|
||||
: index::detail::nonassignable
|
||||
{
|
||||
public:
|
||||
element_axis_corner_less(Translator const& tr)
|
||||
@@ -11,8 +11,8 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/rstar/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/rstar/choose_next_node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp>
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP
|
||||
@@ -12,16 +12,16 @@
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP
|
||||
|
||||
#include <boost/geometry/algorithms/equals.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index { namespace detail {
|
||||
namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree {
|
||||
|
||||
namespace rtree { namespace visitors {
|
||||
namespace visitors {
|
||||
|
||||
template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
|
||||
class are_boxes_ok
|
||||
: public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
|
||||
, index::nonassignable
|
||||
, index::detail::nonassignable
|
||||
{
|
||||
typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
|
||||
typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
bool m_exact_match;
|
||||
};
|
||||
|
||||
}} // namespace rtree::visitors
|
||||
} // namespace visitors
|
||||
|
||||
template <typename Value, typename Parameters, typename Translator, typename Allocator>
|
||||
bool are_boxes_ok(index::rtree<Value, Parameters, Translator, Allocator> const& tree,
|
||||
@@ -136,6 +136,6 @@ bool are_boxes_ok(index::rtree<Value, Parameters, Translator, Allocator> const&
|
||||
return v.result;
|
||||
}
|
||||
|
||||
}}}} // namespace boost::geometry::index::detail
|
||||
}}}}} // namespace boost::geometry::index::detail::rtree
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP
|
||||
@@ -11,16 +11,16 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index { namespace detail {
|
||||
|
||||
namespace rtree { namespace visitors {
|
||||
namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree {
|
||||
|
||||
namespace visitors {
|
||||
|
||||
template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
|
||||
class are_levels_ok
|
||||
: public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
|
||||
, index::nonassignable
|
||||
, index::detail::nonassignable
|
||||
{
|
||||
typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
|
||||
typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
|
||||
@@ -86,7 +86,7 @@ private:
|
||||
size_t m_current_level;
|
||||
};
|
||||
|
||||
}} // namespace rtree::visitors
|
||||
} // namespace visitors
|
||||
|
||||
template <typename Value, typename Parameters, typename Translator, typename Allocator>
|
||||
bool are_levels_ok(index::rtree<Value, Parameters, Translator, Allocator> const& tree)
|
||||
@@ -106,6 +106,6 @@ bool are_levels_ok(index::rtree<Value, Parameters, Translator, Allocator> const&
|
||||
return v.result;
|
||||
}
|
||||
|
||||
}}}} // namespace boost::geometry::index::detail
|
||||
}}}}} // namespace boost::geometry::index::detail::rtree
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/predicates.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -22,7 +20,7 @@ namespace detail { namespace rtree { namespace visitors {
|
||||
template <typename Indexable, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
|
||||
struct count
|
||||
: public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
|
||||
, index::nonassignable
|
||||
, index::detail::nonassignable
|
||||
{
|
||||
typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
|
||||
typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
|
||||
@@ -71,7 +69,7 @@ struct count
|
||||
template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
|
||||
struct count<Value, Value, Options, Translator, Box, Allocators>
|
||||
: public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
|
||||
, index::nonassignable
|
||||
, index::detail::nonassignable
|
||||
{
|
||||
typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
|
||||
typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <boost/geometry/extensions/index/algorithms/content.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -122,7 +122,7 @@ protected:
|
||||
typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
|
||||
|
||||
public:
|
||||
typedef index::static_vector<std::pair<Box, node*>, 1> nodes_container_type;
|
||||
typedef index::detail::static_vector<std::pair<Box, node*>, 1> nodes_container_type;
|
||||
|
||||
template <typename Node>
|
||||
static inline void apply(nodes_container_type & additional_nodes,
|
||||
@@ -220,7 +220,7 @@ struct insert_traverse_data
|
||||
template <typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
|
||||
class insert
|
||||
: public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
|
||||
, index::nonassignable
|
||||
, index::detail::nonassignable
|
||||
{
|
||||
protected:
|
||||
typedef typename Options::parameters_type parameters_type;
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_QUERY_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_QUERY_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/distance_predicates.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/distance_predicates.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/translator/translator.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
@@ -159,7 +159,7 @@ template <
|
||||
>
|
||||
class nearest_query
|
||||
: public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
|
||||
, index::nonassignable
|
||||
, index::detail::nonassignable
|
||||
{
|
||||
public:
|
||||
typedef typename Options::parameters_type parameters_type;
|
||||
@@ -168,20 +168,20 @@ public:
|
||||
typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
|
||||
typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
|
||||
|
||||
typedef index::detail::distances_calc<DistancesPredicates, Box, rtree::node_tag> node_distances_calc;
|
||||
typedef index::detail::distances_calc<DistancesPredicates, Box, index::detail::envelope_tag> node_distances_calc;
|
||||
typedef typename node_distances_calc::result_type node_distances_type;
|
||||
typedef index::detail::distances_predicates_check<DistancesPredicates, Box, rtree::node_tag> node_distances_predicates_check;
|
||||
typedef index::detail::distances_predicates_check<DistancesPredicates, Box, index::detail::envelope_tag> node_distances_predicates_check;
|
||||
|
||||
typedef index::detail::distances_calc<
|
||||
DistancesPredicates,
|
||||
typename translator::indexable_type<Translator>::type,
|
||||
rtree::value_tag
|
||||
index::detail::value_tag
|
||||
> value_distances_calc;
|
||||
typedef typename value_distances_calc::result_type value_distances_type;
|
||||
typedef index::detail::distances_predicates_check<
|
||||
DistancesPredicates,
|
||||
typename translator::indexable_type<Translator>::type,
|
||||
rtree::value_tag
|
||||
index::detail::value_tag
|
||||
> value_distances_predicates_check;
|
||||
|
||||
inline nearest_query(parameters_type const& parameters, Translator const& translator, DistancesPredicates const& dist_pred, Predicates const& pred, Result & r)
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
{
|
||||
// if current node meets predicates
|
||||
// 0 - dummy value
|
||||
if ( index::detail::predicates_check<rtree::node_tag>(m_pred, 0, it->first) )
|
||||
if ( index::detail::predicates_check<index::detail::envelope_tag>(m_pred, 0, it->first) )
|
||||
{
|
||||
// calculate node's distance(s) for distance predicate
|
||||
node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first);
|
||||
@@ -266,7 +266,7 @@ public:
|
||||
it != elements.end(); ++it)
|
||||
{
|
||||
// if value meets predicates
|
||||
if ( index::detail::predicates_check<rtree::value_tag>(m_pred, *it, m_translator(*it)) )
|
||||
if ( index::detail::predicates_check<index::detail::value_tag>(m_pred, *it, m_translator(*it)) )
|
||||
{
|
||||
// calculate values distance for distance predicate
|
||||
value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_translator(*it));
|
||||
@@ -11,9 +11,9 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/covered_by.hpp>
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace detail { namespace rtree { namespace visitors {
|
||||
template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
|
||||
class remove
|
||||
: public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
|
||||
, index::nonassignable
|
||||
, index::detail::nonassignable
|
||||
{
|
||||
typedef typename Options::parameters_type parameters_type;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/predicates.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/predicates.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace detail { namespace rtree { namespace visitors {
|
||||
template <typename Value, typename Options, typename Translator, typename Box, typename Allocators, typename Predicates, typename OutIter>
|
||||
struct spatial_query
|
||||
: public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
|
||||
, index::nonassignable
|
||||
, index::detail::nonassignable
|
||||
{
|
||||
typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
|
||||
typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
|
||||
@@ -43,7 +43,7 @@ struct spatial_query
|
||||
{
|
||||
// if node meets predicates
|
||||
// 0 - dummy value
|
||||
if ( index::detail::predicates_check<rtree::node_tag>(pred, 0, it->first) )
|
||||
if ( index::detail::predicates_check<index::detail::envelope_tag>(pred, 0, it->first) )
|
||||
rtree::apply_visitor(*this, *it->second);
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ struct spatial_query
|
||||
it != elements.end(); ++it)
|
||||
{
|
||||
// if value meets predicates
|
||||
if ( index::detail::predicates_check<rtree::value_tag>(pred, *it, tr(*it)) )
|
||||
if ( index::detail::predicates_check<index::detail::value_tag>(pred, *it, tr(*it)) )
|
||||
{
|
||||
out_iter = *it;
|
||||
++out_iter;
|
||||
@@ -28,9 +28,9 @@
|
||||
#include <boost/type_traits/has_trivial_constructor.hpp>
|
||||
#include <boost/type_traits/has_trivial_destructor.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/assert.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/assert.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
namespace boost { namespace geometry { namespace index { namespace detail {
|
||||
|
||||
template <typename Value, size_t Capacity>
|
||||
class static_vector
|
||||
@@ -801,6 +801,6 @@ private:
|
||||
size_type m_size;
|
||||
};
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
}}}} // namespace boost::geometry::index::detail
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Geometry Index
|
||||
//
|
||||
// Tags used by the R-tree predicates implementation.
|
||||
// Tags used by the predicates checks implementation.
|
||||
//
|
||||
// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
|
||||
//
|
||||
@@ -8,17 +8,17 @@
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_TAGS_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_TAGS_HPP
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
namespace detail { namespace rtree {
|
||||
namespace detail {
|
||||
|
||||
struct value_tag {};
|
||||
struct node_tag {};
|
||||
struct envelope_tag {};
|
||||
|
||||
}} // namespace detail::rtree
|
||||
} // namespace detail
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
// TODO move this to index/tuples and separate algorithms
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
namespace boost { namespace geometry { namespace index { namespace detail {
|
||||
|
||||
namespace tuples {
|
||||
|
||||
@@ -179,6 +179,6 @@ struct add_unique
|
||||
|
||||
} // namespace tuples
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
}}}} // namespace boost::geometry::index::detail
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP
|
||||
@@ -11,11 +11,7 @@
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp>
|
||||
#include <boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp>
|
||||
#include <boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/tuples.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/distance_predicates.hpp>
|
||||
|
||||
/*!
|
||||
\defgroup distance_predicates Distance predicates (boost::geometry::index::)
|
||||
@@ -23,86 +19,6 @@
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
//TODO: awulkiew - consider storing values instead of const references
|
||||
// it may be faster and it eliminates problems with storing of references to temporaries
|
||||
// moreover user may use boost::cref
|
||||
|
||||
// TODO: awulkiew - what with coordinate systems other than cartesian?
|
||||
// do comparable_distance returns distance in coordinate system of objects used?
|
||||
// what if objects are in different systems?
|
||||
// should index algorithms work exactly like comparable_distance or not?
|
||||
|
||||
namespace detail {
|
||||
|
||||
// relations
|
||||
|
||||
template <typename T>
|
||||
struct to_nearest
|
||||
{
|
||||
to_nearest(T const& v) : value(v) {}
|
||||
T value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct to_centroid
|
||||
{
|
||||
to_centroid(T const& v) : value(v) {}
|
||||
T value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct to_furthest
|
||||
{
|
||||
to_furthest(T const& v) : value(v) {}
|
||||
T value;
|
||||
};
|
||||
|
||||
// tags
|
||||
|
||||
struct to_nearest_tag {};
|
||||
struct to_centroid_tag {};
|
||||
struct to_furthest_tag {};
|
||||
|
||||
// relation
|
||||
|
||||
template <typename T>
|
||||
struct relation
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef to_nearest_tag tag;
|
||||
static inline T const& value(T const& v) { return v; }
|
||||
static inline T & value(T & v) { return v; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct relation< to_nearest<T> >
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef to_nearest_tag tag;
|
||||
static inline T const& value(to_nearest<T> const& r) { return r.value; }
|
||||
static inline T & value(to_nearest<T> & r) { return r.value; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct relation< to_centroid<T> >
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef to_centroid_tag tag;
|
||||
static inline T const& value(to_centroid<T> const& r) { return r.value; }
|
||||
static inline T & value(to_centroid<T> & r) { return r.value; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct relation< to_furthest<T> >
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef to_furthest_tag tag;
|
||||
static inline T const& value(to_furthest<T> const& r) { return r.value; }
|
||||
static inline T & value(to_furthest<T> & r) { return r.value; }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// relations generators
|
||||
|
||||
/*!
|
||||
@@ -173,83 +89,6 @@ detail::to_furthest<T> to_furthest(T const& v)
|
||||
return detail::to_furthest<T>(v);
|
||||
}
|
||||
|
||||
// distance predicates
|
||||
|
||||
namespace detail {
|
||||
|
||||
// TODO: awulkiew - consider storing points instead of PointRelations in predicates below
|
||||
|
||||
template <typename PointRelation>
|
||||
struct unbounded
|
||||
: nonassignable
|
||||
{
|
||||
inline explicit unbounded(PointRelation const& pr)
|
||||
: point_relation(pr)
|
||||
{}
|
||||
|
||||
PointRelation point_relation;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation>
|
||||
struct min_bounded
|
||||
: nonassignable
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, point_type>::type distance_type;
|
||||
|
||||
inline min_bounded(PointRelation const& pr, MinRelation const& min_rel)
|
||||
: point_relation(pr)
|
||||
, comparable_min(
|
||||
relation<MinRelation>::value(min_rel) *
|
||||
relation<MinRelation>::value(min_rel) )
|
||||
{}
|
||||
|
||||
PointRelation point_relation;
|
||||
distance_type comparable_min;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation>
|
||||
struct max_bounded
|
||||
: nonassignable
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, point_type>::type distance_type;
|
||||
|
||||
inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel)
|
||||
: point_relation(pr)
|
||||
, comparable_max(
|
||||
relation<MaxRelation>::value(max_rel) *
|
||||
relation<MaxRelation>::value(max_rel) )
|
||||
{}
|
||||
|
||||
PointRelation point_relation;
|
||||
distance_type comparable_max;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation>
|
||||
struct bounded
|
||||
: nonassignable
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, point_type>::type distance_type;
|
||||
|
||||
inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel)
|
||||
: point_relation(pr)
|
||||
, comparable_min(
|
||||
relation<MinRelation>::value(min_rel) *
|
||||
relation<MinRelation>::value(min_rel) )
|
||||
, comparable_max(
|
||||
relation<MaxRelation>::value(max_rel) *
|
||||
relation<MaxRelation>::value(max_rel) )
|
||||
{}
|
||||
|
||||
PointRelation point_relation;
|
||||
distance_type comparable_min;
|
||||
distance_type comparable_max;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// distance predicates generators
|
||||
|
||||
/*!
|
||||
@@ -356,487 +195,6 @@ bounded(PointRelation const& pr, MinRelation const& minr, MaxRelation const& max
|
||||
return detail::bounded<PointRelation, MinRelation, MaxRelation>(pr, minr, maxr);
|
||||
}
|
||||
|
||||
// algorithms
|
||||
|
||||
namespace detail{
|
||||
|
||||
// point_relation
|
||||
|
||||
template <typename PointRelation>
|
||||
struct point_relation
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
template <typename PointRelation>
|
||||
struct point_relation< detail::unbounded<PointRelation> >
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation>
|
||||
struct point_relation< detail::min_bounded<PointRelation, MinRelation> >
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation>
|
||||
struct point_relation< detail::max_bounded<PointRelation, MaxRelation> >
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation>
|
||||
struct point_relation< detail::bounded<PointRelation, MinRelation, MaxRelation> >
|
||||
{
|
||||
typedef PointRelation type;
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// cdist
|
||||
|
||||
template <typename T, typename Tag>
|
||||
struct cdist
|
||||
{
|
||||
T value;
|
||||
};
|
||||
|
||||
// cdist_merge
|
||||
|
||||
template <typename CDistTuple, typename CDist>
|
||||
struct cdist_merge
|
||||
{
|
||||
typedef typename index::tuples::add_unique<
|
||||
CDistTuple,
|
||||
CDist
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <typename T, typename Tag, typename OtherTag>
|
||||
struct cdist_merge<
|
||||
cdist<T, Tag>,
|
||||
cdist<T, OtherTag> >
|
||||
{
|
||||
typedef boost::tuple<
|
||||
cdist<T, Tag>,
|
||||
cdist<T, OtherTag>
|
||||
> type;
|
||||
};
|
||||
|
||||
template <typename T, typename Tag>
|
||||
struct cdist_merge<
|
||||
cdist<T, Tag>,
|
||||
cdist<T, Tag> >
|
||||
{
|
||||
typedef cdist<T, Tag> type;
|
||||
};
|
||||
|
||||
// cdist_value_type
|
||||
|
||||
template <typename CDistTuple>
|
||||
struct cdist_value
|
||||
{
|
||||
typedef typename cdist_value<
|
||||
typename boost::tuples::element<0, CDistTuple>::type
|
||||
>::type type;
|
||||
|
||||
template <typename Tag>
|
||||
static inline type & get(CDistTuple & cdtup)
|
||||
{
|
||||
return boost::get<
|
||||
index::tuples::find_index<
|
||||
CDistTuple,
|
||||
cdist<type, Tag>
|
||||
>::value
|
||||
>(cdtup).value;
|
||||
}
|
||||
|
||||
template <typename Tag>
|
||||
static inline type const& get(CDistTuple const& cdtup)
|
||||
{
|
||||
return boost::get<
|
||||
index::tuples::find_index<
|
||||
CDistTuple,
|
||||
cdist<type, Tag>
|
||||
>::value
|
||||
>(cdtup).value;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename Tag>
|
||||
struct cdist_value<
|
||||
cdist<T, Tag>
|
||||
>
|
||||
{
|
||||
typedef T type;
|
||||
|
||||
template <typename Tag2>
|
||||
static inline type & get(cdist<T, Tag> & cd)
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(tuples::equal< cdist<T, Tag2>, cdist<T, Tag> >::value),
|
||||
TAGS_DO_NOT_MATCH,
|
||||
(cdist_value));
|
||||
|
||||
return cd.value;
|
||||
}
|
||||
|
||||
template <typename Tag2>
|
||||
static inline type const& get(cdist<T, Tag> const& cd)
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(tuples::equal< cdist<T, Tag2>, cdist<T, Tag> >::value),
|
||||
TAGS_DO_NOT_MATCH,
|
||||
(cdist_value));
|
||||
|
||||
return cd.value;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
namespace detail {
|
||||
|
||||
// distances_calc_impl_rel
|
||||
|
||||
template <typename RelDist>
|
||||
struct distances_calc_impl_rel
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(false),
|
||||
NOT_IMPLEMENTED_FOR_THIS_RELATION,
|
||||
(distances_calc_impl_rel));
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct distances_calc_impl_rel<
|
||||
cdist<T, detail::to_nearest_tag>
|
||||
>
|
||||
{
|
||||
template <typename Point, typename Indexable>
|
||||
typename geometry::default_distance_result<Point, Indexable>::type
|
||||
static inline apply(Point const& p, Indexable const& i)
|
||||
{
|
||||
return index::comparable_distance_near(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct distances_calc_impl_rel<
|
||||
cdist<T, detail::to_centroid_tag>
|
||||
>
|
||||
{
|
||||
template <typename Point, typename Indexable>
|
||||
typename geometry::default_distance_result<Point, Indexable>::type
|
||||
static inline apply(Point const& p, Indexable const& i)
|
||||
{
|
||||
return index::comparable_distance_centroid(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct distances_calc_impl_rel<
|
||||
cdist<T, detail::to_furthest_tag>
|
||||
>
|
||||
{
|
||||
template <typename Point, typename Indexable>
|
||||
typename geometry::default_distance_result<Point, Indexable>::type
|
||||
static inline apply(Point const& p, Indexable const& i)
|
||||
{
|
||||
return index::comparable_distance_far(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
// distances_calc_impl_tuple
|
||||
|
||||
template <typename Distances, typename Point, typename Indexable, size_t N>
|
||||
struct distances_calc_impl_tuple
|
||||
{
|
||||
// TODO MPL ASSERT 0 < N
|
||||
static inline void apply(Distances & d, Point const& p, Indexable const&i)
|
||||
{
|
||||
boost::get<N - 1>(d).value =
|
||||
distances_calc_impl_rel<
|
||||
typename boost::tuples::element<N - 1, Distances>::type
|
||||
>::apply(p, i);
|
||||
|
||||
distances_calc_impl_tuple<
|
||||
Distances,
|
||||
Point,
|
||||
Indexable,
|
||||
N - 1
|
||||
>::apply(d, p, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Distances, typename Point, typename Indexable>
|
||||
struct distances_calc_impl_tuple<Distances, Point, Indexable, 1>
|
||||
{
|
||||
static inline void apply(Distances & d, Point const& p, Indexable const&i)
|
||||
{
|
||||
boost::get<0>(d).value =
|
||||
distances_calc_impl_rel<
|
||||
typename boost::tuples::element<0, Distances>::type
|
||||
>::apply(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
// distances_calc_impl
|
||||
|
||||
template <typename Distances, typename Point, typename Indexable>
|
||||
struct distances_calc_impl
|
||||
{
|
||||
static inline void apply(Distances & d, Point const& p, Indexable const&i)
|
||||
{
|
||||
distances_calc_impl_tuple<
|
||||
Distances,
|
||||
Point,
|
||||
Indexable,
|
||||
boost::tuples::length<Distances>::value
|
||||
>::apply(d, p, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename Tag, typename Point, typename Indexable>
|
||||
struct distances_calc_impl<
|
||||
cdist<T, Tag>,
|
||||
Point,
|
||||
Indexable
|
||||
>
|
||||
{
|
||||
static inline void apply(cdist<T, Tag> & d, Point const& p, Indexable const&i)
|
||||
{
|
||||
d.value = distances_calc_impl_rel<
|
||||
cdist<T, Tag>
|
||||
>::apply(p, i);
|
||||
}
|
||||
};
|
||||
|
||||
// distances_calc
|
||||
|
||||
template <typename PointRelation, typename Indexable, typename Tag>
|
||||
struct distances_calc
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
|
||||
typedef detail::cdist<distance_type, point_relation_tag> result_type;
|
||||
|
||||
static inline result_type apply(PointRelation const& p, Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(p), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename Indexable, typename Tag>
|
||||
struct distances_calc<
|
||||
detail::unbounded<PointRelation>,
|
||||
Indexable,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
|
||||
typedef detail::cdist<distance_type, point_relation_tag> result_type;
|
||||
|
||||
static inline result_type apply(detail::unbounded<PointRelation> const& pp, Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename Indexable, typename Tag>
|
||||
struct distances_calc<
|
||||
detail::min_bounded<PointRelation, MinRelation>,
|
||||
Indexable,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
typedef typename detail::relation<MinRelation>::tag min_relation_tag;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
cdist<distance_type, point_relation_tag>,
|
||||
cdist<distance_type, min_relation_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(detail::min_bounded<PointRelation, MinRelation> const& pp, Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation, typename Indexable, typename Tag>
|
||||
struct distances_calc<
|
||||
detail::max_bounded<PointRelation, MaxRelation>,
|
||||
Indexable,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
cdist<distance_type, point_relation_tag>,
|
||||
cdist<distance_type, max_relation_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(detail::max_bounded<PointRelation, MaxRelation> const& pp, Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Indexable, typename Tag>
|
||||
struct distances_calc<
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation>,
|
||||
Indexable,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename detail::relation<PointRelation>::tag point_relation_tag;
|
||||
typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
|
||||
typedef typename detail::relation<MinRelation>::tag min_relation_tag;
|
||||
typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
typename detail::cdist_merge<
|
||||
cdist<distance_type, point_relation_tag>,
|
||||
cdist<distance_type, min_relation_tag>
|
||||
>::type,
|
||||
cdist<distance_type, max_relation_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation> const& pp,
|
||||
Indexable const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Indexable>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
// distances_predicates_check
|
||||
|
||||
// TODO explicitly define Distances type ?
|
||||
// TODO move distance_calc and distance_comp into geometry::index ?
|
||||
|
||||
template <typename PointRelation, typename Indexable, typename Tag>
|
||||
struct distances_predicates_check
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(PointRelation const&, Distances const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename Indexable, typename Tag>
|
||||
struct distances_predicates_check<
|
||||
detail::unbounded<PointRelation>,
|
||||
Indexable,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(detail::unbounded<PointRelation> const&, Distances const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename Indexable, typename Tag>
|
||||
struct distances_predicates_check<
|
||||
detail::min_bounded<PointRelation, MinRelation>,
|
||||
Indexable,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<MinRelation>::tag min_relation_tag;
|
||||
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::min_bounded<PointRelation, MinRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_min <=
|
||||
detail::cdist_value<Distances>::template get<min_relation_tag>(d);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation, typename Indexable, typename Tag>
|
||||
struct distances_predicates_check<
|
||||
detail::max_bounded<PointRelation, MaxRelation>,
|
||||
Indexable,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
|
||||
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::max_bounded<PointRelation, MaxRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_max <=
|
||||
detail::cdist_value<Distances>::template get<max_relation_tag>(d);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Indexable, typename Tag>
|
||||
struct distances_predicates_check<
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation>,
|
||||
Indexable,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<MinRelation>::tag min_relation_tag;
|
||||
typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
|
||||
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_min
|
||||
<= detail::cdist_value<Distances>::template get<min_relation_tag>(d)
|
||||
&& detail::cdist_value<Distances>::template get<max_relation_tag>(d)
|
||||
<= pred.comparable_max;
|
||||
}
|
||||
};
|
||||
|
||||
// TODO calculate all of this for Boxes only!
|
||||
// for Points calculate only 1 distance allways
|
||||
|
||||
} // namespace detail
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Geometry Index
|
||||
//
|
||||
// R-tree options, algorithms, parameters
|
||||
// R-tree algorithms parameters
|
||||
//
|
||||
// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
|
||||
//
|
||||
@@ -8,8 +8,8 @@
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_PARAMETERS_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_PARAMETERS_HPP
|
||||
|
||||
#include <limits>
|
||||
|
||||
@@ -201,143 +201,8 @@ private:
|
||||
size_t m_reinserted_elements;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace detail { namespace rtree {
|
||||
|
||||
// InsertTag
|
||||
struct insert_default_tag {};
|
||||
struct insert_reinsert_tag {};
|
||||
|
||||
// ChooseNextNodeTag
|
||||
struct choose_by_content_diff_tag {};
|
||||
struct choose_by_overlap_diff_tag {};
|
||||
|
||||
// SplitTag
|
||||
struct split_default_tag {};
|
||||
//struct split_kmeans_tag {};
|
||||
|
||||
// RedistributeTag
|
||||
struct linear_tag {};
|
||||
struct quadratic_tag {};
|
||||
struct rstar_tag {};
|
||||
|
||||
// NodeTag
|
||||
struct node_d_mem_dynamic_tag {};
|
||||
struct node_d_mem_static_tag {};
|
||||
struct node_s_mem_dynamic_tag {};
|
||||
struct node_s_mem_static_tag {};
|
||||
|
||||
template <typename Parameters, typename InsertTag, typename ChooseNextNodeTag, typename SplitTag, typename RedistributeTag, typename NodeTag>
|
||||
struct options
|
||||
{
|
||||
typedef Parameters parameters_type;
|
||||
typedef InsertTag insert_tag;
|
||||
typedef ChooseNextNodeTag choose_next_node_tag;
|
||||
typedef SplitTag split_tag;
|
||||
typedef RedistributeTag redistribute_tag;
|
||||
typedef NodeTag node_tag;
|
||||
};
|
||||
|
||||
template <typename Parameters>
|
||||
struct options_type
|
||||
{
|
||||
// TODO: awulkiew - use static assert
|
||||
};
|
||||
|
||||
template <size_t MaxElements, size_t MinElements>
|
||||
struct options_type< linear<MaxElements, MinElements> >
|
||||
{
|
||||
typedef options<
|
||||
linear<MaxElements, MinElements>,
|
||||
insert_default_tag,
|
||||
choose_by_content_diff_tag,
|
||||
split_default_tag,
|
||||
linear_tag,
|
||||
node_d_mem_static_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
template <size_t MaxElements, size_t MinElements>
|
||||
struct options_type< quadratic<MaxElements, MinElements> >
|
||||
{
|
||||
typedef options<
|
||||
quadratic<MaxElements, MinElements>,
|
||||
insert_default_tag,
|
||||
choose_by_content_diff_tag,
|
||||
split_default_tag,
|
||||
quadratic_tag,
|
||||
node_d_mem_static_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
template <size_t MaxElements, size_t MinElements, size_t OverlapCostThreshold, size_t ReinsertedElements>
|
||||
struct options_type< rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements> >
|
||||
{
|
||||
typedef options<
|
||||
rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements>,
|
||||
insert_reinsert_tag,
|
||||
choose_by_overlap_diff_tag,
|
||||
split_default_tag,
|
||||
rstar_tag,
|
||||
node_d_mem_static_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
//template <size_t MaxElements, size_t MinElements>
|
||||
//struct options_type< kmeans<MaxElements, MinElements> >
|
||||
//{
|
||||
// typedef options<
|
||||
// kmeans<MaxElements, MinElements>,
|
||||
// insert_default_tag,
|
||||
// choose_by_content_diff_tag, // change it?
|
||||
// split_kmeans_tag,
|
||||
// int, // dummy tag - not used for now
|
||||
// node_d_mem_static_tag
|
||||
// > type;
|
||||
//};
|
||||
|
||||
template <>
|
||||
struct options_type< runtime::linear >
|
||||
{
|
||||
typedef options<
|
||||
runtime::linear,
|
||||
insert_default_tag,
|
||||
choose_by_content_diff_tag,
|
||||
split_default_tag,
|
||||
linear_tag,
|
||||
node_d_mem_dynamic_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct options_type< runtime::quadratic >
|
||||
{
|
||||
typedef options<
|
||||
runtime::quadratic,
|
||||
insert_default_tag,
|
||||
choose_by_content_diff_tag,
|
||||
split_default_tag,
|
||||
quadratic_tag,
|
||||
node_d_mem_dynamic_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct options_type< runtime::rstar >
|
||||
{
|
||||
typedef options<
|
||||
runtime::rstar,
|
||||
insert_reinsert_tag,
|
||||
choose_by_overlap_diff_tag,
|
||||
split_default_tag,
|
||||
rstar_tag,
|
||||
node_d_mem_dynamic_tag
|
||||
> type;
|
||||
};
|
||||
|
||||
}} // namespace detail::rtree
|
||||
} // namespace runtime
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PARAMETERS_HPP
|
||||
@@ -18,113 +18,14 @@
|
||||
// TODO: awulkiew - temporary
|
||||
#include <boost/geometry/algorithms/covered_by.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/detail/predicates.hpp>
|
||||
|
||||
/*!
|
||||
\defgroup predicates Spatial predicates (boost::geometry::index::)
|
||||
*/
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
namespace detail {
|
||||
|
||||
// predicates
|
||||
|
||||
struct empty {};
|
||||
|
||||
template <typename ValuePredicate>
|
||||
struct value
|
||||
{
|
||||
value(ValuePredicate const& vpred) : value_predicate(vpred) {}
|
||||
ValuePredicate value_predicate;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct covered_by
|
||||
{
|
||||
covered_by(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct disjoint
|
||||
{
|
||||
disjoint(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct intersects
|
||||
{
|
||||
intersects(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct overlaps
|
||||
{
|
||||
overlaps(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct touches
|
||||
//{
|
||||
// touches(Geometry const& g) : geometry(g) {}
|
||||
// Geometry geometry;
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct within
|
||||
{
|
||||
within(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_covered_by
|
||||
{
|
||||
not_covered_by(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_disjoint
|
||||
{
|
||||
not_disjoint(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_intersects
|
||||
{
|
||||
not_intersects(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_overlaps
|
||||
{
|
||||
not_overlaps(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct not_touches
|
||||
//{
|
||||
// not_touches(Geometry const& g) : geometry(g) {}
|
||||
// Geometry geometry;
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct not_within
|
||||
{
|
||||
not_within(Geometry const& g) : geometry(g) {}
|
||||
Geometry geometry;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// generators
|
||||
|
||||
/*!
|
||||
\brief Generate empty predicate.
|
||||
|
||||
@@ -267,246 +168,6 @@ inline detail::within<Geometry> within(Geometry const& g)
|
||||
return detail::within<Geometry>(g);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// predicate check
|
||||
|
||||
// TODO: awulkiew - consider passing Value/Node and Translator instead of
|
||||
// Value and Indexable
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, g);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tag>
|
||||
struct predicate_check<empty, Tag>
|
||||
{
|
||||
template <typename Geometry, typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const&, Value const&, Indexable const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ValuePredicate, typename Tag>
|
||||
struct predicate_check<value<ValuePredicate>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(value<ValuePredicate> const& p, Value const& v, Indexable const&)
|
||||
{
|
||||
return p.value_predicate(v);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<covered_by<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(covered_by<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<disjoint<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(disjoint<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::disjoint(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<intersects<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(intersects<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<overlaps<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(overlaps<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::overlaps(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
//template <typename Geometry, typename Tag>
|
||||
//struct predicate_check<touches<Geometry>, Tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(touches<Geometry> const& p, Value const&, Indexable const& i)
|
||||
// {
|
||||
// return geometry::touches(i, p.geometry);
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<within<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(within<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::within(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<not_covered_by<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_covered_by<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<not_disjoint<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_disjoint<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::disjoint(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<not_intersects<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_intersects<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<not_overlaps<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_overlaps<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::overlaps(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
//template <typename Geometry, typename Tag>
|
||||
//struct predicate_check<not_touches<Geometry>, Tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(not_touches<Geometry> const& p, Value const&, Indexable const& i)
|
||||
// {
|
||||
// return !geometry::touches(i, p.geometry);
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
struct predicate_check<not_within<Geometry>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_within<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return !geometry::within(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
// predicates check
|
||||
|
||||
template <typename TuplePredicates, typename Tag, unsigned int N>
|
||||
struct predicates_check_tuple
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicates_check_tuple<TuplePredicates, Tag, N - 1>::apply(p, v, i)
|
||||
&& predicate_check<
|
||||
typename boost::tuples::element<N - 1, TuplePredicates>::type,
|
||||
Tag
|
||||
>::apply(boost::get<N - 1>(p), v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename TuplePredicates, typename Tag>
|
||||
struct predicates_check_tuple<TuplePredicates, Tag, 1>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<
|
||||
typename boost::tuples::element<0, TuplePredicates>::type,
|
||||
Tag
|
||||
>::apply(boost::get<0>(p), v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Predicate, typename Tag>
|
||||
struct predicates_check_impl
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(Predicate const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<Predicate, Tag>::apply(p, v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Predicate1, typename Predicate2, typename Tag>
|
||||
struct predicates_check_impl<std::pair<Predicate1, Predicate2>, Tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(std::pair<Predicate1, Predicate2> const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<Predicate1, Tag>::apply(p.first, v, i)
|
||||
&& predicate_check<Predicate2, Tag>::apply(p.second, v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8, typename T9,
|
||||
typename Tag
|
||||
>
|
||||
struct predicates_check_impl<
|
||||
boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
|
||||
Tag
|
||||
>
|
||||
{
|
||||
typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> predicates_type;
|
||||
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicates_check_tuple<
|
||||
predicates_type,
|
||||
Tag,
|
||||
boost::tuples::length<predicates_type>::value
|
||||
>::apply(p, v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tag, typename Predicates, typename Value, typename Indexable>
|
||||
inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return detail::predicates_check_impl<Predicates, Tag>
|
||||
::apply(p, v, i);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
|
||||
// operator! generators
|
||||
|
||||
@@ -19,31 +19,32 @@
|
||||
|
||||
#include <boost/geometry/geometry.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/assert.hpp>
|
||||
#include <boost/geometry/extensions/index/nonassignable.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/assert.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/nonassignable.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/translator/translator.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/options.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/options.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/predicates.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/adaptors.hpp>
|
||||
#include <boost/geometry/extensions/index/distance_predicates.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/adaptors.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/node.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/node.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/algorithms/is_valid.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/remove.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/copy.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/destroy.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/count.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/remove.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/nearest_query.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/count.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/linear/linear.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/rstar/rstar.hpp>
|
||||
//#include <boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/linear/linear.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp>
|
||||
//#include <boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/inserter.hpp>
|
||||
|
||||
@@ -1,218 +0,0 @@
|
||||
// Boost.Geometry Index
|
||||
//
|
||||
// Spatial index distance predicates, calculators and checkers
|
||||
// used in nearest query - specialized for nodes
|
||||
//
|
||||
// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
|
||||
//
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/distance_predicates.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/tags.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
namespace detail {
|
||||
|
||||
// distance_calc
|
||||
|
||||
template <typename PointRelation, typename Box>
|
||||
struct distances_calc<
|
||||
PointRelation,
|
||||
Box,
|
||||
rtree::node_tag>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef detail::cdist<distance_type, detail::to_nearest_tag> result_type;
|
||||
|
||||
static inline result_type apply(PointRelation const& p, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(p), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename Box>
|
||||
struct distances_calc<
|
||||
detail::unbounded<PointRelation>,
|
||||
Box,
|
||||
rtree::node_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef detail::cdist<distance_type, detail::to_nearest_tag> result_type;
|
||||
|
||||
static inline result_type apply(detail::unbounded<PointRelation> const& pp, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename Box>
|
||||
struct distances_calc<
|
||||
detail::min_bounded<PointRelation, MinRelation>,
|
||||
Box,
|
||||
rtree::node_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
cdist<distance_type, detail::to_nearest_tag>,
|
||||
cdist<distance_type, detail::to_furthest_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(detail::min_bounded<PointRelation, MinRelation> const& pp, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation, typename Box>
|
||||
struct distances_calc<
|
||||
detail::max_bounded<PointRelation, MaxRelation>,
|
||||
Box,
|
||||
rtree::node_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef cdist<distance_type, detail::to_nearest_tag> result_type;
|
||||
|
||||
static inline result_type apply(detail::max_bounded<PointRelation, MaxRelation> const& pp, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Box>
|
||||
struct distances_calc<
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation>,
|
||||
Box,
|
||||
rtree::node_tag
|
||||
>
|
||||
{
|
||||
typedef typename detail::relation<PointRelation>::value_type point_type;
|
||||
typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
|
||||
|
||||
typedef typename detail::cdist_merge<
|
||||
cdist<distance_type, detail::to_nearest_tag>,
|
||||
cdist<distance_type, detail::to_furthest_tag>
|
||||
>::type result_type;
|
||||
|
||||
static inline result_type apply(detail::bounded<PointRelation, MinRelation, MaxRelation> const& pp, Box const& i)
|
||||
{
|
||||
result_type res;
|
||||
distances_calc_impl<result_type, point_type, Box>
|
||||
::apply(res, relation<PointRelation>::value(pp.point_relation), i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
// distance_predicate_check
|
||||
|
||||
template <typename PointRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
PointRelation,
|
||||
Box,
|
||||
rtree::node_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(PointRelation const&, Distances const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
detail::unbounded<PointRelation>,
|
||||
Box,
|
||||
rtree::node_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::unbounded<PointRelation> const&,
|
||||
Distances const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
detail::min_bounded<PointRelation, MinRelation>,
|
||||
Box,
|
||||
rtree::node_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::min_bounded<PointRelation, MinRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_min
|
||||
<= cdist_value<Distances>::template get<detail::to_furthest_tag>(d);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MaxRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
detail::max_bounded<PointRelation, MaxRelation>,
|
||||
Box,
|
||||
rtree::node_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::max_bounded<PointRelation, MaxRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return cdist_value<Distances>::template get<detail::to_nearest_tag>(d)
|
||||
<= pred.comparable_max;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Box>
|
||||
struct distances_predicates_check<
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation>,
|
||||
Box,
|
||||
rtree::node_tag>
|
||||
{
|
||||
template <typename Distances>
|
||||
static inline bool apply(
|
||||
detail::bounded<PointRelation, MinRelation, MaxRelation> const& pred,
|
||||
Distances const& d)
|
||||
{
|
||||
return pred.comparable_min
|
||||
<= cdist_value<Distances>::template get<detail::to_furthest_tag>(d)
|
||||
&& cdist_value<Distances>::template get<detail::to_nearest_tag>(d)
|
||||
<= pred.comparable_max;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP
|
||||
@@ -1,182 +0,0 @@
|
||||
// Boost.Geometry Index
|
||||
//
|
||||
// Spatial query predicates checks specialized for nodes
|
||||
//
|
||||
// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.
|
||||
//
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP
|
||||
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP
|
||||
|
||||
#include <boost/geometry/extensions/index/predicates.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/tags.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
namespace detail {
|
||||
|
||||
// TODO: awulkiew - consider removing Value from parameters
|
||||
// then predicates_check must be implemented for nodes as well
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<Geometry, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, g);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct predicate_check<empty, rtree::node_tag>
|
||||
{
|
||||
template <typename Geometry, typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const&, Value const&, Indexable const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ValuePredicate>
|
||||
struct predicate_check<value<ValuePredicate>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(value<ValuePredicate> const&, Value const&, Box const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<covered_by<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(covered_by<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<disjoint<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(disjoint<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<intersects<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(intersects<Geometry> const& p, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<overlaps<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static inline bool apply(overlaps<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
// TODO: awulkiew - possibly change to the version without border case
|
||||
// e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct predicate_check<touches<Geometry>, rtree::node_tag>
|
||||
//{
|
||||
// template <typename Value, typename Box>
|
||||
// static bool apply(touches<Geometry> const& p, Value const&, Box const& i)
|
||||
// {
|
||||
// return geometry::intersects(i, p.geometry);
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<within<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(within<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
// TODO: awulkiew - possibly change to the version without border case
|
||||
// e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false
|
||||
return geometry::intersects(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_covered_by<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_covered_by<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_disjoint<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_disjoint<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::disjoint(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_intersects<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_intersects<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::covered_by(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_overlaps<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_overlaps<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//template <typename Geometry>
|
||||
//struct predicate_check<not_touches<Geometry>, rtree::node_tag>
|
||||
//{
|
||||
// template <typename Value, typename Box>
|
||||
// static bool apply(not_touches<Geometry> const& p, Value const&, Box const& i)
|
||||
// {
|
||||
// return !geometry::intersects(i, p.geometry);
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<not_within<Geometry>, rtree::node_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_within<Geometry> const& p, Value const&, Box const& i)
|
||||
{
|
||||
return !geometry::within(i, p.geometry);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
}}} // namespace boost::geometry::index
|
||||
|
||||
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <boost/geometry.hpp>
|
||||
#define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE
|
||||
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree.hpp>
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
|
||||
@@ -104,61 +104,61 @@ void test_rtree_elements_exceptions(Parameters const& parameters = Parameters())
|
||||
|
||||
for ( size_t i = 0 ; i < 100 ; i += 2 )
|
||||
{
|
||||
throwing_pushable_array_settings::reset_calls_counter();
|
||||
throwing_pushable_array_settings::set_max_calls(10000);
|
||||
throwing_static_vector_settings::reset_calls_counter();
|
||||
throwing_static_vector_settings::set_max_calls(10000);
|
||||
|
||||
Tree tree(parameters);
|
||||
|
||||
throwing_pushable_array_settings::reset_calls_counter();
|
||||
throwing_pushable_array_settings::set_max_calls(i);
|
||||
throwing_static_vector_settings::reset_calls_counter();
|
||||
throwing_static_vector_settings::set_max_calls(i);
|
||||
|
||||
BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_pushable_array_exception );
|
||||
BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_static_vector_exception );
|
||||
}
|
||||
|
||||
for ( size_t i = 0 ; i < 50 ; i += 2 )
|
||||
{
|
||||
throwing_pushable_array_settings::reset_calls_counter();
|
||||
throwing_pushable_array_settings::set_max_calls(10000);
|
||||
throwing_static_vector_settings::reset_calls_counter();
|
||||
throwing_static_vector_settings::set_max_calls(10000);
|
||||
|
||||
Tree tree(parameters);
|
||||
|
||||
tree.insert(input.begin(), input.end());
|
||||
|
||||
throwing_pushable_array_settings::reset_calls_counter();
|
||||
throwing_pushable_array_settings::set_max_calls(i);
|
||||
throwing_static_vector_settings::reset_calls_counter();
|
||||
throwing_static_vector_settings::set_max_calls(i);
|
||||
|
||||
BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_pushable_array_exception );
|
||||
BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_static_vector_exception );
|
||||
}
|
||||
|
||||
for ( size_t i = 0 ; i < 50 ; i += 2 )
|
||||
{
|
||||
throwing_pushable_array_settings::reset_calls_counter();
|
||||
throwing_pushable_array_settings::set_max_calls(10000);
|
||||
throwing_static_vector_settings::reset_calls_counter();
|
||||
throwing_static_vector_settings::set_max_calls(10000);
|
||||
|
||||
Tree tree(parameters);
|
||||
|
||||
tree.insert(input.begin(), input.end());
|
||||
|
||||
throwing_pushable_array_settings::reset_calls_counter();
|
||||
throwing_pushable_array_settings::set_max_calls(i);
|
||||
throwing_static_vector_settings::reset_calls_counter();
|
||||
throwing_static_vector_settings::set_max_calls(i);
|
||||
|
||||
BOOST_CHECK_THROW( Tree tree2(tree), throwing_pushable_array_exception );
|
||||
BOOST_CHECK_THROW( Tree tree2(tree), throwing_static_vector_exception );
|
||||
}
|
||||
|
||||
for ( size_t i = 0 ; i < 50 ; i += 2 )
|
||||
{
|
||||
throwing_pushable_array_settings::reset_calls_counter();
|
||||
throwing_pushable_array_settings::set_max_calls(10000);
|
||||
throwing_static_vector_settings::reset_calls_counter();
|
||||
throwing_static_vector_settings::set_max_calls(10000);
|
||||
|
||||
Tree tree(parameters);
|
||||
Tree tree2(parameters);
|
||||
|
||||
tree.insert(input.begin(), input.end());
|
||||
|
||||
throwing_pushable_array_settings::reset_calls_counter();
|
||||
throwing_pushable_array_settings::set_max_calls(i);
|
||||
throwing_static_vector_settings::reset_calls_counter();
|
||||
throwing_static_vector_settings::set_max_calls(i);
|
||||
|
||||
BOOST_CHECK_THROW(tree2 = tree, throwing_pushable_array_exception );
|
||||
BOOST_CHECK_THROW(tree2 = tree, throwing_static_vector_exception );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp>
|
||||
#include <boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/are_levels_ok.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp>
|
||||
|
||||
//#include <boost/geometry/geometries/ring.hpp>
|
||||
//#include <boost/geometry/geometries/polygon.hpp>
|
||||
@@ -549,9 +547,9 @@ void test_exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Ran
|
||||
template <typename Rtree, typename Value, typename Predicates>
|
||||
void test_spatial_query(Rtree & rtree, Predicates const& pred, std::vector<Value> const& expected_output)
|
||||
{
|
||||
BOOST_CHECK( bgi::detail::are_levels_ok(rtree) );
|
||||
BOOST_CHECK( bgi::detail::rtree::are_levels_ok(rtree) );
|
||||
if ( !rtree.empty() )
|
||||
BOOST_CHECK( bgi::detail::are_boxes_ok(rtree) );
|
||||
BOOST_CHECK( bgi::detail::rtree::are_boxes_ok(rtree) );
|
||||
|
||||
std::vector<Value> output;
|
||||
size_t n = rtree.spatial_query(pred, std::back_inserter(output));
|
||||
|
||||
@@ -14,16 +14,12 @@
|
||||
|
||||
#include <rtree/test_rtree.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/rtree/node/dynamic_visitor.hpp>
|
||||
|
||||
#include <rtree/test_throwing.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace index {
|
||||
|
||||
// options implementation (from options.hpp)
|
||||
|
||||
struct node_throwing_d_mem_static_tag {};
|
||||
|
||||
template <size_t MaxElements, size_t MinElements>
|
||||
struct linear_throwing : public linear<MaxElements, MinElements> {};
|
||||
|
||||
@@ -35,6 +31,10 @@ struct rstar_throwing : public rstar<MaxElements, MinElements, OverlapCostThresh
|
||||
|
||||
namespace detail { namespace rtree {
|
||||
|
||||
// options implementation (from options.hpp)
|
||||
|
||||
struct node_throwing_d_mem_static_tag {};
|
||||
|
||||
template <size_t MaxElements, size_t MinElements>
|
||||
struct options_type< linear_throwing<MaxElements, MinElements> >
|
||||
{
|
||||
@@ -109,7 +109,7 @@ struct dynamic_leaf<Value, Parameters, Box, Allocators, node_throwing_d_mem_stat
|
||||
|
||||
// elements derived type
|
||||
template <typename OldValue, size_t N, typename NewValue>
|
||||
struct container_from_elements_type<throwing_pushable_array<OldValue, N>, NewValue>
|
||||
struct container_from_elements_type<throwing_static_vector<OldValue, N>, NewValue>
|
||||
{
|
||||
typedef throwing_static_vector<NewValue, N> type;
|
||||
};
|
||||
|
||||
@@ -141,185 +141,7 @@ struct generate_value< std::pair<bg::model::point<T, 2, C>, throwing_value> >
|
||||
//
|
||||
//}}} // namespace boost::geometry::index
|
||||
|
||||
#include <boost/geometry/extensions/index/pushable_array.hpp>
|
||||
|
||||
struct throwing_pushable_array_exception : public std::exception
|
||||
{
|
||||
const char * what() const throw() { return "pushable array exception."; }
|
||||
};
|
||||
|
||||
struct throwing_pushable_array_settings
|
||||
{
|
||||
static void throw_if_required()
|
||||
{
|
||||
// throw if counter meets max count
|
||||
if ( get_max_calls_ref() <= get_calls_counter_ref() )
|
||||
throw throwing_pushable_array_exception();
|
||||
else
|
||||
++get_calls_counter_ref();
|
||||
}
|
||||
|
||||
static void reset_calls_counter() { get_calls_counter_ref() = 0; }
|
||||
static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; }
|
||||
|
||||
static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; }
|
||||
static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits<size_t>::max)(); return mc; }
|
||||
};
|
||||
|
||||
template <typename Element, size_t Capacity>
|
||||
class throwing_pushable_array
|
||||
{
|
||||
typedef typename boost::array<Element, Capacity> array_type;
|
||||
|
||||
public:
|
||||
typedef typename array_type::value_type value_type;
|
||||
typedef typename array_type::size_type size_type;
|
||||
typedef typename array_type::iterator iterator;
|
||||
typedef typename array_type::const_iterator const_iterator;
|
||||
typedef typename array_type::reverse_iterator reverse_iterator;
|
||||
typedef typename array_type::const_reverse_iterator const_reverse_iterator;
|
||||
typedef typename array_type::reference reference;
|
||||
typedef typename array_type::const_reference const_reference;
|
||||
|
||||
inline throwing_pushable_array()
|
||||
: m_size(0)
|
||||
{}
|
||||
|
||||
//inline explicit throwing_pushable_array(size_type s)
|
||||
// : m_size(s)
|
||||
//{
|
||||
// BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big");
|
||||
//}
|
||||
|
||||
inline void resize(size_type s)
|
||||
{
|
||||
BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big");
|
||||
throwing_pushable_array_settings::throw_if_required();
|
||||
m_size = s;
|
||||
}
|
||||
|
||||
inline void reserve(size_type /*s*/)
|
||||
{
|
||||
//BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big");
|
||||
// do nothing
|
||||
}
|
||||
|
||||
inline Element & operator[](size_type i)
|
||||
{
|
||||
BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container");
|
||||
return m_array[i];
|
||||
}
|
||||
|
||||
inline Element const& operator[](size_type i) const
|
||||
{
|
||||
BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container");
|
||||
return m_array[i];
|
||||
}
|
||||
|
||||
inline Element const& front() const
|
||||
{
|
||||
BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
|
||||
return m_array.front();
|
||||
}
|
||||
|
||||
inline Element & front()
|
||||
{
|
||||
BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
|
||||
return m_array.front();
|
||||
}
|
||||
|
||||
inline Element const& back() const
|
||||
{
|
||||
BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
|
||||
return *(begin() + (m_size - 1));
|
||||
}
|
||||
|
||||
inline Element & back()
|
||||
{
|
||||
BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
|
||||
return *(begin() + (m_size - 1));
|
||||
}
|
||||
|
||||
inline iterator begin()
|
||||
{
|
||||
return m_array.begin();
|
||||
}
|
||||
|
||||
inline iterator end()
|
||||
{
|
||||
return m_array.begin() + m_size;
|
||||
}
|
||||
|
||||
inline const_iterator begin() const
|
||||
{
|
||||
return m_array.begin();
|
||||
}
|
||||
|
||||
inline const_iterator end() const
|
||||
{
|
||||
return m_array.begin() + m_size;
|
||||
}
|
||||
|
||||
inline reverse_iterator rbegin()
|
||||
{
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
inline reverse_iterator rend()
|
||||
{
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
inline const_reverse_iterator rbegin() const
|
||||
{
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
inline const_reverse_iterator rend() const
|
||||
{
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
inline void clear()
|
||||
{
|
||||
m_size = 0;
|
||||
}
|
||||
|
||||
void push_back(Element const& v)
|
||||
{
|
||||
BOOST_GEOMETRY_INDEX_ASSERT(m_size < Capacity, "can't further increase the size of the container");
|
||||
throwing_pushable_array_settings::throw_if_required();
|
||||
m_array[m_size] = v;
|
||||
++m_size;
|
||||
}
|
||||
|
||||
inline void pop_back()
|
||||
{
|
||||
BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
|
||||
--m_size;
|
||||
}
|
||||
|
||||
inline bool empty() const
|
||||
{
|
||||
return m_size == 0;
|
||||
}
|
||||
|
||||
inline size_t size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
inline size_t capacity() const
|
||||
{
|
||||
return Capacity;
|
||||
}
|
||||
|
||||
private:
|
||||
boost::array<Element, Capacity> m_array;
|
||||
size_type m_size;
|
||||
};
|
||||
|
||||
#include <boost/geometry/extensions/index/static_vector.hpp>
|
||||
#include <boost/geometry/extensions/index/detail/static_vector.hpp>
|
||||
|
||||
struct throwing_static_vector_exception : public std::exception
|
||||
{
|
||||
@@ -332,7 +154,7 @@ struct throwing_static_vector_settings
|
||||
{
|
||||
// throw if counter meets max count
|
||||
if ( get_max_calls_ref() <= get_calls_counter_ref() )
|
||||
throw throwing_pushable_array_exception();
|
||||
throw throwing_static_vector_exception();
|
||||
else
|
||||
++get_calls_counter_ref();
|
||||
}
|
||||
@@ -346,9 +168,9 @@ struct throwing_static_vector_settings
|
||||
|
||||
template <typename Element, size_t Capacity>
|
||||
class throwing_static_vector
|
||||
: public boost::geometry::index::static_vector<Element, Capacity>
|
||||
: public boost::geometry::index::detail::static_vector<Element, Capacity>
|
||||
{
|
||||
typedef boost::geometry::index::static_vector<Element, Capacity> container;
|
||||
typedef boost::geometry::index::detail::static_vector<Element, Capacity> container;
|
||||
|
||||
public:
|
||||
typedef typename container::value_type value_type;
|
||||
@@ -362,13 +184,13 @@ public:
|
||||
|
||||
inline void resize(size_type s)
|
||||
{
|
||||
throwing_pushable_array_settings::throw_if_required();
|
||||
throwing_static_vector_settings::throw_if_required();
|
||||
container::resize(s);
|
||||
}
|
||||
|
||||
void push_back(Element const& v)
|
||||
{
|
||||
throwing_pushable_array_settings::throw_if_required();
|
||||
throwing_static_vector_settings::throw_if_required();
|
||||
container::push_back(v);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user