Restore the intended behavior that tiny polygons don't get simplified

This commit is contained in:
Erica Fischer
2022-08-25 15:32:12 -07:00
parent 932c524ebc
commit 56259e4a16
3 changed files with 277 additions and 2 deletions
+10 -1
View File
@@ -544,6 +544,11 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
// inner rings must just have their area de-accumulated rather
// than being drawn since we don't really know where they are.
// i.e., this ring (inner or outer) is small enough that we are including it
// in a tiny polygon rather than letting it represent itself,
// OR it is an inner ring and we haven't output an outer ring for it to be
// cut out of, so we are just subtracting its area from the tiny polygon
// rather than trying to deal with it geometrically
if (std::fabs(area) <= pixel * pixel || (area < 0 && !included_last_outer)) {
// printf("area is only %f vs %lld so using square\n", area, pixel * pixel);
@@ -563,13 +568,17 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
if (area > 0) {
included_last_outer = false;
}
} else {
}
// i.e., this ring is large enough that it gets to represent itself
else {
// printf("area is %f so keeping instead of %lld\n", area, pixel * pixel);
for (size_t k = i; k <= j && k < geom.size(); k++) {
out.push_back(geom[k]);
}
// which means that the overall polygon has a real geometry,
// which means that it gets to be simplified.
*reduced = false;
if (area > 0) {
File diff suppressed because one or more lines are too long
+5 -1
View File
@@ -466,7 +466,11 @@ void *partial_feature_worker(void *v) {
}
if ((t == VT_LINE || t == VT_POLYGON) && !(prevent[P_SIMPLIFY] || (z == maxzoom && prevent[P_SIMPLIFY_LOW]) || (z < maxzoom && additional[A_GRID_LOW_ZOOMS]))) {
if (1 /* !reduced */) { // XXX why did this not simplify if reduced?
// Now I finally remember why it doesn't simplify if the feature was reduced:
// because it makes square placeholders look like weird triangular placeholders.
// Only matters if simplification is set higher than the tiny polygon size.
// Tiny polygons that are part of a tiny multipolygon will still get simplified.
if (!(*partials)[i].reduced) {
if (t == VT_LINE) {
// continues to deduplicate to line_detail even if we have extra detail
geom = remove_noop(geom, t, 32 - z - line_detail);