mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 09:55:41 +02:00
Stay in (tile-relative) world-scaled coordinates initially
This commit is contained in:
@@ -77,9 +77,6 @@ int decode_feature(char **meta, struct draw *out, int z, unsigned tx, unsigned t
|
|||||||
wwy -= ty << (32 - z);
|
wwy -= ty << (32 - z);
|
||||||
}
|
}
|
||||||
|
|
||||||
wwx >>= (32 - detail - z);
|
|
||||||
wwy >>= (32 - detail - z);
|
|
||||||
|
|
||||||
if (out != NULL) {
|
if (out != NULL) {
|
||||||
out[len].x = wwx;
|
out[len].x = wwx;
|
||||||
out[len].y = wwy;
|
out[len].y = wwy;
|
||||||
@@ -126,10 +123,6 @@ int draw(struct draw *geom, int n, mapnik::vector::tile_feature *feature) {
|
|||||||
int dx = wwx - px;
|
int dx = wwx - px;
|
||||||
int dy = wwy - py;
|
int dy = wwy - py;
|
||||||
|
|
||||||
if (dx == 0 && dy == 0 && op == VT_LINETO) {
|
|
||||||
printf("0 delta\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (feature != NULL) {
|
if (feature != NULL) {
|
||||||
feature->add_geometry((dx << 1) ^ (dx >> 31));
|
feature->add_geometry((dx << 1) ^ (dx >> 31));
|
||||||
feature->add_geometry((dy << 1) ^ (dy >> 31));
|
feature->add_geometry((dy << 1) ^ (dy >> 31));
|
||||||
@@ -204,6 +197,15 @@ int remove_noop(struct draw *geom, int n) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void to_tile_scale(struct draw *geom, int n, int z, int detail) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
geom[i].x >>= (32 - detail - z);
|
||||||
|
geom[i].y >>= (32 - detail - z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
long long write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned tx, unsigned ty, int detail, int basezoom, struct pool *file_keys) {
|
long long write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned tx, unsigned ty, int detail, int basezoom, struct pool *file_keys) {
|
||||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||||
|
|
||||||
@@ -265,6 +267,8 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
|
|||||||
deserialize_int(&meta, &t);
|
deserialize_int(&meta, &t);
|
||||||
decode_feature(&meta, geom, z, tx, ty, detail);
|
decode_feature(&meta, geom, z, tx, ty, detail);
|
||||||
|
|
||||||
|
to_tile_scale(geom, len, z, detail);
|
||||||
|
|
||||||
if (t == VT_LINE || t == VT_POLYGON) {
|
if (t == VT_LINE || t == VT_POLYGON) {
|
||||||
len = remove_noop(geom, len);
|
len = remove_noop(geom, len);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user