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 overlay heuristic for GeometryCollections with empty elements #1229

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dr-jts
Copy link
Contributor

@dr-jts dr-jts commented Jan 15, 2025

This fixes the behaviour of the "combine disjoint" overlay heuristic for GeometryCollections containing empty elements (which are now removed).

Fixes #1224

(Note: part of #1224 requires #1136 to be fixed as well).

The PR also:

  • centralized overlay heuristic logic in HeuristicOverlay (moving code from Geometry)
  • modularizes the HeuristicOverlay code
  • removes unnecessary dependencies on HeuristicOverlay
  • fixes XMLTester to correctly handle operation A & B argument switching

@dr-jts dr-jts added the Enhancement New feature or feature improvement. label Jan 15, 2025
}

void
extractELements(const Geometry* g, std::vector<std::unique_ptr<Geometry>>& v)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extractELements(const Geometry* g, std::vector<std::unique_ptr<Geometry>>& v)
extractElements(const Geometry* g, std::vector<std::unique_ptr<Geometry>>& v)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

second letter of "elements"

Comment on lines +60 to +61
const GeometryCollection* coll;
if (nullptr != (coll = dynamic_cast<const GeometryCollection*>(g))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const GeometryCollection* coll;
if (nullptr != (coll = dynamic_cast<const GeometryCollection*>(g))) {
if (const auto* coll = dynamic_cast<const GeometryCollection*>(g))) {

Comment on lines +164 to +165
default: // only OverlayNG::INTERSECTION
return s0.doIntersection(s1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default: // only OverlayNG::INTERSECTION
return s0.doIntersection(s1);
case OverlayNG::INTERSECTION:
return s0.doIntersection(s1);
default:
throw util::IllegalArgumentException("Invalid opcode");

@@ -178,6 +178,17 @@ tolower(std::string& str)
);
}

void
toupper(std::string& str)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already implemented in geos/util/string.h

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or feature improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Union Operations returns collections containing empty elements
2 participants