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

3.4 Backports #9056

Merged
merged 14 commits into from Feb 1, 2019
Merged

3.4 Backports #9056

merged 14 commits into from Feb 1, 2019

Conversation

nyalldawson
Copy link
Collaborator

No description provided.

PeterPetrik and others added 12 commits February 1, 2019 14:08
- fix parameter can get converted to plain number parameter after edits
- allow parameter to be linked to parent parameters, so that the
correct distance unit and choices are shown for the parameter

(cherry picked from commit 4f6df29)
The i == 0 test was wrong, and a test is actually not needed.

(cherry picked from commit 389149c)
By default a range widget is built with a minimum value set to the
minimal integer that is possible to represent. When "allow null" is
enabled, a new value (minvalue - 1) is inserted. With the default
value, we then had an integer overflow.

(cherry picked from commit eb5a336)
…gis#20774)

With topo editing mode enabled, addition of extra points to keep the topology
correct wasn't working correctly because for the first segment we were getting
two matches due to duplicated first and last vertex in the ring. The fix
ensures that only one match will be returned for the first duplicated vertex.

(cherry picked from commit 3769faa)
Also add better error message reporting, and deprecate horrible API.

(cherry picked from commit 9a723d9)
@nyalldawson nyalldawson added this to the 3.4.5 milestone Feb 1, 2019
@nirvn
Copy link
Contributor

nirvn commented Feb 1, 2019

@nyalldawson , I this commit (dd97201) hasn't been backported (and needs to).

nyalldawson and others added 2 commits February 1, 2019 16:11
… sub-steps

of main algorithm

Using code like:

    buffered_layer = processing.run(..., context, feedback)['OUTPUT']
    ...
    return {'OUTPUT': buffered_layer}

can cause issues if done as a sub-step of a larger processing algorithm. This
is because ownership of the generated layer is transferred to the caller
(Python) by processing.run. When the algorithm returns, Processing
attempts to move ownership of the layer from the context to the caller,
resulting in a crash.

(This is by design, because processing.run has been optimised for the
most common use case, which is one-off execution of algorithms as part
of a script, not as part of another processing algorithm. Accordingly
by design it returns layers and ownership to the caller, making things
easier for callers as they do not then have to resolve the layer reference
from the context object and handle ownership themselves)

This commit adds a new "is_child_algorithm" argument to processing.run.
For algorithms which are executed as sub-steps of a larger algorithm
is_child_algorithm should be set to True to avoid any ownership issues
with layers. E.g.

    buffered_layer = processing.run(..., context, feedback, is_child_algorithm=True)['OUTPUT']
    ...
    return {'OUTPUT': buffered_layer}

(cherry picked from commit 7f7c7a9)
…#18434)

The problem was that QgsSnappingConfig when initialized from a project
loads global settings from QgsSettings and sets individual layer configs
based on that.

The issue was showing up only in "current layer" mode of vertex tool
because for "all layers" mode all individual layer configs were overwritten.

(cherry picked from commit dd97201)
QgsNewVectorLayerDialog geomDialog( parent );
geomDialog.setCrs( crs );
if ( !initialPath.isEmpty() )
geomDialog.setFilename( initialPath );
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps make this if consistent with bottom one by having braces for the one liner like:

+ if ( !initialPath.isEmpty() ) 
+{
+   geomDialog.setFilename( initialPath );
+}
-  if ( !initialPath.isEmpty() )
-    geomDialog.setFilename( initialPath );

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll do that in master - this is just a backport, so any specific changes here will be ultimately lost

{
QString error;
QString res = execAndCreateLayer( error, parent, initialPath, pEnc, crs );
if ( res.isEmpty() && error.isEmpty() )
Copy link
Contributor

Choose a reason for hiding this comment

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

look at my suggestion for one liner if's below.

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

6 participants