diff --git a/geometry.cpp b/geometry.cpp index 34adff94..47a7858e 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -21,7 +21,7 @@ #include "errors.hpp" #include "projection.hpp" -drawvec decode_geometry(const char **meta, int z, unsigned tx, unsigned ty, long long *bbox, unsigned initial_x, unsigned initial_y) { +drawvec decode_geometry(const char **meta, int z, unsigned tx, unsigned ty, long long *bbox, long long initial_x, long long initial_y) { drawvec out; bbox[0] = LLONG_MAX; diff --git a/geometry.hpp b/geometry.hpp index f847afd1..5a18d589 100644 --- a/geometry.hpp +++ b/geometry.hpp @@ -67,7 +67,7 @@ struct draw { typedef std::vector drawvec; struct serial_feature; -drawvec decode_geometry(const char **meta, int z, unsigned tx, unsigned ty, long long *bbox, unsigned initial_x, unsigned initial_y); +drawvec decode_geometry(const char **meta, int z, unsigned tx, unsigned ty, long long *bbox, long long initial_x, long long initial_y); void to_tile_scale(drawvec &geom, int z, int detail); drawvec from_tile_scale(drawvec const &geom, int z, int detail); drawvec remove_noop(drawvec geom, int type, int shift); diff --git a/main.cpp b/main.cpp index 2bac12e1..e5871083 100644 --- a/main.cpp +++ b/main.cpp @@ -450,7 +450,7 @@ void *run_sort(void *v) { return NULL; } -void do_read_parallel(char *map, long long len, long long initial_offset, const char *reading, std::vector *readers, std::atomic *progress_seq, std::set *exclude, std::set *include, int exclude_all, int basezoom, int source, std::vector > *layermaps, int *initialized, unsigned *initial_x, unsigned *initial_y, int maxzoom, std::string layername, bool uses_gamma, std::unordered_map const *attribute_types, int separator, double *dist_sum, size_t *dist_count, double *area_sum, bool want_dist, bool filters) { +void do_read_parallel(char *map, long long len, long long initial_offset, const char *reading, std::vector *readers, std::atomic *progress_seq, std::set *exclude, std::set *include, int exclude_all, int basezoom, int source, std::vector > *layermaps, int *initialized, long long *initial_x, long long *initial_y, int maxzoom, std::string layername, bool uses_gamma, std::unordered_map const *attribute_types, int separator, double *dist_sum, size_t *dist_count, double *area_sum, bool want_dist, bool filters) { long long segs[CPUS + 1]; segs[0] = 0; segs[CPUS] = len; @@ -647,8 +647,8 @@ struct read_parallel_arg { int source = 0; std::vector > *layermaps = NULL; int *initialized = NULL; - unsigned *initial_x = NULL; - unsigned *initial_y = NULL; + long long *initial_x = NULL; + long long *initial_y = NULL; std::string layername = ""; bool uses_gamma = false; std::unordered_map const *attribute_types = NULL; @@ -695,7 +695,7 @@ void *run_read_parallel(void *v) { return NULL; } -void start_parsing(int fd, STREAM *fp, long long offset, long long len, std::atomic *is_parsing, pthread_t *parallel_parser, bool &parser_created, const char *reading, std::vector *readers, std::atomic *progress_seq, std::set *exclude, std::set *include, int exclude_all, int basezoom, int source, std::vector > &layermaps, int *initialized, unsigned *initial_x, unsigned *initial_y, int maxzoom, std::string layername, bool uses_gamma, std::unordered_map const *attribute_types, int separator, double *dist_sum, size_t *dist_count, double *area_sum, bool want_dist, bool filters) { +void start_parsing(int fd, STREAM *fp, long long offset, long long len, std::atomic *is_parsing, pthread_t *parallel_parser, bool &parser_created, const char *reading, std::vector *readers, std::atomic *progress_seq, std::set *exclude, std::set *include, int exclude_all, int basezoom, int source, std::vector > &layermaps, int *initialized, long long *initial_x, long long *initial_y, int maxzoom, std::string layername, bool uses_gamma, std::unordered_map const *attribute_types, int separator, double *dist_sum, size_t *dist_count, double *area_sum, bool want_dist, bool filters) { // This has to kick off an intermediate thread to start the parser threads, // so the main thread can get back to reading the next input stage while // the intermediate thread waits for the completion of the parser threads. @@ -1358,7 +1358,7 @@ std::pair read_input(std::vector &sources, char *fname, i // 2 * CPUS: One per reader thread, one per tiling thread int initialized[2 * CPUS]; - unsigned initial_x[2 * CPUS], initial_y[2 * CPUS]; + long long initial_x[2 * CPUS], initial_y[2 * CPUS]; for (size_t i = 0; i < 2 * CPUS; i++) { initialized[i] = initial_x[i] = initial_y[i] = 0; } diff --git a/serial.cpp b/serial.cpp index 0bad2db9..066228ff 100644 --- a/serial.cpp +++ b/serial.cpp @@ -230,7 +230,7 @@ std::string serialize_feature(serial_feature *sf, long long wx, long long wy) { return s; } -serial_feature deserialize_feature(std::string const &geoms, unsigned z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y) { +serial_feature deserialize_feature(std::string const &geoms, unsigned z, unsigned tx, unsigned ty, long long *initial_x, long long *initial_y) { serial_feature sf; const char *cp = geoms.c_str(); diff --git a/serial.hpp b/serial.hpp index 2d47f672..c2eaf768 100644 --- a/serial.hpp +++ b/serial.hpp @@ -120,7 +120,7 @@ struct serial_feature { }; std::string serialize_feature(serial_feature *sf, long long wx, long long wy); -serial_feature deserialize_feature(std::string const &geoms, unsigned z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y); +serial_feature deserialize_feature(std::string const &geoms, unsigned z, unsigned tx, unsigned ty, long long *initial_x, long long *initial_y); struct reader { int poolfd = -1; @@ -201,8 +201,8 @@ struct serialization_state { std::vector *readers = NULL; // array of data for each input thread int segment = 0; // the current input thread - unsigned *initial_x = NULL; // relative offset of all geometries - unsigned *initial_y = NULL; + long long *initial_x = NULL; // relative offset of all geometries + long long *initial_y = NULL; int *initialized = NULL; double *dist_sum = NULL; // running tally for calculation of resolution within features diff --git a/tile.cpp b/tile.cpp index efd4dd4e..2f8cfe0b 100644 --- a/tile.cpp +++ b/tile.cpp @@ -436,7 +436,7 @@ static std::vector disassemble_multiplier_clusters(std::vector *geompos, compressor *geomfile[], const char *fname, int child_shards, int max_zoom_increment, int segment, unsigned *initial_x, unsigned *initial_y) { +static void rewrite(serial_feature const &osf, int z, int nextzoom, int maxzoom, unsigned tx, unsigned ty, int buffer, int within[], std::atomic *geompos, compressor *geomfile[], const char *fname, int child_shards, int max_zoom_increment, int segment, long long *initial_x, long long *initial_y) { if (osf.geometry.size() > 0 && (nextzoom <= maxzoom || additional[A_EXTEND_ZOOMS] || extend_zooms_max > 0)) { int xo, yo; int span = 1 << (nextzoom - z); @@ -878,8 +878,8 @@ struct write_tile_args { double simplification = 0; std::atomic *most = NULL; long long *pool_off = NULL; - unsigned *initial_x = NULL; - unsigned *initial_y = NULL; + long long *initial_x = NULL; + long long *initial_y = NULL; std::atomic *running = NULL; int err = 0; std::vector> *layermaps = NULL; @@ -1026,7 +1026,7 @@ struct multiplier_state { // This function is called repeatedly from write_tile() to retrieve the next feature // from the input stream. If the stream is at an end, it returns a feature with the // geometry type set to -2. -static serial_feature next_feature(decompressor *geoms, std::atomic *geompos_in, int z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y, long long *original_features, long long *unclipped_features, int nextzoom, int maxzoom, int minzoom, int max_zoom_increment, size_t pass, std::atomic *along, long long alongminus, int buffer, int *within, compressor **geomfile, std::atomic *geompos, std::atomic *oprogress, double todo, const char *fname, int child_shards, json_object *filter, const char *global_stringpool, long long *pool_off, std::vector> *layer_unmaps, bool first_time, bool compressed, multiplier_state *multiplier_state, std::shared_ptr &tile_stringpool, std::vector const &unidecode_data) { +static serial_feature next_feature(decompressor *geoms, std::atomic *geompos_in, int z, unsigned tx, unsigned ty, long long *initial_x, long long *initial_y, long long *original_features, long long *unclipped_features, int nextzoom, int maxzoom, int minzoom, int max_zoom_increment, size_t pass, std::atomic *along, long long alongminus, int buffer, int *within, compressor **geomfile, std::atomic *geompos, std::atomic *oprogress, double todo, const char *fname, int child_shards, json_object *filter, const char *global_stringpool, long long *pool_off, std::vector> *layer_unmaps, bool first_time, bool compressed, multiplier_state *multiplier_state, std::shared_ptr &tile_stringpool, std::vector const &unidecode_data) { while (1) { serial_feature sf; long long len; @@ -1206,8 +1206,8 @@ struct run_prefilter_args { int z = 0; unsigned tx = 0; unsigned ty = 0; - unsigned *initial_x = 0; - unsigned *initial_y = 0; + long long *initial_x = 0; + long long *initial_y = 0; long long *original_features = 0; long long *unclipped_features = 0; int nextzoom = 0; @@ -1486,7 +1486,7 @@ bool drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer_features return false; // did not drop because nothing could be found to accumulate attributes onto } -long long write_tile(decompressor *geoms, std::atomic *geompos_in, char *global_stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, int minzoom, int maxzoom, double todo, std::atomic *along, long long alongminus, double gamma, int child_shards, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic *running, double simplification, std::vector> *layermaps, std::vector> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, unsigned long long mindrop_sequence, const char *prefilter, const char *postfilter, json_object *filter, write_tile_args *arg, atomic_strategy *strategy, bool compressed_input, node *shared_nodes_map, size_t nodepos, std::vector const &unidecode_data) { +long long write_tile(decompressor *geoms, std::atomic *geompos_in, char *global_stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, int minzoom, int maxzoom, double todo, std::atomic *along, long long alongminus, double gamma, int child_shards, long long *pool_off, long long *initial_x, long long *initial_y, std::atomic *running, double simplification, std::vector> *layermaps, std::vector> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, unsigned long long mindrop_sequence, const char *prefilter, const char *postfilter, json_object *filter, write_tile_args *arg, atomic_strategy *strategy, bool compressed_input, node *shared_nodes_map, size_t nodepos, std::vector const &unidecode_data) { double merge_fraction = 1; double mingap_fraction = 1; double minextent_fraction = 1; @@ -2685,7 +2685,7 @@ exit(EXIT_IMPOSSIBLE); return err_or_null; } -int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::atomic *midx, std::atomic *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector> &layermaps, const char *prefilter, const char *postfilter, std::unordered_map const *attribute_accum, json_object *filter, std::vector &strategies, int iz, node *shared_nodes_map, size_t nodepos, int basezoom, double droprate, std::vector const &unidecode_data) { +int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::atomic *midx, std::atomic *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, long long *initial_x, long long *initial_y, double simplification, double maxzoom_simplification, std::vector> &layermaps, const char *prefilter, const char *postfilter, std::unordered_map const *attribute_accum, json_object *filter, std::vector &strategies, int iz, node *shared_nodes_map, size_t nodepos, int basezoom, double droprate, std::vector const &unidecode_data) { last_progress = 0; // The existing layermaps are one table per input thread. diff --git a/tile.hpp b/tile.hpp index f679f85d..868f55a4 100644 --- a/tile.hpp +++ b/tile.hpp @@ -55,7 +55,7 @@ struct strategy { // long long write_tile(char **geom, char *stringpool, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int min_detail, int basezoom, sqlite3 *outdb, const char *outdir, double droprate, int buffer, const char *fname, FILE **geomfile, int file_minzoom, int file_maxzoom, double todo, char *geomstart, long long along, double gamma, int nlayers, std::atomic *strategy); -int traverse_zooms(int *geomfd, off_t *geom_size, char *stringpool, std::atomic *midx, std::atomic *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector > &layermap, const char *prefilter, const char *postfilter, std::unordered_map const *attribute_accum, struct json_object *filter, std::vector &strategies, int iz, struct node *shared_nodes_map, size_t nodepos, int basezoom, double droprate, std::vector const &unidecode_data); +int traverse_zooms(int *geomfd, off_t *geom_size, char *stringpool, std::atomic *midx, std::atomic *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, long long *initial_x, long long *initial_y, double simplification, double maxzoom_simplification, std::vector > &layermap, const char *prefilter, const char *postfilter, std::unordered_map const *attribute_accum, struct json_object *filter, std::vector &strategies, int iz, struct node *shared_nodes_map, size_t nodepos, int basezoom, double droprate, std::vector const &unidecode_data); int manage_gap(unsigned long long index, unsigned long long *previndex, double scale, double gamma, double *gap);