Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(QgsCurve): properly handle area cache when reversing geometry #59167

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

lbartoletti
Copy link
Member

@lbartoletti lbartoletti commented Oct 22, 2024

Description

@agiudiceandrea I was wrong in my previous PR about the sumUpArea method. While unconventional in my opinion, this method works correctly, particularly with compound curves where the "classical" approach would fail.

The issue appears to be cache-related.
When reversing a line or circular string geometry, ensure the cached area value is also reversed by negating it. This ensures correct area orientation calculations, particularly important for:

  • Maintaining correct winding order information
  • Ensuring consistent orientation() results
  • Preserving area sign conventions (positive for CCW, negative for CW)

Added unit tests verifying the area and orientation behavior for both clockwise and counter-clockwise line strings, and their reversed versions.

Follow-up #59156
Fixes #58333

@lbartoletti lbartoletti self-assigned this Oct 22, 2024
@github-actions github-actions bot added this to the 3.40.0 milestone Oct 22, 2024
Copy link

github-actions bot commented Oct 22, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 61b7291)

@lbartoletti lbartoletti changed the title fix(QgsCurve): invalidate area cache to ensure good orientation fix(QgsCurve): properly handle area cache when reversing geometry Oct 22, 2024
@lbartoletti lbartoletti marked this pull request as ready for review October 22, 2024 12:10
@nyalldawson nyalldawson merged commit 8f1a6e3 into qgis:master Oct 22, 2024
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect winding/orientation/order of polygon's vertices in Memory layers
2 participants