diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 7ccbd04bc..f613f5718 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -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`] and [^`boost::tuple`]. For example, if [^`std::pair`] is stored in the container, the default translator translates from [^`std::pair const&`] to [^`Box const&`]. [heading Header] -`#include ` +`#include ` [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. diff --git a/doc/generated/rtree_linear.qbk b/doc/generated/rtree_linear.qbk index 3f32de605..5e307645f 100644 --- a/doc/generated/rtree_linear.qbk +++ b/doc/generated/rtree_linear.qbk @@ -7,7 +7,7 @@ Linear r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_quadratic.qbk b/doc/generated/rtree_quadratic.qbk index b4a3233b2..82d6b2636 100644 --- a/doc/generated/rtree_quadratic.qbk +++ b/doc/generated/rtree_quadratic.qbk @@ -7,7 +7,7 @@ Quadratic r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_rstar.qbk b/doc/generated/rtree_rstar.qbk index c546da7a5..a02079630 100644 --- a/doc/generated/rtree_rstar.qbk +++ b/doc/generated/rtree_rstar.qbk @@ -7,7 +7,7 @@ R*-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_runtime_linear.qbk b/doc/generated/rtree_runtime_linear.qbk index d3dd181f0..a20dccd53 100644 --- a/doc/generated/rtree_runtime_linear.qbk +++ b/doc/generated/rtree_runtime_linear.qbk @@ -7,7 +7,7 @@ Linear r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_runtime_quadratic.qbk b/doc/generated/rtree_runtime_quadratic.qbk index 1d52f8f47..5c39105e2 100644 --- a/doc/generated/rtree_runtime_quadratic.qbk +++ b/doc/generated/rtree_runtime_quadratic.qbk @@ -7,7 +7,7 @@ Quadratic r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_runtime_rstar.qbk b/doc/generated/rtree_runtime_rstar.qbk index 1eb0d33a4..8448ac1dc 100644 --- a/doc/generated/rtree_runtime_rstar.qbk +++ b/doc/generated/rtree_runtime_rstar.qbk @@ -7,7 +7,7 @@ R*-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index 6bc83f483..1d2ce0ca6 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -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. ]] diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index c00e43835..dd5718dbb 100644 --- a/doc/html/geometry_index/introduction.html +++ b/doc/html/geometry_index/introduction.html @@ -3,7 +3,7 @@ Introduction - + diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 4d5f596cd..9c5468fb8 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + diff --git a/doc/html/geometry_index/r_tree/creation_and_modification.html b/doc/html/geometry_index/r_tree/creation_and_modification.html index 263f4d250..5d10c6375 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -3,7 +3,7 @@ Creation and modification - + @@ -55,7 +55,7 @@

rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
 
