wkb_reader/json input grammar - correct polygons to have CCW exterioir/CW interior
This commit is contained in:
parent
9e35540b50
commit
f4a1e9368b
2 changed files with 10 additions and 1 deletions
|
@ -24,6 +24,9 @@
|
||||||
#define MAPNIK_JSON_GEOMETRY_UTIL_HPP
|
#define MAPNIK_JSON_GEOMETRY_UTIL_HPP
|
||||||
|
|
||||||
#include <mapnik/geometry_impl.hpp>
|
#include <mapnik/geometry_impl.hpp>
|
||||||
|
#include <mapnik/geometry_adapters.hpp>
|
||||||
|
// boost.geometry
|
||||||
|
#include <boost/geometry/algorithms/correct.hpp>
|
||||||
|
|
||||||
namespace mapnik { namespace json {
|
namespace mapnik { namespace json {
|
||||||
|
|
||||||
|
@ -97,7 +100,8 @@ struct create_polygon
|
||||||
if (i == 0) poly.set_exterior_ring(std::move(ring));
|
if (i == 0) poly.set_exterior_ring(std::move(ring));
|
||||||
else poly.add_hole(std::move(ring));
|
else poly.add_hole(std::move(ring));
|
||||||
}
|
}
|
||||||
|
// correct oriantations etc
|
||||||
|
boost::geometry::correct(poly);
|
||||||
geom_ = std::move(poly);
|
geom_ = std::move(poly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#include <mapnik/wkb.hpp>
|
#include <mapnik/wkb.hpp>
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
#include <mapnik/util/noncopyable.hpp>
|
#include <mapnik/util/noncopyable.hpp>
|
||||||
|
#include <mapnik/geometry_adapters.hpp>
|
||||||
|
// boost.geometry
|
||||||
|
#include <boost/geometry/algorithms/correct.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -318,6 +321,8 @@ private:
|
||||||
if ( i == 0) poly.set_exterior_ring(std::move(ring));
|
if ( i == 0) poly.set_exterior_ring(std::move(ring));
|
||||||
else poly.add_hole(std::move(ring));
|
else poly.add_hole(std::move(ring));
|
||||||
}
|
}
|
||||||
|
// correct orientations etc
|
||||||
|
boost::geometry::correct(poly);
|
||||||
return poly;
|
return poly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue