Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74606 - in sandbox-branches/geometry/index: boost/geometry/extensions/index boost/geometry/extensions/index/rtree tests
From: adam.wulkiewicz_at_[hidden]
Date: 2011-09-28 20:03:46


Author: awulkiew
Date: 2011-09-28 20:03:45 EDT (Wed, 28 Sep 2011)
New Revision: 74606
URL: http://svn.boost.org/trac/boost/changeset/74606

Log:
operator!() predicates generators implemented.
Text files modified:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/predicates.hpp | 78 ++++++++++++++++++++++++++++++++++++++-
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/predicates.hpp | 6 ---
   sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp | 18 +++++++++
   3 files changed, 94 insertions(+), 8 deletions(-)

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/predicates.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/predicates.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/predicates.hpp 2011-09-28 20:03:45 EDT (Wed, 28 Sep 2011)
@@ -19,10 +19,10 @@
 
 namespace boost { namespace geometry { namespace index {
 
-// predicates
-
 namespace detail {
 
+// predicates
+
 struct empty {};
 
 template <typename ValuePredicate>
@@ -104,6 +104,8 @@
 
 } // namespace detail
 
+// generators
+
 inline detail::empty empty()
 {
     return detail::empty();
@@ -403,4 +405,76 @@
 
 }}} // namespace boost::geometry::index
 
+// operator! generators
+
+template <typename Geometry>
+boost::geometry::index::detail::not_covered_by<Geometry>
+operator!(boost::geometry::index::detail::covered_by<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_covered_by<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::covered_by<Geometry>
+operator!(boost::geometry::index::detail::not_covered_by<Geometry> const& p)
+{
+ return boost::geometry::index::detail::covered_by<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::not_disjoint<Geometry>
+operator!(boost::geometry::index::detail::disjoint<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_disjoint<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::disjoint<Geometry>
+operator!(boost::geometry::index::detail::not_disjoint<Geometry> const& p)
+{
+ return boost::geometry::index::detail::disjoint<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::not_intersects<Geometry>
+operator!(boost::geometry::index::detail::intersects<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_intersects<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::intersects<Geometry>
+operator!(boost::geometry::index::detail::not_intersects<Geometry> const& p)
+{
+ return boost::geometry::index::detail::intersects<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::not_overlaps<Geometry>
+operator!(boost::geometry::index::detail::overlaps<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_overlaps<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::overlaps<Geometry>
+operator!(boost::geometry::index::detail::not_overlaps<Geometry> const& p)
+{
+ return boost::geometry::index::detail::overlaps<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::not_within<Geometry>
+operator!(boost::geometry::index::detail::within<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_within<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::within<Geometry>
+operator!(boost::geometry::index::detail::not_within<Geometry> const& p)
+{
+ return boost::geometry::index::detail::within<Geometry>(p.geometry);
+}
+
 #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PREDICATES_HPP

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/predicates.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/predicates.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/predicates.hpp 2011-09-28 20:03:45 EDT (Wed, 28 Sep 2011)
@@ -140,12 +140,6 @@
     template <typename Value, typename Box>
     static bool apply(not_overlaps<Geometry> const& p, Value const&, Box const& i)
     {
- bool inters = geometry::intersects(i, p.geometry);
-
- //return !inters || ( inters && !geometry::overlaps(i, p.geometry) );
-
- // TODO: awulkiew - write working condition
-
         return true;
     }
 };

Modified: sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp
==============================================================================
--- sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp (original)
+++ sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp 2011-09-28 20:03:45 EDT (Wed, 28 Sep 2011)
@@ -185,6 +185,24 @@
 
     // searching test
     {
+ std::cout << "query(!disjoint(B)) searching time test... ("
+ << queries_count << ")\n";
+ tim.restart();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ std::deque< std::pair<B, size_t> > result;
+ t.query(!bgi::disjoint(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result));
+ temp += result.size();
+ }
+ std::cout << "time: " << tim.elapsed() << "s\n";
+ std::cout << "found: " << temp << "\n";
+ }
+
+ // searching test
+ {
         std::cout << "query(B) searching time test... ("
             << queries_count << ")\n";
         tim.restart();


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