Improve Area -> Geometry conversion - #5506
Merged
cwisniew merged 5 commits intoMay 27, 2025
Merged
Conversation
…s JTS ShapeReader does
These unions are really expensive, so if we can avoid them it matters. A key case is in rendering the topology tool - it was doing this expensive union each time it painted. We now just obtain a list of the masks and render them individually.
cwisniew
approved these changes
May 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Identify the Bug or Feature request
Improves on #5159
Description of the Change
There are two parallel changes in this PR.
First is fix for how we handle more nuanced geometry.
Areadoes not seem to give reliably oriented paths when the coordinates are more precise than about 1e-10. So after read the coordinates, we reduce their precision to a 1e-10 grid in order to get more consistent orientation checks. Along with that, we also apply aGeometryFixerto each polygon to make sure that we don't get invalid geometry if any manages to sneak by.Second change is a performance improvement to how we handle token BL, especially when rendering the topology overlay. Before, we would union up all the token BL of a given type on a map to produce a single
Area, which would then be rendered. This unioning is very slow when there are many BL-bearing tokens, so it has been updated to use the faster union inGeometryUtil.union(). Even with that, it is much to slow to use during rendering, so in that case we skip unions altogether and just draw the individual BL. This is arguable more correct as well, since it more clearly indicates where token BL overlaps.Possible Drawbacks
None
Documentation Notes
N/A
Release Notes
This change is