mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
32-bit worlds as hex strings
This commit is contained in:
@@ -293,7 +293,7 @@ drawvec clean_or_clip_poly(drawvec &geom, int z, int buffer, bool clip, bool try
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (clip) {
|
if (clip) {
|
||||||
long long area = 0xFFFFFFFF;
|
long long area = (1LL << GLOBAL_DETAIL) - 1;
|
||||||
if (z != 0) {
|
if (z != 0) {
|
||||||
area = 1LL << (GLOBAL_DETAIL - z);
|
area = 1LL << (GLOBAL_DETAIL - z);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -425,11 +425,11 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf, std::
|
|||||||
|
|
||||||
for (size_t i = 0; i < sf.geometry.size(); i++) {
|
for (size_t i = 0; i < sf.geometry.size(); i++) {
|
||||||
if (sf.geometry[i].op == VT_MOVETO || sf.geometry[i].op == VT_LINETO) {
|
if (sf.geometry[i].op == VT_MOVETO || sf.geometry[i].op == VT_LINETO) {
|
||||||
if (sf.geometry[i].y > 0 && sf.geometry[i].y < 0xFFFFFFFF) {
|
if (sf.geometry[i].y > 0 && sf.geometry[i].y < (1LL << GLOBAL_DETAIL) - 1) {
|
||||||
// standard -180 to 180 world plane
|
// standard -180 to 180 world plane
|
||||||
|
|
||||||
long long x = sf.geometry[i].x & 0xFFFFFFFF;
|
long long x = sf.geometry[i].x & ((1LL << GLOBAL_DETAIL) - 1);
|
||||||
long long y = sf.geometry[i].y & 0xFFFFFFFF;
|
long long y = sf.geometry[i].y & ((1LL << GLOBAL_DETAIL) - 1);
|
||||||
|
|
||||||
r->file_bbox1[0] = std::min(r->file_bbox1[0], x);
|
r->file_bbox1[0] = std::min(r->file_bbox1[0], x);
|
||||||
r->file_bbox1[1] = std::min(r->file_bbox1[1], y);
|
r->file_bbox1[1] = std::min(r->file_bbox1[1], y);
|
||||||
@@ -439,8 +439,8 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf, std::
|
|||||||
// printf("%llx,%llx %llx,%llx %llx,%llx ", x, y, r->file_bbox1[0], r->file_bbox1[1], r->file_bbox1[2], r->file_bbox1[3]);
|
// printf("%llx,%llx %llx,%llx %llx,%llx ", x, y, r->file_bbox1[0], r->file_bbox1[1], r->file_bbox1[2], r->file_bbox1[3]);
|
||||||
|
|
||||||
// shift the western hemisphere 360 degrees to the east
|
// shift the western hemisphere 360 degrees to the east
|
||||||
if (x < 0x80000000) { // prime meridian
|
if (x < 1LL << (GLOBAL_DETAIL - 1)) { // prime meridian
|
||||||
x += 0x100000000;
|
x += 1LL << GLOBAL_DETAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
r->file_bbox2[0] = std::min(r->file_bbox2[0], x);
|
r->file_bbox2[0] = std::min(r->file_bbox2[0], x);
|
||||||
|
|||||||
Reference in New Issue
Block a user