Skip to content

Check and fix algorithms improvement #61531

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

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

Djedouas
Copy link
Member

Description

Following #59637 to improve the processing checks and fixes already here.

  • avoid using new keyword to avoid memory leaks
  • avoid using unnecessary pointers
  • remove auto keyword
  • better formatting
  • better algorithm descriptions

@Djedouas Djedouas added Processing Relating to QGIS Processing framework or individual Processing algorithms Geometry checker labels Apr 17, 2025
@github-actions github-actions bot added this to the 3.44.0 milestone Apr 17, 2025
Copy link

github-actions bot commented Apr 17, 2025

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 89eb999)

🪟 Windows builds

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

Copy link
Contributor

@DelazJ DelazJ left a comment

Choose a reason for hiding this comment

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

Hi @Djedouas
Thanks for these updates. I was about to open issue reports for these and saw your PR, hence I'm asking here.

) );

std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
Copy link
Contributor

Choose a reason for hiding this comment

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

As mentioned in qgis/QGIS-Documentation#9773, afaiu I find this tolerance parameter (8 meaning 10^-8) non-obvious, and its min/max values counter-intuitive. A parameter help is at least required for end users, but imho, we should move to something simpler as a plain double value with unit selector, as commonly used for this kind of parameter.

Copy link
Member

Choose a reason for hiding this comment

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

Yes but it's to keep consistency with Geometry Checker plugin:

output.mp4

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes but it's to keep consistency with Geometry Checker plugin:

Probably, but 1E-8 as shown in the plugin looks much more meaningful than 8. I don't know how strong is/should be the link between the two tools and I'm not speaking in terms of code, rather as a Processing end user who would expect some obviousness in the options and harmonization (and that we take advantage from improved parameter types in Processing)...

Copy link
Member Author

@Djedouas Djedouas Apr 18, 2025

Choose a reason for hiding this comment

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

Yes I agree that from an end user perspective, it could be confusing. However, we are tied with how the geometry checker is written right now.

We can't use the distance widget parameter because it would be nonsense and difficult to restrict the user to specific logarithmic values like "10, 1, 0.1, 0.001, 0.0001, etc.".

Our options are

  1. to create another parameter type, think of its UI, and that handles the differences we have between geographic and metric distances
  2. to change how the geometry checker tolerance is handled

I prefer to go with option 2. but in any case, it will be a work that would be done in a dedicated PR.

Right now, we could improve the documentation, or add a description of the tolerance parameter in every processing description.

Copy link
Contributor

@DelazJ DelazJ Apr 18, 2025

Choose a reason for hiding this comment

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

I would have said

Right now, we could improve the documentation, orAND add a description of the tolerance parameter in every processing description.

They should have a start of answer in the GUI imho.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a short text in every processing short help.

The "Tolerance" advanced parameter defines the numerical precision of geometric operations, given as an integer n, meaning that any difference smaller than 10⁻ⁿ (in map units) is considered zero.

Copy link
Contributor

Choose a reason for hiding this comment

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

