shapeindex : remove duplicate node defs + add default ctor
This commit is contained in:
parent
88a04a120f
commit
4c6632cf93
3 changed files with 16 additions and 25 deletions
|
@ -63,12 +63,12 @@ shape_index_featureset<filterT>::shape_index_featureset(filterT const& filter,
|
|||
if (index)
|
||||
{
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
mapnik::util::spatial_index<detail::node, filterT,boost::interprocess::ibufferstream>::query(filter, index->file(), offsets_);
|
||||
mapnik::util::spatial_index<mapnik::detail::node, filterT,boost::interprocess::ibufferstream>::query(filter, index->file(), offsets_);
|
||||
#else
|
||||
mapnik::util::spatial_index<detail::node, filterT, std::ifstream>::query(filter, index->file(), offsets_);
|
||||
mapnik::util::spatial_index<mapnik::detail::node, filterT, std::ifstream>::query(filter, index->file(), offsets_);
|
||||
#endif
|
||||
}
|
||||
std::sort(offsets_.begin(), offsets_.end(), [](detail::node const& n0, detail::node const& n1)
|
||||
std::sort(offsets_.begin(), offsets_.end(), [](mapnik::detail::node const& n0, mapnik::detail::node const& n1)
|
||||
{return n0.offset != n1.offset ? n0.offset < n1.offset : n0.start < n1.start;});
|
||||
MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: Query size=" << offsets_.size();
|
||||
itr_ = offsets_.begin();
|
||||
|
|
|
@ -45,15 +45,20 @@ using mapnik::box2d;
|
|||
using mapnik::feature_ptr;
|
||||
using mapnik::context_ptr;
|
||||
|
||||
namespace detail
|
||||
namespace mapnik { namespace detail
|
||||
{
|
||||
struct node
|
||||
{
|
||||
node() = default;
|
||||
node(int offset_, int start_, int end_)
|
||||
: offset(offset_),
|
||||
start(start_),
|
||||
end(end_) {}
|
||||
int offset;
|
||||
int start;
|
||||
int end;
|
||||
};
|
||||
}
|
||||
}} // ns
|
||||
|
||||
template <typename filterT>
|
||||
class shape_index_featureset : public Featureset
|
||||
|
@ -73,8 +78,8 @@ private:
|
|||
context_ptr ctx_;
|
||||
std::unique_ptr<shape_io> shape_ptr_;
|
||||
const std::unique_ptr<mapnik::transcoder> tr_;
|
||||
std::vector<detail::node> offsets_;
|
||||
std::vector<detail::node>::iterator itr_;
|
||||
std::vector<mapnik::detail::node> offsets_;
|
||||
std::vector<mapnik::detail::node>::iterator itr_;
|
||||
std::vector<int> attr_ids_;
|
||||
mapnik::value_integer row_limit_;
|
||||
mutable int count_;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <mapnik/geometry_envelope.hpp>
|
||||
#include "shapefile.hpp"
|
||||
#include "shape_io.hpp"
|
||||
|
||||
#include "shape_index_featureset.hpp"
|
||||
#pragma GCC diagnostic push
|
||||
#include <mapnik/warning_ignore.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
@ -39,20 +39,6 @@
|
|||
const int DEFAULT_DEPTH = 8;
|
||||
const double DEFAULT_RATIO=0.55;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct node
|
||||
{
|
||||
node(int offset_, int start_, int end_)
|
||||
: offset(offset_),
|
||||
start(start_),
|
||||
end(end_) {}
|
||||
int offset;
|
||||
int start;
|
||||
int end;
|
||||
};
|
||||
}
|
||||
|
||||
int main (int argc,char** argv)
|
||||
{
|
||||
using namespace mapnik;
|
||||
|
@ -180,7 +166,7 @@ int main (int argc,char** argv)
|
|||
|
||||
int pos = 50;
|
||||
shx.seek(pos * 2);
|
||||
mapnik::quad_tree<node> tree(extent, depth, ratio);
|
||||
mapnik::quad_tree<mapnik::detail::node> tree(extent, depth, ratio);
|
||||
int count = 0;
|
||||
|
||||
if (shape_type != shape_io::shape_null)
|
||||
|
@ -241,7 +227,7 @@ int main (int argc,char** argv)
|
|||
{
|
||||
std::clog << "record number " << record_number << " box=" << item_ext << std::endl;
|
||||
}
|
||||
tree.insert(node(offset * 2, start, end),item_ext);
|
||||
tree.insert(mapnik::detail::node(offset * 2, start, end),item_ext);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +244,7 @@ int main (int argc,char** argv)
|
|||
{
|
||||
std::clog << "record number " << record_number << " box=" << item_ext << std::endl;
|
||||
}
|
||||
tree.insert(node(offset * 2,-1,0),item_ext);
|
||||
tree.insert(mapnik::detail::node(offset * 2,-1,0),item_ext);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue