diff --git a/serial.cpp b/serial.cpp index 375c9cf6..c29dda99 100644 --- a/serial.cpp +++ b/serial.cpp @@ -210,7 +210,6 @@ std::string serialize_feature(serial_feature *sf, long long wx, long long wy) { if (sf->index != 0) { serialize_ulong_long(s, sf->index); - serialize_ulong_long(s, sf->previndex); serialize_ulong_long(s, sf->gap); } if (sf->label_point != 0) { @@ -260,7 +259,6 @@ serial_feature deserialize_feature(std::string const &geoms, unsigned z, unsigne deserialize_int(&cp, &sf.segment); sf.index = 0; - sf.previndex = 0; sf.gap = 0; sf.label_point = 0; sf.extent = 0; @@ -269,7 +267,6 @@ serial_feature deserialize_feature(std::string const &geoms, unsigned z, unsigne if (sf.layer & (1 << FLAG_INDEX)) { deserialize_ulong_long(&cp, &sf.index); - deserialize_ulong_long(&cp, &sf.previndex); deserialize_ulong_long(&cp, &sf.gap); } if (sf.layer & (1 << FLAG_LABEL_POINT)) { diff --git a/serial.hpp b/serial.hpp index 805199cd..91479a4a 100644 --- a/serial.hpp +++ b/serial.hpp @@ -67,8 +67,7 @@ struct serial_feature { drawvec geometry = drawvec(); unsigned long long index = 0; - unsigned long long previndex = 0; // filled in during z0 - unsigned long long gap = 0; // filled in during z0. square of planar distance + unsigned long long gap = 0; // filled in during z0. square of planar distance unsigned long long label_point = 0; long long extent = 0; diff --git a/tile.cpp b/tile.cpp index 46fa060c..06e99fc4 100644 --- a/tile.cpp +++ b/tile.cpp @@ -1047,19 +1047,19 @@ static serial_feature next_feature(decompressor *geoms, std::atomic * (*original_features)++; - if (sf.previndex == 0) { - sf.previndex = previndex; + if (sf.gap == 0) { + if (sf.index != previndex) { + unsigned wx1, wy1; + decode_index(sf.index, &wx1, &wy1); - unsigned wx1, wy1; - decode_index(sf.index, &wx1, &wy1); + unsigned wx2, wy2; + decode_index(previndex, &wx2, &wy2); - unsigned wx2, wy2; - decode_index(sf.previndex, &wx2, &wy2); + long long dx = (long long) wx1 - wx2; + long long dy = (long long) wy1 - wy2; - long long dx = (long long) wx1 - wx2; - long long dy = (long long) wy1 - wy2; - - sf.gap = dx * dx + dy * dy; + sf.gap = dx * dx + dy * dy; + } } previndex = sf.index; @@ -1735,7 +1735,7 @@ long long write_tile(decompressor *geoms, std::atomic *geompos_in, ch } if (z <= cluster_maxzoom && cluster_distance != 0) { - // This still uses merge_previndex instead of sf.previndex + // This still uses merge_previndex instead of sf.gap // because the cluster size in -K is expecting to specify // distances between points that are subject to dot-dropping, // rather than wanting each feature to have a consistent