From 58f770bf85e0ead1968515558c4ae5defbed353b Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 22 Jan 2015 16:34:28 +0100 Subject: [PATCH] support BOOST_VERSION < 105600 --- plugins/input/large_geojson/large_geojson_datasource.cpp | 9 +++++++++ plugins/input/large_geojson/large_geojson_datasource.hpp | 6 +++++- plugins/input/large_geojson/large_geojson_featureset.cpp | 5 +++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/input/large_geojson/large_geojson_datasource.cpp b/plugins/input/large_geojson/large_geojson_datasource.cpp index 7c1aefa9b..b407c196e 100644 --- a/plugins/input/large_geojson/large_geojson_datasource.cpp +++ b/plugins/input/large_geojson/large_geojson_datasource.cpp @@ -152,12 +152,21 @@ void large_geojson_datasource::initialise_index(Iterator start, Iterator end) } std::cerr << "OK size=" << boxes.size() << std::endl; std::cerr << "Populate index" << std::endl; +#if BOOST_VERSION >= 105600 tree_ = std::make_unique(boxes); +#else + tree_ = std::make_unique(16, 4); +#endif std::cerr << "Calculate total extent" << std::endl; for (auto const& item : boxes) { auto const& box = std::get<0>(item); + +#if BOOST_VERSION < 105600 + auto const& geometry_index = std::get<1>(item); + tree_->insert(box, geometry_index); +#endif if (!extent_.valid()) { extent_ = box; diff --git a/plugins/input/large_geojson/large_geojson_datasource.hpp b/plugins/input/large_geojson/large_geojson_datasource.hpp index c3cc6d974..42a8a1771 100644 --- a/plugins/input/large_geojson/large_geojson_datasource.hpp +++ b/plugins/input/large_geojson/large_geojson_datasource.hpp @@ -89,9 +89,13 @@ class large_geojson_datasource : public mapnik::datasource { public: using box_type = mapnik::box2d; +#if BOOST_VERSION >= 105600 using item_type = std::pair>; using spatial_index_type = boost::geometry::index::rtree >; - +#else + using item_type = std::pair; + using spatial_index_type = boost::geometry::index::rtree; +#endif // constructor large_geojson_datasource(mapnik::parameters const& params); virtual ~large_geojson_datasource (); diff --git a/plugins/input/large_geojson/large_geojson_featureset.cpp b/plugins/input/large_geojson/large_geojson_featureset.cpp index b6bead866..4917c3b6e 100644 --- a/plugins/input/large_geojson/large_geojson_featureset.cpp +++ b/plugins/input/large_geojson/large_geojson_featureset.cpp @@ -68,9 +68,10 @@ mapnik::feature_ptr large_geojson_featureset::next() large_geojson_datasource::item_type const& item = *index_itr_++; std::size_t file_offset = item.second.first; std::size_t size = item.second.second; - //std::cerr << file_offset << " (" << size << ") " << item.first << std::endl; #else - std::size_t index = *index_itr_++; + std::pair index = *index_itr_++; + std::size_t file_offset = index.first; + std::size_t size = index.second; #endif std::fseek(file_.get(), file_offset, SEEK_SET); std::vector json;