|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68987 - in sandbox-branches/geometry/index_080: boost/geometry/extensions/index/rtree boost/geometry/extensions/index/translator tests
From: adam.wulkiewicz_at_[hidden]
Date: 2011-02-18 06:46:50
Author: awulkiew
Date: 2011-02-18 06:46:40 EST (Fri, 18 Feb 2011)
New Revision: 68987
URL: http://svn.boost.org/trac/boost/changeset/68987
Log:
filters now uses new interface
Text files modified:
sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/filters.hpp | 12 ++++++------
sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/helpers.hpp | 8 ++++----
sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree.hpp | 3 ++-
sandbox-branches/geometry/index_080/boost/geometry/extensions/index/translator/helpers.hpp | 12 ++++++++++--
sandbox-branches/geometry/index_080/tests/rtree_filters.cpp | 24 +++++++++++++++++-------
5 files changed, 39 insertions(+), 20 deletions(-)
Modified: sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/filters.hpp
==============================================================================
--- sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/filters.hpp (original)
+++ sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/filters.hpp 2011-02-18 06:46:40 EST (Fri, 18 Feb 2011)
@@ -18,14 +18,14 @@
namespace boost { namespace geometry { namespace index { namespace filters {
-template <typename Box, typename Value>
-class spatial_filter< index::rtree<Box, Value> >
+template <typename Value, typename Translator, typename Box>
+class spatial_filter< index::rtree<Value, Translator, Box> >
{
public:
typedef typename std::deque<Value>::iterator iterator;
typedef typename std::deque<Value>::const_iterator const_iterator;
- spatial_filter(index::rtree<Box, Value> const& rtree, Box const& b)
+ spatial_filter(index::rtree<Value, Translator, Box> const& rtree, Box const& b)
{
m_result = rtree.find(b);
}
@@ -81,8 +81,8 @@
// implement final version of nearest filter
// range should be sorted (for Boxes - by closest corner)
-template <typename Box, typename Value>
-class nearest_filter< index::rtree<Box, Value> >
+template <typename Value, typename Translator, typename Box>
+class nearest_filter< index::rtree<Value, Translator, Box> >
{
public:
typedef typename std::deque<Value>::iterator iterator;
@@ -90,7 +90,7 @@
template <typename Point>
nearest_filter(
- index::rtree<Box, Value> const& rtree,
+ index::rtree<Value, Translator, Box> const& rtree,
Point const& box_centre,
typename traits::coordinate_type<Point>::type const& radius
)
Modified: sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/helpers.hpp
==============================================================================
--- sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/helpers.hpp (original)
+++ sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/helpers.hpp 2011-02-18 06:46:40 EST (Fri, 18 Feb 2011)
@@ -118,12 +118,12 @@
void copy_box(SrcBox const& src, DstBox & dst)
{
BOOST_STATIC_ASSERT(
- traits::dimension<traits::point_type<SrcBox>::type>::value
- == traits::dimension<traits::point_type<DstBox>::type>::value
+ traits::dimension<typename traits::point_type<SrcBox>::type>::value
+ == traits::dimension<typename traits::point_type<DstBox>::type>::value
);
dispatch::copy_box<
- traits::dimension<traits::point_type<SrcBox>::type>::value,
+ traits::dimension<typename traits::point_type<SrcBox>::type>::value,
SrcBox,
DstBox
>::apply(src, dst);
@@ -165,7 +165,7 @@
{
dispatch::convert_to_box<
BoundingObject,
- traits::tag<BoundingObject>::type,
+ typename traits::tag<BoundingObject>::type,
Box
>::apply(bo, b);
}
Modified: sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree.hpp (original)
+++ sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree.hpp 2011-02-18 06:46:40 EST (Fri, 18 Feb 2011)
@@ -34,7 +34,8 @@
template <
typename Value,
typename Translator = translator::def<Value>,
- typename Box = detail::bounding_box<Translator::bounding_geometry_type>::type
+ typename Box = typename detail::bounding_box
+ <typename Translator::bounding_geometry_type>::type
>
class rtree
{
Modified: sandbox-branches/geometry/index_080/boost/geometry/extensions/index/translator/helpers.hpp
==============================================================================
--- sandbox-branches/geometry/index_080/boost/geometry/extensions/index/translator/helpers.hpp (original)
+++ sandbox-branches/geometry/index_080/boost/geometry/extensions/index/translator/helpers.hpp 2011-02-18 06:46:40 EST (Fri, 18 Feb 2011)
@@ -197,8 +197,16 @@
{
static bool apply(std::pair<First, Second> const& p1, std::pair<First, Second> const& p2)
{
- return dispatch::equals<First, traits::tag<First>::type>::apply(p1.first, p2.first) &&
- dispatch::equals<Second, traits::tag<Second>::type>::apply(p1.second, p2.second);
+ return
+ dispatch::equals<
+ First,
+ typename traits::tag<First>::type
+ >::apply(p1.first, p2.first)
+ &&
+ dispatch::equals<
+ Second,
+ typename traits::tag<Second>::type
+ >::apply(p1.second, p2.second);
}
};
Modified: sandbox-branches/geometry/index_080/tests/rtree_filters.cpp
==============================================================================
--- sandbox-branches/geometry/index_080/tests/rtree_filters.cpp (original)
+++ sandbox-branches/geometry/index_080/tests/rtree_filters.cpp 2011-02-18 06:46:40 EST (Fri, 18 Feb 2011)
@@ -12,8 +12,17 @@
template <typename R>
void print_range(R const& r)
{
- BOOST_FOREACH(typename boost::iterator_value<typename R::const_iterator>::type const& i, r)
- std::cout << i << ' ';
+ BOOST_FOREACH(typename boost::iterator_value<typename R::const_iterator>::type const& b, r)
+ {
+ float min_x = b.min_corner().template get<0>();
+ float min_y = b.min_corner().template get<1>();
+ float max_x = b.max_corner().template get<0>();
+ float max_y = b.max_corner().template get<1>();
+ std::cout << "(" << min_x << ", " << min_y << ")";
+ std::cout << 'x';
+ std::cout << "(" << max_x << ", " << max_y << ")";
+ std::cout << '\n';
+ }
std::cout << std::endl;
}
@@ -23,11 +32,11 @@
typedef boost::geometry::model::box<P> B;
{
- boost::geometry::index::rtree<B, size_t> t(3, 0);
- t.insert(B(P(0, 0), P(1, 1)), 0);
- t.insert(B(P(2, 2), P(3, 3)), 1);
- t.insert(B(P(4, 4), P(5, 5)), 2);
- t.insert(B(P(6, 6), P(7, 7)), 3);
+ boost::geometry::index::rtree<B> t(3, 0);
+ t.insert(B(P(0, 0), P(1, 1)));
+ t.insert(B(P(2, 2), P(3, 3)));
+ t.insert(B(P(4, 4), P(5, 5)));
+ t.insert(B(P(6, 6), P(7, 7)));
t.print();
namespace f = boost::geometry::index::filters;
@@ -35,5 +44,6 @@
print_range(t | f::nearest_filtered(P(3.5f, 3.5f), 1.0f));
}
+ std::cin.get();
return 0;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk