mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-22 10:10:49 +00:00
Merge pull request #149 from mapbox/fix-progress
Progress indicator improvements
This commit is contained in:
commit
29db0e8988
12
geojson.c
12
geojson.c
@ -1319,6 +1319,8 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
progress_seq = indexpos / sizeof(struct index);
|
||||
|
||||
if (basezoom < 0 || droprate < 0) {
|
||||
struct index *map = mmap(NULL, indexpos, PROT_READ, MAP_PRIVATE, indexfd, 0);
|
||||
if (map == MAP_FAILED) {
|
||||
@ -1344,12 +1346,22 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
||||
}
|
||||
}
|
||||
|
||||
long long progress = -1;
|
||||
|
||||
long long indices = indexpos / sizeof(struct index);
|
||||
long long i;
|
||||
for (i = 0; i < indices; i++) {
|
||||
unsigned xx, yy;
|
||||
decode(map[i].index, &xx, &yy);
|
||||
|
||||
long long nprogress = 100 * i / indices;
|
||||
if (nprogress != progress) {
|
||||
progress = nprogress;
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Base zoom/drop rate: %lld%% \r", progress);
|
||||
}
|
||||
}
|
||||
|
||||
int z;
|
||||
for (z = 0; z <= MAX_ZOOM; z++) {
|
||||
unsigned xxx = 0, yyy = 0;
|
||||
|
8
tile.cc
8
tile.cc
@ -579,7 +579,11 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi
|
||||
}
|
||||
}
|
||||
|
||||
for (line_detail = detail; line_detail >= min_detail || line_detail == detail; line_detail--) {
|
||||
static volatile double oprogress = 0;
|
||||
|
||||
// This only loops if the tile data didn't fit, in which case the detail
|
||||
// goes down and the progress indicator goes backward for the next try.
|
||||
for (line_detail = detail; line_detail >= min_detail || line_detail == detail; line_detail--, oprogress = 0) {
|
||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||
|
||||
struct pool keys1[nlayers], values1[nlayers];
|
||||
@ -622,8 +626,6 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi
|
||||
memset(within, '\0', sizeof(within));
|
||||
memset(geompos, '\0', sizeof(geompos));
|
||||
|
||||
double oprogress = 0;
|
||||
|
||||
*geoms = og;
|
||||
|
||||
while (1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user