Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85023 - trunk/libs/geometry/index/example
From: adam.wulkiewicz_at_[hidden]
Date: 2013-07-13 12:43:50


Author: awulkiew
Date: 2013-07-13 12:43:50 EDT (Sat, 13 Jul 2013)
New Revision: 85023
URL: http://svn.boost.org/trac/boost/changeset/85023

Log:
[geometry][index]example: added serialization preliminary test/example (not compiling since serialization is not yet implemented)

Added:
   trunk/libs/geometry/index/example/serialize.cpp (contents, props changed)

Added: trunk/libs/geometry/index/example/serialize.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libs/geometry/index/example/serialize.cpp 2013-07-13 12:43:50 EDT (Sat, 13 Jul 2013) (r85023)
@@ -0,0 +1,57 @@
+// Boost.Geometry Index
+// Additional tests
+
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// WARNING! This code is not fully functional!
+
+#include <iostream>
+#include <fstream>
+
+#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+#include <boost/geometry/index/rtree.hpp>
+
+#include <boost/archive/binary_oarchive.hpp>
+#include <boost/archive/binary_iarchive.hpp>
+
+#include <boost/foreach.hpp>
+
+namespace boost { namespace serialization {
+
+
+
+}} // namespace boost::serialization
+
+int main()
+{
+ namespace bg = boost::geometry;
+ namespace bgi = bg::index;
+
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P;
+ typedef bg::model::box<P> B;
+ typedef bgi::rtree<B, bgi::linear<16, 4> > RT;
+ //typedef bgi::rtree<B, bgi::quadratic<8, 3> > RT;
+ //typedef bgi::rtree<B, bgi::rstar<8, 3> > RT;
+
+ RT tree;
+
+ //insert values
+ {
+ for ( double x = 0 ; x < 100 ; x += 10 )
+ for ( double y = 0 ; y < 100 ; y += 10 )
+ tree.insert(B(P(x, y), P(x+1, y+1)));
+ }
+
+ // save
+ {
+ std::ofstream ofs("filename", std::ios::binary);
+ boost::archive::binary_oarchive oa(ofs);
+ oa << tree;
+ }
+
+ 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