From f53d9f77d284b86d60674e238c1af4de5aeda890 Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Mon, 11 Dec 2023 12:07:42 -0800 Subject: [PATCH] Add more comments --- serial.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/serial.cpp b/serial.cpp index 09e16a8c..f8050419 100644 --- a/serial.cpp +++ b/serial.cpp @@ -364,14 +364,21 @@ static long long scale_geometry(struct serialization_state *sst, long long *bbox prev_x = op.x; } + // If this is a polygon, in which the first and last + // points of each ring are supposed to be identical, + // make sure the antimeridian wraparound detection + // preserves that expectation. If it doesn't, it means + // we have detected something wrongly. if (geom[j - 1] == geom[i]) { if (offset != 0) { // first and last points are supposed to be the same - // but there is an unresolved antimeridian shift still + // but there is an unresolved antimeridian shift balanced = false; } } + // If something contradictory happened in longitude + // wraparound detection, restore the original geometry if (!balanced) { ring.clear(); for (size_t k = i; k < j; k++) {