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

Clipboard Cut&Paste fix when attached special field values. Fixes #16870 #5030

Merged

Conversation

luipir
Copy link
Contributor

@luipir luipir commented Aug 16, 2017

Description

backport cherry-pick for a2c1810
resume:
In some cases when features are attached from clipboard as \t separated string, the import failed due the fact that the fromWkt geometry contructor is build on WKT * dumped fields. In some case when some dumped field has values inside parenthesis "(some value") the fromWkt parser return a ZM geometry.
This patch strips the leading field values leaving only WKT to the parser.

Checklist

Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.

  • Commit messages are descriptive and explain the rationale for changes
  • Commits which fix bugs include fixes #11111 in the commit message next to the description
  • Commits which add new features are tagged with [FEATURE] in the commit message
  • Commits which change the UI or existing user workflows are tagged with [needs-docs] in the commit message and containt sufficient information in the commit message to be documented
  • I have read the QGIS Coding Standards and this PR complies with them
  • This PR passes all existing unit tests (test results will be reported by travis-ci after opening this PR)
  • New unit tests have been added for core changes
  • I have run the scripts/prepare-commit.sh script before each commit

@luipir
Copy link
Contributor Author

luipir commented Aug 16, 2017

@nyalldawson @elpaso I did a backport of a2c1810
becasue it affect also 2.18 especially when cut&paste is directly from clipboard filled from external text files and not from internal vectorlayer cut&paste.

@m-kuhn
Copy link
Member

m-kuhn commented Aug 16, 2017

Thanks @luipir
can you adjust the typo in the commit title so it gets linked to the issue?

if ( !geometry )
continue;

QgsFeature feature;
if ( !fields.isEmpty() )
feature.setFields( fields, true );

feature.setGeometry( geometry );
feature.setGeometry( *geometry );
Copy link
Member

Choose a reason for hiding this comment

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

I think this leaks the geometry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed... tanks to point out. I read the api too quickly.

@luipir luipir changed the title From Clipboard Cut&Paste fix when attached special field values. Fixies #16870 Clipboard Cut&Paste fix when attached special field values. Fixes #16870 Aug 17, 2017
Copy link
Contributor Author

@luipir luipir left a comment

Choose a reason for hiding this comment

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

fixed with b73b25d

if ( !geometry )
continue;

QgsFeature feature;
if ( !fields.isEmpty() )
feature.setFields( fields, true );

feature.setGeometry( geometry );
feature.setGeometry( *geometry );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed... tanks to point out. I read the api too quickly.

@luipir
Copy link
Contributor Author

luipir commented Aug 17, 2017

@m-kuhn travis fail on qgis3 but succes on qgis 2.x

@luipir
Copy link
Contributor Author

luipir commented Aug 17, 2017

tnx

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.

None yet

3 participants