mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-22 18:12:40 +00:00
Further cleanup of minzoom- and maxzoom-related variable names
This commit is contained in:
parent
7372a2c4bc
commit
76de0c82d2
14
geojson.c
14
geojson.c
@ -564,19 +564,19 @@ int serialize_geometry(json_object *geometry, json_object *properties, const cha
|
|||||||
serialize_byte(geomfile, VT_END, geompos, fname);
|
serialize_byte(geomfile, VT_END, geompos, fname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note that minzoom for lines is the dimension
|
* Note that feature_minzoom for lines is the dimension
|
||||||
* of the geometry in world coordinates, but
|
* of the geometry in world coordinates, but
|
||||||
* for points is the lowest zoom level (in tiles,
|
* for points is the lowest zoom level (in tiles,
|
||||||
* not in pixels) at which it should be drawn.
|
* not in pixels) at which it should be drawn.
|
||||||
*
|
*
|
||||||
* So a line that is too small for, say, z8
|
* So a line that is too small for, say, z8
|
||||||
* will have minzoom of 18 (if tile detail is 10),
|
* will have feature_minzoom of 18 (if tile detail is 10),
|
||||||
* not 8.
|
* not 8.
|
||||||
*/
|
*/
|
||||||
int minzoom = 0;
|
int feature_minzoom = 0;
|
||||||
if (mb_geometry[t] == VT_LINE) {
|
if (mb_geometry[t] == VT_LINE) {
|
||||||
for (minzoom = 0; minzoom < 31; minzoom++) {
|
for (feature_minzoom = 0; feature_minzoom < 31; feature_minzoom++) {
|
||||||
unsigned mask = 1 << (32 - (minzoom + 1));
|
unsigned mask = 1 << (32 - (feature_minzoom + 1));
|
||||||
|
|
||||||
if (((bbox[0] & mask) != (bbox[2] & mask)) || ((bbox[1] & mask) != (bbox[3] & mask))) {
|
if (((bbox[0] & mask) != (bbox[2] & mask)) || ((bbox[1] & mask) != (bbox[3] & mask))) {
|
||||||
break;
|
break;
|
||||||
@ -587,10 +587,10 @@ int serialize_geometry(json_object *geometry, json_object *properties, const cha
|
|||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
r = .00000001;
|
r = .00000001;
|
||||||
}
|
}
|
||||||
minzoom = basezoom - floor(log(r) / -log(droprate));
|
feature_minzoom = basezoom - floor(log(r) / -log(droprate));
|
||||||
}
|
}
|
||||||
|
|
||||||
serialize_byte(geomfile, minzoom, geompos, fname);
|
serialize_byte(geomfile, feature_minzoom, geompos, fname);
|
||||||
|
|
||||||
struct index index;
|
struct index index;
|
||||||
index.start = geomstart;
|
index.start = geomstart;
|
||||||
|
18
tile.cc
18
tile.cc
@ -362,8 +362,8 @@ struct sll {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void rewrite(drawvec &geom, int z, int nextzoom, int file_maxzoom, long long *bbox, unsigned tx, unsigned ty, int buffer, int line_detail, int *within, long long *geompos, FILE **geomfile, const char *fname, signed char t, int layer, long long metastart, signed char feature_minzoom, int child_shards, int max_zoom_increment, long long seq, int tippecanoe_minzoom, int tippecanoe_maxzoom) {
|
void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, unsigned tx, unsigned ty, int buffer, int line_detail, int *within, long long *geompos, FILE **geomfile, const char *fname, signed char t, int layer, long long metastart, signed char feature_minzoom, int child_shards, int max_zoom_increment, long long seq, int tippecanoe_minzoom, int tippecanoe_maxzoom) {
|
||||||
if (geom.size() > 0 && nextzoom <= file_maxzoom) {
|
if (geom.size() > 0 && nextzoom <= maxzoom) {
|
||||||
int xo, yo;
|
int xo, yo;
|
||||||
int span = 1 << (nextzoom - z);
|
int span = 1 << (nextzoom - z);
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ void rewrite(drawvec &geom, int z, int nextzoom, int file_maxzoom, long long *bb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsigned tx, unsigned ty, int detail, int min_detail, int basezoom, struct pool **file_keys, char **layernames, sqlite3 *outdb, double droprate, int buffer, const char *fname, FILE **geomfile, int file_minzoom, int file_maxzoom, double todo, char *geomstart, volatile long long *along, double gamma, int nlayers, char *prevent, char *additional, int child_shards) {
|
long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsigned tx, unsigned ty, int detail, int min_detail, int basezoom, struct pool **file_keys, char **layernames, sqlite3 *outdb, double droprate, int buffer, const char *fname, FILE **geomfile, int minzoom, int maxzoom, double todo, char *geomstart, volatile long long *along, double gamma, int nlayers, char *prevent, char *additional, int child_shards) {
|
||||||
int line_detail;
|
int line_detail;
|
||||||
double fraction = 1;
|
double fraction = 1;
|
||||||
|
|
||||||
@ -481,9 +481,9 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi
|
|||||||
}
|
}
|
||||||
|
|
||||||
int nextzoom = z + 1;
|
int nextzoom = z + 1;
|
||||||
if (nextzoom < file_minzoom) {
|
if (nextzoom < minzoom) {
|
||||||
if (z + max_zoom_increment > file_minzoom) {
|
if (z + max_zoom_increment > minzoom) {
|
||||||
nextzoom = file_minzoom;
|
nextzoom = minzoom;
|
||||||
} else {
|
} else {
|
||||||
nextzoom = z + max_zoom_increment;
|
nextzoom = z + max_zoom_increment;
|
||||||
}
|
}
|
||||||
@ -566,7 +566,7 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi
|
|||||||
signed char feature_minzoom;
|
signed char feature_minzoom;
|
||||||
deserialize_byte(geoms, &feature_minzoom);
|
deserialize_byte(geoms, &feature_minzoom);
|
||||||
|
|
||||||
double progress = floor((((*geoms - geomstart + *along) / (double) todo) + z) / (file_maxzoom + 1) * 1000) / 10;
|
double progress = floor((((*geoms - geomstart + *along) / (double) todo) + z) / (maxzoom + 1) * 1000) / 10;
|
||||||
if (progress >= oprogress + 0.1) {
|
if (progress >= oprogress + 0.1) {
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
|
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
|
||||||
@ -630,10 +630,10 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (line_detail == detail && fraction == 1) { /* only write out the next zoom once, even if we retry */
|
if (line_detail == detail && fraction == 1) { /* only write out the next zoom once, even if we retry */
|
||||||
rewrite(geom, z, nextzoom, file_maxzoom, bbox, tx, ty, buffer, line_detail, within, geompos, geomfile, fname, t, layer, metastart, feature_minzoom, child_shards, max_zoom_increment, original_seq, tippecanoe_minzoom, tippecanoe_maxzoom);
|
rewrite(geom, z, nextzoom, maxzoom, bbox, tx, ty, buffer, line_detail, within, geompos, geomfile, fname, t, layer, metastart, feature_minzoom, child_shards, max_zoom_increment, original_seq, tippecanoe_minzoom, tippecanoe_maxzoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (z < file_minzoom) {
|
if (z < minzoom) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user