store box2d<float> directly in index_record to avoid conversions.
This commit is contained in:
parent
d81a7610d3
commit
6c19efa990
5 changed files with 7 additions and 7 deletions
|
@ -41,7 +41,7 @@ struct index_record
|
||||||
{
|
{
|
||||||
std::uint64_t off;
|
std::uint64_t off;
|
||||||
std::uint64_t size;
|
std::uint64_t size;
|
||||||
float box[4];
|
box2d<float> box;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename InputStream>
|
template <typename InputStream>
|
||||||
|
|
|
@ -81,7 +81,7 @@ csv_index_featureset::csv_index_featureset(std::string const& filename,
|
||||||
positions_.erase(std::remove_if(positions_.begin(),
|
positions_.erase(std::remove_if(positions_.begin(),
|
||||||
positions_.end(),
|
positions_.end(),
|
||||||
[&](value_type const& pos)
|
[&](value_type const& pos)
|
||||||
{ return !mapnik::box2d<float>{pos.box[0], pos.box[1], pos.box[2], pos.box[3]}.intersects(filter.box_);}),
|
{ return !pos.box.intersects(filter.box_);}),
|
||||||
positions_.end());
|
positions_.end());
|
||||||
std::sort(positions_.begin(), positions_.end(),
|
std::sort(positions_.begin(), positions_.end(),
|
||||||
[](value_type const& lhs, value_type const& rhs) { return lhs.off < rhs.off;});
|
[](value_type const& lhs, value_type const& rhs) { return lhs.off < rhs.off;});
|
||||||
|
|
|
@ -72,7 +72,7 @@ geojson_index_featureset::geojson_index_featureset(std::string const& filename,
|
||||||
positions_.erase(std::remove_if(positions_.begin(),
|
positions_.erase(std::remove_if(positions_.begin(),
|
||||||
positions_.end(),
|
positions_.end(),
|
||||||
[&](value_type const& pos)
|
[&](value_type const& pos)
|
||||||
{ return !mapnik::box2d<float>{pos.box[0], pos.box[1], pos.box[2], pos.box[3]}.intersects(filter.box_);}),
|
{ return !pos.box.intersects(filter.box_);}),
|
||||||
positions_.end());
|
positions_.end());
|
||||||
|
|
||||||
std::sort(positions_.begin(), positions_.end(),
|
std::sort(positions_.begin(), positions_.end(),
|
||||||
|
|
|
@ -222,7 +222,7 @@ int main (int argc, char** argv)
|
||||||
auto ext_f = std::get<0>(item);
|
auto ext_f = std::get<0>(item);
|
||||||
if (use_bbox && !bbox.intersects(ext_f)) continue;
|
if (use_bbox && !bbox.intersects(ext_f)) continue;
|
||||||
mapnik::util::index_record rec =
|
mapnik::util::index_record rec =
|
||||||
{std::get<1>(item).first, std::get<1>(item).second, {ext_f.minx(), ext_f.miny(), ext_f.maxx(), ext_f.maxy()}};
|
{std::get<1>(item).first, std::get<1>(item).second, ext_f};
|
||||||
tree.insert(rec, ext_f);
|
tree.insert(rec, ext_f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue