mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Don't swap attributes when reducing tiny polygon dust (#207)
* Don't swap attributes when reducing tiny polygon dust Because the dust placeholder may be misleadingly far from the feature that contributed the most area to it * Remove unused arguments; update changelog
This commit is contained in:
+1
-27
@@ -168,11 +168,9 @@ void check_polygon(drawvec &geom) {
|
||||
}
|
||||
}
|
||||
|
||||
drawvec reduce_tiny_poly(drawvec const &geom, int z, int detail, bool *still_needs_simplification, bool *reduced_away, double *accum_area, serial_feature *this_feature, serial_feature *tiny_feature) {
|
||||
drawvec reduce_tiny_poly(drawvec const &geom, int z, int detail, bool *still_needs_simplification, bool *reduced_away, double *accum_area) {
|
||||
drawvec out;
|
||||
const double pixel = (1LL << (32 - detail - z)) * (double) tiny_polygon_size;
|
||||
bool includes_real = false;
|
||||
bool includes_dust = false;
|
||||
|
||||
bool included_last_outer = false;
|
||||
*still_needs_simplification = false;
|
||||
@@ -217,7 +215,6 @@ drawvec reduce_tiny_poly(drawvec const &geom, int z, int detail, bool *still_nee
|
||||
out.emplace_back(VT_LINETO, geom[i].x - pixel / 2 + pixel, geom[i].y - pixel / 2 + pixel);
|
||||
out.emplace_back(VT_LINETO, geom[i].x - pixel / 2, geom[i].y - pixel / 2 + pixel);
|
||||
out.emplace_back(VT_LINETO, geom[i].x - pixel / 2, geom[i].y - pixel / 2);
|
||||
includes_dust = true;
|
||||
|
||||
*accum_area -= pixel * pixel;
|
||||
}
|
||||
@@ -238,7 +235,6 @@ drawvec reduce_tiny_poly(drawvec const &geom, int z, int detail, bool *still_nee
|
||||
// which means that the overall polygon has a real geometry,
|
||||
// which means that it gets to be simplified.
|
||||
*still_needs_simplification = true;
|
||||
includes_real = true;
|
||||
|
||||
if (area > 0) {
|
||||
included_last_outer = true;
|
||||
@@ -260,28 +256,6 @@ drawvec reduce_tiny_poly(drawvec const &geom, int z, int detail, bool *still_nee
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
out.push_back(geom[i]);
|
||||
includes_real = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!includes_real) {
|
||||
if (includes_dust) {
|
||||
// this geometry is just dust, so if there is another feature that
|
||||
// contributed to the dust that is larger than this feature,
|
||||
// keep its attributes instead of this one that just happened to be
|
||||
// the one that hit the threshold of survival.
|
||||
|
||||
if (tiny_feature->extent > this_feature->extent) {
|
||||
*this_feature = *tiny_feature;
|
||||
tiny_feature->extent = 0;
|
||||
}
|
||||
} else {
|
||||
// this is a feature that we are throwing away, so hang on to it
|
||||
// attributes if it is bigger than the biggest one we threw away so far
|
||||
|
||||
if (this_feature->extent > tiny_feature->extent) {
|
||||
*tiny_feature = *this_feature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user