mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Another polygon fix: if the outer ring was dropped, drop its inner rings too
This commit is contained in:
+10
-1
@@ -344,6 +344,7 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
|||||||
long long pixel = (1 << (32 - detail - z)) * 2;
|
long long pixel = (1 << (32 - detail - z)) * 2;
|
||||||
|
|
||||||
*reduced = true;
|
*reduced = true;
|
||||||
|
bool included_last_outer = false;
|
||||||
|
|
||||||
for (unsigned i = 0; i < geom.size(); i++) {
|
for (unsigned i = 0; i < geom.size(); i++) {
|
||||||
if (geom[i].op == VT_MOVETO) {
|
if (geom[i].op == VT_MOVETO) {
|
||||||
@@ -361,7 +362,7 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
|||||||
}
|
}
|
||||||
area = area / 2;
|
area = area / 2;
|
||||||
|
|
||||||
if (fabs(area) <= pixel * pixel) {
|
if (fabs(area) <= pixel * pixel || (area < 0 && !included_last_outer)) {
|
||||||
// printf("area is only %f vs %lld so using square\n", area, pixel * pixel);
|
// printf("area is only %f vs %lld so using square\n", area, pixel * pixel);
|
||||||
|
|
||||||
*accum_area += area;
|
*accum_area += area;
|
||||||
@@ -376,6 +377,10 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
|||||||
|
|
||||||
*accum_area -= pixel * pixel;
|
*accum_area -= pixel * pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (area >= 0) {
|
||||||
|
included_last_outer = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// printf("area is %f so keeping instead of %lld\n", area, pixel * pixel);
|
// printf("area is %f so keeping instead of %lld\n", area, pixel * pixel);
|
||||||
|
|
||||||
@@ -384,6 +389,10 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
|||||||
}
|
}
|
||||||
|
|
||||||
*reduced = false;
|
*reduced = false;
|
||||||
|
|
||||||
|
if (area >= 0) {
|
||||||
|
included_last_outer = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = j - 1;
|
i = j - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user