Clipper - fix PolyTree traversal
This commit is contained in:
parent
fb61a2bb90
commit
2ebc729cc8
1 changed files with 10 additions and 11 deletions
|
@ -512,26 +512,25 @@ public:
|
|||
bool first = true;
|
||||
while (polynode)
|
||||
{
|
||||
//do stuff with polynode here
|
||||
if (first) first = false;
|
||||
else mp.emplace_back();
|
||||
if (!polynode->IsHole())
|
||||
{
|
||||
if (first) first = false;
|
||||
else mp.emplace_back(); // start new polygon
|
||||
for (auto const& pt : polynode->Contour)
|
||||
{
|
||||
mp.back().exterior_ring.add_coord(pt.X, pt.Y);
|
||||
}
|
||||
}
|
||||
else
|
||||
// childrens are interior rings
|
||||
for (auto const* ring : polynode->Childs)
|
||||
{
|
||||
mapnik::geometry::linear_ring hole;
|
||||
for (auto const& pt : polynode->Contour)
|
||||
for (auto const& pt : ring->Contour)
|
||||
{
|
||||
hole.add_coord(pt.X, pt.Y);
|
||||
}
|
||||
mp.back().add_hole(std::move(hole));
|
||||
}
|
||||
std::cerr << "Is hole? " << polynode->IsHole() << std::endl;
|
||||
}
|
||||
polynode = polynode->GetNext();
|
||||
}
|
||||
std::string expect = expected_+".png";
|
||||
|
|
Loading…
Reference in a new issue