Scaffolding

This commit is contained in:
Erica Fischer
2024-03-26 16:26:52 -07:00
parent 266ef3c286
commit 19b79d0d5c
4 changed files with 16 additions and 8 deletions
+4 -4
View File
@@ -758,7 +758,7 @@ static std::vector<std::pair<double, double>> clip_poly1(std::vector<std::pair<d
std::string overzoom(const std::string &s, int oz, int ox, int oy, int nz, int nx, int ny, std::string overzoom(const 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, int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles, std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles,
bool demultiply, json_object *filter, bool preserve_input_order, std::unordered_map<std::string, attribute_op> const &attribute_accum, std::vector<std::string> const &unidecode_data) { bool demultiply, json_object *filter, bool preserve_input_order, std::unordered_map<std::string, attribute_op> const &attribute_accum, std::vector<std::string> const &unidecode_data, json_object *join_attributes_json) {
mvt_tile tile; mvt_tile tile;
try { try {
@@ -772,7 +772,7 @@ std::string overzoom(const std::string &s, int oz, int ox, int oy, int nz, int n
exit(EXIT_PROTOBUF); exit(EXIT_PROTOBUF);
} }
return overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, do_compress, next_overzoomed_tiles, demultiply, filter, preserve_input_order, attribute_accum, unidecode_data); return overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, do_compress, next_overzoomed_tiles, demultiply, filter, preserve_input_order, attribute_accum, unidecode_data, join_attributes_json);
} }
struct tile_feature { struct tile_feature {
@@ -873,7 +873,7 @@ static struct preservecmp {
std::string overzoom(const mvt_tile &tile, int oz, int ox, int oy, int nz, int nx, int ny, std::string overzoom(const 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, int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles, std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles,
bool demultiply, json_object *filter, bool preserve_input_order, std::unordered_map<std::string, attribute_op> const &attribute_accum, std::vector<std::string> const &unidecode_data) { bool demultiply, json_object *filter, bool preserve_input_order, std::unordered_map<std::string, attribute_op> const &attribute_accum, std::vector<std::string> const &unidecode_data, json_object *join_attributes_json) {
mvt_tile outtile; mvt_tile outtile;
std::shared_ptr<std::string> tile_stringpool = std::make_shared<std::string>(); std::shared_ptr<std::string> tile_stringpool = std::make_shared<std::string>();
@@ -1046,7 +1046,7 @@ std::string overzoom(const mvt_tile &tile, int oz, int ox, int oy, int nz, int n
std::string child = overzoom(outtile, nz, nx, ny, std::string child = overzoom(outtile, nz, nx, ny,
nz + 1, nx * 2 + x, ny * 2 + y, nz + 1, nx * 2 + x, ny * 2 + y,
detail, buffer, keep, false, NULL, detail, buffer, keep, false, NULL,
demultiply, filter, preserve_input_order, attribute_accum, unidecode_data); demultiply, filter, preserve_input_order, attribute_accum, unidecode_data, join_attributes_json);
if (child.size() > 0) { if (child.size() > 0) {
next_overzoomed_tiles->emplace_back(nx * 2 + x, ny * 2 + y); next_overzoomed_tiles->emplace_back(nx * 2 + x, ny * 2 + y);
} }
+4 -2
View File
@@ -105,13 +105,15 @@ std::string overzoom(const mvt_tile &tile, int oz, int ox, int oy, int nz, int n
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles, std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles,
bool demultiply, json_object *filter, bool preserve_input_order, bool demultiply, json_object *filter, bool preserve_input_order,
std::unordered_map<std::string, attribute_op> const &attribute_accum, std::unordered_map<std::string, attribute_op> const &attribute_accum,
std::vector<std::string> const &unidecode_data); std::vector<std::string> const &unidecode_data,
json_object *join_attributes_json);
std::string overzoom(const std::string &s, int oz, int ox, int oy, int nz, int nx, int ny, std::string overzoom(const 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, int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles, std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles,
bool demultiply, json_object *filter, bool preserve_input_order, bool demultiply, json_object *filter, bool preserve_input_order,
std::unordered_map<std::string, attribute_op> const &attribute_accum, std::unordered_map<std::string, attribute_op> const &attribute_accum,
std::vector<std::string> const &unidecode_data); std::vector<std::string> const &unidecode_data,
json_object *join_attributes_json);
#endif #endif
+7 -1
View File
@@ -20,6 +20,7 @@ std::string filter;
bool preserve_input_order = false; bool preserve_input_order = false;
std::unordered_map<std::string, attribute_op> attribute_accum; std::unordered_map<std::string, attribute_op> attribute_accum;
std::vector<std::string> unidecode_data; std::vector<std::string> unidecode_data;
json_object *join_attributes_json = NULL;
std::set<std::string> keep; std::set<std::string> keep;
@@ -43,6 +44,7 @@ int main(int argc, char **argv) {
{"preserve-input-order", no_argument, 0, 'o' & 0x1F}, {"preserve-input-order", no_argument, 0, 'o' & 0x1F},
{"accumulate-attribute", required_argument, 0, 'E'}, {"accumulate-attribute", required_argument, 0, 'E'},
{"unidecode-data", required_argument, 0, 'u' & 0x1F}, {"unidecode-data", required_argument, 0, 'u' & 0x1F},
{"join-attributes-json", required_argument, 0, 'c' & 0x1F},
{0, 0, 0, 0}, {0, 0, 0, 0},
}; };
@@ -97,6 +99,10 @@ int main(int argc, char **argv) {
unidecode_data = read_unidecode(optarg); unidecode_data = read_unidecode(optarg);
break; break;
case 'c' & 0x1F:
join_attributes_json = read_filter(optarg);
break;
default: default:
fprintf(stderr, "Unrecognized flag -%c\n", i); fprintf(stderr, "Unrecognized flag -%c\n", i);
usage(argv); usage(argv);
@@ -151,7 +157,7 @@ int main(int argc, char **argv) {
json_filter = parse_filter(filter.c_str()); json_filter = parse_filter(filter.c_str());
} }
std::string out = overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, true, NULL, demultiply, json_filter, preserve_input_order, attribute_accum, unidecode_data); std::string out = overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, true, NULL, demultiply, json_filter, preserve_input_order, attribute_accum, unidecode_data, join_attributes_json);
fwrite(out.c_str(), sizeof(char), out.size(), f); fwrite(out.c_str(), sizeof(char), out.size(), f);
fclose(f); fclose(f);
+1 -1
View File
@@ -704,7 +704,7 @@ struct tileset_reader {
} }
if (source.layers.size() != 0) { if (source.layers.size() != 0) {
std::string ret = overzoom(source, parent_tile.z, parent_tile.x, parent_tile.y, tile.z, tile.x, tile.y, -1, buffer, std::set<std::string>(), false, &next_overzoomed_tiles, false, NULL, false, std::unordered_map<std::string, attribute_op>(), unidecode_data); std::string ret = overzoom(source, parent_tile.z, parent_tile.x, parent_tile.y, tile.z, tile.x, tile.y, -1, buffer, std::set<std::string>(), false, &next_overzoomed_tiles, false, NULL, false, std::unordered_map<std::string, attribute_op>(), unidecode_data, NULL /* XXX join_attributes_json */);
return ret; return ret;
} }