avoid closing empty path
This commit is contained in:
parent
340ed85e4e
commit
5162027034
1 changed files with 24 additions and 10 deletions
|
@ -75,26 +75,40 @@ struct geometry_to_path
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto const& pt : poly.exterior_ring)
|
for (auto const& pt : poly.exterior_ring)
|
||||||
{
|
{
|
||||||
//point pt_new;
|
if (first) {
|
||||||
//Transformer::apply(pt, pt_new);
|
p_.move_to(pt.x, pt.y);
|
||||||
if (first) { p_.move_to(pt.x, pt.y); first=false;}
|
first=false;
|
||||||
else p_.line_to(pt.x, pt.y);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_.line_to(pt.x, pt.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!first)
|
||||||
|
{
|
||||||
p_.close_path();
|
p_.close_path();
|
||||||
|
}
|
||||||
// interior
|
// interior
|
||||||
for (auto const& ring : poly.interior_rings)
|
for (auto const& ring : poly.interior_rings)
|
||||||
{
|
{
|
||||||
first = true;
|
first = true;
|
||||||
for (auto const& pt : ring)
|
for (auto const& pt : ring)
|
||||||
{
|
{
|
||||||
//point pt_new;
|
if (first) {
|
||||||
//Transformer::apply(pt, pt_new);
|
p_.move_to(pt.x, pt.y);
|
||||||
if (first) { p_.move_to(pt.x, pt.y); first=false;}
|
first=false;
|
||||||
else p_.line_to(pt.x, pt.y);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_.line_to(pt.x, pt.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!first)
|
||||||
|
{
|
||||||
p_.close_path();
|
p_.close_path();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// multi point
|
// multi point
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
Loading…
Add table
Reference in a new issue