Given that this option is in advanced panel, I doubt people will modify it and don't think it deserves a mention in the algorithm main help. It should instead be as a tooltip over the parameter only, i.e.:

  tolerance->setHelp( QObject::tr( "The \"Tolerance\" defines the numerical precision of geometric operations, "
                                   "given as an integer n, meaning that any difference smaller than 10⁻ⁿ (in map units) is considered zero." );

@Djedouas Djedouas force-pushed the check_and_fix_algorithms_improvement branch from 45ff9b4 to 2bc04ce Compare April 18, 2025 08:35
@Djedouas
Copy link
Member Author

Djedouas commented Apr 18, 2025

Hi @DelazJ

What do you think of changing the "Check geometry (<name>)" processing name to simply "<name>" ?

It seems heavy right now:

image

@Djedouas Djedouas force-pushed the check_and_fix_algorithms_improvement branch from 2bc04ce to ed61539 Compare April 18, 2025 10:15
@DelazJ
Copy link
Contributor

DelazJ commented Apr 18, 2025

What do you think of changing the "Check geometry (<name>)" processing name to simply <name>" ?

I agree that it looks crowded. I'm not very sure that an alg named "Angle" or "Contained" would be obvious (well, it is still displayed under the check group).
Maybe "Check <name>"? though I'm still not sure if "Check contained" is a quite expressive name...

PS: I'm not sure that the alg name is supposed to be in title case... ("Check Geometry (Dangle) --> Check geometry (dangle)")
PS2: most of the time, the alg outputs are named using the alg name, i.e., Buffer --> Buffered, while here they all output "layer output" and "Error layer". It could be nice to have part of the alg name in the output(s)
PS3: Thanks for the switch to optional output.

Djedouas added 21 commits April 24, 2025 10:30
- avoid using new keyword to avoid memory leaks
- remove auto keyword
- better formatting
- better algorithm description
- avoid using new keyword to avoid memory leaks
- remove auto keyword
- better formatting
- better algorithm description
- avoid using new keyword to avoid memory leaks
- remove auto keyword
- better formatting
- better algorithm description
- avoid using new keyword to avoid memory leaks
- remove auto keyword
- better formatting
- better algorithm description
- avoid using unnecessary pointers
- remove auto keyword
- better formatting
- avoid using unnecessary pointers
- remove auto keyword
- better formatting
- avoid using unnecessary pointers
- remove auto keyword
- better formatting
- avoid using unnecessary pointers
- remove auto keyword
- better formatting
@Djedouas Djedouas force-pushed the check_and_fix_algorithms_improvement branch from 38b4cd4 to 89eb999 Compare April 24, 2025 08:33
@Djedouas
Copy link
Member Author

Maybe "Check "? though I'm still not sure if "Check contained" is a quite expressive name...
PS: I'm not sure that the alg name is supposed to be in title case... ("Check Geometry (Dangle) --> Check geometry (dangle)")

@DelazJ In fact, I think that we need to keep the long algorithm name, because when used inside a processing model we must see a full name. I really don't have an idea about title case or not for the name, that's why there is a mix... What do you think about this?

PS2: most of the time, the alg outputs are named using the alg name, i.e., Buffer --> Buffered, while here they all output "layer output" and "Error layer". It could be nice to have part of the alg name in the output(s)

That's a good point. We could add the check name like the algorithm name:

  • Errors layer (check dangle)
  • Output layer (check dangle)

@DelazJ
Copy link
Contributor

DelazJ commented Apr 28, 2025

In fact, I think that we need to keep the long algorithm name, because when used inside a processing model we must see a full name.

@Djedouas Sorry I do not get the point with the modeler.
IMHO No need to repeat the group name in the alg, which is already displayed at the top of the alg dialog.
image

The name should really be shortened for the reason you mentioned earlier, and maybe revisited to greatly reflect what the alg does. Do we really need the "check..." every time? What about e.g.:

  • Check geometry (Angle) --> Find(/Detect) small(er?) angles

  • Fix geometry (Angle) --> Delete small(er?) angles

    I really don't have an idea about title case or not for the name, that's why there is a mix... What do you think about this?

Actually, they should not be in title case. If you walk through the Processing toolbox you'll notice that only the first letter is in upper case, unless there is an acronym. This is the rule to follow.

That's a good point. We could add the check name like the algorithm name:

Errors layer (check dangle)
Output layer (check dangle)

I'm not really fan; still long and not inline with existing practice. What about e.g.:

  • Dangle errors / Errors (dangle)
  • Dangle / Dangle locations -- the global target of this output is not always really clear to me
  • Dangle fixed / Undangled (assuming it is English)

Sorry to add: There is also that great function to display algs short help when you hover over them in the toolbox. That may be helpful. But I realize there are quite a few algorithms using it. 😢

If usual Processing algs reviewers could chime in...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Geometry checker Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants