diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 558e8654e..7b2858581 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -195,9 +195,24 @@ A wrapper around user-defined UnaryPredicate checking if Value should be returne [heading Example] `` -bool is_red(Value const& v) { ... } -... -bgi::query(spatial_index, bgi::intersects(box) && bgi::satisfies(is_red), std::back_inserter(result)); +bool is_red(__value__ const& v) { return v.is_red(); } + +struct is_red_o { +template bool operator()(__value__ const& v) { return v.is_red(); } +} + +// ... + +rt.query(index::intersects(box) && index::satisfies(is_red), +std::back_inserter(result)); + +rt.query(index::intersects(box) && index::satisfies(is_red_o()), +std::back_inserter(result)); + +#ifndef BOOST_NO_CXX11_LAMBDAS +rt.query(index::intersects(box) && index::satisfies([](__value__ const& v) { return v.is_red(); }), +std::back_inserter(result)); +#endif `` diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 08affd337..cc9b648d1 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -609,11 +609,11 @@ This query function performs spatial and k-nearest neighbor searches. It allows [*Spatial predicates] -The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: +Spatial predicates may be generated by one of the functions listed below: * [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], * [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], * [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], @@ -626,11 +626,11 @@ It is possible to negate spatial predicates: * [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -[*Value predicate] +[*Satisfies predicate] -This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: +This is a special kind of predicate which allows to pass a user-defined function or function object which checks if Value should be returned by the query. It's generated by: -* [^`boost::geometry::index::value()`]. +* [^[link group__predicates_1gae7e9291c5b99041fb155d29de0860bab boost::geometry::index::satisfies()]]. [*Nearest predicate] @@ -659,7 +659,7 @@ The number of values found. `` // return elements intersecting box -tree.query(box, std::back_inserter(result)); +tree.query(bgi::intersects(box), std::back_inserter(result)); // return elements intersecting poly but not within box tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun unary predicate diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 60110d045..466b7146f 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -181,11 +181,11 @@ This query function performs spatial and k-nearest neighbor searches. It allows [*Spatial predicates] -The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: +Spatial predicates may be generated by one of the functions listed below: * [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], * [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], * [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], @@ -198,11 +198,11 @@ It is possible to negate spatial predicates: * [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -[*Value predicate] +[*Satisfies predicate] -This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: +This is a special kind of predicate which allows to pass a user-defined function or function object which checks if Value should be returned by the query. It's generated by: -* [^`boost::geometry::index::value()`]. +* [^[link group__predicates_1gae7e9291c5b99041fb155d29de0860bab boost::geometry::index::satisfies()]]. [*Nearest predicate] @@ -238,7 +238,7 @@ The number of values found. `` // return elements intersecting box -bgi::query(tree, box, std::back_inserter(result)); +bgi::query(tree, bgi::intersects(box), std::back_inserter(result)); // return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun value predicate diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index dd5718dbb..c00e43835 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 3b11e3a94..4bf610979 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + @@ -57,8 +57,8 @@ queries
Nearest neighbours queries
-
Satisfies - predicate
+
user-defined + unary predicate
Passing a set of predicates
Inserting 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 582f76640..5a53f97f9 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 = index::translator<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<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 8dc523bbc..74f9022ec 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 @@ -181,13 +181,13 @@

          - Implementation + Implementation details

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

          -
            +
            • capable to store arbitrary Value type,
            • @@ -211,7 +211,7 @@
            - Dependencies + Dependencies

            R-tree depends on Boost.Move, Boost.Container, Boost.Tuple, @@ -219,7 +219,7 @@

            - Contributors + Contributors

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

            - Spatial + Spatial thanks

            @@ -235,20 +235,20 @@ J. Simonson for their support and ideas.

            -

            -

            [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/queries.html b/doc/html/geometry_index/r_tree/queries.html index 304a999e6..2429cdc5f 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -3,7 +3,7 @@ Queries - + @@ -33,8 +33,8 @@ queries
Nearest neighbours queries
-
Satisfies - predicate
+
user-defined + unary predicate
Passing a set of predicates
Inserting @@ -44,24 +44,24 @@ Queries returns Values which meets some predicates. Currently supported are three types of predicates:

-

- There are three ways to perform a query. In the following example Box - is used as the predicate, this is a default spatial predicate described - in the following section. Following queries returns Values - intersecting some region defined as a Box. - These three ways are: + There are three ways to perform a query presented below. All of them returns + Values intersecting some region defined as a Box.

Method call

std::vector<Value> returned_values;
 Box box_region(...);
-rt.query(box_region, std::back_inserter(returned_values));
+rt.query(bgi::intersects(box_region), std::back_inserter(returned_values));
 

Function call

std::vector<Value> returned_values;
 Box box_region(...);
-index::query(rt, box_region, std::back_inserter(returned_values));
+index::query(rt, bgi::intersects(box_region), std::back_inserter(returned_values));
 

Use of pipe operator generating a range

Box box_region(...);
-BOOST_FOREACH(Value & v, rt | index::adaptors::queried(box_region))
+BOOST_FOREACH(Value & v, rt | index::adaptors::queried(bgi::intersects(box_region)))
   ; // do something with v
 
@@ -113,7 +110,7 @@

Spatial query returns Values which are related somehow to - a geometry or some number of geometries. Names of spatial predicates corresponds + some Geometry - box, polygon, etc. Names of spatial predicates corresponds to names of Boost.Geometry algorithms. Examples of some basic queries may be found in tables below. The query region and result Values @@ -224,12 +221,10 @@

- To use a spatial predicate one may pass a geometry (which is a default - case) or use one of the functions defined in boost::geometry::index - namespace to define it explicitly. + To use a spatial predicate one may use one of the functions defined in + boost::geometry::index namespace.

-
rt.query(box, std::back_inserter(result));                    // default case - intersects
-rt.query(index::intersects(box), std::back_inserter(result)); // the same as default
+
rt.query(index::intersects(box), std::back_inserter(result));
 rt.query(index::covered_by(box), std::back_inserter(result));
 rt.query(index::disjont(box), std::back_inserter(result));
 rt.query(index::overlaps(box), std::back_inserter(result));
@@ -250,10 +245,10 @@
 
 

Nearest neighbours queries returns Values which are closest - to some point in space. Additionally it is possible to pass define how - the distance to the Value - should be calculated. The examples of some knn queries may be found in - the table below. All queries returns 5 closest Values. + to some point in space. Additionally it is possible to define how the distance + to the Value should be + calculated. The examples of some knn queries may be found in the table + below. All queries return 5 closest Values. The query point and Values are orange.

@@ -314,23 +309,42 @@

- There is a unique predicate index::satisfies(...) taking user-defined function or function - object which checks if Value should be returned by the query. - It may be used to check some specific conditions for user-defined Values. + The user may pass a UnaryPredicate + - function, function object or lambda expression taking const reference + to Value and returning bool. This object may be passed to the query in + order to check if Value should be returned by the query. To + do it one may use index::satisfies() function like on the example below:

-
bool fun(Value const& v)
+
bool is_red(Value const& v)
 {
   return v.is_red();
 }
 
+struct is_red_o
+{
+  template <typename Value>
+  bool operator()(Value const& v)
+  {
+    return v.is_red();
+  }
+}
+
 // ...
 
-rt.query(index::intersects(box) && index::satisfies(fun),
+rt.query(index::intersects(box) && index::satisfies(is_red),
          std::back_inserter(result));
+
+rt.query(index::intersects(box) && index::satisfies(is_red_o()),
+         std::back_inserter(result));
+
+#ifndef BOOST_NO_CXX11_LAMBDAS
+rt.query(index::intersects(box) && index::satisfies([](Value const& v) { return v.is_red(); }),
+         std::back_inserter(result));
+#endif
 
@@ -387,7 +401,7 @@ /* some inserting into the tree */ std::vector<Value> result; -rt1.query(Box(/*...*/), std::back_inserter(result)); +rt1.query(bgi::intersects(Box(/*...*/)), std::back_inserter(result)); RTree rt2(result.begin(), result.end());

@@ -397,14 +411,14 @@ query results because temporary container won't be used.

RTree rt3;
-rt1.query(Box(/*...*/), bgi::inserter(rt3));
+rt1.query(bgi::intersects(Box(/*...*/))), bgi::inserter(rt3));
 

If you like Boost.Range you'll appreciate the third option. You may pass the result Range directly to the constructor. However in this case the temporary container is created.

-
RTree rt4(rt1 | bgi::adaptors::queried(Box(/*...*/)));
+
RTree rt4(rt1 | bgi::adaptors::queried(bgi::intersects(Box(/*...*/)))));
 
diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 783af34a2..520b75acd 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -50,7 +50,7 @@

- Description + Description

This is self-balancing spatial index capable to store various types of @@ -58,7 +58,7 @@

- Parameters + Parameters

The user must pass a type defining the Parameters which will be used in @@ -68,7 +68,7 @@

Predefined algorithms with compile-time parameters are:

-
    +
    • boost::geometry::index::linear,
    • @@ -82,7 +82,7 @@

      Predefined algorithms with run-time parameters are:

      -
        +
        - Translator + Translator

        The Translator translates from Value to Indexable each time r-tree requires @@ -112,14 +112,14 @@

        - Header + Header

        #include <boost/geometry/index/rtree.hpp>

        - Synopsis + Synopsis
        template<typename Value,
                  typename Parameters,
        @@ -132,7 +132,7 @@
         
        - Template + Template parameter(s)
        @@ -206,7 +206,7 @@
        - Typedef(s) + Typedef(s)
        @@ -314,7 +314,7 @@
        - Constructor(s) + Constructor(s) and destructor
        @@ -457,7 +457,7 @@
        - Member(s) + Member(s)
        @@ -780,13 +780,13 @@

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

        @@ -795,7 +795,7 @@

        - Parameter(s) + Parameter(s)
        @@ -861,7 +861,7 @@
        - Throws + Throws

        If allocator default constructor throws. @@ -877,7 +877,7 @@

        - Synopsis + Synopsis
        rtree(parameters_type const & parameters,
               translator_type const & translator,
        @@ -885,7 +885,7 @@
         
        - Parameter(s) + Parameter(s)
        @@ -968,7 +968,7 @@
        - Throws + Throws

        If allocator copy constructor throws. @@ -984,7 +984,7 @@

        - Synopsis + Synopsis
        template<typename Iterator>
         rtree(Iterator first,
        @@ -995,7 +995,7 @@
         
        - Parameter(s) + Parameter(s)
        @@ -1112,9 +1112,9 @@
        - Throws + Throws
        -
          +
          • If allocator copy constructor throws.
          • @@ -1139,7 +1139,7 @@

            - Synopsis + Synopsis
            template<typename Range>
             rtree(Range const & rng,
            @@ -1149,7 +1149,7 @@
             
            - Modifier(s) + Modifier(s)

            @@ -1158,7 +1158,7 @@

            - Parameter(s) + Parameter(s)
            @@ -1259,9 +1259,9 @@
            - Throws + Throws
            -
              +
              • If allocator copy constructor throws.
              • @@ -1285,13 +1285,13 @@

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

                Nothing. @@ -1307,20 +1307,20 @@

                - Description + Description

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

                - Synopsis + Synopsis
                rtree(rtree const & src)
                 
                - Parameter(s) + Parameter(s)
                @@ -1366,9 +1366,9 @@
                - Throws + Throws
                -
                  +
                  • If allocator copy constructor throws.
                  • @@ -1393,20 +1393,20 @@

                    - 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)
                    @@ -1472,9 +1472,9 @@
                    - Throws + Throws
                    -
                      +
                      • If allocator copy constructor throws.
                      • @@ -1499,20 +1499,20 @@

                        - Description + Description

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

                        - Synopsis + Synopsis
                        rtree(rtree && src)
                         
                        - Parameter(s) + Parameter(s)
                        @@ -1558,7 +1558,7 @@
                        - Throws + Throws

                        Nothing. @@ -1574,20 +1574,20 @@

                        - Description + Description

                        It uses parameters and translator from the source tree.

                        - Synopsis + Synopsis
                        rtree(rtree && src, allocator_type const & allocator)
                         
                        - Parameter(s) + Parameter(s)
                        @@ -1653,9 +1653,9 @@
                        - Throws + Throws
                        -
                          +
                          • If allocator copy constructor throws.
                          • @@ -1681,20 +1681,20 @@

                            - Description + Description

                            It uses parameters and translator from the source tree.

                            - Synopsis + Synopsis
                            rtree & operator=(const rtree & src)
                             
                            - Parameter(s) + Parameter(s)
                            @@ -1740,9 +1740,9 @@
                            - Throws + Throws
                            -
                              +
                              • If Value copy constructor throws.
                              • @@ -1764,20 +1764,20 @@

                                - Description + Description

                                It uses parameters and translator from the source tree.

                                - Synopsis + Synopsis
                                rtree & operator=(rtree && src)
                                 
                                - Parameter(s) + Parameter(s)
                                @@ -1823,12 +1823,12 @@
                                - Throws + Throws

                                Only if allocators aren't equal.

                                -
                                  +
                                  • If Value copy constructor throws.
                                  • @@ -1850,20 +1850,20 @@

                                    - Description + Description

                                    Parameters, translator and allocators are swapped as well.

                                    - Synopsis + Synopsis
                                    void swap(rtree & other)
                                     
                                    - Parameter(s) + Parameter(s)
                                    @@ -1909,7 +1909,7 @@
                                    - Throws + Throws

                                    If allocators swap throws. @@ -1925,13 +1925,13 @@

                                    - Synopsis + Synopsis
                                    void insert(value_type const & value)
                                     
                                    - Parameter(s) + Parameter(s)
                                    @@ -1977,9 +1977,9 @@
                                    - Throws + Throws
                                    -
                                      +
                                      • If Value copy constructor or copy assignment throws.
                                      • @@ -2012,14 +2012,14 @@

                                        - Synopsis + Synopsis
                                        template<typename Iterator>
                                         void insert(Iterator first, Iterator last)
                                         
                                        - Parameter(s) + Parameter(s)
                                        @@ -2083,9 +2083,9 @@
                                        - Throws + Throws
                                        -
                                          +
                                          • If Value copy constructor or copy assignment throws.
                                          • @@ -2118,14 +2118,14 @@

                                            - Synopsis + Synopsis
                                            template<typename Range>
                                             void insert(Range const & rng)
                                             
                                            - Parameter(s) + Parameter(s)
                                            @@ -2171,9 +2171,9 @@
                                            - Throws + Throws
                                            -
                                              +
                                              • If Value copy constructor or copy assignment throws.
                                              • @@ -2206,7 +2206,7 @@

                                                - Description + Description

                                                In contrast to the std::set @@ -2215,13 +2215,13 @@

                                                - Synopsis + Synopsis
                                                size_type remove(value_type const & value)
                                                 
                                                - Parameter(s) + Parameter(s)
                                                @@ -2267,16 +2267,16 @@
                                                - Returns + Returns

                                                1 if the value was removed, 0 otherwise.

                                                - Throws + Throws
                                                -
                                                  +
                                                  • If Value copy constructor or copy assignment throws.
                                                  • @@ -2309,7 +2309,7 @@

                                                    - Description + Description

                                                    In contrast to the std::set @@ -2320,14 +2320,14 @@

                                                    - Synopsis + Synopsis
                                                    template<typename Iterator>
                                                     size_type remove(Iterator first, Iterator last)
                                                     
                                                    - Parameter(s) + Parameter(s)
                                                    @@ -2391,16 +2391,16 @@
                                                    - Returns + Returns

                                                    The number of removed values.

                                                    - Throws + Throws
                                                    -
                                                      +
                                                      • If Value copy constructor or copy assignment throws.
                                                      • @@ -2433,7 +2433,7 @@

                                                        - Description + Description

                                                        In contrast to the std::set @@ -2443,14 +2443,14 @@

                                                        - Synopsis + Synopsis
                                                        template<typename Range>
                                                         size_type remove(Range const & rng)
                                                         
                                                        - Parameter(s) + Parameter(s)
                                                        @@ -2496,16 +2496,16 @@
                                                        - Returns + Returns

                                                        The number of removed values.

                                                        - Throws + Throws
                                                        -
                                                          +
                                                          • If Value copy constructor or copy assignment throws.
                                                          • @@ -2539,7 +2539,7 @@

                                                            - Description + Description

                                                            This query function performs spatial and k-nearest neighbor searches. @@ -2550,12 +2550,9 @@ Spatial predicates

                                                            - The simplest form of spatial predicate is a Geometry. - In this case Values intersecting the Geometry - are returned. More spatial predicates may be generated by one of the - functions listed below: + Spatial predicates may be generated by one of the functions listed below:

                                                            -
                                                              +
                                                              • boost::geometry::index::covered_by(),
                                                              • @@ -2563,8 +2560,7 @@ boost::geometry::index::disjoint(),
                                                              • - boost::geometry::index::intersects() - - default, + boost::geometry::index::intersects(),
                                                              • boost::geometry::index::overlaps(), @@ -2576,7 +2572,7 @@

                                                                It is possible to negate spatial predicates:

                                                                -
                                                                - Functions + Functions
                                                                @@ -3296,7 +3292,7 @@

                                                                - Description + Description

                                                                It calls rtree::insert(value_type @@ -3304,7 +3300,7 @@

                                                                - Synopsis + Synopsis
                                                                template<typename Value,
                                                                          typename Options,
                                                                @@ -3314,7 +3310,7 @@
                                                                 
                                                                - Parameter(s) + Parameter(s)
                                                                @@ -3393,7 +3389,7 @@

                                                                - Description + Description

                                                                It calls rtree::insert(Iterator, @@ -3401,7 +3397,7 @@

                                                                - Synopsis + Synopsis
                                                                template<typename Value,
                                                                          typename Options,
                                                                @@ -3414,7 +3410,7 @@
                                                                 
                                                                - Parameter(s) + Parameter(s)
                                                                @@ -3509,7 +3505,7 @@

                                                                - Description + Description

                                                                It calls rtree::insert(Range @@ -3517,7 +3513,7 @@

                                                                - Synopsis + Synopsis
                                                                template<typename Value,
                                                                          typename Options,
                                                                @@ -3528,7 +3524,7 @@
                                                                 
                                                                - Parameter(s) + Parameter(s)
                                                                @@ -3607,7 +3603,7 @@

                                                                - Description + Description

                                                                Remove a value from the container. In contrast to the std::set or std::map erase() method this function removes @@ -3619,7 +3615,7 @@

                                                                - Synopsis + Synopsis
                                                                template<typename Value,
                                                                          typename Options,
                                                                @@ -3629,7 +3625,7 @@
                                                                 
                                                                - Parameter(s) + Parameter(s)
                                                                @@ -3699,7 +3695,7 @@
                                                                - Returns + Returns

                                                                1 if value was removed, 0 otherwise. @@ -3715,7 +3711,7 @@

                                                                - Description + Description

                                                                Remove a range of values from the container. In contrast to the std::set or std::map erase() method it doesn't take iterators @@ -3729,7 +3725,7 @@

                                                                - Synopsis + Synopsis
                                                                template<typename Value,
                                                                          typename Options,
                                                                @@ -3742,7 +3738,7 @@
                                                                 
                                                                - Parameter(s) + Parameter(s)
                                                                @@ -3828,7 +3824,7 @@
                                                                - Returns + Returns

                                                                The number of removed values. @@ -3844,7 +3840,7 @@

                                                                - Description + Description

                                                                Remove a range of values from the container. In contrast to the std::set or std::map erase() method it removes values @@ -3857,7 +3853,7 @@

                                                                - Synopsis + Synopsis
                                                                template<typename Value,
                                                                          typename Options,
                                                                @@ -3868,7 +3864,7 @@
                                                                 
                                                                - Parameter(s) + Parameter(s)
                                                                @@ -3938,7 +3934,7 @@
                                                                - Returns + Returns

                                                                The number of removed values. @@ -3955,7 +3951,7 @@

                                                                - Description + Description

                                                                This query function performs spatial and k-nearest neighbor searches. @@ -3966,12 +3962,9 @@ Spatial predicates

                                                                - The simplest form of spatial predicate is a Geometry. - In this case Values intersecting the Geometry - are returned. More spatial predicates may be generated by one of the - functions listed below: + Spatial predicates may be generated by one of the functions listed below:

                                                                -
                                                                  +
                                                                  • boost::geometry::index::covered_by(),
                                                                  • @@ -3979,8 +3972,7 @@ boost::geometry::index::disjoint(),
                                                                  • - boost::geometry::index::intersects() - - default, + boost::geometry::index::intersects(),
                                                                  • boost::geometry::index::overlaps(), @@ -3992,7 +3984,7 @@

                                                                    It is possible to negate spatial predicates:

                                                                    -
                                                                      +

                                                                      - Value predicate + Satisfies predicate

                                                                      This is a special kind of predicate which allows to pass a user-defined - functor which checks if Value should be returned by the query. It's generated - by: + function or function object which checks if Value should be returned + by the query. It's generated by:

                                                                      -
                                                                      - Functions + Functions
                                                                      @@ -6419,7 +6426,7 @@

                                                                      - Description + Description

                                                                      Generate a nearest query Point and Value's Indexable relationship while @@ -6432,14 +6439,14 @@

                                                                      - Synopsis + Synopsis
                                                                      template<typename T>
                                                                       detail::to_nearest<T> boost::geometry::index::to_nearest(T const & v)
                                                                       
                                                                      - Template + Template parameter(s)
                                                                      @@ -6475,7 +6482,7 @@
                                                                      - Parameter(s) + Parameter(s)
                                                                      @@ -6531,7 +6538,7 @@

                                                                      - Description + Description

                                                                      Generate a nearest query Point and Value's Indexable relationship while @@ -6542,14 +6549,14 @@

                                                                      - Synopsis + Synopsis
                                                                      template<typename T>
                                                                       detail::to_centroid<T> boost::geometry::index::to_centroid(T const & v)
                                                                       
                                                                      - Template + Template parameter(s)
                                                                      @@ -6585,7 +6592,7 @@
                                                                      - Parameter(s) + Parameter(s)
                                                                      @@ -6641,7 +6648,7 @@

                                                                      - Description + Description

                                                                      Generate a nearest query Point and Value's Indexable relationship while @@ -6654,14 +6661,14 @@

                                                                      - Synopsis + Synopsis
                                                                      template<typename T>
                                                                       detail::to_furthest<T> boost::geometry::index::to_furthest(T const & v)
                                                                       
                                                                      - Template + Template parameter(s)
                                                                      @@ -6697,7 +6704,7 @@
                                                                      - Parameter(s) + Parameter(s)
                                                                      @@ -6750,7 +6757,7 @@
                                                                      - Functions + Functions
                                                                      @@ -6793,14 +6800,14 @@

                                                                      - Synopsis + Synopsis
                                                                      template<typename Predicates>
                                                                       detail::query<Predicates> boost::geometry::index::adaptors::queried(Predicates const & pred)
                                                                       
                                                                      - Parameter(s) + Parameter(s)
                                                                      @@ -6852,7 +6859,7 @@
                                                                      - Functions + Functions
                                                                      @@ -6894,7 +6901,7 @@

                                                                      - Description + Description

                                                                      Returns insert iterator capable to insert values to the container (spatial @@ -6902,14 +6909,14 @@

                                                                      - Synopsis + Synopsis
                                                                      template<typename Container>
                                                                       insert_iterator<Container> boost::geometry::index::inserter(Container & c)
                                                                       
                                                                      - Parameter(s) + Parameter(s)
                                                                      @@ -6955,7 +6962,7 @@
                                                                      - Returns + Returns

                                                                      The insert iterator inserting values to the container. diff --git a/doc/html/geometry_index/r_tree/rtree_examples.html b/doc/html/geometry_index/r_tree/rtree_examples.html index 03a8c2071..b803abc4e 100644 --- a/doc/html/geometry_index/r_tree/rtree_examples.html +++ b/doc/html/geometry_index/r_tree/rtree_examples.html @@ -3,7 +3,7 @@ Examples - + @@ -86,7 +86,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -179,7 +179,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -264,7 +264,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -404,7 +404,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -493,7 +493,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -588,7 +588,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -699,7 +699,7 @@ std::cout << "Child: Querying for objects intersecting box = [(45, 45)(55, 55)]\n"; std::vector<B> result; - unsigned k = tree->query(B(P(45, 45), P(55, 55)), std::back_inserter(result)); + unsigned k = tree->query(bgi::intersects(B(P(45, 45), P(55, 55))), std::back_inserter(result)); std::cout << "Child: Found objects:\n"; std::cout << k << "\n"; diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 22a62ca05..d0516c114 100644 --- a/doc/html/geometry_index/r_tree/rtree_quickstart.html +++ b/doc/html/geometry_index/r_tree/rtree_quickstart.html @@ -3,7 +3,7 @@ Quick Start - + @@ -116,7 +116,7 @@

                                                                      // find values intersecting some area defined by a box
                                                                       box query_box(point(0, 0), point(5, 5));
                                                                       std::vector<value> result_s;
                                                                      -rtree.query(query_box, std::back_inserter(result_s));
                                                                      +rtree.query(bgi::intersects(query_box), std::back_inserter(result_s));
                                                                       

                                                                      @@ -156,7 +156,7 @@

                                                                      - More + More

                                                                      More information about the R-tree implementation, other algorithms and queries diff --git a/doc/html/index.html b/doc/html/index.html index 7a78e45d9..478437542 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -51,7 +51,7 @@

                                                                  - +

                                                                  Last revised: March 01, 2013 at 02:58:06 GMT

                                                                  Last revised: March 01, 2013 at 18:11:11 GMT


                                                                  diff --git a/doc/rtree/query.qbk b/doc/rtree/query.qbk index e905180d6..f13e87393 100644 --- a/doc/rtree/query.qbk +++ b/doc/rtree/query.qbk @@ -13,8 +13,8 @@ Queries returns `__value__`s which meets some predicates. Currently supported are three types of predicates: * spatial predicates - defining relationship between stored Values and some Geometry, -* nearest predicates - defining relationship between stored Values and some Point, -* satisfies predicate - allows to pass user-defined UnaryPredicate (function or function object) to the query. +* nearest predicate - defining relationship between stored Values and some Point, +* user-defined unary predicate - function, function object or lambda expression checking user-defined condition. For example queries may be used to retrieve Values: @@ -24,34 +24,32 @@ For example queries may be used to retrieve Values: [section Performing a query] -There are three ways to perform a query. In the following example `__box__` is used as -the predicate, this is a default spatial predicate described in the following section. -Following queries returns `__value__`s intersecting some region defined as a `__box__`. -These three ways are: +There are three ways to perform a query presented below. All of them returns `__value__`s intersecting some +region defined as a `__box__`. Method call std::vector<__value__> returned_values; __box__ box_region(...); - rt.query(box_region, std::back_inserter(returned_values)); + rt.query(bgi::intersects(box_region), std::back_inserter(returned_values)); Function call std::vector<__value__> returned_values; __box__ box_region(...); - index::query(rt, box_region, std::back_inserter(returned_values)); + index::query(rt, bgi::intersects(box_region), std::back_inserter(returned_values)); Use of pipe operator generating a range __box__ box_region(...); - BOOST_FOREACH(__value__ & v, rt | index::adaptors::queried(box_region)) + BOOST_FOREACH(__value__ & v, rt | index::adaptors::queried(bgi::intersects(box_region))) ; // do something with v [endsect] [section Spatial queries] -Spatial query returns `__value__`s which are related somehow to a geometry or some number of geometries. +Spatial query returns `__value__`s which are related somehow to some Geometry - box, polygon, etc. Names of spatial predicates corresponds to names of __boost_geometry__ algorithms. Examples of some basic queries may be found in tables below. The query region and result `Value`s are orange. @@ -65,11 +63,9 @@ basic queries may be found in tables below. The query region and result `Value`s [[[$../images/intersects_ring.png]] [[$../images/intersects_poly.png]] [[$../images/intersects_mpoly.png]]] ] -To use a spatial predicate one may pass a geometry (which is a default case) or use one of the functions defined in -`boost::geometry::index` namespace to define it explicitly. +To use a spatial predicate one may use one of the functions defined in `boost::geometry::index` namespace. - rt.query(box, std::back_inserter(result)); // default case - intersects - rt.query(index::intersects(box), std::back_inserter(result)); // the same as default + rt.query(index::intersects(box), std::back_inserter(result)); rt.query(index::covered_by(box), std::back_inserter(result)); rt.query(index::disjont(box), std::back_inserter(result)); rt.query(index::overlaps(box), std::back_inserter(result)); @@ -86,8 +82,8 @@ All predicates may be negated, e.g.: [section Nearest neighbours queries] Nearest neighbours queries returns `__value__`s which are closest to some point in space. -Additionally it is possible to pass define how the distance to the `Value` should be calculated. -The examples of some knn queries may be found in the table below. All queries returns 5 closest `Values`. +Additionally it is possible to define how the distance to the `Value` should be calculated. +The examples of some knn queries may be found in the table below. All queries return 5 closest `Values`. The query point and Values are orange. [$../images/knn.png] @@ -134,22 +130,39 @@ a relation object generated as follows: [endsect] -[section Satisfies predicate] +[section user-defined unary predicate] -There is a unique predicate `index::satisfies(...)` taking user-defined function or function object -which checks if `__value__` should be returned by the query. It may be used to check -some specific conditions for user-defined Values. +The user may pass a `UnaryPredicate` - function, function object or lambda expression taking const reference to Value and returning bool. +This object may be passed to the query in order to check if `__value__` should be returned by the query. To do it one +may use `index::satisfies()` function like on the example below: - bool fun(__value__ const& v) + bool is_red(__value__ const& v) { return v.is_red(); } + struct is_red_o + { + template + bool operator()(__value__ const& v) + { + return v.is_red(); + } + } + // ... - rt.query(index::intersects(box) && index::satisfies(fun), + rt.query(index::intersects(box) && index::satisfies(is_red), std::back_inserter(result)); + rt.query(index::intersects(box) && index::satisfies(is_red_o()), + std::back_inserter(result)); + + #ifndef BOOST_NO_CXX11_LAMBDAS + rt.query(index::intersects(box) && index::satisfies([](__value__ const& v) { return v.is_red(); }), + std::back_inserter(result)); + #endif + [endsect] [section Passing a set of predicates] @@ -189,7 +202,7 @@ The most basic way is creating a temporary container for Values and insert them /* some inserting into the tree */ std::vector result; - rt1.query(Box(/*...*/), std::back_inserter(result)); + rt1.query(bgi::intersects(Box(/*...*/)), std::back_inserter(result)); RTree rt2(result.begin(), result.end()); However there are better ways. One of these methods is mentioned in the "Creation and modification" section. @@ -197,12 +210,12 @@ The insert iterator may be passed directly to the query, which will be the faste query results because temporary container won't be used. RTree rt3; - rt1.query(Box(/*...*/), bgi::inserter(rt3)); + rt1.query(bgi::intersects(Box(/*...*/))), bgi::inserter(rt3)); If you like Boost.Range you'll appreciate the third option. You may pass the result Range directly to the constructor. However in this case the temporary container is created. - RTree rt4(rt1 | bgi::adaptors::queried(Box(/*...*/))); + RTree rt4(rt1 | bgi::adaptors::queried(bgi::intersects(Box(/*...*/))))); [endsect] diff --git a/doc/src/examples/rtree/interprocess.cpp b/doc/src/examples/rtree/interprocess.cpp index 1b59451b9..4260ffdf1 100644 --- a/doc/src/examples/rtree/interprocess.cpp +++ b/doc/src/examples/rtree/interprocess.cpp @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) std::cout << "Child: Querying for objects intersecting box = [(45, 45)(55, 55)]\n"; std::vector result; - unsigned k = tree->query(B(P(45, 45), P(55, 55)), std::back_inserter(result)); + unsigned k = tree->query(bgi::intersects(B(P(45, 45), P(55, 55))), std::back_inserter(result)); std::cout << "Child: Found objects:\n"; std::cout << k << "\n"; diff --git a/doc/src/examples/rtree/polygons_shared_ptr.cpp b/doc/src/examples/rtree/polygons_shared_ptr.cpp index 210fb27ad..5886fbf04 100644 --- a/doc/src/examples/rtree/polygons_shared_ptr.cpp +++ b/doc/src/examples/rtree/polygons_shared_ptr.cpp @@ -63,7 +63,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/doc/src/examples/rtree/polygons_vector.cpp b/doc/src/examples/rtree/polygons_vector.cpp index 3fa6cb51f..e64e574a1 100644 --- a/doc/src/examples/rtree/polygons_vector.cpp +++ b/doc/src/examples/rtree/polygons_vector.cpp @@ -71,7 +71,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index f25b2383c..efa4b3584 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -57,7 +57,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); //] //[rtree_quickstart_nearest_query diff --git a/doc/src/examples/rtree/translator_index.cpp b/doc/src/examples/rtree/translator_index.cpp index ea629f6c2..978b7dbae 100644 --- a/doc/src/examples/rtree/translator_index.cpp +++ b/doc/src/examples/rtree/translator_index.cpp @@ -73,7 +73,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/doc/src/examples/rtree/translator_shared_ptr.cpp b/doc/src/examples/rtree/translator_shared_ptr.cpp index b40e561b5..52e26a280 100644 --- a/doc/src/examples/rtree/translator_shared_ptr.cpp +++ b/doc/src/examples/rtree/translator_shared_ptr.cpp @@ -67,7 +67,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/doc/src/examples/rtree/variants_map.cpp b/doc/src/examples/rtree/variants_map.cpp index 38fd9aafc..427c5567c 100644 --- a/doc/src/examples/rtree/variants_map.cpp +++ b/doc/src/examples/rtree/variants_map.cpp @@ -118,7 +118,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/example/benchmark.cpp b/example/benchmark.cpp index fad858aa4..12a38ff3c 100644 --- a/example/benchmark.cpp +++ b/example/benchmark.cpp @@ -91,7 +91,7 @@ int main() float x = coords[i].first; float y = coords[i].second; result.clear(); - t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } dur_t time = clock_t::now() - start; diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index e58aa511b..93874aa40 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -20,8 +20,7 @@ namespace boost { namespace geometry { namespace index { namespace detail { // predicates // ------------------------------------------------------------------ // -// not needed? -struct empty {}; +//struct empty {}; template struct satisfies @@ -125,43 +124,102 @@ struct nearest unsigned count; }; +// ------------------------------------------------------------------ // +// is_predicate +// ------------------------------------------------------------------ // + +//template struct is_predicate { static const bool value = false; }; +////template <> struct is_predicate< empty > { static const bool value = true; }; +//template struct is_predicate< satisfies > { static const bool value = true; }; +//template struct is_predicate< covered_by > { static const bool value = true; }; +//template struct is_predicate< disjoint > { static const bool value = true; }; +//template struct is_predicate< intersects > { static const bool value = true; }; +//template struct is_predicate< overlaps > { static const bool value = true; }; +////template struct is_predicate< touches > { static const bool value = true; }; +//template struct is_predicate< within > { static const bool value = true; }; +//template struct is_predicate< not_covered_by > { static const bool value = true; }; +//template struct is_predicate< not_disjoint > { static const bool value = true; }; +//template struct is_predicate< not_intersects > { static const bool value = true; }; +//template struct is_predicate< not_overlaps > { static const bool value = true; }; +////template struct is_predicate< not_touches > { static const bool value = true; }; +//template struct is_predicate< not_within > { static const bool value = true; }; +//template struct is_predicate< nearest

                                                                  > { static const bool value = true; }; + +// ------------------------------------------------------------------ // +// predicate_check_default +// ------------------------------------------------------------------ // + +//template +//struct predicate_check_default +//{ +// BOOST_MPL_ASSERT_MSG( +// (false), +// NOT_IMPLEMENTED_FOR_THESE_TAGS, +// (predicate_check_default)); +//}; + // ------------------------------------------------------------------ // // predicate_check // ------------------------------------------------------------------ // -template +template struct predicate_check { BOOST_MPL_ASSERT_MSG( (false), - NOT_IMPLEMENTED_FOR_THIS_TAG, + NOT_IMPLEMENTED_FOR_THIS_PREDICATE_OR_TAG, (predicate_check)); }; +// ------------------------------------------------------------------ // +// predicate_check_default for value +// ------------------------------------------------------------------ // + +//template +//struct predicate_check_default +//{ +// template +// static inline bool apply(Geometry const& g, Value const&, Indexable const& i) +// { +// return geometry::intersects(i, g); +// } +//}; +// +//template +//struct predicate_check_default +//{ +// template +// static inline bool apply(Unary const& u, Value const& v, Indexable const&) +// { +// return u(v); +// } +//}; + // ------------------------------------------------------------------ // // 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(GeometryOrUnary const& g, Value const& v, Indexable const& i) +// { +// return predicate_check_default< +// GeometryOrUnary, typename geometry::traits::tag::type, bounds_tag +// >::apply(g, v, i); +// } +//}; -// not needed? -template <> -struct predicate_check -{ - template - static inline bool apply(empty const&, Value const&, Indexable const&) - { - return true; - } -}; +//template <> +//struct predicate_check +//{ +// template +// static inline bool apply(empty const&, Value const&, Indexable const&) +// { +// return true; +// } +//}; template struct predicate_check, value_tag> @@ -304,28 +362,54 @@ struct predicate_check, value_tag> }; // ------------------------------------------------------------------ // -// predicates_chec for envelope +// predicate_check_default for bounds // ------------------------------------------------------------------ // -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_default +//{ +// template +// static inline bool apply(Geometry const& g, Value const&, Indexable const& i) +// { +// return geometry::intersects(i, g); +// } +//}; +// +//template +//struct predicate_check_default +//{ +// template +// static inline bool apply(Unary const&, Value const&, Indexable const&) +// { +// return true; +// } +//}; -template <> -struct predicate_check -{ - template - static inline bool apply(Geometry const&, Value const&, Indexable const&) - { - return true; - } -}; +// ------------------------------------------------------------------ // +// predicates_chec for bounds +// ------------------------------------------------------------------ // + +//template +//struct predicate_check +//{ +// template +// static inline bool apply(GeometryOrUnary const& g, Value const& v, Indexable const& i) +// { +// return predicate_check_default< +// GeometryOrUnary, typename geometry::traits::tag::type, bounds_tag +// >::apply(g, v, i); +// } +//}; + +//template <> +//struct predicate_check +//{ +// template +// static inline bool apply(Geometry const&, Value const&, Indexable const&) +// { +// return true; +// } +//}; template struct predicate_check, bounds_tag> @@ -481,17 +565,17 @@ struct predicates_length static const unsigned value = 1; }; -template -struct predicates_length< std::pair > -{ - static const unsigned value = 2; -}; +//template +//struct predicates_length< std::pair > +//{ +// static const unsigned value = 2; +//}; -template -struct predicates_length< boost::tuple > -{ - static const unsigned value = boost::tuples::length< boost::tuple >::value; -}; +//template +//struct predicates_length< boost::tuple > +//{ +// static const unsigned value = boost::tuples::length< boost::tuple >::value; +//}; template struct predicates_length< boost::tuples::cons > @@ -511,30 +595,30 @@ struct predicates_element static type const& get(T const& p) { return p; } }; -template -struct predicates_element< I, std::pair > -{ - BOOST_MPL_ASSERT_MSG((I < 2), INVALID_INDEX, (predicates_element)); - - typedef F type; - static type const& get(std::pair const& p) { return p.first; } -}; - -template -struct predicates_element< 1, std::pair > -{ - typedef S type; - static type const& get(std::pair const& p) { return p.second; } -}; - -template -struct predicates_element< I, boost::tuple > -{ - typedef boost::tuple predicate_type; - - typedef typename boost::tuples::element::type type; - static type const& get(predicate_type const& p) { return boost::get(p); } -}; +//template +//struct predicates_element< I, std::pair > +//{ +// BOOST_MPL_ASSERT_MSG((I < 2), INVALID_INDEX, (predicates_element)); +// +// typedef F type; +// static type const& get(std::pair const& p) { return p.first; } +//}; +// +//template +//struct predicates_element< 1, std::pair > +//{ +// typedef S type; +// static type const& get(std::pair const& p) { return p.second; } +//}; +// +//template +//struct predicates_element< I, boost::tuple > +//{ +// typedef boost::tuple predicate_type; +// +// typedef typename boost::tuples::element::type type; +// static type const& get(predicate_type const& p) { return boost::get(p); } +//}; template struct predicates_element< I, boost::tuples::cons > @@ -549,49 +633,49 @@ struct predicates_element< I, boost::tuples::cons > // predicates_check // ------------------------------------------------------------------ // -template -struct predicates_check_pair {}; - -template -struct predicates_check_pair -{ - template - static inline bool apply(PairPredicates const& , Value const& , Indexable const& ) - { - return true; - } -}; - -template -struct predicates_check_pair -{ - template - static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p.first, v, i); - } -}; - -template -struct predicates_check_pair -{ - template - static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p.second, v, i); - } -}; - -template -struct predicates_check_pair -{ - template - static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p.first, v, i) - && predicate_check::apply(p.second, v, i); - } -}; +//template +//struct predicates_check_pair {}; +// +//template +//struct predicates_check_pair +//{ +// template +// static inline bool apply(PairPredicates const& , Value const& , Indexable const& ) +// { +// return true; +// } +//}; +// +//template +//struct predicates_check_pair +//{ +// template +// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) +// { +// return predicate_check::apply(p.first, v, i); +// } +//}; +// +//template +//struct predicates_check_pair +//{ +// template +// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) +// { +// return predicate_check::apply(p.second, v, i); +// } +//}; +// +//template +//struct predicates_check_pair +//{ +// template +// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) +// { +// return predicate_check::apply(p.first, v, i) +// && predicate_check::apply(p.second, v, i); +// } +//}; template struct predicates_check_tuple @@ -630,43 +714,43 @@ struct predicates_check_impl } }; -template -struct predicates_check_impl, Tag, First, Last> -{ - BOOST_MPL_ASSERT_MSG((First < 2 && Last <= 2 && First <= Last), INVALID_INDEXES, (predicates_check_impl)); - - 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, unsigned First, unsigned Last -> -struct predicates_check_impl< - boost::tuple, - Tag, First, Last -> -{ - typedef boost::tuple predicates_type; - - static const unsigned pred_len = boost::tuples::length::value; - BOOST_MPL_ASSERT_MSG((First < pred_len && Last <= pred_len && First <= Last), INVALID_INDEXES, (predicates_check_impl)); - - template - static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) - { - return predicates_check_tuple< - predicates_type, - Tag, First, Last - >::apply(p, v, i); - } -}; +//template +//struct predicates_check_impl, Tag, First, Last> +//{ +// BOOST_MPL_ASSERT_MSG((First < 2 && Last <= 2 && First <= Last), INVALID_INDEXES, (predicates_check_impl)); +// +// 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, unsigned First, unsigned Last +//> +//struct predicates_check_impl< +// boost::tuple, +// Tag, First, Last +//> +//{ +// typedef boost::tuple predicates_type; +// +// static const unsigned pred_len = boost::tuples::length::value; +// BOOST_MPL_ASSERT_MSG((First < pred_len && Last <= pred_len && First <= Last), INVALID_INDEXES, (predicates_check_impl)); +// +// template +// static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) +// { +// return predicates_check_tuple< +// predicates_type, +// Tag, First, Last +// >::apply(p, v, i); +// } +//}; template struct predicates_check_impl< @@ -722,12 +806,12 @@ struct predicates_count_nearest static const unsigned value = predicates_is_nearest::value; }; -template -struct predicates_count_nearest< std::pair > -{ - static const unsigned value = predicates_is_nearest::value - + predicates_is_nearest::value; -}; +//template +//struct predicates_count_nearest< std::pair > +//{ +// static const unsigned value = predicates_is_nearest::value +// + predicates_is_nearest::value; +//}; template struct predicates_count_nearest_tuple @@ -744,14 +828,14 @@ struct predicates_count_nearest_tuple predicates_is_nearest::type>::value; }; -template -struct predicates_count_nearest< boost::tuple > -{ - static const unsigned value = predicates_count_nearest_tuple< - boost::tuple, - boost::tuples::length< boost::tuple >::value - >::value; -}; +//template +//struct predicates_count_nearest< boost::tuple > +//{ +// static const unsigned value = predicates_count_nearest_tuple< +// boost::tuple, +// boost::tuples::length< boost::tuple >::value +// >::value; +//}; template struct predicates_count_nearest< boost::tuples::cons > @@ -770,12 +854,12 @@ struct predicates_find_nearest static const unsigned value = predicates_is_nearest::value ? 0 : 1; }; -template -struct predicates_find_nearest< std::pair > -{ - static const unsigned value = predicates_is_nearest::value ? 0 : - (predicates_is_nearest::value ? 1 : 2); -}; +//template +//struct predicates_find_nearest< std::pair > +//{ +// static const unsigned value = predicates_is_nearest::value ? 0 : +// (predicates_is_nearest::value ? 1 : 2); +//}; template struct predicates_find_nearest_tuple @@ -796,14 +880,14 @@ struct predicates_find_nearest_tuple static const unsigned value = is_found ? 0 : boost::tuples::length::value; }; -template -struct predicates_find_nearest< boost::tuple > -{ - static const unsigned value = predicates_find_nearest_tuple< - boost::tuple, - boost::tuples::length< boost::tuple >::value - >::value; -}; +//template +//struct predicates_find_nearest< boost::tuple > +//{ +// static const unsigned value = predicates_find_nearest_tuple< +// boost::tuple, +// boost::tuples::length< boost::tuple >::value +// >::value; +//}; template struct predicates_find_nearest< boost::tuples::cons > diff --git a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp index ef54d995f..0019a4d81 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp @@ -19,48 +19,48 @@ namespace detail { namespace rtree { namespace visitors { // in store() or break store to 2 functions e.g. should_store() and store() // - well not with this algorithm of storing k-th neighbor -template -struct nearest_query_result_one -{ -public: - typedef typename geometry::default_distance_result< - Point, - typename translator::indexable_type::type - >::type distance_type; - - inline nearest_query_result_one(Value & value) - : m_value(value) - , m_comp_dist((std::numeric_limits::max)()) - {} - - inline void store(Value const& val, distance_type const& curr_comp_dist) - { - if ( curr_comp_dist < m_comp_dist ) - { - m_comp_dist = curr_comp_dist; - m_value = val; - } - } - - inline bool is_comparable_distance_valid() const - { - return m_comp_dist < (std::numeric_limits::max)(); - } - - inline distance_type comparable_distance() const - { - return m_comp_dist; - } - - inline size_t finish() - { - return is_comparable_distance_valid() ? 1 : 0; - } - -private: - Value & m_value; - distance_type m_comp_dist; -}; +//template +//struct nearest_query_result_one +//{ +//public: +// typedef typename geometry::default_distance_result< +// Point, +// typename translator::indexable_type::type +// >::type distance_type; +// +// inline nearest_query_result_one(Value & value) +// : m_value(value) +// , m_comp_dist((std::numeric_limits::max)()) +// {} +// +// inline void store(Value const& val, distance_type const& curr_comp_dist) +// { +// if ( curr_comp_dist < m_comp_dist ) +// { +// m_comp_dist = curr_comp_dist; +// m_value = val; +// } +// } +// +// inline bool is_comparable_distance_valid() const +// { +// return m_comp_dist < (std::numeric_limits::max)(); +// } +// +// inline distance_type comparable_distance() const +// { +// return m_comp_dist; +// } +// +// inline size_t finish() +// { +// return is_comparable_distance_valid() ? 1 : 0; +// } +// +//private: +// Value & m_value; +// distance_type m_comp_dist; +//}; template struct nearest_query_result_k @@ -324,8 +324,9 @@ private: parameters_type const& m_parameters; Translator const& m_translator; - DistancesPredicates const& m_dist_pred; - Predicates const& m_pred; + + DistancesPredicates m_dist_pred; + Predicates m_pred; Result & m_result; }; diff --git a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp index 17244e30f..3a15f04bd 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp @@ -66,7 +66,9 @@ struct spatial_query } Translator const& tr; - Predicates const& pred; + + Predicates pred; + OutIter out_iter; size_t found_count; }; diff --git a/include/boost/geometry/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp index a7cd3c318..4b111201c 100644 --- a/include/boost/geometry/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -175,9 +175,24 @@ A wrapper around user-defined UnaryPredicate checking if Value should be returne \par Example \verbatim -bool is_red(Value const& v) { ... } -... -bgi::query(spatial_index, bgi::intersects(box) && bgi::satisfies(is_red), std::back_inserter(result)); +bool is_red(__value__ const& v) { return v.is_red(); } + +struct is_red_o { +template bool operator()(__value__ const& v) { return v.is_red(); } +} + +// ... + +rt.query(index::intersects(box) && index::satisfies(is_red), +std::back_inserter(result)); + +rt.query(index::intersects(box) && index::satisfies(is_red_o()), +std::back_inserter(result)); + +#ifndef BOOST_NO_CXX11_LAMBDAS +rt.query(index::intersects(box) && index::satisfies([](__value__ const& v) { return v.is_red(); }), +std::back_inserter(result)); +#endif \endverbatim \ingroup predicates @@ -324,14 +339,13 @@ boost::tuples::cons< > operator&&(Pred1 const& p1, Pred2 const& p2) { + /*typedef typename boost::mpl::if_c::value, Pred1, Pred1 const&>::type stored1; + typedef typename boost::mpl::if_c::value, Pred2, Pred2 const&>::type stored2;*/ + namespace bt = boost::tuples; + return - boost::tuples::cons< - Pred1, - boost::tuples::cons - >( - p1, - boost::tuples::cons(p2, boost::tuples::null_type()) - ); + bt::cons< Pred1, bt::cons > + ( p1, bt::cons(p2, bt::null_type()) ); } template inline @@ -343,12 +357,12 @@ typename tuples::push_back_impl< >::type operator&&(boost::tuples::cons const& t, Pred const& p) { + //typedef typename boost::mpl::if_c::value, Pred, Pred const&>::type stored; + namespace bt = boost::tuples; + return tuples::push_back_impl< - boost::tuples::cons, - Pred, - 0, - boost::tuples::length >::value + bt::cons, Pred, 0, bt::length< bt::cons >::value >::apply(t, p); } diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index c6ac359a2..e95037f7e 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -596,11 +596,10 @@ public: Spatial predicates - The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. - More spatial predicates may be generated by one of the functions listed below: + Spatial predicates may be generated by one of the functions listed below: \li \c boost::geometry::index::covered_by(), \li \c boost::geometry::index::disjoint(), - \li \c boost::geometry::index::intersects() - default, + \li \c boost::geometry::index::intersects(), \li \c boost::geometry::index::overlaps(), \li \c boost::geometry::index::within(), @@ -611,11 +610,11 @@ public: \li ! boost::geometry::index::overlaps(), \li ! boost::geometry::index::within() - Value predicate + Satisfies predicate - This is a special kind of predicate which allows to pass a user-defined functor which checks + This is a special kind of predicate which allows to pass a user-defined function or function object which checks if Value should be returned by the query. It's generated by: - \li \c boost::geometry::index::value(). + \li \c boost::geometry::index::satisfies(). Nearest predicate @@ -631,7 +630,7 @@ public: \par Example \verbatim // return elements intersecting box - tree.query(box, std::back_inserter(result)); + tree.query(bgi::intersects(box), std::back_inserter(result)); // return elements intersecting poly but not within box tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun unary predicate @@ -1247,11 +1246,10 @@ Values will be returned only if all predicates are met. Spatial predicates -The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. -More spatial predicates may be generated by one of the functions listed below: +Spatial predicates may be generated by one of the functions listed below: \li \c boost::geometry::index::covered_by(), \li \c boost::geometry::index::disjoint(), -\li \c boost::geometry::index::intersects() - default, +\li \c boost::geometry::index::intersects(), \li \c boost::geometry::index::overlaps(), \li \c boost::geometry::index::within(), @@ -1262,11 +1260,11 @@ It is possible to negate spatial predicates: \li ! boost::geometry::index::overlaps(), \li ! boost::geometry::index::within() -Value predicate - -This is a special kind of predicate which allows to pass a user-defined functor which checks +Satisfies predicate + +This is a special kind of predicate which allows to pass a user-defined function or function object which checks if Value should be returned by the query. It's generated by: -\li \c boost::geometry::index::value(). +\li \c boost::geometry::index::satisfies(). Nearest predicate @@ -1282,7 +1280,7 @@ Predicates may be passed together connected with \c operator&&(). \par Example \verbatim // return elements intersecting box -bgi::query(tree, box, std::back_inserter(result)); +bgi::query(tree, bgi::intersects(box), std::back_inserter(result)); // return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun value predicate diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 09555e38a..78dd7be99 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -574,7 +574,7 @@ void test_intersects(Rtree const& tree, std::vector const& input, Box con if ( bg::intersects(tree.translator()(v), qbox) ) expected_output.push_back(v); - test_spatial_query(tree, qbox, expected_output); + //test_spatial_query(tree, qbox, expected_output); test_spatial_query(tree, bgi::intersects(qbox), expected_output); test_spatial_query(tree, !bgi::disjoint(qbox), expected_output); @@ -857,7 +857,7 @@ void test_value_predicate(Rtree const& rtree, std::vector const& input) BOOST_CHECK(result.size() == input.size()); #ifndef BOOST_NO_CXX11_LAMBDAS result.clear(); - rtree.query(bgi::satisfies([](Value const& v){ return true; }), std::back_inserter(result)); + rtree.query(bgi::satisfies([](Value const&){ return true; }), std::back_inserter(result)); BOOST_CHECK(result.size() == input.size()); #endif } @@ -872,7 +872,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) size_t s = tree.size(); std::vector expected_output; - tree.query(qbox, std::back_inserter(expected_output)); + tree.query(bgi::intersects(qbox), std::back_inserter(expected_output)); // copy constructor Rtree t1(tree); @@ -881,7 +881,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(tree.size() == t1.size()); std::vector output; - t1.query(qbox, std::back_inserter(output)); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); // copying assignment operator @@ -891,7 +891,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(tree.size() == t1.size()); output.clear(); - t1.query(qbox, std::back_inserter(output)); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); Rtree t2(tree.parameters(), tree.translator(), tree.get_allocator()); @@ -902,11 +902,11 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(0 == t1.size()); output.clear(); - t1.query(qbox, std::back_inserter(output)); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); BOOST_CHECK(output.empty()); output.clear(); - t2.query(qbox, std::back_inserter(output)); + t2.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t2, output, expected_output); t2.swap(t1); @@ -917,7 +917,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(t1.size() == 0); output.clear(); - t3.query(qbox, std::back_inserter(output)); + t3.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t3, output, expected_output); // moving assignment operator @@ -927,7 +927,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(t3.size() == 0); output.clear(); - t1.query(qbox, std::back_inserter(output)); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); //TODO - test SWAP @@ -939,7 +939,7 @@ template void test_create_insert(Rtree & tree, std::vector const& input, Box const& qbox) { std::vector expected_output; - tree.query(qbox, std::back_inserter(expected_output)); + tree.query(bgi::intersects(qbox), std::back_inserter(expected_output)); { Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); @@ -947,7 +947,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const t.insert(v); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -955,21 +955,21 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const std::copy(input.begin(), input.end(), bgi::inserter(t)); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { Rtree t(input.begin(), input.end(), tree.parameters(), tree.translator(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { Rtree t(input, tree.parameters(), tree.translator(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -977,7 +977,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const t.insert(input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -985,7 +985,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const t.insert(input); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } @@ -995,7 +995,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const bgi::insert(t, v); BOOST_CHECK(tree.size() == t.size()); std::vector output; - bgi::query(t, qbox, std::back_inserter(output)); + bgi::query(t, bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -1003,7 +1003,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const bgi::insert(t, input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - bgi::query(t, qbox, std::back_inserter(output)); + bgi::query(t, bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -1011,7 +1011,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const bgi::insert(t, input); BOOST_CHECK(tree.size() == t.size()); std::vector output; - bgi::query(t, qbox, std::back_inserter(output)); + bgi::query(t, bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } } @@ -1024,7 +1024,7 @@ void test_remove(Rtree & tree, Box const& qbox) typedef typename Rtree::value_type Value; std::vector values_to_remove; - tree.query(qbox, std::back_inserter(values_to_remove)); + tree.query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); BOOST_CHECK(0 < values_to_remove.size()); std::vector expected_output; @@ -1107,7 +1107,7 @@ template void test_clear(Rtree & tree, std::vector const& input, Box const& qbox) { std::vector values_to_remove; - tree.query(qbox, std::back_inserter(values_to_remove)); + tree.query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); BOOST_CHECK(0 < values_to_remove.size()); //clear @@ -1208,7 +1208,7 @@ void test_count_rtree_values(Parameters const& parameters, Allocator const& allo BOOST_CHECK(t.size() + rest_count == Value::counter()); std::vector values_to_remove; - t.query(qbox, std::back_inserter(values_to_remove)); + t.query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); rest_count += values_to_remove.size();