Skip to content

Commit

Permalink
Clean up naming; use std::move to avoid copying large arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Nov 8, 2023
1 parent 1b1ff47 commit 1a276b8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.37.0

* Speed up tile-join overzooming and make it use less memory, by not including empty child tiles in the enumeration

# 2.36.0

* Make tile-join distrust the source tilesets' metadata maxzoom and minzoom
Expand Down
10 changes: 5 additions & 5 deletions clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ static std::vector<std::pair<double, double>> clip_poly1(std::vector<std::pair<d

std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int ny,
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *child_tiles) {
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles) {
mvt_tile tile;

try {
Expand All @@ -768,12 +768,12 @@ std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int
exit(EXIT_PROTOBUF);
}

return overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, do_compress, child_tiles);
return overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, do_compress, next_overzoomed_tiles);
}

std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int ny,
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *child_tiles) {
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles) {
mvt_tile outtile;

for (auto const &layer : tile.layers) {
Expand Down Expand Up @@ -892,7 +892,7 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
}
}

if (child_tiles != NULL) {
if (next_overzoomed_tiles != NULL) {
// will any child tiles have features in them?
// find out recursively from the tile we just made.
//
Expand All @@ -907,7 +907,7 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
nz + 1, nx * 2 + x, ny * 2 + y,
detail, buffer, keep, false, NULL);
if (child.size() > 0) {
child_tiles->emplace_back(nx * 2 + x, ny * 2 + y);
next_overzoomed_tiles->emplace_back(nx * 2 + x, ny * 2 + y);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ double distance_from_line(long long point_x, long long point_y, long long segA_x

std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int ny,
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *child_tiles);
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles);

std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int ny,
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *child_tiles);
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles);

#endif
2 changes: 1 addition & 1 deletion tile-join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ struct tileset_reader {
}
}
} else {
overzoomed_tiles = next_overzoomed_tiles;
overzoomed_tiles = std::move(next_overzoomed_tiles);
next_overzoomed_tiles.clear();
}

Expand Down
2 changes: 1 addition & 1 deletion version.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP

#define VERSION "v2.36.0"
#define VERSION "v2.37.0"

#endif

0 comments on commit 1a276b8

Please sign in to comment.