Skip to content

Commit

Permalink
Add more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Dec 11, 2023
1 parent c719ce2 commit f53d9f7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit f53d9f7

Please sign in to comment.