polygon_clipper: detect invalid winding order when in debug mode
This commit is contained in:
parent
8ca8b2c64e
commit
0b5d70f926
1 changed files with 9 additions and 2 deletions
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/box2d.hpp>
|
#include <mapnik/box2d.hpp>
|
||||||
|
#include <mapnik/debug.hpp>
|
||||||
#include <mapnik/geometry.hpp>
|
#include <mapnik/geometry.hpp>
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
|
@ -101,7 +102,7 @@ struct polygon_clipper
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
polygon_clipper( box2d<double> const& clip_box,Geometry & geom)
|
polygon_clipper(box2d<double> const& clip_box, Geometry & geom)
|
||||||
: clip_box_(clip_box),
|
: clip_box_(clip_box),
|
||||||
geom_(geom)
|
geom_(geom)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +180,13 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
polygon_list clipped_polygons;
|
polygon_list clipped_polygons;
|
||||||
|
#ifdef MAPNIK_LOG
|
||||||
|
double area = boost::geometry::area(subject_poly);
|
||||||
|
if (area < 0)
|
||||||
|
{
|
||||||
|
MAPNIK_LOG_ERROR(polygon_clipper) << "negative area detected for polygon indicating incorrect winding order";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boost::geometry::intersection(clip_box_, subject_poly, clipped_polygons);
|
boost::geometry::intersection(clip_box_, subject_poly, clipped_polygons);
|
||||||
|
|
Loading…
Add table
Reference in a new issue