From 11e96c624745233632afc02642eef214f1c4ad72 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 4 Sep 2012 18:09:39 +0000 Subject: [PATCH] fixed near/far macros issue by renaming near(to to_nearest), far(to to_furthest) and centroid to to_centroid for consistency. [SVN r80398] --- .../r_tree/nearest_neighbours_queries.html | 8 +- doc/html/index.html | 2 +- doc/rtree/nearest.qbk | 8 +- .../extensions/index/distance_predicates.hpp | 94 +++++++++---------- .../index/rtree/distance_predicates.hpp | 22 ++--- .../geometry/extensions/index/rtree/rtree.hpp | 32 +++---- .../index/rtree/visitors/nearest.hpp | 6 +- tests/additional_sizes_and_times.cpp | 6 -- 8 files changed, 86 insertions(+), 92 deletions(-) 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 1544defb7..edbd07a1b 100644 --- a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html +++ b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html @@ -137,15 +137,15 @@ must be greater than 10 */ /* same as default - distance between Indexable's closest point and a query point must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values)); +index::nearest(rt, index::min_bounded(pt, index::to_nearest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's furthest point and a query point must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values)); +index::nearest(rt, index::min_bounded(pt, index::to_furthest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's centroid and a query point must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values)); +index::nearest(rt, index::min_bounded(pt, index::to_centroid(10)), k, std::back_inserter(returned_values));
@@ -163,7 +163,7 @@ must be greater than 10 */ Point pt(...); Box b(...); -size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value); +size_t n1 = rt.nearest(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value); size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); diff --git a/doc/html/index.html b/doc/html/index.html index cb1da7e6c..dfa4be92f 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -54,7 +54,7 @@
- +

Last revised: August 26, 2012 at 01:34:23 GMT

Last revised: September 04, 2012 at 18:00:33 GMT


