Correctly detect external hole perimeters

This commit is contained in:
Alessandro Ranellucci 2013-05-13 12:52:57 +02:00
parent ca549cd2fe
commit 1d94618c5e

View file

@ -353,7 +353,9 @@ sub make_perimeters {
push @loops, $traverse->($polynode->{children}, $depth+1, $is_contour);
my $role = EXTR_ROLE_PERIMETER;
if ($depth == 0) {
if ($is_contour ? $depth == 0 : !@{ $polynode->{children} }) {
# external perimeters are root level in case of contours
# and items with no children in case of holes
$role = EXTR_ROLE_EXTERNAL_PERIMETER;
} elsif ($depth == 1 && $is_contour) {
$role = EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER;