remove slicing

This commit is contained in:
artemp 2015-03-04 14:54:11 +01:00
parent a6f0c30a74
commit 58f21f33ea

View file

@ -25,6 +25,7 @@
#include <mapnik/feature_factory.hpp> #include <mapnik/feature_factory.hpp>
#include <mapnik/json/topology.hpp> #include <mapnik/json/topology.hpp>
#include <mapnik/util/variant.hpp> #include <mapnik/util/variant.hpp>
#include <mapnik/geometry_adapters.hpp>
// stl // stl
#include <string> #include <string>
#include <vector> #include <vector>
@ -36,7 +37,6 @@
#pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#include <boost/range/adaptor/reversed.hpp> #include <boost/range/adaptor/reversed.hpp>
#include <boost/range/adaptor/sliced.hpp>
#include <boost/geometry.hpp> #include <boost/geometry.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@ -215,14 +215,14 @@ struct feature_generator
if (reverse) if (reverse)
{ {
for (auto const& c : processed_coords | reversed | sliced(0, processed_coords.size()-1)) for (auto const& c : processed_coords | reversed)
{ {
linear_ring.emplace_back(c.x, c.y); linear_ring.emplace_back(c.x, c.y);
} }
} }
else else
{ {
for (auto const& c : processed_coords | sliced(0, processed_coords.size()-1)) for (auto const& c : processed_coords)
{ {
linear_ring.emplace_back(c.x, c.y); linear_ring.emplace_back(c.x, c.y);
} }
@ -238,7 +238,7 @@ struct feature_generator
polygon.add_hole(std::move(linear_ring)); polygon.add_hole(std::move(linear_ring));
} }
} }
boost::geometry::correct(polygon);
feature->set_geometry(std::move(polygon)); feature->set_geometry(std::move(polygon));
assign_properties(*feature, poly, tr_); assign_properties(*feature, poly, tr_);
return feature; return feature;
@ -253,7 +253,6 @@ struct feature_generator
for (auto const& poly : multi_poly.polygons) for (auto const& poly : multi_poly.polygons)
{ {
//std::unique_ptr<geometry_type> poly_ptr(new geometry_type(geometry_type::types::Polygon));
bool first = true; bool first = true;
mapnik::new_geometry::polygon polygon; mapnik::new_geometry::polygon polygon;
if (poly.size() > 1) polygon.interior_rings.reserve(poly.size() - 1); if (poly.size() > 1) polygon.interior_rings.reserve(poly.size() - 1);
@ -286,14 +285,14 @@ struct feature_generator
if (reverse) if (reverse)
{ {
for (auto const& c : (processed_coords | reversed | sliced(0,processed_coords.size() - 1))) for (auto const& c : (processed_coords | reversed))
{ {
linear_ring.add_coord(c.x, c.y); linear_ring.add_coord(c.x, c.y);
} }
} }
else else
{ {
for (auto const& c : processed_coords | sliced(0,processed_coords.size() - 1)) for (auto const& c : processed_coords)
{ {
linear_ring.add_coord(c.x, c.y); linear_ring.add_coord(c.x, c.y);
} }