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

Possibility to use Difference/Clip processing algorithme #5678

Closed
wants to merge 3 commits into from

Conversation

qsavoye
Copy link

@qsavoye qsavoye commented Sep 24, 2024

  1. Select vector geometry features
  2. Click on Process Selected Features
  3. New algo are availabe especially from Vector Overlay group, Choose Difference algo
  4. Select OVERLAY layer you want

Copy link
Member

@nirvn nirvn left a comment

Choose a reason for hiding this comment

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

@qsavoye , hey there, thanks for the contribution! I've added a couple of comments that'd need addressing. Looking forward to merge this :)

Could you also install the pre-commit hook to insure formatting is done so it passes our CI tests? See documentation here: https://github.com/opengisch/QField/blob/master/doc/dev.md#contribute

Copy link
Member

@nirvn nirvn left a comment

Choose a reason for hiding this comment

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

Hey @qsavoye , thanks again for this, great way to contribute!

I did some more cleanups here #5690 (variable name renaming for clarity, and what I've mentioned in the second round of review).

In case you hadn't noticed, it also unlocked split by line, which is a nice alg. to have too!

context.setProject( QgsProject::instance() );
for ( auto it = map.begin(); it != map.end(); ++it )
{
if ( it.value()->type() == Qgis::LayerType::Vector && QgsProcessingUtils::variantToSource( it.value()->name(), context, mParameters.at( index.row() )->defaultValue() ) )
Copy link
Member

Choose a reason for hiding this comment

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

@qsavoye , we didn't need the vartiantToSource here, but what we definitively needed was to do a check against the parameter's dataTypes() to filter out of vector layers that are not part of list of geometry types passed by the algorithms.

I've done that here: https://github.com/opengisch/QField/pull/5690/files#diff-15f7c96b0c450067ace3ed62a83f37fea47213c6cdefbf28bba20747ff6634d2R302

@@ -151,8 +151,11 @@ void ProcessingAlgorithmParametersModelBase::rebuild()
mHasAdvancedParameters = true;
}

mParameters << definition;
mValues << definition->defaultValue();
if ( definition->name() != "INPUT" )
Copy link
Member

Choose a reason for hiding this comment

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

Just to be extra safe, I've added a definition->type() == QStringLiteral( "source" ) condition here:

https://github.com/opengisch/QField/pull/5690/files#diff-15f7c96b0c450067ace3ed62a83f37fea47213c6cdefbf28bba20747ff6634d2R154

@nirvn
Copy link
Member

nirvn commented Sep 29, 2024

Superseded by #5690

@nirvn nirvn closed this Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants