grid_vertex_converter: Fix handling of empty polygon
This commit is contained in:
parent
a602c65354
commit
2f2dcf1eea
1 changed files with 19 additions and 14 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue