grid_vertex_converter: Fix handling of empty polygon

This commit is contained in:
Jiri Drbalek 2018-02-13 14:13:34 +00:00
parent a602c65354
commit 2f2dcf1eea

View file

@ -167,6 +167,8 @@ private:
}
double get_hit_bitmap_scale(box2d<T> const& envelope) const
{
if (envelope.valid())
{
T size = envelope.width() * envelope.height();
// Polygon with huge area can lead to excessive memory allocation.
@ -177,6 +179,7 @@ private:
{
return std::sqrt(max_size / size);
}
}
return 1;
}
@ -212,6 +215,8 @@ private:
double scale_factor) const
{
mapnik::geometry::point<T> interior;
if (envelope.valid())
{
if (!mapnik::geometry::interior(poly, scale_factor, interior))
{
auto center = envelope.center();
@ -220,7 +225,7 @@ private:
}
vt_.forward(&interior.x, &interior.y);
}
return interior;
}