-
    +
    • Value - type of object which will be stored in the container,
    • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

      -
        +
        • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

          -
            +
            • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

              If comparison of two Values is required, the default translator:

              -
                +
                • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 28ae3b6fd..035a9287c 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

            R-tree is a tree data structure used for spatial searching. It was proposed - by Antonin Guttman in 1984 [1] as an expansion of B-tree for multi-dimensional data. It may + by Antonin Guttman in 1984 [1] 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 [2]. + close to some point in space [2].

            The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

            The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. 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 @@

          - Implementation + Implementation details

          Key features of this implementation of the R-tree are:

          -
            +
            • capable to store arbitrary Value type,
            • @@ -207,7 +207,7 @@
            - Contributors + Contributors

            The spatial index was originally started by Federico J. Fernandez during @@ -215,7 +215,7 @@

            - Spatial + Spatial thanks

            @@ -224,20 +224,20 @@ list for their help.

            -

            -

            [1] +


            +

            [1] Guttman, A. (1984). R-Trees: A Dynamic Index Structure for Spatial Searching

            -

            [2] +

            [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

            -

            [3] +

            [3] Greene, D. (1989). An implementation and performance analysis of spatial data access methods

            -

            [4] +

            [4] Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). The R*-tree: an efficient and robust access method for points and rectangles

            diff --git a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html index 18130e9d5..16a6eba21 100644 --- a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html +++ b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html @@ -3,7 +3,7 @@ Nearest neighbours queries - + diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index e0f1cc15c..ad1df612c 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -47,12 +47,12 @@ boost::geometry::index::rtree

            - + The R-tree spatial index.

            - Description + Description

            This is self-balancing spatial index capable to store various types of @@ -60,7 +60,7 @@ The R-tree spatial index.

            - Parameters + Parameters

            The user must pass a type defining the Parameters which will be used in @@ -70,7 +70,7 @@ The R-tree spatial index.

            Predefined algorithms with compile-time parameters are:

            -
              +
              • boost::geometry::index::linear,
              • @@ -84,7 +84,7 @@ The R-tree spatial index.

                Predefined algorithms with run-time parameters are:

                -
                  +
                  - Translator + Translator

                  The Translator translates from Value to Indexable each time r-tree requires @@ -114,14 +114,14 @@ The R-tree spatial index.

                  - Header + Header

                  - #include <boost/geometry/extensions/index/rtree/rtree.hpp> + #include <boost/geometry/extensions/index/rtree.hpp>

                  - Synopsis + Synopsis
                  template<typename Value,
                            typename Parameters,
                  @@ -134,7 +134,7 @@ The R-tree spatial index.
                   
                  - Template + Template parameter(s)
                  @@ -208,7 +208,7 @@ The R-tree spatial index.
                  - Typedef(s) + Typedef(s)
                  @@ -316,7 +316,7 @@ The R-tree spatial index.
                  - Constructor(s) + Constructor(s) and destructor
                  @@ -458,20 +458,14 @@ The R-tree spatial index.
                  - Member(s) + Member(s)
                  - - - - - - - - - - - - - - - - - - - - - - - -
                  -

                  - Modifier -

                  -

                  Function @@ -485,8 +479,6 @@ The R-tree spatial index.

                  -

                  operator=(const rtree @@ -500,8 +492,6 @@ The R-tree spatial index.

                  -

                  operator=(rtree &&) @@ -514,8 +504,6 @@ The R-tree spatial index.

                  -

                  swap(rtree &) @@ -528,8 +516,6 @@ The R-tree spatial index.

                  -

                  insert(value_type const @@ -543,8 +529,6 @@ The R-tree spatial index.

                  -

                  insert(Iterator, @@ -558,8 +542,6 @@ The R-tree spatial index.

                  -

                  insert(Range const @@ -573,8 +555,6 @@ The R-tree spatial index.

                  -

                  remove(value_type const @@ -588,8 +568,6 @@ The R-tree spatial index.

                  -

                  remove(Iterator, @@ -603,8 +581,6 @@ The R-tree spatial index.

                  -

                  remove(Range const @@ -618,11 +594,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  spatial_query(Predicates const @@ -637,11 +608,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  nearest_query(DistancesPredicates const @@ -657,11 +623,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  nearest_query(DistancesPredicates const @@ -678,11 +639,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  nearest_query(DistancesPredicates const @@ -697,11 +653,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  nearest_query(DistancesPredicates const @@ -718,11 +669,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  size() @@ -735,11 +681,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  empty() @@ -752,8 +693,6 @@ The R-tree spatial index.

                  -

                  clear() @@ -766,11 +705,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  box() @@ -783,11 +717,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  count(ValueOrIndexable const @@ -801,11 +730,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  parameters() @@ -818,11 +742,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  translator() @@ -835,11 +754,6 @@ The R-tree spatial index.

                  -

                  - const -

                  -

                  get_allocator() @@ -862,22 +776,13 @@ The R-tree spatial index.

                  - Synopsis + Synopsis
                  rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
                   
                  - Modifier(s) -
                  -

                  -

                  -
                  explicit
                  -

                  -

                  -
                  - - Parameter(s) + Parameter(s)
                  @@ -941,8 +846,8 @@ The R-tree spatial index.
                  - - Throws + + Throws

                  If allocator default constructor throws. @@ -958,7 +863,7 @@ The R-tree spatial index.

                  - Synopsis + Synopsis
                  rtree(parameters_type parameters,
                         translator_type const & translator,
                  @@ -966,7 +871,7 @@ The R-tree spatial index.
                   
                  - Parameter(s) + Parameter(s)
                  @@ -1048,7 +953,7 @@ The R-tree spatial index.
                  - Throws + Throws

                  If allocator copy constructor throws. @@ -1064,7 +969,7 @@ The R-tree spatial index.

                  - Synopsis + Synopsis
                  template<typename Iterator>
                   rtree(Iterator first,
                  @@ -1075,7 +980,7 @@ The R-tree spatial index.
                   
                  - Parameter(s) + Parameter(s)
                  @@ -1191,9 +1096,9 @@ The R-tree spatial index.
                  - Throws + Throws
                  -
                    +
                    • If allocator copy constructor throws.
                    • @@ -1218,7 +1123,7 @@ The R-tree spatial index.

                      - Synopsis + Synopsis
                      template<typename Range>
                       rtree(Range const & rng,
                      @@ -1228,16 +1133,7 @@ The R-tree spatial index.
                       
                      - Modifier(s) -
                      -

                      -

                      -
                      explicit
                      -

                      -

                      -
                      - - Parameter(s) + Parameter(s)
                      @@ -1336,10 +1232,10 @@ The R-tree spatial index.
                      - - Throws + + Throws
                      -
                        +
                        • If allocator copy constructor throws.
                        • @@ -1363,13 +1259,13 @@ The R-tree spatial index.

                          - Synopsis + Synopsis
                          ~rtree()
                           
                          - Throws + Throws

                          Nothing. @@ -1385,20 +1281,20 @@ The R-tree spatial index.

                          - Description + Description

                          It uses parameters, translator and allocator from the source tree.

                          - Synopsis + Synopsis
                          rtree(rtree const & src)
                           
                          - Parameter(s) + Parameter(s)
                          @@ -1444,9 +1340,9 @@ The R-tree spatial index.
                          - Throws + Throws
                          -
                            +
                            • If allocator copy constructor throws.
                            • @@ -1471,20 +1367,20 @@ The R-tree spatial index.

                              - Description + Description

                              It uses Parameters and translator from the source tree.

                              - Synopsis + Synopsis
                              rtree(rtree const & src, allocator_type const & allocator)
                               
                              - Parameter(s) + Parameter(s)
                              @@ -1550,9 +1446,9 @@ The R-tree spatial index.
                              - Throws + Throws
                              -
                                +
                                • If allocator copy constructor throws.
                                • @@ -1577,20 +1473,20 @@ The R-tree spatial index.

                                  - Description + Description

                                  It uses parameters, translator and allocator from the source tree.

                                  - Synopsis + Synopsis
                                  rtree(rtree && src)
                                   
                                  - Parameter(s) + Parameter(s)
                                  @@ -1636,7 +1532,7 @@ The R-tree spatial index.
                                  - Throws + Throws

                                  Nothing. @@ -1652,20 +1548,20 @@ The R-tree spatial index.

                                  - Description + Description

                                  It uses parameters and translator from the source tree.

                                  - Synopsis + Synopsis
                                  rtree(rtree && src, allocator_type const & allocator)
                                   
                                  - Parameter(s) + Parameter(s)
                                  @@ -1731,9 +1627,9 @@ The R-tree spatial index.
                                  - Throws + Throws
                                  -
                                    +
                                    • If allocator copy constructor throws.
                                    • @@ -1759,20 +1655,20 @@ The R-tree spatial index.

                                      - Description + Description

                                      It uses parameters and translator from the source tree.

                                      - Synopsis + Synopsis
                                      rtree & operator=(const rtree & src)
                                       
                                      - Parameter(s) + Parameter(s)
                                      @@ -1818,9 +1714,9 @@ The R-tree spatial index.
                                      - Throws + Throws
                                      -
                                        +
                                        • If Value copy constructor throws.
                                        • @@ -1842,20 +1738,20 @@ The R-tree spatial index.

                                          - Description + Description

                                          It uses parameters and translator from the source tree.

                                          - Synopsis + Synopsis
                                          rtree & operator=(rtree && src)
                                           
                                          - Parameter(s) + Parameter(s)
                                          @@ -1901,12 +1797,12 @@ The R-tree spatial index.
                                          - Throws + Throws

                                          Only if allocators aren't equal.

                                          -
                                            +
                                            • If Value copy constructor throws.
                                            • @@ -1928,20 +1824,20 @@ The R-tree spatial index.

                                              - Description + Description

                                              Parameters, translator and allocators are swapped as well.

                                              - Synopsis + Synopsis
                                              void swap(rtree & other)
                                               
                                              - Parameter(s) + Parameter(s)
                                              @@ -1987,7 +1883,7 @@ The R-tree spatial index.
                                              - Throws + Throws

                                              If allocators swap throws. @@ -2003,13 +1899,13 @@ The R-tree spatial index.

                                              - Synopsis + Synopsis
                                              void insert(value_type const & value)
                                               
                                              - Parameter(s) + Parameter(s)
                                              @@ -2055,9 +1951,9 @@ The R-tree spatial index.
                                              - Throws + Throws
                                              -
                                                +
                                                • If Value copy constructor or copy assignment throws.
                                                • @@ -2090,14 +1986,14 @@ The R-tree spatial index.

                                                  - Synopsis + Synopsis
                                                  template<typename Iterator>
                                                   void insert(Iterator first, Iterator last)
                                                   
                                                  - Parameter(s) + Parameter(s)
                                                  @@ -2161,9 +2057,9 @@ The R-tree spatial index.
                                                  - Throws + Throws
                                                  -
                                                    +
                                                    • If Value copy constructor or copy assignment throws.
                                                    • @@ -2196,14 +2092,14 @@ The R-tree spatial index.

                                                      - Synopsis + Synopsis
                                                      template<typename Range>
                                                       void insert(Range const & rng)
                                                       
                                                      - Parameter(s) + Parameter(s)
                                                      @@ -2249,9 +2145,9 @@ The R-tree spatial index.
                                                      - Throws + Throws
                                                      -
                                                        +
                                                        • If Value copy constructor or copy assignment throws.
                                                        • @@ -2284,7 +2180,7 @@ The R-tree spatial index.

                                                          - Description + Description

                                                          In contrast to the std::set @@ -2293,13 +2189,13 @@ The R-tree spatial index.

                                                          - Synopsis + Synopsis
                                                          size_type remove(value_type const & value)
                                                           
                                                          - Parameter(s) + Parameter(s)
                                                          @@ -2345,16 +2241,16 @@ The R-tree spatial index.
                                                          - Returns + Returns

                                                          1 if the value was removed, 0 otherwise.

                                                          - Throws + Throws
                                                          -
                                                            +
                                                            • If Value copy constructor or copy assignment throws.
                                                            • @@ -2387,7 +2283,7 @@ The R-tree spatial index.

                                                              - Description + Description

                                                              In contrast to the std::set @@ -2398,14 +2294,14 @@ The R-tree spatial index.

                                                              - Synopsis + Synopsis
                                                              template<typename Iterator>
                                                               size_type remove(Iterator first, Iterator last)
                                                               
                                                              - Parameter(s) + Parameter(s)
                                                              @@ -2469,16 +2365,16 @@ The R-tree spatial index.
                                                              - Returns + Returns

                                                              The number of removed values.

                                                              - Throws + Throws
                                                              -
                                                                +
                                                                • If Value copy constructor or copy assignment throws.
                                                                • @@ -2511,7 +2407,7 @@ The R-tree spatial index.

                                                                  - Description + Description

                                                                  In contrast to the std::set @@ -2521,14 +2417,14 @@ The R-tree spatial index.

                                                                  - Synopsis + Synopsis
                                                                  template<typename Range>
                                                                   size_type remove(Range const & rng)
                                                                   
                                                                  - Parameter(s) + Parameter(s)
                                                                  @@ -2574,16 +2470,16 @@ The R-tree spatial index.
                                                                  - Returns + Returns

                                                                  The number of removed values.

                                                                  - Throws + Throws
                                                                  -
                                                                    +
                                                                    • If Value copy constructor or copy assignment throws.
                                                                    • @@ -2616,7 +2512,7 @@ The R-tree spatial index.

                                                                      - Description + Description

                                                                      Spatial predicates may be a Geometry. In this case Values @@ -2626,7 +2522,7 @@ The R-tree spatial index.

                                                                      It may be generated by one of the functions listed below:

                                                                      -
                                                                        +
                                                                        • boost::geometry::index::covered_by(),
                                                                        • @@ -2668,23 +2564,14 @@ The R-tree spatial index.

                                                                          - Synopsis + Synopsis
                                                                          template<typename Predicates, typename OutIter>
                                                                           size_type spatial_query(Predicates const & pred, OutIter out_it)
                                                                           
                                                                          - Modifier(s) -
                                                                          -

                                                                          -

                                                                          -
                                                                          const
                                                                          -

                                                                          -

                                                                          -
                                                                          - - Parameter(s) + Parameter(s)
                                                                          @@ -2748,17 +2635,17 @@ The R-tree spatial index.
                                                                          - - Returns + + Returns

                                                                          The number of values found.

                                                                          - - Throws + + Throws
                                                                          -
                                                                            +
                                                                            • If Value copy constructor or copy assignment throws.
                                                                            • @@ -2777,7 +2664,7 @@ The R-tree spatial index.

                                                                              - Description + Description

                                                                              Distances predicates may be a Point. In this the case the @@ -2788,7 +2675,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                              -
                                                                                +
                                                                                • boost::geometry::index::to_nearest() - default, @@ -2805,7 +2692,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                  -
                                                                                    +
                                                                                    • boost::geometry::index::unbounded() - default, @@ -2824,7 +2711,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                      -
                                                                                        +
                                                                                        - Synopsis + Synopsis
                                                                                        template<typename DistancesPredicates>
                                                                                         size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
                                                                                         
                                                                                        - Modifier(s) -
                                                                                        -

                                                                                        -

                                                                                        -
                                                                                        const
                                                                                        -

                                                                                        -

                                                                                        -
                                                                                        - - Parameter(s) + Parameter(s)
                                                                                        @@ -2918,15 +2796,15 @@ The R-tree spatial index.
                                                                                        - - Returns + + Returns

                                                                                        The number of values found.

                                                                                        - - Throws + + Throws

                                                                                        If Value copy constructor or copy assignment throws. @@ -2943,7 +2821,7 @@ The R-tree spatial index.

                                                                                        - Description + Description

                                                                                        Distances predicates may be a Point. In this the case the @@ -2954,7 +2832,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                        -
                                                                                          +
                                                                                          • boost::geometry::index::to_nearest() - default, @@ -2971,7 +2849,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                            -
                                                                                              +
                                                                                              • boost::geometry::index::unbounded() - default, @@ -2990,7 +2868,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                -
                                                                                                  +
                                                                                                  • boost::geometry::index::to_nearest(),
                                                                                                  • @@ -3009,7 +2887,7 @@ The R-tree spatial index.

                                                                                                    It may be generated by one of the functions listed below:

                                                                                                    -
                                                                                                      +
                                                                                                      • boost::geometry::index::covered_by(),
                                                                                                      • @@ -3051,7 +2929,7 @@ The R-tree spatial index.

                                                                                                        - Synopsis + Synopsis
                                                                                                        template<typename DistancesPredicates, typename Predicates>
                                                                                                         size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                        @@ -3060,16 +2938,7 @@ The R-tree spatial index.
                                                                                                         
                                                                                                        - Modifier(s) -
                                                                                                        -

                                                                                                        -

                                                                                                        -
                                                                                                        const
                                                                                                        -

                                                                                                        -

                                                                                                        -
                                                                                                        - - Parameter(s) + Parameter(s)
                                                                                                        @@ -3151,15 +3020,15 @@ The R-tree spatial index.
                                                                                                        - - Returns + + Returns

                                                                                                        The number of values found.

                                                                                                        - - Throws + + Throws

                                                                                                        If Value copy constructor or copy assignment throws. @@ -3176,7 +3045,7 @@ The R-tree spatial index.

                                                                                                        - Description + Description

                                                                                                        Distances predicates may be a Point. In this the case the @@ -3187,7 +3056,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                        -
                                                                                                          +
                                                                                                          • boost::geometry::index::to_nearest() - default, @@ -3204,7 +3073,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                            -
                                                                                                              +
                                                                                                              • boost::geometry::index::unbounded() - default, @@ -3223,7 +3092,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                                -
                                                                                                                  +
                                                                                                                  - Synopsis + Synopsis
                                                                                                                  template<typename DistancesPredicates, typename OutIter>
                                                                                                                   size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                                  @@ -3245,16 +3114,7 @@ The R-tree spatial index.
                                                                                                                   
                                                                                                                  - Modifier(s) -
                                                                                                                  -

                                                                                                                  -

                                                                                                                  -
                                                                                                                  const
                                                                                                                  -

                                                                                                                  -

                                                                                                                  -
                                                                                                                  - - Parameter(s) + Parameter(s)
                                                                                                                  @@ -3335,15 +3195,15 @@ The R-tree spatial index.
                                                                                                                  - - Returns + + Returns

                                                                                                                  The number of values found.

                                                                                                                  - - Throws + + Throws

                                                                                                                  If Value copy constructor or copy assignment throws. If OutIter dereference @@ -3361,7 +3221,7 @@ The R-tree spatial index.

                                                                                                                  - Description + Description

                                                                                                                  Distances predicates may be a Point. In this the case the @@ -3372,7 +3232,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                                  -
                                                                                                                  - +

                                                                                                                  Last revised: January 17, 2013 at 17:06:52 GMT

                                                                                                                  Last revised: January 18, 2013 at 20:09:35 GMT


                                                                                                                  diff --git a/doc/src/examples/Jamfile.v2 b/doc/src/examples/Jamfile.v2 new file mode 100644 index 000000000..e221ca86b --- /dev/null +++ b/doc/src/examples/Jamfile.v2 @@ -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 + ../../.. + #../../../boost/geometry/extensions/contrib/ttmath + msvc:on + ; + +build-project rtree ; diff --git a/doc/src/examples/rtree/Jamfile.v2 b/doc/src/examples/rtree/Jamfile.v2 new file mode 100644 index 000000000..9a70926c8 --- /dev/null +++ b/doc/src/examples/rtree/Jamfile.v2 @@ -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 ; + diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index 33eb2147f..65fe4ddf4 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include // to store queries results #include diff --git a/include/boost/geometry/extensions/index/assert.hpp b/include/boost/geometry/extensions/index/detail/assert.hpp similarity index 100% rename from include/boost/geometry/extensions/index/assert.hpp rename to include/boost/geometry/extensions/index/detail/assert.hpp diff --git a/include/boost/geometry/extensions/index/detail/distance_predicates.hpp b/include/boost/geometry/extensions/index/detail/distance_predicates.hpp new file mode 100644 index 000000000..6b0aa5989 --- /dev/null +++ b/include/boost/geometry/extensions/index/detail/distance_predicates.hpp @@ -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 +#include +#include + +#include + +#include + +// 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 +struct to_nearest +{ + to_nearest(T const& v) : value(v) {} + T value; +}; + +template +struct to_centroid +{ + to_centroid(T const& v) : value(v) {} + T value; +}; + +template +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 +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 +struct relation< to_nearest > +{ + typedef T value_type; + typedef to_nearest_tag tag; + static inline T const& value(to_nearest const& r) { return r.value; } + static inline T & value(to_nearest & r) { return r.value; } +}; + +template +struct relation< to_centroid > +{ + typedef T value_type; + typedef to_centroid_tag tag; + static inline T const& value(to_centroid const& r) { return r.value; } + static inline T & value(to_centroid & r) { return r.value; } +}; + +template +struct relation< to_furthest > +{ + typedef T value_type; + typedef to_furthest_tag tag; + static inline T const& value(to_furthest const& r) { return r.value; } + static inline T & value(to_furthest & r) { return r.value; } +}; + +// ------------------------------------------------------------------ // +// distance predicates +// ------------------------------------------------------------------ // + +template +struct unbounded + : nonassignable +{ + inline explicit unbounded(PointRelation const& pr) + : point_relation(pr) + {} + + PointRelation point_relation; +}; + +template +struct min_bounded + : nonassignable +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline min_bounded(PointRelation const& pr, MinRelation const& min_rel) + : point_relation(pr) + , comparable_min( + relation::value(min_rel) * + relation::value(min_rel) ) + {} + + PointRelation point_relation; + distance_type comparable_min; +}; + +template +struct max_bounded + : nonassignable +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel) + : point_relation(pr) + , comparable_max( + relation::value(max_rel) * + relation::value(max_rel) ) + {} + + PointRelation point_relation; + distance_type comparable_max; +}; + +template +struct bounded + : nonassignable +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel) + : point_relation(pr) + , comparable_min( + relation::value(min_rel) * + relation::value(min_rel) ) + , comparable_max( + relation::value(max_rel) * + relation::value(max_rel) ) + {} + + PointRelation point_relation; + distance_type comparable_min; + distance_type comparable_max; +}; + +// ------------------------------------------------------------------ // +// point_relation trait +// ------------------------------------------------------------------ // + +template +struct point_relation +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::unbounded > +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::min_bounded > +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::max_bounded > +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::bounded > +{ + typedef PointRelation type; +}; + +// ------------------------------------------------------------------ // +// helpers +// ------------------------------------------------------------------ // + +// algorithms + +// cdist + +template +struct cdist +{ + T value; +}; + +// cdist_merge + +template +struct cdist_merge +{ + typedef typename detail::tuples::add_unique< + CDistTuple, + CDist + >::type type; +}; + +template +struct cdist_merge< + cdist, + cdist > +{ + typedef boost::tuple< + cdist, + cdist + > type; +}; + +template +struct cdist_merge< + cdist, + cdist > +{ + typedef cdist type; +}; + +// cdist_value_type + +template +struct cdist_value +{ + typedef typename cdist_value< + typename boost::tuples::element<0, CDistTuple>::type + >::type type; + + template + static inline type & get(CDistTuple & cdtup) + { + return boost::get< + tuples::find_index< + CDistTuple, + cdist + >::value + >(cdtup).value; + } + + template + static inline type const& get(CDistTuple const& cdtup) + { + return boost::get< + tuples::find_index< + CDistTuple, + cdist + >::value + >(cdtup).value; + } +}; + +template +struct cdist_value< + cdist +> +{ + typedef T type; + + template + static inline type & get(cdist & cd) + { + BOOST_MPL_ASSERT_MSG( + (tuples::equal< cdist, cdist >::value), + TAGS_DO_NOT_MATCH, + (cdist_value)); + + return cd.value; + } + + template + static inline type const& get(cdist const& cd) + { + BOOST_MPL_ASSERT_MSG( + (tuples::equal< cdist, cdist >::value), + TAGS_DO_NOT_MATCH, + (cdist_value)); + + return cd.value; + } +}; + +// distances_calc_impl_rel + +template +struct distances_calc_impl_rel +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_RELATION, + (distances_calc_impl_rel)); +}; + +template +struct distances_calc_impl_rel< + cdist +> +{ + template + typename geometry::default_distance_result::type + static inline apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_near(p, i); + } +}; + +template +struct distances_calc_impl_rel< + cdist +> +{ + template + typename geometry::default_distance_result::type + static inline apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_centroid(p, i); + } +}; + +template +struct distances_calc_impl_rel< + cdist +> +{ + template + typename geometry::default_distance_result::type + static inline apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_far(p, i); + } +}; + +// distances_calc_impl_tuple + +template +struct distances_calc_impl_tuple +{ + // TODO MPL ASSERT 0 < N + static inline void apply(Distances & d, Point const& p, Indexable const&i) + { + boost::get(d).value = + distances_calc_impl_rel< + typename boost::tuples::element::type + >::apply(p, i); + + distances_calc_impl_tuple< + Distances, + Point, + Indexable, + N - 1 + >::apply(d, p, i); + } +}; + +template +struct distances_calc_impl_tuple +{ + 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 +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::value + >::apply(d, p, i); + } +}; + +template +struct distances_calc_impl< + cdist, + Point, + Indexable +> +{ + static inline void apply(cdist & d, Point const& p, Indexable const&i) + { + d.value = distances_calc_impl_rel< + cdist + >::apply(p, i); + } +}; + +// ------------------------------------------------------------------ // +// distance_calc and distances_predicates_check +// ------------------------------------------------------------------ // + +template +struct distances_calc +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG, + (distances_calc)); +}; + +template +struct distances_predicates_check +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG, + (distances_predicates_check)); +}; + +// ------------------------------------------------------------------ // +// distance_calc for value_tag +// ------------------------------------------------------------------ // + +template +struct distances_calc +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(PointRelation const& p, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(p), i); + return res; + } +}; + +template +struct distances_calc< + detail::unbounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(detail::unbounded const& pp, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::min_bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + typedef typename detail::relation::tag min_relation_tag; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::min_bounded const& pp, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::max_bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + typedef typename detail::relation::tag max_relation_tag; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::max_bounded const& pp, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + typedef typename detail::relation::tag min_relation_tag; + typedef typename detail::relation::tag max_relation_tag; + + typedef typename detail::cdist_merge< + typename detail::cdist_merge< + cdist, + cdist + >::type, + cdist + >::type result_type; + + static inline result_type apply( + detail::bounded const& pp, + Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +// ------------------------------------------------------------------ // +// distance_predicates_check for value_tag +// ------------------------------------------------------------------ // + +template +struct distances_predicates_check +{ + template + static inline bool apply(PointRelation const&, Distances const&) + { + return true; + } +}; + +template +struct distances_predicates_check< + detail::unbounded, + Indexable, + value_tag +> +{ + template + static inline bool apply(detail::unbounded const&, Distances const&) + { + return true; + } +}; + +template +struct distances_predicates_check< + detail::min_bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::tag min_relation_tag; + + template + static inline bool apply( + detail::min_bounded const& pred, + Distances const& d) + { + return pred.comparable_min <= + detail::cdist_value::template get(d); + } +}; + +template +struct distances_predicates_check< + detail::max_bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::tag max_relation_tag; + + template + static inline bool apply( + detail::max_bounded const& pred, + Distances const& d) + { + return pred.comparable_max <= + detail::cdist_value::template get(d); + } +}; + +template +struct distances_predicates_check< + detail::bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::tag min_relation_tag; + typedef typename detail::relation::tag max_relation_tag; + + template + static inline bool apply( + detail::bounded const& pred, + Distances const& d) + { + return pred.comparable_min + <= detail::cdist_value::template get(d) + && detail::cdist_value::template get(d) + <= pred.comparable_max; + } +}; + +// ------------------------------------------------------------------ // +// distance_calc for envelope_tag +// ------------------------------------------------------------------ // + +template +struct distances_calc< + PointRelation, + Box, + envelope_tag> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(PointRelation const& p, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(p), i); + return res; + } +}; + +template +struct distances_calc< + detail::unbounded, + Box, + envelope_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(detail::unbounded const& pp, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::min_bounded, + Box, + envelope_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::min_bounded const& pp, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::max_bounded, + Box, + envelope_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef cdist result_type; + + static inline result_type apply(detail::max_bounded const& pp, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::bounded, + Box, + envelope_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::bounded const& pp, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +// ------------------------------------------------------------------ // +// distance_predicates_check for envelope_tag +// ------------------------------------------------------------------ // + +template +struct distances_predicates_check< + PointRelation, + Box, + envelope_tag> +{ + template + static inline bool apply(PointRelation const&, Distances const&) + { + return true; + } +}; + +template +struct distances_predicates_check< + detail::unbounded, + Box, + envelope_tag> +{ + template + static inline bool apply( + detail::unbounded const&, + Distances const&) + { + return true; + } +}; + +template +struct distances_predicates_check< + detail::min_bounded, + Box, + envelope_tag> +{ + template + static inline bool apply( + detail::min_bounded const& pred, + Distances const& d) + { + return pred.comparable_min + <= cdist_value::template get(d); + } +}; + +template +struct distances_predicates_check< + detail::max_bounded, + Box, + envelope_tag> +{ + template + static inline bool apply( + detail::max_bounded const& pred, + Distances const& d) + { + return cdist_value::template get(d) + <= pred.comparable_max; + } +}; + +template +struct distances_predicates_check< + detail::bounded, + Box, + envelope_tag> +{ + template + static inline bool apply( + detail::bounded const& pred, + Distances const& d) + { + return pred.comparable_min + <= cdist_value::template get(d) + && cdist_value::template get(d) + <= pred.comparable_max; + } +}; + +}}}} // namespace boost::geometry::index::detail + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/nonassignable.hpp b/include/boost/geometry/extensions/index/detail/nonassignable.hpp similarity index 81% rename from include/boost/geometry/extensions/index/nonassignable.hpp rename to include/boost/geometry/extensions/index/detail/nonassignable.hpp index 810cfd111..345007b0d 100644 --- a/include/boost/geometry/extensions/index/nonassignable.hpp +++ b/include/boost/geometry/extensions/index/detail/nonassignable.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 diff --git a/include/boost/geometry/extensions/index/detail/predicates.hpp b/include/boost/geometry/extensions/index/detail/predicates.hpp new file mode 100644 index 000000000..abe19c760 --- /dev/null +++ b/include/boost/geometry/extensions/index/detail/predicates.hpp @@ -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 +#include + +namespace boost { namespace geometry { namespace index { namespace detail { + +// ------------------------------------------------------------------ // +// predicates +// ------------------------------------------------------------------ // + +struct empty {}; + +template +struct value +{ + value(ValuePredicate const& vpred) : value_predicate(vpred) {} + ValuePredicate value_predicate; +}; + +template +struct covered_by +{ + covered_by(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct disjoint +{ + disjoint(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct intersects +{ + intersects(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct overlaps +{ + overlaps(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +//template +//struct touches +//{ +// touches(Geometry const& g) : geometry(g) {} +// Geometry geometry; +//}; + +template +struct within +{ + within(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_covered_by +{ + not_covered_by(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_disjoint +{ + not_disjoint(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_intersects +{ + not_intersects(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_overlaps +{ + not_overlaps(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +//template +//struct not_touches +//{ +// not_touches(Geometry const& g) : geometry(g) {} +// Geometry geometry; +//}; + +template +struct not_within +{ + not_within(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +// ------------------------------------------------------------------ // +// predicate_check +// ------------------------------------------------------------------ // + +template +struct predicate_check +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG, + (predicate_check)); +}; + +// ------------------------------------------------------------------ // +// predicate_check for value +// ------------------------------------------------------------------ // + +template +struct predicate_check +{ + template + static inline bool apply(Geometry const& g, Value const&, Indexable const& i) + { + return geometry::intersects(i, g); + } +}; + +template <> +struct predicate_check +{ + template + static inline bool apply(empty const&, Value const&, Indexable const&) + { + return true; + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(value const& p, Value const& v, Indexable const&) + { + return p.value_predicate(v); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(covered_by const& p, Value const&, Indexable const& i) + { + return geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(disjoint const& p, Value const&, Indexable const& i) + { + return geometry::disjoint(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(intersects const& p, Value const&, Indexable const& i) + { + return geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(overlaps const& p, Value const&, Indexable const& i) + { + return geometry::overlaps(i, p.geometry); + } +}; + +//template +//struct predicate_check, value_tag> +//{ +// template +// static inline bool apply(touches const& p, Value const&, Indexable const& i) +// { +// return geometry::touches(i, p.geometry); +// } +//}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(within const& p, Value const&, Indexable const& i) + { + return geometry::within(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_covered_by const& p, Value const&, Indexable const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_disjoint const& p, Value const&, Indexable const& i) + { + return !geometry::disjoint(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_intersects const& p, Value const&, Indexable const& i) + { + return !geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_overlaps const& p, Value const&, Indexable const& i) + { + return !geometry::overlaps(i, p.geometry); + } +}; + +//template +//struct predicate_check, value_tag> +//{ +// template +// static inline bool apply(not_touches const& p, Value const&, Indexable const& i) +// { +// return !geometry::touches(i, p.geometry); +// } +//}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_within const& p, Value const&, Indexable const& i) + { + return !geometry::within(i, p.geometry); + } +}; + +// ------------------------------------------------------------------ // +// predicates_chec for envelope +// ------------------------------------------------------------------ // + +template +struct predicate_check +{ + template + static inline bool apply(Geometry const& g, Value const&, Indexable const& i) + { + return geometry::intersects(i, g); + } +}; + +template <> +struct predicate_check +{ + template + static inline bool apply(Geometry const&, Value const&, Indexable const&) + { + return true; + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(value const&, Value const&, Box const&) + { + return true; + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(covered_by const& p, Value const&, Box const& i) + { + return geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(disjoint const& p, Value const&, Box const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static inline bool apply(intersects const& p, Value const&, Indexable const& i) + { + return geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static inline bool apply(overlaps 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 +//struct predicate_check, envelope_tag> +//{ +// template +// static bool apply(touches const& p, Value const&, Box const& i) +// { +// return geometry::intersects(i, p.geometry); +// } +//}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(within 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 +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_covered_by const& p, Value const&, Box const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_disjoint const& p, Value const&, Box const& i) + { + return !geometry::disjoint(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_intersects const& p, Value const&, Box const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_overlaps const& p, Value const&, Box const& i) + { + return true; + } +}; + +//template +//struct predicate_check, envelope_tag> +//{ +// template +// static bool apply(not_touches const& p, Value const&, Box const& i) +// { +// return !geometry::intersects(i, p.geometry); +// } +//}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_within const& p, Value const&, Box const& i) + { + return !geometry::within(i, p.geometry); + } +}; + +// ------------------------------------------------------------------ // +// predicates_check +// ------------------------------------------------------------------ // + +template +struct predicates_check_tuple +{ + template + static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) + { + return predicates_check_tuple::apply(p, v, i) + && predicate_check< + typename boost::tuples::element::type, + Tag + >::apply(boost::get(p), v, i); + } +}; + +template +struct predicates_check_tuple +{ + template + 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 +struct predicates_check_impl +{ + template + static inline bool apply(Predicate const& p, Value const& v, Indexable const& i) + { + return predicate_check::apply(p, v, i); + } +}; + +template +struct predicates_check_impl, Tag> +{ + template + static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) + { + return predicate_check::apply(p.first, v, i) + && predicate_check::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, + Tag +> +{ + typedef boost::tuple predicates_type; + + template + static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) + { + return predicates_check_tuple< + predicates_type, + Tag, + boost::tuples::length::value + >::apply(p, v, i); + } +}; + +template +inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i) +{ + return detail::predicates_check_impl + ::apply(p, v, i); +} + +}}}} // namespace boost::geometry::index::detail + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/detail/pushable_array.hpp similarity index 95% rename from include/boost/geometry/extensions/index/pushable_array.hpp rename to include/boost/geometry/extensions/index/detail/pushable_array.hpp index 5e9aad018..6140ac96e 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/detail/pushable_array.hpp @@ -11,9 +11,9 @@ #include -#include +#include -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { template 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 diff --git a/include/boost/geometry/extensions/index/rtree/adaptors.hpp b/include/boost/geometry/extensions/index/detail/rtree/adaptors.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/adaptors.hpp rename to include/boost/geometry/extensions/index/detail/rtree/adaptors.hpp diff --git a/include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp b/include/boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp rename to include/boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp diff --git a/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp b/include/boost/geometry/extensions/index/detail/rtree/kmeans/split.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/kmeans/split.hpp rename to include/boost/geometry/extensions/index/detail/rtree/kmeans/split.hpp diff --git a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp b/include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp similarity index 85% rename from include/boost/geometry/extensions/index/rtree/linear/linear.hpp rename to include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp index 1f249bd04..4c6aaf44e 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp @@ -11,6 +11,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP -#include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp rename to include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp index fb52e3b5e..7581b557b 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp @@ -17,9 +17,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/concept.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/concept.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/concept.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/concept.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/dynamic_visitor.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/dynamic_visitor.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node.hpp similarity index 90% rename from include/boost/geometry/extensions/index/rtree/node/node.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node.hpp index 64b0bfc30..21d9ffad2 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node.hpp @@ -11,19 +11,19 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP -#include +#include -#include -#include +#include +#include -#include -#include +#include +#include -#include +#include #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp index fcb3e1492..7b7663660 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp @@ -13,7 +13,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp similarity index 99% rename from include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp index 5d06919a3..1a0a5f5cf 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -13,7 +13,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp similarity index 93% rename from include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp index 71d4b4488..7c6c6cfc0 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp @@ -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 -#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -22,7 +22,7 @@ template : public dynamic_node { - typedef index::static_vector< + typedef detail::static_vector< std::pair< Box, dynamic_node * @@ -43,7 +43,7 @@ template : public dynamic_node { - typedef index::static_vector elements_type; + typedef detail::static_vector elements_type; template inline dynamic_leaf(Dummy) {} @@ -82,16 +82,16 @@ struct visitor -struct container_from_elements_type, NewValue> +struct container_from_elements_type, NewValue> { - typedef index::static_vector type; + typedef detail::static_vector type; }; // allocators template class allocators - : nonassignable + : detail::nonassignable { BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp similarity index 99% rename from include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp index e620ded8d..577e60c08 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -13,7 +13,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp index 4040124bc..5f906fca3 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp @@ -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 +#include -#include +#include namespace boost { namespace geometry { namespace index { @@ -24,7 +24,7 @@ namespace detail { namespace rtree { template struct static_internal_node { - typedef index::static_vector< + typedef detail::static_vector< std::pair< Box, typename node::type * @@ -41,7 +41,7 @@ struct static_internal_node struct static_leaf { - typedef index::static_vector elements_type; + typedef detail::static_vector elements_type; template inline static_leaf(Dummy) {} diff --git a/include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/static_visitor.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/static_visitor.hpp diff --git a/include/boost/geometry/extensions/index/detail/rtree/options.hpp b/include/boost/geometry/extensions/index/detail/rtree/options.hpp new file mode 100644 index 000000000..c9431ad90 --- /dev/null +++ b/include/boost/geometry/extensions/index/detail/rtree/options.hpp @@ -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 + +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 +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 +struct options_type +{ + // TODO: awulkiew - use static assert +}; + +template +struct options_type< linear > +{ + typedef options< + linear, + insert_default_tag, + choose_by_content_diff_tag, + split_default_tag, + linear_tag, + node_d_mem_static_tag + > type; +}; + +template +struct options_type< quadratic > +{ + typedef options< + quadratic, + insert_default_tag, + choose_by_content_diff_tag, + split_default_tag, + quadratic_tag, + node_d_mem_static_tag + > type; +}; + +template +struct options_type< rstar > +{ + typedef options< + rstar, + insert_reinsert_tag, + choose_by_overlap_diff_tag, + split_default_tag, + rstar_tag, + node_d_mem_static_tag + > type; +}; + +//template +//struct options_type< kmeans > +//{ +// typedef options< +// kmeans, +// 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 diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp b/include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp similarity index 85% rename from include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp rename to include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp index 071311d39..d7eaa03af 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp @@ -11,6 +11,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP -#include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp rename to include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp index e4bf7d42b..de7d8ef1e 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp @@ -16,9 +16,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/choose_next_node.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp rename to include/boost/geometry/extensions/index/detail/rtree/rstar/choose_next_node.hpp index bf840cb5f..4624bfd06 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/choose_next_node.hpp @@ -19,8 +19,8 @@ #include #include -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp similarity index 99% rename from include/boost/geometry/extensions/index/rtree/rstar/insert.hpp rename to include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp index 1d4e17f2e..20be0c224 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp @@ -426,7 +426,7 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> template class insert : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp rename to include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp index f90e7656b..06c898b6f 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp @@ -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 +#include #include #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -31,7 +31,7 @@ namespace rstar { template class element_axis_corner_less - : index::nonassignable + : index::detail::nonassignable { public: element_axis_corner_less(Translator const& tr) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp similarity index 67% rename from include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp rename to include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp index a8db3364e..905c4e540 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp @@ -11,8 +11,8 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP -#include -#include -#include +#include +#include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp similarity index 94% rename from include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp index 542c2e16d..3a1dd50be 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp @@ -12,16 +12,16 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP #include -#include +#include -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 class are_boxes_ok : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; @@ -115,7 +115,7 @@ private: bool m_exact_match; }; -}} // namespace rtree::visitors +} // namespace visitors template bool are_boxes_ok(index::rtree const& tree, @@ -136,6 +136,6 @@ bool are_boxes_ok(index::rtree 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 diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/are_levels_ok.hpp similarity index 93% rename from include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/are_levels_ok.hpp index 854a19243..01576d2dd 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/are_levels_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 +#include -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 class are_levels_ok : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; @@ -86,7 +86,7 @@ private: size_t m_current_level; }; -}} // namespace rtree::visitors +} // namespace visitors template bool are_levels_ok(index::rtree const& tree) @@ -106,6 +106,6 @@ bool are_levels_ok(index::rtree 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 diff --git a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/children_box.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/children_box.hpp diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/visitors/copy.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp index ab92bc299..dddbe3c60 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/count.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/count.hpp similarity index 96% rename from include/boost/geometry/extensions/index/rtree/visitors/count.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/count.hpp index 2b8a324c6..72e355919 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/count.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/count.hpp @@ -11,9 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP -#include - -#include +#include namespace boost { namespace geometry { namespace index { @@ -22,7 +20,7 @@ namespace detail { namespace rtree { namespace visitors { template struct count : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -71,7 +69,7 @@ struct count template struct count : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp similarity index 97% rename from include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp index 0d60fae83..462d58bff 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/gl_draw.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/gl_draw.hpp diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp similarity index 99% rename from include/boost/geometry/extensions/index/rtree/visitors/insert.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp index 5635ce013..3f3189d68 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp @@ -13,7 +13,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -122,7 +122,7 @@ protected: typedef rtree::node_auto_ptr node_auto_ptr; public: - typedef index::static_vector, 1> nodes_container_type; + typedef index::detail::static_vector, 1> nodes_container_type; template static inline void apply(nodes_container_type & additional_nodes, @@ -220,7 +220,7 @@ struct insert_traverse_data template class insert : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { protected: typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp index 9fd479b4f..7c22e3747 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp @@ -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 +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/nearest_query.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/nearest_query.hpp index 58f59cbd7..c3cc698b5 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/nearest_query.hpp @@ -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 +#include -#include +#include #include namespace boost { namespace geometry { namespace index { @@ -159,7 +159,7 @@ template < > class nearest_query : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { public: typedef typename Options::parameters_type parameters_type; @@ -168,20 +168,20 @@ public: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef index::detail::distances_calc node_distances_calc; + typedef index::detail::distances_calc node_distances_calc; typedef typename node_distances_calc::result_type node_distances_type; - typedef index::detail::distances_predicates_check node_distances_predicates_check; + typedef index::detail::distances_predicates_check node_distances_predicates_check; typedef index::detail::distances_calc< DistancesPredicates, typename translator::indexable_type::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::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(m_pred, 0, it->first) ) + if ( index::detail::predicates_check(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(m_pred, *it, m_translator(*it)) ) + if ( index::detail::predicates_check(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)); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/print.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/visitors/print.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/print.hpp diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/remove.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/visitors/remove.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/remove.hpp index 25ca6eeff..2a6ae4ae4 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/remove.hpp @@ -11,9 +11,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP -#include +#include -#include +#include #include @@ -25,7 +25,7 @@ namespace detail { namespace rtree { namespace visitors { template class remove : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp similarity index 88% rename from include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp index 87f904546..15e40e966 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp @@ -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 +#include -#include +#include namespace boost { namespace geometry { namespace index { @@ -22,7 +22,7 @@ namespace detail { namespace rtree { namespace visitors { template struct spatial_query : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -43,7 +43,7 @@ struct spatial_query { // if node meets predicates // 0 - dummy value - if ( index::detail::predicates_check(pred, 0, it->first) ) + if ( index::detail::predicates_check(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(pred, *it, tr(*it)) ) + if ( index::detail::predicates_check(pred, *it, tr(*it)) ) { out_iter = *it; ++out_iter; diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/detail/static_vector.hpp similarity index 99% rename from include/boost/geometry/extensions/index/static_vector.hpp rename to include/boost/geometry/extensions/index/detail/static_vector.hpp index bba47ae1b..675012b01 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/detail/static_vector.hpp @@ -28,9 +28,9 @@ #include #include -#include +#include -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { template 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 diff --git a/include/boost/geometry/extensions/index/rtree/tags.hpp b/include/boost/geometry/extensions/index/detail/tags.hpp similarity index 64% rename from include/boost/geometry/extensions/index/rtree/tags.hpp rename to include/boost/geometry/extensions/index/detail/tags.hpp index 5589be5b6..a49532008 100644 --- a/include/boost/geometry/extensions/index/rtree/tags.hpp +++ b/include/boost/geometry/extensions/index/detail/tags.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 diff --git a/include/boost/geometry/extensions/index/tuples.hpp b/include/boost/geometry/extensions/index/detail/tuples.hpp similarity index 96% rename from include/boost/geometry/extensions/index/tuples.hpp rename to include/boost/geometry/extensions/index/detail/tuples.hpp index 3e63c49bc..2784a495d 100644 --- a/include/boost/geometry/extensions/index/tuples.hpp +++ b/include/boost/geometry/extensions/index/detail/tuples.hpp @@ -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 diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index 57fd3e60d..7faad08ce 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -11,11 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP -#include -#include -#include - -#include +#include /*! \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 -struct to_nearest -{ - to_nearest(T const& v) : value(v) {} - T value; -}; - -template -struct to_centroid -{ - to_centroid(T const& v) : value(v) {} - T value; -}; - -template -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 -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 -struct relation< to_nearest > -{ - typedef T value_type; - typedef to_nearest_tag tag; - static inline T const& value(to_nearest const& r) { return r.value; } - static inline T & value(to_nearest & r) { return r.value; } -}; - -template -struct relation< to_centroid > -{ - typedef T value_type; - typedef to_centroid_tag tag; - static inline T const& value(to_centroid const& r) { return r.value; } - static inline T & value(to_centroid & r) { return r.value; } -}; - -template -struct relation< to_furthest > -{ - typedef T value_type; - typedef to_furthest_tag tag; - static inline T const& value(to_furthest const& r) { return r.value; } - static inline T & value(to_furthest & r) { return r.value; } -}; - -} // namespace detail - // relations generators /*! @@ -173,83 +89,6 @@ detail::to_furthest to_furthest(T const& v) return detail::to_furthest(v); } -// distance predicates - -namespace detail { - -// TODO: awulkiew - consider storing points instead of PointRelations in predicates below - -template -struct unbounded - : nonassignable -{ - inline explicit unbounded(PointRelation const& pr) - : point_relation(pr) - {} - - PointRelation point_relation; -}; - -template -struct min_bounded - : nonassignable -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline min_bounded(PointRelation const& pr, MinRelation const& min_rel) - : point_relation(pr) - , comparable_min( - relation::value(min_rel) * - relation::value(min_rel) ) - {} - - PointRelation point_relation; - distance_type comparable_min; -}; - -template -struct max_bounded - : nonassignable -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel) - : point_relation(pr) - , comparable_max( - relation::value(max_rel) * - relation::value(max_rel) ) - {} - - PointRelation point_relation; - distance_type comparable_max; -}; - -template -struct bounded - : nonassignable -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel) - : point_relation(pr) - , comparable_min( - relation::value(min_rel) * - relation::value(min_rel) ) - , comparable_max( - relation::value(max_rel) * - relation::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(pr, minr, maxr); } -// algorithms - -namespace detail{ - -// point_relation - -template -struct point_relation -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::unbounded > -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::min_bounded > -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::max_bounded > -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::bounded > -{ - typedef PointRelation type; -}; - - -} // namespace detail - -namespace detail -{ - -// cdist - -template -struct cdist -{ - T value; -}; - -// cdist_merge - -template -struct cdist_merge -{ - typedef typename index::tuples::add_unique< - CDistTuple, - CDist - >::type type; -}; - -template -struct cdist_merge< - cdist, - cdist > -{ - typedef boost::tuple< - cdist, - cdist - > type; -}; - -template -struct cdist_merge< - cdist, - cdist > -{ - typedef cdist type; -}; - -// cdist_value_type - -template -struct cdist_value -{ - typedef typename cdist_value< - typename boost::tuples::element<0, CDistTuple>::type - >::type type; - - template - static inline type & get(CDistTuple & cdtup) - { - return boost::get< - index::tuples::find_index< - CDistTuple, - cdist - >::value - >(cdtup).value; - } - - template - static inline type const& get(CDistTuple const& cdtup) - { - return boost::get< - index::tuples::find_index< - CDistTuple, - cdist - >::value - >(cdtup).value; - } -}; - -template -struct cdist_value< - cdist -> -{ - typedef T type; - - template - static inline type & get(cdist & cd) - { - BOOST_MPL_ASSERT_MSG( - (tuples::equal< cdist, cdist >::value), - TAGS_DO_NOT_MATCH, - (cdist_value)); - - return cd.value; - } - - template - static inline type const& get(cdist const& cd) - { - BOOST_MPL_ASSERT_MSG( - (tuples::equal< cdist, cdist >::value), - TAGS_DO_NOT_MATCH, - (cdist_value)); - - return cd.value; - } -}; - -} // namespace detail - -namespace detail { - -// distances_calc_impl_rel - -template -struct distances_calc_impl_rel -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_IMPLEMENTED_FOR_THIS_RELATION, - (distances_calc_impl_rel)); -}; - -template -struct distances_calc_impl_rel< - cdist -> -{ - template - typename geometry::default_distance_result::type - static inline apply(Point const& p, Indexable const& i) - { - return index::comparable_distance_near(p, i); - } -}; - -template -struct distances_calc_impl_rel< - cdist -> -{ - template - typename geometry::default_distance_result::type - static inline apply(Point const& p, Indexable const& i) - { - return index::comparable_distance_centroid(p, i); - } -}; - -template -struct distances_calc_impl_rel< - cdist -> -{ - template - typename geometry::default_distance_result::type - static inline apply(Point const& p, Indexable const& i) - { - return index::comparable_distance_far(p, i); - } -}; - -// distances_calc_impl_tuple - -template -struct distances_calc_impl_tuple -{ - // TODO MPL ASSERT 0 < N - static inline void apply(Distances & d, Point const& p, Indexable const&i) - { - boost::get(d).value = - distances_calc_impl_rel< - typename boost::tuples::element::type - >::apply(p, i); - - distances_calc_impl_tuple< - Distances, - Point, - Indexable, - N - 1 - >::apply(d, p, i); - } -}; - -template -struct distances_calc_impl_tuple -{ - 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 -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::value - >::apply(d, p, i); - } -}; - -template -struct distances_calc_impl< - cdist, - Point, - Indexable -> -{ - static inline void apply(cdist & d, Point const& p, Indexable const&i) - { - d.value = distances_calc_impl_rel< - cdist - >::apply(p, i); - } -}; - -// distances_calc - -template -struct distances_calc -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(PointRelation const& p, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(p), i); - return res; - } -}; - -template -struct distances_calc< - detail::unbounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(detail::unbounded const& pp, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::min_bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - typedef typename detail::relation::tag min_relation_tag; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::min_bounded const& pp, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::max_bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - typedef typename detail::relation::tag max_relation_tag; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::max_bounded const& pp, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - typedef typename detail::relation::tag min_relation_tag; - typedef typename detail::relation::tag max_relation_tag; - - typedef typename detail::cdist_merge< - typename detail::cdist_merge< - cdist, - cdist - >::type, - cdist - >::type result_type; - - static inline result_type apply( - detail::bounded const& pp, - Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::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 -struct distances_predicates_check -{ - template - static inline bool apply(PointRelation const&, Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::unbounded, - Indexable, - Tag -> -{ - template - static inline bool apply(detail::unbounded const&, Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::min_bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::tag min_relation_tag; - - template - static inline bool apply( - detail::min_bounded const& pred, - Distances const& d) - { - return pred.comparable_min <= - detail::cdist_value::template get(d); - } -}; - -template -struct distances_predicates_check< - detail::max_bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::tag max_relation_tag; - - template - static inline bool apply( - detail::max_bounded const& pred, - Distances const& d) - { - return pred.comparable_max <= - detail::cdist_value::template get(d); - } -}; - -template -struct distances_predicates_check< - detail::bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::tag min_relation_tag; - typedef typename detail::relation::tag max_relation_tag; - - template - static inline bool apply( - detail::bounded const& pred, - Distances const& d) - { - return pred.comparable_min - <= detail::cdist_value::template get(d) - && detail::cdist_value::template get(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 diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/parameters.hpp similarity index 63% rename from include/boost/geometry/extensions/index/rtree/options.hpp rename to include/boost/geometry/extensions/index/parameters.hpp index 76f34a2fb..7b8a9a594 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/parameters.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 @@ -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 -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 -struct options_type -{ - // TODO: awulkiew - use static assert -}; - -template -struct options_type< linear > -{ - typedef options< - linear, - insert_default_tag, - choose_by_content_diff_tag, - split_default_tag, - linear_tag, - node_d_mem_static_tag - > type; -}; - -template -struct options_type< quadratic > -{ - typedef options< - quadratic, - insert_default_tag, - choose_by_content_diff_tag, - split_default_tag, - quadratic_tag, - node_d_mem_static_tag - > type; -}; - -template -struct options_type< rstar > -{ - typedef options< - rstar, - insert_reinsert_tag, - choose_by_overlap_diff_tag, - split_default_tag, - rstar_tag, - node_d_mem_static_tag - > type; -}; - -//template -//struct options_type< kmeans > -//{ -// typedef options< -// kmeans, -// 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 diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 902a705d3..ee8554ba6 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -18,113 +18,14 @@ // TODO: awulkiew - temporary #include +#include + /*! \defgroup predicates Spatial predicates (boost::geometry::index::) */ namespace boost { namespace geometry { namespace index { -namespace detail { - -// predicates - -struct empty {}; - -template -struct value -{ - value(ValuePredicate const& vpred) : value_predicate(vpred) {} - ValuePredicate value_predicate; -}; - -template -struct covered_by -{ - covered_by(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct disjoint -{ - disjoint(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct intersects -{ - intersects(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct overlaps -{ - overlaps(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -//template -//struct touches -//{ -// touches(Geometry const& g) : geometry(g) {} -// Geometry geometry; -//}; - -template -struct within -{ - within(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct not_covered_by -{ - not_covered_by(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct not_disjoint -{ - not_disjoint(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct not_intersects -{ - not_intersects(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct not_overlaps -{ - not_overlaps(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -//template -//struct not_touches -//{ -// not_touches(Geometry const& g) : geometry(g) {} -// Geometry geometry; -//}; - -template -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 within(Geometry const& g) return detail::within(g); } -namespace detail -{ - -// predicate check - -// TODO: awulkiew - consider passing Value/Node and Translator instead of -// Value and Indexable - -template -struct predicate_check -{ - template - static inline bool apply(Geometry const& g, Value const&, Indexable const& i) - { - return geometry::intersects(i, g); - } -}; - -template -struct predicate_check -{ - template - static inline bool apply(Geometry const&, Value const&, Indexable const&) - { - return true; - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(value const& p, Value const& v, Indexable const&) - { - return p.value_predicate(v); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(covered_by const& p, Value const&, Indexable const& i) - { - return geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(disjoint const& p, Value const&, Indexable const& i) - { - return geometry::disjoint(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(intersects const& p, Value const&, Indexable const& i) - { - return geometry::intersects(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(overlaps const& p, Value const&, Indexable const& i) - { - return geometry::overlaps(i, p.geometry); - } -}; - -//template -//struct predicate_check, Tag> -//{ -// template -// static inline bool apply(touches const& p, Value const&, Indexable const& i) -// { -// return geometry::touches(i, p.geometry); -// } -//}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(within const& p, Value const&, Indexable const& i) - { - return geometry::within(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_covered_by const& p, Value const&, Indexable const& i) - { - return !geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_disjoint const& p, Value const&, Indexable const& i) - { - return !geometry::disjoint(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_intersects const& p, Value const&, Indexable const& i) - { - return !geometry::intersects(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_overlaps const& p, Value const&, Indexable const& i) - { - return !geometry::overlaps(i, p.geometry); - } -}; - -//template -//struct predicate_check, Tag> -//{ -// template -// static inline bool apply(not_touches const& p, Value const&, Indexable const& i) -// { -// return !geometry::touches(i, p.geometry); -// } -//}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_within const& p, Value const&, Indexable const& i) - { - return !geometry::within(i, p.geometry); - } -}; - -// predicates check - -template -struct predicates_check_tuple -{ - template - static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) - { - return predicates_check_tuple::apply(p, v, i) - && predicate_check< - typename boost::tuples::element::type, - Tag - >::apply(boost::get(p), v, i); - } -}; - -template -struct predicates_check_tuple -{ - template - 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 -struct predicates_check_impl -{ - template - static inline bool apply(Predicate const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p, v, i); - } -}; - -template -struct predicates_check_impl, Tag> -{ - template - static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p.first, v, i) - && predicate_check::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, - Tag -> -{ - typedef boost::tuple predicates_type; - - template - static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) - { - return predicates_check_tuple< - predicates_type, - Tag, - boost::tuples::length::value - >::apply(p, v, i); - } -}; - -template -inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i) -{ - return detail::predicates_check_impl - ::apply(p, v, i); -} - -} // namespace detail - }}} // namespace boost::geometry::index // operator! generators diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree.hpp similarity index 97% rename from include/boost/geometry/extensions/index/rtree/rtree.hpp rename to include/boost/geometry/extensions/index/rtree.hpp index 830e16ebc..e5b364e9f 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree.hpp @@ -19,31 +19,32 @@ #include -#include -#include +#include +#include #include -#include +#include #include -#include +#include +#include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -//#include +#include +#include +#include +//#include #include diff --git a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp deleted file mode 100644 index 73e10e188..000000000 --- a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp +++ /dev/null @@ -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 -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { - -// distance_calc - -template -struct distances_calc< - PointRelation, - Box, - rtree::node_tag> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(PointRelation const& p, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(p), i); - return res; - } -}; - -template -struct distances_calc< - detail::unbounded, - Box, - rtree::node_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(detail::unbounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::min_bounded, - Box, - rtree::node_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::min_bounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::max_bounded, - Box, - rtree::node_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef cdist result_type; - - static inline result_type apply(detail::max_bounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::bounded, - Box, - rtree::node_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::bounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -// distance_predicate_check - -template -struct distances_predicates_check< - PointRelation, - Box, - rtree::node_tag> -{ - template - static inline bool apply(PointRelation const&, Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::unbounded, - Box, - rtree::node_tag> -{ - template - static inline bool apply( - detail::unbounded const&, - Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::min_bounded, - Box, - rtree::node_tag> -{ - template - static inline bool apply( - detail::min_bounded const& pred, - Distances const& d) - { - return pred.comparable_min - <= cdist_value::template get(d); - } -}; - -template -struct distances_predicates_check< - detail::max_bounded, - Box, - rtree::node_tag> -{ - template - static inline bool apply( - detail::max_bounded const& pred, - Distances const& d) - { - return cdist_value::template get(d) - <= pred.comparable_max; - } -}; - -template -struct distances_predicates_check< - detail::bounded, - Box, - rtree::node_tag> -{ - template - static inline bool apply( - detail::bounded const& pred, - Distances const& d) - { - return pred.comparable_min - <= cdist_value::template get(d) - && cdist_value::template get(d) - <= pred.comparable_max; - } -}; - -} // namespace detail - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp deleted file mode 100644 index 106d938b7..000000000 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ /dev/null @@ -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 -#include - -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 -struct predicate_check -{ - template - static inline bool apply(Geometry const& g, Value const&, Indexable const& i) - { - return geometry::intersects(i, g); - } -}; - -template <> -struct predicate_check -{ - template - static inline bool apply(Geometry const&, Value const&, Indexable const&) - { - return true; - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(value const&, Value const&, Box const&) - { - return true; - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(covered_by const& p, Value const&, Box const& i) - { - return geometry::intersects(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(disjoint const& p, Value const&, Box const& i) - { - return !geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static inline bool apply(intersects const& p, Value const&, Indexable const& i) - { - return geometry::intersects(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static inline bool apply(overlaps 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 -//struct predicate_check, rtree::node_tag> -//{ -// template -// static bool apply(touches const& p, Value const&, Box const& i) -// { -// return geometry::intersects(i, p.geometry); -// } -//}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(within 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 -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_covered_by const& p, Value const&, Box const& i) - { - return !geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_disjoint const& p, Value const&, Box const& i) - { - return !geometry::disjoint(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_intersects const& p, Value const&, Box const& i) - { - return !geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_overlaps const& p, Value const&, Box const& i) - { - return true; - } -}; - -//template -//struct predicate_check, rtree::node_tag> -//{ -// template -// static bool apply(not_touches const& p, Value const&, Box const& i) -// { -// return !geometry::intersects(i, p.geometry); -// } -//}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_within 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 diff --git a/test/geometry_index_test_common.hpp b/test/geometry_index_test_common.hpp index 35e623d86..770657d48 100644 --- a/test/geometry_index_test_common.hpp +++ b/test/geometry_index_test_common.hpp @@ -12,7 +12,7 @@ #include #define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE -#include +#include #include diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index 2e279a121..365dae009 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -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 ); } } diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 05896776b..bc341c315 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -16,10 +16,8 @@ #include #include -#include - -#include -#include +#include +#include //#include //#include @@ -549,9 +547,9 @@ void test_exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Ran template void test_spatial_query(Rtree & rtree, Predicates const& pred, std::vector 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 output; size_t n = rtree.spatial_query(pred, std::back_inserter(output)); diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 735510e61..138a27de8 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -14,16 +14,12 @@ #include -#include +#include #include namespace boost { namespace geometry { namespace index { -// options implementation (from options.hpp) - -struct node_throwing_d_mem_static_tag {}; - template struct linear_throwing : public linear {}; @@ -35,6 +31,10 @@ struct rstar_throwing : public rstar struct options_type< linear_throwing > { @@ -109,7 +109,7 @@ struct dynamic_leaf -struct container_from_elements_type, NewValue> +struct container_from_elements_type, NewValue> { typedef throwing_static_vector type; }; diff --git a/test/rtree/test_throwing.hpp b/test/rtree/test_throwing.hpp index 40d823b37..acc9d4a7a 100644 --- a/test/rtree/test_throwing.hpp +++ b/test/rtree/test_throwing.hpp @@ -141,185 +141,7 @@ struct generate_value< std::pair, throwing_value> > // //}}} // namespace boost::geometry::index -#include - -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::max)(); return mc; } -}; - -template -class throwing_pushable_array -{ - typedef typename boost::array 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 m_array; - size_type m_size; -}; - -#include +#include 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 class throwing_static_vector - : public boost::geometry::index::static_vector + : public boost::geometry::index::detail::static_vector { - typedef boost::geometry::index::static_vector container; + typedef boost::geometry::index::detail::static_vector 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); } };