Avoid clipping if the input and output tiles are the same

This commit is contained in:
Erica Fischer
2024-01-25 09:58:42 -08:00
parent 0f026d5040
commit dc88da5e3e
+8
View File
@@ -931,6 +931,7 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
long long tilesize = 1LL << (32 - oz); // source tile size in world coordinates long long tilesize = 1LL << (32 - oz); // source tile size in world coordinates
draw ring_closure(0, 0, 0); draw ring_closure(0, 0, 0);
bool sametile = (nz == ox && nx == ox && ny == oy);
for (auto const &g : feature.geometry) { for (auto const &g : feature.geometry) {
if (g.op == mvt_closepath) { if (g.op == mvt_closepath) {
@@ -956,6 +957,7 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
g.y -= ny * outtilesize; g.y -= ny * outtilesize;
} }
if (!sametile) {
// Clip to output tile // Clip to output tile
long long xmin = LLONG_MAX; long long xmin = LLONG_MAX;
@@ -983,16 +985,22 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
} else if (t == VT_POINT) { } else if (t == VT_POINT) {
geom = clip_point(geom, nz, buffer); geom = clip_point(geom, nz, buffer);
} }
}
// Scale to output tile extent // Scale to output tile extent
to_tile_scale(geom, nz, det); to_tile_scale(geom, nz, det);
if (!sametile) {
// Clean geometries // Clean geometries
geom = remove_noop(geom, t, 0); geom = remove_noop(geom, t, 0);
if (t == VT_POLYGON) { if (t == VT_POLYGON) {
geom = clean_or_clip_poly(geom, 0, 0, false, false); geom = clean_or_clip_poly(geom, 0, 0, false, false);
}
}
if (t == VT_POLYGON) {
geom = close_poly(geom); geom = close_poly(geom);
} }