Keep the progress indicator progressing while working through big tiles

This commit is contained in:
Eric Fischer 2014-12-17 16:01:33 -08:00
parent 7f3551070e
commit 48b5db6ae5
3 changed files with 9 additions and 6 deletions

View File

@ -255,10 +255,7 @@ void check(int geomfd[4], off_t geom_size[4], char *metabase, unsigned *file_bbo
// fprintf(stderr, "%d/%u/%u\n", z, x, y);
fprintf(stderr, " %3.1f%% %d/%u/%u \r",
(((geom - geomstart + along) / (double) todo) + z) / (maxzoom + 1) * 100, z, x, y);
long long len = write_tile(&geom, metabase, file_bbox, z, x, y, z == maxzoom ? full_detail : low_detail, maxzoom, file_keys, layername, outdb, droprate, buffer, fname, jp, sub, minzoom, maxzoom);
long long len = write_tile(&geom, metabase, file_bbox, z, x, y, z == maxzoom ? full_detail : low_detail, maxzoom, file_keys, layername, outdb, droprate, buffer, fname, jp, sub, minzoom, maxzoom, todo, geomstart, along);
if (z == maxzoom && len > most) {
*midx = x;

View File

@ -342,9 +342,10 @@ void evaluate(std::vector<coalesce> &features, char *metabase, struct pool *file
pool_free(&keys);
}
long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, unsigned tx, unsigned ty, int detail, int basezoom, struct pool *file_keys, const char *layername, sqlite3 *outdb, double droprate, int buffer, const char *fname, json_pull *jp, FILE *geomfile[4], int file_minzoom, int file_maxzoom) {
long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, unsigned tx, unsigned ty, int detail, int basezoom, struct pool *file_keys, const char *layername, sqlite3 *outdb, double droprate, int buffer, const char *fname, json_pull *jp, FILE *geomfile[4], int file_minzoom, int file_maxzoom, double todo, char *geomstart, long long along) {
int line_detail;
static bool evaluated = false;
double oprogress = 0;
char *og = *geoms;
@ -384,6 +385,11 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
signed char feature_minzoom;
deserialize_byte(geoms, &feature_minzoom);
double progress = floor((((*geoms - geomstart + along) / (double) todo) + z) / (file_maxzoom + 1) * 1000) / 10;
if (progress != oprogress) {
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
}
int quick = quick_check(bbox, z, line_detail, buffer);
if (quick == 0) {
continue;

2
tile.h
View File

@ -26,4 +26,4 @@ void deserialize_uint(char **f, unsigned *n);
void deserialize_byte(char **f, signed char *n);
struct pool_val *deserialize_string(char **f, struct pool *p, int type);
long long write_tile(char **geom, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, const char *layername, sqlite3 *outdb, double droprate, int buffer, const char *fname, struct json_pull *jp, FILE *geomfile[4], int file_minzoom, int file_maxzoom);
long long write_tile(char **geom, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, const char *layername, sqlite3 *outdb, double droprate, int buffer, const char *fname, struct json_pull *jp, FILE *geomfile[4], int file_minzoom, int file_maxzoom, double todo, char *geomstart, long long along);