-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[digitizing] Split features: always give largest geometry to original feature #59806
[digitizing] Split features: always give largest geometry to original feature #59806
Conversation
5639f14
to
1716ddb
Compare
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
@JuhoErvasti do you currently have a use case for this beyond that described by #53696 ? If there's no concrete use case for custom sorting, then I'd avoid the complexity and just ALWAYS use the largest part (as described in #53696) |
@nyalldawson If this is not necessary, I can of course change it. In this case since you can split a feature an arbitrary number of times should all of them still be sorted by area/length or just that the original feature will get the largest geometry? |
I'm wondering if instead it'd make more sense to handle this in the split tool itself, so that users can interactively pick on a split-by-split basis which feature is the "reference" feature. Eg maybe something like ctrl+click with the tool sets the reference point, and then after the split the part closest to the reference point becomes the reference (original) feature geometry. |
@nyalldawson You'd then have to remember to set the reference point each time and in some cases it can be difficult to eyeball which is the biggest feature, making it more error-prone. Also potentially if there's different rules for different layers you'd have to remember them and keep track of that as well. I think that feature would work for some situations, but I think there's also a very solid case for being able to set a layer-level rule to avoid manual work and mistakes. Edit: I do understand that this implementation does add complexity. We wanted make it an option preemptively in case other users/organizations have different needs. Would it be better from the complexity perspective if instead of an expression there were preset options (a bit similar to the Attributes Form split/duplicate policies? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to complete @JuhoErvasti, my concerns was that user would be continuously asking for different way of choosing the reference feature according to their needs, so better have an expression and maybe a list of classic order (area, length).
Regarding the PR, not sure sorting order is needed. Because you can order in ascending with $area, and descending with 1/$area, no?
@nyalldawson Your proposal is interesting but it makes the UI a little bit complex with even more click when it is not (always) needed.
What I'm proposing are two changes:
|
Well, that would take care of the use case I'm trying to address. I'm okay to make that change if is no need for custom sorting. If I could then ask a few more questions:
That would work, I thought I'd add it for consistency since some other sorting features in the GUI have it as well (at least feature rendering order). |
That's fine by me! I don't personally think the second part is a requirement, I just think it's a better approach to handling advanced situations vs the expression. So if you just want to do the "always biggest part" logic only, that's perfectly reasonable.
I think it can be considered a bug fix, yes.
I'm fine with just the single biggest part being treated special, and the rest in random order. Ordering for adding features usually isn't important anyway. |
1716ddb
to
b2d4fc8
Compare
I've force-pushed the change to just always give the biggest geom to the original feature and also updated the description if you want to take look. I had to modify some existing tests, some of them were retrieving the new feature by a hard-coded number and the change also affected the split policy test. |
- This change was made to match the change in b2d4fc8 where the largest geometry is now inherited by the original feature when splitting features. - This caused the test to fail for the 'field_unset' and 'field_ratio' attributes since the largest feature with the largest 'field_ratio' attribute also had the original 'field_unset' value and the others had an unset attribute
@JuhoErvasti looks good to me, thanks! |
We'll wait for @troopa81's feedback before merging |
Thank you! Could this be tagged for a backport to 3.40 as well? 🙏 |
LGTM |
Fixes #53696. Backport to 3.40 requested.
Funded by the National Land Survey of Finland.