diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp index 7261e6cbe..2e312f981 100644 --- a/plugins/input/topojson/topojson_datasource.cpp +++ b/plugins/input/topojson/topojson_datasource.cpp @@ -145,8 +145,7 @@ mapnik::featureset_ptr topojson_datasource::features(mapnik::query const& q) con if (extent_.intersects(b)) { box_type box(point_type(b.minx(),b.miny()),point_type(b.maxx(),b.maxy())); - index_array_ = tree_.find(box); - return std::make_shared(topo_, *tr_, index_array_.begin(), index_array_.end()); + return std::make_shared(topo_, *tr_, tree_.find(box)); } // otherwise return an empty featureset pointer return mapnik::featureset_ptr(); diff --git a/plugins/input/topojson/topojson_datasource.hpp b/plugins/input/topojson/topojson_datasource.hpp index 69c2c84f6..b428eaa5e 100644 --- a/plugins/input/topojson/topojson_datasource.hpp +++ b/plugins/input/topojson/topojson_datasource.hpp @@ -74,7 +74,6 @@ private: std::shared_ptr tr_; mapnik::topojson::topology topo_; spatial_index_type tree_; - mutable std::deque index_array_; }; diff --git a/plugins/input/topojson/topojson_featureset.cpp b/plugins/input/topojson/topojson_featureset.cpp index 1ef626cb8..a5e18efd6 100644 --- a/plugins/input/topojson/topojson_featureset.cpp +++ b/plugins/input/topojson/topojson_featureset.cpp @@ -353,13 +353,13 @@ struct feature_generator : public boost::static_visitor topojson_featureset::topojson_featureset(mapnik::topojson::topology const& topo, mapnik::transcoder const& tr, - std::deque::const_iterator index_itr, - std::deque::const_iterator index_end) + std::deque && index_array) : ctx_(std::make_shared()), topo_(topo), tr_(tr), - index_itr_(index_itr), - index_end_(index_end), + index_array_(std::move(index_array)), + index_itr_(index_array_.begin()), + index_end_(index_array_.end()), feature_id_ (0) {} topojson_featureset::~topojson_featureset() {} diff --git a/plugins/input/topojson/topojson_featureset.hpp b/plugins/input/topojson/topojson_featureset.hpp index cd81179dc..0d3fa4c12 100644 --- a/plugins/input/topojson/topojson_featureset.hpp +++ b/plugins/input/topojson/topojson_featureset.hpp @@ -34,8 +34,8 @@ class topojson_featureset : public mapnik::Featureset public: topojson_featureset(mapnik::topojson::topology const& topo, mapnik::transcoder const& tr, - std::deque::const_iterator index_itr, - std::deque::const_iterator index_end); + std::deque && index_array); + virtual ~topojson_featureset(); mapnik::feature_ptr next(); @@ -44,6 +44,7 @@ private: mapnik::box2d box_; mapnik::topojson::topology const& topo_; mapnik::transcoder const& tr_; + const std::deque index_array_; std::deque::const_iterator index_itr_; std::deque::const_iterator index_end_; std::size_t feature_id_;