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

Show a warning when pasted feature geometry collapsed #8125

Merged

Conversation

elpaso
Copy link
Contributor

@elpaso elpaso commented Oct 6, 2018

... due to due to intersection avoidance

Features are still pasted but the user is warned.

Fixes #20020

... due to due to intersection avoidance

Features are still pasted but the user is warned.

Fixes qgis#20020
@elpaso elpaso added the Bugfix label Oct 6, 2018
@elpaso elpaso added this to the 3.4.0 milestone Oct 6, 2018
messageBar()->pushMessage( tr( "Paste features" ),
tr( "%1 of %2 features could be successfully pasted." ).arg( nCopiedFeatures ).arg( nTotalFeatures ),
Qgis::Warning, messageTimeout() );
message = tr( "%1 of %2 features could be successfully pasted." ).arg( nCopiedFeatures ).arg( nTotalFeatures );
Copy link
Member

Choose a reason for hiding this comment

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

tr( "%1 of %n feature(s) ...", nTotalFeatures ).arg( nCopiedFeatures ) should be supersmart about things. But I never verified ;)

QgsExpressionContext context = pasteVectorLayer->createExpressionContext();


QgsFeatureList compatibleFeatures( QgsVectorLayerUtils::makeFeaturesCompatible( features, pasteVectorLayer ) );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we certain that features here always have their original QgsFields set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say yes, AFAIK features can only come from a copy operation from a layer source, QgsFields should be there. I did a manual test with copy/paste from layers with different fieldset but sharing a few field names and everything worked just fine if is that what you are worried about.

@elpaso elpaso merged commit 795c27f into qgis:master Oct 9, 2018
@elpaso elpaso deleted the bugfix-20020-paste-geometry-collapsed-features branch October 9, 2018 06:40
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.

3 participants