diff --git a/doc/rtree/nearest.qbk b/doc/rtree/nearest.qbk index 2ecdf5717..8b157b1de 100644 --- a/doc/rtree/nearest.qbk +++ b/doc/rtree/nearest.qbk @@ -92,15 +92,15 @@ non-point `__indexable__` should be taken into account in the routine calculatin /* same as default - distance between Indexable's closest point and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values)); + index::nearest(rt, index::min_bounded(pt, index::to_nearest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's furthest point and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values)); + index::nearest(rt, index::min_bounded(pt, index::to_furthest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's centroid and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values)); + index::nearest(rt, index::min_bounded(pt, index::to_centroid(10)), k, std::back_inserter(returned_values)); [endsect] @@ -114,7 +114,7 @@ It is possible to use spatial predicates described before in nearest neighbours __point__ pt(...); __box__ b(...); - size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value); + size_t n1 = rt.nearest(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value); size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index 70901c720..afc0d2bdf 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -33,31 +33,31 @@ namespace detail { // relations template -struct near +struct to_nearest { - near(T const& v) : value(v) {} + to_nearest(T const& v) : value(v) {} T value; }; template -struct centroid +struct to_centroid { - centroid(T const& v) : value(v) {} + to_centroid(T const& v) : value(v) {} T value; }; template -struct far +struct to_furthest { - far(T const& v) : value(v) {} + to_furthest(T const& v) : value(v) {} T value; }; // tags -struct near_tag {}; -struct centroid_tag {}; -struct far_tag {}; +struct to_nearest_tag {}; +struct to_centroid_tag {}; +struct to_furthest_tag {}; // relation @@ -65,36 +65,36 @@ template struct relation { typedef T value_type; - typedef near_tag tag; + 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< near > +struct relation< to_nearest > { typedef T value_type; - typedef near_tag tag; - static inline T const& value(near const& r) { return r.value; } - static inline T & value(near & r) { return r.value; } + 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< centroid > +struct relation< to_centroid > { typedef T value_type; - typedef centroid_tag tag; - static inline T const& value(centroid const& r) { return r.value; } - static inline T & value(centroid & r) { return r.value; } + 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< far > +struct relation< to_furthest > { typedef T value_type; - typedef far_tag tag; - static inline T const& value(far const& r) { return r.value; } - static inline T & value(far & r) { return r.value; } + 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 @@ -115,9 +115,9 @@ closer or further than value v. This is default relation. \param v Point or bound value. */ template -detail::near near(T const& v) +detail::to_nearest to_nearest(T const& v) { - return detail::near(v); + return detail::to_nearest(v); } /*! @@ -133,9 +133,9 @@ closer or further than value v. \param v Point or bound value. */ template -detail::centroid centroid(T const& v) +detail::to_centroid to_centroid(T const& v) { - return detail::centroid(v); + return detail::to_centroid(v); } /*! @@ -152,9 +152,9 @@ closer or further than value v. \param v Point or bound value. */ template -detail::far far(T const& v) +detail::to_furthest to_furthest(T const& v) { - return detail::far(v); + return detail::to_furthest(v); } // distance predicates @@ -244,8 +244,8 @@ by PointRelation. This is default nearest predicate. \tparam PointRelation PointRelation type. -\param pr The point relation. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). +\param pr The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). */ template inline detail::unbounded @@ -264,10 +264,10 @@ Point but only if nearest points are further than some distance. \tparam PointRelation PointRelation type. \tparam MinRelation MinRelation type. -\param pr The point relation. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). -\param minr The minimum bound relation. This may be generated by bgi::near(min_distance), - bgi::centroid(min_distance) or bgi::far(min_distance). +\param pr The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +\param minr The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). */ template inline detail::min_bounded @@ -286,10 +286,10 @@ Point but only if nearest points are closer than some distance. \tparam PointRelation PointRelation type. \tparam MaxRelation MaxRelation type. -\param pr The point relation. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). -\param maxr The maximum bound relation. This may be generated by bgi::near(max_distance), - bgi::centroid(max_distance) or bgi::far(max_distance). +\param pr The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +\param maxr The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). */ template inline detail::max_bounded @@ -310,12 +310,12 @@ points are further than some distance and closer than some other distance. \tparam MinRelation MinRelation type. \tparam MaxRelation MaxRelation type. -\param pr The point relation. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). -\param minr The minimum bound relation. This may be generated by bgi::near(min_distance), - bgi::centroid(min_distance) or bgi::far(min_distance). -\param maxr The maximum bound relation. This may be generated by bgi::near(max_distance), - bgi::centroid(max_distance) or bgi::far(max_distance). +\param pr The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +\param minr The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). +\param maxr The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). */ template inline detail::bounded @@ -483,7 +483,7 @@ struct distances_calc_impl_rel template struct distances_calc_impl_rel< - cdist + cdist > { template @@ -496,7 +496,7 @@ struct distances_calc_impl_rel< template struct distances_calc_impl_rel< - cdist + cdist > { template @@ -509,7 +509,7 @@ struct distances_calc_impl_rel< template struct distances_calc_impl_rel< - cdist + cdist > { template diff --git a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp index fd4f90a42..73e10e188 100644 --- a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp @@ -30,7 +30,7 @@ struct distances_calc< typedef typename detail::relation::value_type point_type; typedef typename geometry::default_distance_result::type distance_type; - typedef detail::cdist result_type; + typedef detail::cdist result_type; static inline result_type apply(PointRelation const& p, Box const& i) { @@ -51,7 +51,7 @@ struct distances_calc< typedef typename detail::relation::value_type point_type; typedef typename geometry::default_distance_result::type distance_type; - typedef detail::cdist result_type; + typedef detail::cdist result_type; static inline result_type apply(detail::unbounded const& pp, Box const& i) { @@ -73,8 +73,8 @@ struct distances_calc< typedef typename geometry::default_distance_result::type distance_type; typedef typename detail::cdist_merge< - cdist, - cdist + cdist, + cdist >::type result_type; static inline result_type apply(detail::min_bounded const& pp, Box const& i) @@ -96,7 +96,7 @@ struct distances_calc< typedef typename detail::relation::value_type point_type; typedef typename geometry::default_distance_result::type distance_type; - typedef cdist result_type; + typedef cdist result_type; static inline result_type apply(detail::max_bounded const& pp, Box const& i) { @@ -118,8 +118,8 @@ struct distances_calc< typedef typename geometry::default_distance_result::type distance_type; typedef typename detail::cdist_merge< - cdist, - cdist + cdist, + cdist >::type result_type; static inline result_type apply(detail::bounded const& pp, Box const& i) @@ -173,7 +173,7 @@ struct distances_predicates_check< Distances const& d) { return pred.comparable_min - <= cdist_value::template get(d); + <= cdist_value::template get(d); } }; @@ -188,7 +188,7 @@ struct distances_predicates_check< detail::max_bounded const& pred, Distances const& d) { - return cdist_value::template get(d) + return cdist_value::template get(d) <= pred.comparable_max; } }; @@ -205,8 +205,8 @@ struct distances_predicates_check< Distances const& d) { return pred.comparable_min - <= cdist_value::template get(d) - && cdist_value::template get(d) + <= cdist_value::template get(d) + && cdist_value::template get(d) <= pred.comparable_max; } }; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index fea5be68b..10b3272b2 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -392,13 +392,13 @@ public: \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), - bgi::centroid(dist_bound) or bgi::far(dist_bound). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \param v The reference to the object which will contain the result. @@ -416,13 +416,13 @@ public: \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), - bgi::centroid(dist_bound) or bgi::far(dist_bound). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \param pred The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), @@ -445,13 +445,13 @@ public: \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), - bgi::centroid(dist_bound) or bgi::far(dist_bound). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \param k The max number of values. \param out_it The output iterator of the result range. E.g. a back_insert_iterator. @@ -469,13 +469,13 @@ public: \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), - bgi::centroid(dist_bound) or bgi::far(dist_bound). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \param k The max number of values. \param pred The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 685f9c239..c85bfaf74 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -308,9 +308,9 @@ private: std::pair const& p2) { return index::detail::cdist_value - ::template get(p1.first) + ::template get(p1.first) < index::detail::cdist_value - ::template get(p2.first); + ::template get(p2.first); } template @@ -318,7 +318,7 @@ private: { return smallest_dist < index::detail::cdist_value - ::template get(d); + ::template get(d); } parameters_type const& m_parameters; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 0c3c76bcb..6749725b8 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -20,12 +20,6 @@ #include #include -/*#include -#undef near -#undef far -#undef min -#undef max*/ - template struct test_pred {