mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-22 04:18:01 +00:00
Save a little more space by sub-ordering within the same index
to put the lowest-numbered endpoint last within lines that start at the same point, since that is the one that might come next.
This commit is contained in:
parent
1cae0e85b3
commit
ac00c84fb2
16
tile.cc
16
tile.cc
@ -699,6 +699,7 @@ struct coalesce {
|
|||||||
drawvec geom;
|
drawvec geom;
|
||||||
std::vector<int> meta;
|
std::vector<int> meta;
|
||||||
unsigned long long index;
|
unsigned long long index;
|
||||||
|
unsigned long long index2;
|
||||||
char *metasrc;
|
char *metasrc;
|
||||||
bool coalesced;
|
bool coalesced;
|
||||||
|
|
||||||
@ -748,6 +749,12 @@ int coalindexcmp(const struct coalesce *c1, const struct coalesce *c2) {
|
|||||||
} else if (c1->index > c2->index) {
|
} else if (c1->index > c2->index) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c1->index2 > c2->index2) {
|
||||||
|
return -1;
|
||||||
|
} else if (c1->index2 < c2->index2) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmp;
|
return cmp;
|
||||||
@ -994,8 +1001,17 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
|
|||||||
c.type = t;
|
c.type = t;
|
||||||
if (geom.size() > 0) {
|
if (geom.size() > 0) {
|
||||||
c.index = encode(geom[0].x, geom[0].y);
|
c.index = encode(geom[0].x, geom[0].y);
|
||||||
|
c.index2 = encode(geom[geom.size() - 1].x, geom[geom.size() - 1].y);
|
||||||
|
|
||||||
|
// Anything numbered below the start of the line
|
||||||
|
// can't possibly be the next feature.
|
||||||
|
// We want lowest-but-not-under.
|
||||||
|
if (c.index2 < c.index) {
|
||||||
|
c.index2 = ~0LL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
c.index = i->index;
|
c.index = i->index;
|
||||||
|
c.index2 = i->index;
|
||||||
}
|
}
|
||||||
c.geom = geom;
|
c.geom = geom;
|
||||||
c.metasrc = meta;
|
c.metasrc = meta;
|
||||||
|
Loading…
Reference in New Issue
Block a user