Repository navigation
fix(analysis): Clip and the overlay tools say which mask features they leave out - #1733
flight1973 wants to merge 7 commits into
Conversation
…er nothing Clip, Erase, Intersect, Identity, Union, Symmetrical Difference, Update and Split skipped a feature of the mask or overlay layer that has no polygon (no geometry, a point or line in the polygon layer, an empty polygon) without saying so. Minimum Bounding Geometry now writes flat hulls as points and lines in a polygon layer, so these are easier to hit. Each tool now counts them and gives one notice; Clip also counts a polygon with no area, and the overlay tools a feature whose parts union to nothing. Empty update and overlay polygons are no longer written out by Update, Union and Symmetrical Difference. Minimum Bounding Geometry with Group: All looks at Cancel per feature, and both group modes join the long tools in the cancel test.
…sk is an error Review follow-up. overlay_zones keeps every feature with a polygon as a zone again, so Update still writes an update polygon whose parts have no area, as it is. Union and Symmetrical Difference, where such a feature's row would vanish, count it in a notice of its own. Clip and the overlay tools stop with an error when every feature of the mask or overlay layer covers nothing, as Dissolve does, rather than give an empty layer or the input unchanged. A row selected twice is counted once, and Minimum Bounding Geometry's notice says the overlay tools leave its points and lines out of a mask or overlay layer only.
…Clip does Review follow-up. An erase, overlay or split polygon with no area, one part or several, covers nothing, yet Erase, Intersect, Identity and Split kept it as a zone without a word, and Union and Symmetrical Difference wrote a single one out. overlay_zones now leaves these out and counts them, with a notice of their own, and counts them toward the error when every feature is left out. Update keeps them, writing its update polygons as they are. Minimum Bounding Geometry uses each_once for its rows, and the cancel test names each tool with its parameters, so the two convexHull runs are told apart.
…hing would come out Review follow-up. The overlay tools judged a polygon to have no area by its shoelace area, which is zero for a bowtie that covers ground, so they left such a polygon out where Clip keeps it. They now keep every polygon as a zone, as before; Union and Symmetrical Difference count an overlay feature whose parts union to nothing, as nothing of it would be written, and Clip counts a mask whose union is empty, each in a notice of its own, apart from the features with no polygon. Leaving out every feature is an error only for Clip, Intersect and Split, whose result would be empty; Erase, Identity, Union, Symmetrical Difference and Update give the input, with the notice, as before. The error says how many of each kind.
Review follow-up. A polygon has no area when its union is empty, as Clip judges its masks: rings on a line, one part or several, but not a bowtie, which covers its two triangles. overlay_zones now leaves such features out of Erase, Intersect, Identity, Union, Symmetrical Difference and Split, counted in a notice of their own and toward the error for Intersect and Split, instead of Union and Symmetrical Difference alone catching some of them later. Update keeps them, as it writes its update polygons as they are. A one-part polygon is unioned once more to judge it.
…ncel for hulls moves out Narrow the change to what was silent. Judging which overlay polygons have no area changed results for points and lines on flat rings, could drop very thin polygons the union rounds away, and doubled the overlay tools' setup work. Erase, Intersect, Identity, Union, Symmetrical Difference, Update and Split keep every polygon as a zone, as on main, and add only the notices: features with no polygon, and in Union and Symmetrical Difference a feature whose parts union to nothing, which would otherwise vanish. Clip keeps counting masks whose union is empty. Leaving out every feature is an error only for Intersect and Split, and for Clip. Minimum Bounding Geometry's Cancel check for Group: All goes to a pull request of its own.
Review follow-up. Split read its split polygons, and could stop with "none covers anything", before it checked the field parameter, so a wrong field was hidden behind that error. The user guide now says the error comes when no feature of the layer has a polygon (for Clip, when none covers any area), which is when it does.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| /// which must be polygons, and its (selected) features with geometry as [`Zone`]s, in order. | ||
| fn overlay_zones<'a>(inp: &'a dyn Inputs, p: &Json, k: &str) -> Result<(&'a Dataset, Vec<Zone>), String> { | ||
| /// The polygon layer of `tool`'s parameter `k` (`overlay`, `erase`, `update`, `split`), which | ||
| /// must be polygons, its (selected) features with a polygon as [`Zone`]s, in order, each once, and |
There was a problem hiding this comment.
Silent drop for Intersect, Identity, Erase and Split. overlay_zones only counts features with no polygon. An overlay feature with several parts whose union is empty (mask_of gives an empty MultiPolygon) is kept as a zone, but part returns None for it, so its row never reaches the output. That is the same loss the PR counts for Union and Symmetrical Difference, and the new test codifies the silence: the _ => vec![note(name, 5, NO_POLYGON)] arm at tools.rs:7047 expects no notice for mask 16 (two flat rings) under Intersect and Identity.
Suggested fix: count the empty-union zones in overlay_zones (e.g. left.no_area when mask_of(poly).0.is_empty()) and drop them from zones, then report them through left.notes for every tool that uses it, except Update, which writes its zone geometry as-is. Then update the expected notes in the test for those tools. Confidence: high on the behavior, medium that every tool needs the notice (Erase and Split lose nothing visible, but the rule is still "say how many").
Code reviewBugs
Security
Performance
Quality (nits, left for the release quality pass)
AGENTS.md
Confidence overall: medium-high. I could not build or run the tests (no Bash), so the findings rest on reading the code. Change sizeCompared: the whole PR against main (merge base f62c795 to PR head 11ece6d).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
Summary
Clip, Erase, Intersect, Identity, Union, Symmetrical Difference, Update and Split skipped features of the mask or overlay layer that have no polygon (no geometry, a point or line in the polygon layer, an empty polygon) and didn't say so. Since #1572, Minimum Bounding Geometry writes flat hulls as points and lines in a polygon layer, so this is easier to hit. The bot review on #1572 caught it after the merge.
What I left alone:
Testing
cargo xtask ci: fmt, clippy and layers are clean. All workspace tests pass exceptpopupmedia::tests::decoding_keeps_the_caps, which also fails on main on macOS and Windows (main's CI for f62c795).UI evidence
No visible UI change.
Related issue
Follow-up to #1572.
Summary by CodeRabbit