|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68756 - sandbox-branches/geometry/index_080/tests
From: adam.wulkiewicz_at_[hidden]
Date: 2011-02-09 18:47:29
Author: awulkiew
Date: 2011-02-09 18:47:28 EST (Wed, 09 Feb 2011)
New Revision: 68756
URL: http://svn.boost.org/trac/boost/changeset/68756
Log:
tests added
Added:
sandbox-branches/geometry/index_080/tests/
sandbox-branches/geometry/index_080/tests/rtree_filters.cpp (contents, props changed)
sandbox-branches/geometry/index_080/tests/translators.cpp (contents, props changed)
Added: sandbox-branches/geometry/index_080/tests/rtree_filters.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_080/tests/rtree_filters.cpp 2011-02-09 18:47:28 EST (Wed, 09 Feb 2011)
@@ -0,0 +1,39 @@
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/extensions/index/rtree/rtree.hpp>
+
+#include <boost/geometry/extensions/index/rtree/filters.hpp>
+#include <boost/geometry/extensions/index/filters/nearest_filter.hpp>
+
+#include <iostream>
+
+#include <boost/range/algorithm.hpp>
+#include <boost/foreach.hpp>
+
+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 << ' ';
+ std::cout << std::endl;
+}
+
+int main()
+{
+ typedef boost::geometry::model::point<float, 2, boost::geometry::cs::cartesian> P;
+ 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);
+ t.print();
+
+ namespace f = boost::geometry::index::filters;
+ print_range(t | f::spatially_filtered(B(P(2.5f, 2.5f), P(4.5f, 4.5f))));
+ print_range(t | f::nearest_filtered(P(3.5f, 3.5f), 1.0f));
+ }
+
+ return 0;
+}
Added: sandbox-branches/geometry/index_080/tests/translators.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_080/tests/translators.cpp 2011-02-09 18:47:28 EST (Wed, 09 Feb 2011)
@@ -0,0 +1,67 @@
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/extensions/index/rtree/rtree.hpp>
+
+#include <boost/geometry/extensions/index/translator/def.hpp>
+#include <boost/geometry/extensions/index/translator/index.hpp>
+
+#include <vector>
+#include <map>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
+int main()
+{
+ typedef boost::geometry::model::point<float, 2, boost::geometry::cs::cartesian> P;
+ typedef boost::geometry::model::box<P> B;
+ typedef boost::geometry::index::rtree<B, size_t> I;
+
+ using namespace boost::geometry;
+
+ index::translator::def<P> p;
+ index::translator::def<P*> pp;
+ index::translator::def<std::pair<int, P>*> pip;
+ index::translator::def< boost::shared_ptr<P> > sp;
+ index::translator::def< std::vector<P>::iterator > ip;
+ index::translator::def< std::map<int, P>::iterator > mip;
+ index::translator::def< std::pair<P, size_t> > ppi;
+ index::translator::def< boost::shared_ptr< std::pair<int, P> > > spip;
+ index::translator::def< boost::shared_ptr< std::pair<P, int> > > sppi;
+ index::translator::def< boost::scoped_ptr< std::pair<P, int> > > scppi;
+ index::translator::def< boost::scoped_ptr< std::pair<int, P> > > scpip;
+
+ P tmp_p;
+ boost::shared_ptr<P> tmp_sp(new P());
+ std::vector<P> tmp_v(1);
+ std::map<int, P> tmp_m;
+ tmp_m.insert(std::pair<int, P>(0, P()));
+ std::pair<int, P> tmp_pip;
+ boost::shared_ptr< std::pair<int, P> > tmp_spip(new std::pair<int, P>(0, P()));
+ boost::shared_ptr< std::pair<P, int> > tmp_sppi(new std::pair<P, int>(P(), 0));
+ boost::scoped_ptr< std::pair<int, P> > tmp_scpip(new std::pair<int, P>(0, P()));
+ boost::scoped_ptr< std::pair<P, int> > tmp_scppi(new std::pair<P, int>(P(), 0));
+
+ tmp_p = p(P());
+ tmp_p = pp(&tmp_p);
+ tmp_p = pip(&tmp_pip);
+ tmp_p = sp(tmp_sp);
+ tmp_p = ip(tmp_v.begin());
+ tmp_p = mip(tmp_m.begin());
+ tmp_p = ppi(std::pair<P, size_t>(P(), 0));
+ tmp_p = spip(tmp_spip);
+ tmp_p = sppi(tmp_sppi);
+ tmp_p = scpip(tmp_scpip);
+ tmp_p = scppi(tmp_scppi);
+
+ //index::translator::def<int> d; // error
+ //index::translator::def< model::segment<P> > d; // error
+
+ index::translator::def< std::pair<model::polygon<P>, B> > d;
+ index::translator::def< std::pair<B, model::polygon<P> > > dd;
+
+ B tmp_b;
+ tmp_b = d( std::pair<model::polygon<P>, B>() );
+ tmp_b = dd( std::pair<B, model::polygon<P> >() );
+
+ 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