grid_vertex_converter: Fix handling of empty polygon
This commit is contained in:
parent
e08786b5fb
commit
b6c451d7e3
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