Don't actually need the previous index in serial_feature now

This commit is contained in:
Erica Fischer
2024-07-08 12:05:23 -07:00
parent b166f10797
commit cc809157c7
3 changed files with 12 additions and 16 deletions
-3
View File
@@ -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)) {
+1 -2
View File
@@ -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;
+11 -11
View File
@@ -1047,19 +1047,19 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
(*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<long long> *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