support BOOST_VERSION < 105600
This commit is contained in:
parent
e42d0deb61
commit
58f770bf85
3 changed files with 17 additions and 3 deletions
|
@ -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<spatial_index_type>(boxes);
|
||||
#else
|
||||
tree_ = std::make_unique<spatial_index_type>(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;
|
||||
|
|
|
@ -89,9 +89,13 @@ class large_geojson_datasource : public mapnik::datasource
|
|||
{
|
||||
public:
|
||||
using box_type = mapnik::box2d<double>;
|
||||
#if BOOST_VERSION >= 105600
|
||||
using item_type = std::pair<box_type, std::pair<std::size_t, std::size_t>>;
|
||||
using spatial_index_type = boost::geometry::index::rtree<item_type,geojson_linear<16,4> >;
|
||||
|
||||
#else
|
||||
using item_type = std::pair<std::size_t,std::size_t>;
|
||||
using spatial_index_type = boost::geometry::index::rtree<box_type,item_type>;
|
||||
#endif
|
||||
// constructor
|
||||
large_geojson_datasource(mapnik::parameters const& params);
|
||||
virtual ~large_geojson_datasource ();
|
||||
|
|
|
@ -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<std::size_t,std::size_t> 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<char> json;
|
||||
|
|
Loading…
Reference in a new issue