mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-01 21:01:19 +01:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03647fb4a5 | ||
|
|
a52d15a0b1 |
@@ -676,7 +676,9 @@ static void *simplification_worker(void *v) {
|
||||
|
||||
for (size_t i = a->task; i < (*features).size(); i += a->tasks) {
|
||||
double area = 0;
|
||||
if (!a->trying_to_stop_early) {
|
||||
if (a->trying_to_stop_early) {
|
||||
area = get_mp_area((*features)[i]->geometry);
|
||||
} else {
|
||||
area = simplify_feature(&*((*features)[i]), *(a->shared_nodes), a->shared_nodes_map, a->nodepos, *(a->shared_nodes_bloom));
|
||||
}
|
||||
|
||||
@@ -701,8 +703,13 @@ static void *simplification_worker(void *v) {
|
||||
}
|
||||
|
||||
if (geom.size() < 3) {
|
||||
if (area > 0) {
|
||||
if (area > 0 && !additional[A_GRID_LOW_ZOOMS]) {
|
||||
// area is in world coordinates, calculated before scaling down
|
||||
//
|
||||
// Don't revive if we are gridding low zooms, because
|
||||
// the expectation there is that only the features that
|
||||
// happen to span integer divisions of the tile grid
|
||||
// will survive
|
||||
geom = revive_polygon(before, area, z, out_detail);
|
||||
} else {
|
||||
geom.clear();
|
||||
@@ -712,15 +719,19 @@ static void *simplification_worker(void *v) {
|
||||
}
|
||||
}
|
||||
|
||||
if (t == VT_POLYGON && additional[A_GENERATE_POLYGON_LABEL_POINTS]) {
|
||||
t = (*features)[i]->t = VT_POINT;
|
||||
geom = checkerboard_anchors(from_tile_scale(geom, z, out_detail), (*features)[i]->tx, (*features)[i]->ty, z, (*features)[i]->label_point);
|
||||
to_tile_scale(geom, z, out_detail);
|
||||
}
|
||||
|
||||
if ((*features)[i]->index == 0) {
|
||||
(*features)[i]->index = i;
|
||||
}
|
||||
#if 0
|
||||
if (geom.size() == 0 && !additional[A_GRID_LOW_ZOOMS]) {
|
||||
fprintf(stderr, "simplified away to nothing\n");
|
||||
for (auto const &g : geom) {
|
||||
fprintf(stderr, "(%d)%lld,%lld ", g.op, g.x, g.y);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
(*features)[i]->geometry = std::move(geom);
|
||||
}
|
||||
|
||||
@@ -2070,6 +2081,25 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
if (line_is_too_small(sf.geometry, z, line_detail)) {
|
||||
continue;
|
||||
}
|
||||
if (sf.t == VT_POLYGON && get_mp_area(sf.geometry) <= 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Make label anchors early in tiling, even though it requires simplifying early,
|
||||
// so that if there is no label anchor for this feature in this tile,
|
||||
// we find out now rather than after we have already decided that there
|
||||
// are too_many_bytes.
|
||||
if (sf.t == VT_POLYGON && additional[A_GENERATE_POLYGON_LABEL_POINTS]) {
|
||||
drawvec ngeom = simplify_lines(sf.geometry, z, tx, ty, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), sf.simplification, sf.t == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0, "");
|
||||
if (ngeom.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
sf.geometry = checkerboard_anchors(ngeom, tx, ty, z, sf.label_point);
|
||||
if (sf.geometry.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
sf.t = VT_POINT;
|
||||
}
|
||||
|
||||
unsigned long long sfindex = sf.index;
|
||||
@@ -2174,6 +2204,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
// have been assembled globally, although that also means that simplification
|
||||
// may not be very effective for reducing memory usage.
|
||||
|
||||
fprintf(stderr, "simplifying through\n");
|
||||
for (; simplified_geometry_through < features.size(); simplified_geometry_through++) {
|
||||
simplify_feature(&*features[simplified_geometry_through], shared_nodes, shared_nodes_map, nodepos, shared_nodes_bloom);
|
||||
|
||||
@@ -2752,6 +2783,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
fprintf(stderr, "Going to try gamma of %0.3f to make it fit\n", gamma);
|
||||
}
|
||||
line_detail++; // to keep it the same when the loop decrements it
|
||||
continue;
|
||||
} else if (mingap < ULONG_MAX && (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED])) {
|
||||
mingap_fraction = std::min(1.0, mingap_fraction * adjusted_max_tile_size / adjusted_tile_size * 0.80);
|
||||
unsigned long long m = choose_mingap(gaps, mingap_fraction, mingap);
|
||||
|
||||
Reference in New Issue
Block a user