avoid closing empty path

This commit is contained in:
Dane Springmeyer 2015-05-07 16:12:38 -07:00
parent 340ed85e4e
commit 5162027034

View file

@ -75,26 +75,40 @@ struct geometry_to_path
bool first = true;
for (auto const& pt : poly.exterior_ring)
{
//point pt_new;
//Transformer::apply(pt, pt_new);
if (first) { p_.move_to(pt.x, pt.y); first=false;}
else p_.line_to(pt.x, pt.y);
if (first) {
p_.move_to(pt.x, pt.y);
first=false;
}
else
{
p_.line_to(pt.x, pt.y);
}
}
if (!first)
{
p_.close_path();
}
// interior
for (auto const& ring : poly.interior_rings)
{
first = true;
for (auto const& pt : ring)
{
//point pt_new;
//Transformer::apply(pt, pt_new);
if (first) { p_.move_to(pt.x, pt.y); first=false;}
else p_.line_to(pt.x, pt.y);
if (first) {
p_.move_to(pt.x, pt.y);
first=false;
}
else
{
p_.line_to(pt.x, pt.y);
}
}
if (!first)
{
p_.close_path();
}
}
}
// multi point
template <typename T>