12126 Commits

Author SHA1 Message Date
nirvn
4aef3b719f [processing] fix python error with OSM vector layers 2018-02-15 15:56:53 +07:00
Nyall Dawson
46dc2f6e5b [processing] Avoid losing static, user-entered parameter values
in model child algorithms

Prior to this change if you edited an algorithm in a model and
tried to enter a preset string for certain parameter types, this
string would get silently discarded on closing the dialog. E.g.
with a dissolve algorithm it was not possible to have a fixed
field name within the model to dissolve by.

This was caused by WidgetWrapper.comboValue  returning the customData
for these manually entered values in the parameters combo box,
yet manually entered values never have custom data.

To work around this we only return the custom data if its
set for the selected item - otherwise we return the text unchanged.
In order to handle the "[not set]" options, a new static custom
data value of WidgetWrapper.NOT_SET_OPTION is added to that
comboValue can detect this and return the appropriate None value.
2018-02-15 17:45:19 +11:00
Nyall Dawson
12fcfac0d5 [processing] Ensure algorithms which add attributes to features
always add a consistent amount of attributes regardless of the
code paths taken

Some algorithms were adding features to data providers with
different number of attributes vs the layer's fields - this is
not supported and depending on the data provider will have
different (bad) results.
2018-02-15 17:45:00 +11:00
Nyall Dawson
a8110369a8 [processing] Don't throw an exception if an expression cannot
be prepared

There's cases where this happens without reflecting an invalid
expression. So we can try to prepare, but not abort if the
preparation fails.

Fixes #18103
2018-02-15 15:43:26 +11:00
nirvn
8697c79993 [needs-docs][ui] harmonize title of panels 2018-02-15 11:43:19 +07:00
Nyall Dawson
2defaff796 [processing] Much faster random points in polygon by using
prepared geometries
2018-02-15 09:14:01 +11:00
Nyall Dawson
81aa2f956e [processing] Misc fixes and improvements to Random Points in Polygons
- Fix missing format call for string when calculated number
of points is 0
- Fix incorrect progress reports which were spamming the dialog
and causing UI hangs, and slow algorithm execution
2018-02-15 09:14:01 +11:00
Nyall Dawson
e0cf578096 [processing] Add some missing sources to expression contexts 2018-02-15 09:14:01 +11:00
Nyall Dawson
8154a85f29 Fix Python exception in Random Points in Polygon alg
Fixes #18103
2018-02-15 09:14:01 +11:00
Mathieu Pellerin
543e4f0dd1
[attribute table] fix long UI freeze when resizing columns for large filtered datasets (#6341) 2018-02-14 21:25:43 +07:00
Alexander Bruy
b664f12ed6
Merge pull request #6340 from nyalldawson/batch_layer_name
[processing] In batch dialog, use layer names for input layers
2018-02-14 11:06:36 +02:00
Nyall Dawson
8ceb6fc007 [processing] In batch dialog, use layer names for input layers
if they are unique in the current project

Instead of always using the layer id, which is generally
gibberish and meaningless for users, instead prefer to use
the layer name as an input in the batch processing dialog. This
is done only if the name is unique within the current project's
loaded layers.

This change makes the dialog more user-friendly, but more importantly
it means that autofilling output values based on an input layer
parameter generates more meaningful automatic output file names.
2018-02-14 16:46:26 +10:00
Nyall Dawson
cd24adbf9e [needs-docs] Rework arrangement of buttons in categories tab in
metadata editor to make their operation more self-explanatory
for users.

Also add tooltips to the buttons describing their function, and
allow the buttons to operate on multiple selected rows at once.

Fixes #18090
2018-02-14 15:35:47 +11:00
nirvn
2d24bbf819 [needs-docs][processing] update raster calculator help to reflect updated logic 2018-02-14 07:43:05 +07:00
Salvatore Larosa
abeef2573c macOS: fix shortcut even for processing tool button 2018-02-13 16:51:04 +01:00
Nyall Dawson
ea40f1e82a More capitalization homogenization 2018-02-13 19:49:15 +11:00
Nyall Dawson
fa56aa5542 [dbmanager] Fix python error when scrolling postgis results
Fixes #17835
2018-02-13 19:49:15 +11:00
Nyall Dawson
ad849615a3 Fix python error when trying to export db manager table 2018-02-13 19:49:15 +11:00
Nyall Dawson
6b4e734d95 [dbmanager] Fix inconsistent capitalization, HIG violations,
and unprofessional strings
2018-02-13 19:49:15 +11:00
Nyall Dawson
c08e4c53a9 Fix invalid (deprecated) escape strings in db manager 2018-02-13 19:49:15 +11:00
Nyall Dawson
66b9b435b6 [processing] Fix destination files are silently ignored when relaunching
algorithms from the history panel
2018-02-13 14:24:48 +10:00
nirvn
1994c44644 [processing] harmonize results viewer action behavior 2018-02-13 10:40:17 +07:00
Nyall Dawson
a1a45536a2
Merge pull request #6221 from nyalldawson/var_leak
Fix massive memory leak in PyQGIS, pt 1
2018-02-13 13:18:42 +11:00
Nyall Dawson
0c6f22386b Drop some legacy sip conversion code 2018-02-13 12:02:50 +11:00
Denis Rouzaud
2a7aeafb75 doxygen, init in header 2018-02-12 11:29:41 -04:00
Denis Rouzaud
338a73b32e [sip] remove unused QPair conversion 2018-02-12 09:22:53 -04:00
Denis Rouzaud
31e93aecae [dxf] use a struct instead of QPair for layers
there was a crash in Python in QgsDxfExport.addLayers due to a bad conversion
2018-02-12 09:22:21 -04:00
nirvn
4ada4989e5 [processing] automatically open results viewer panel when items added 2018-02-12 18:09:38 +07:00
nirvn
207a94738d [processing] offer hyperlink to file path in the results viewer
because users don't always get that there is a dbl-click action
against the tree view items.
2018-02-12 18:09:38 +07:00
nirvn
e5d7733bfc [processing] harmonize order of result panel (latest first) and add timestamp 2018-02-12 13:51:31 +07:00
Nyall Dawson
ff7bb9aa53 Remove inefficient method for creating empty geometry of same
WKB type, and use optimized method instead

Refs #17809
2018-02-12 08:56:12 +10:00
Nyall Dawson
65827adc7d Provide an optimised constructor for a null QgsRectangle
This is used a lot, yet the current constructor calls the
normalize() method which does a bunch of operations for no
result.

So instead provide a simple optimised null QgsRectangle
constructor and save a lot of cycles.

Refs #17809
2018-02-12 08:56:12 +10:00
Alexander Bruy
178509347a [processing] add enums support for fields and feature source parameters
(follow up 068d74d5)
2018-02-11 14:05:09 +02:00
Nyall Dawson
367aba1766
Merge pull request #6308 from nyalldawson/multi_out
[processing] Add explicit output type for multiple layers
2018-02-11 18:52:22 +11:00
Nyall Dawson
db9db58e71 Fix undefined behavior when closing layout designer 2018-02-11 12:44:34 +11:00
Nyall Dawson
414c3a4bfe Fix unavailable layer inputs for multi-layer inputs set to any map layer type 2018-02-11 11:00:49 +10:00
Nyall Dawson
54a99c27a3 [processing] Add multi layer outputs to Package Layers and Vector Split algorithms 2018-02-11 11:00:33 +10:00
Nyall Dawson
4bcc9df5b4 [processing] Add explicit output type for multiple layers
This was a missing capability in the processing API - while algorithms
could declare multiple layer input parameters, there was no corresponding
multi-layer output. This meant that algorithms (such as Package Layers,
Vector Split) which create a set of layers which cannot be determined
in advance had no way to pass these generated layers on for further model
processing steps.

It's also useful for algorithms which operate on a specified folder,
processing all layers found there, and allowing these generated
outputs to be utilised in other model steps (e.g. packaging
all of them, merging them, etc)
2018-02-11 10:57:44 +10:00
Nyall Dawson
8f902e7796 Implement manual locks on QgsSpatialIndex
Since libspatialindex is not thread safe on all platforms, and
have expressed desire to remove the thread safety that they DO
have on remaining platforms, it's safer and easier for us
to manually add locks to QgsSpatialIndex and be gauranteed that
this class is thread safe on all platforms and libspatialindex
versions.

Also improve docs for the class.
2018-02-09 20:13:04 +11:00
Nyall Dawson
abcaba857f Add method to force a detach for QgsSpatialIndex
Since the underlying libspatialindex is not thread safe
on some platforms (e.g. Windows), manual calls to detach()
must be made if a QgsSpatialIndex is to be accessed across
multiple threads.

Note that for platforms on which libspatialindex is thread
safe, calling detach() has no effect and does not force the
deep copy.
2018-02-09 20:13:04 +11:00
Juergen E. Fischer
9302613f28 fix #18066 2018-02-09 09:38:04 +01:00
Alexander Bruy
603d2e6364
Merge pull request #6293 from alexbruy/processing-enums
[processing] allow enums values to be used in description files
2018-02-09 09:08:05 +02:00
Alexander Bruy
90cc17b934
Merge pull request #6298 from nyalldawson/fix_17231
[processing] Allow providers to return a different helpId() vs their unique id()
2018-02-09 09:07:37 +02:00
nirvn
bcb68dda54 [processing] fix batch input selection panel for multiple layers parameter 2018-02-09 14:05:26 +07:00
nirvn
9562b9dad2 [processing] only pass needed raster entries in QgsRasterCalculator constructor 2018-02-09 14:05:26 +07:00
nirvn
e27847d383 [processing] make output crs optional in the raster calculator 2018-02-09 14:05:26 +07:00
nirvn
c4874b3161 [processing] use feedback object in raster calculator 2018-02-09 14:05:26 +07:00
nirvn
2ed225d5f4 [processing] ressurect raster calculator and add CRS parameter 2018-02-09 14:05:26 +07:00
Nyall Dawson
2d1e9188f1 [processing] Allow providers to return a different helpId() vs
their unique id()

This is used when generating the QgsHelp url for algorithms
attached to the providers.

Implement helpId overrides for the native and 3d providers so
that they return 'qgis' helpIds, meaning that all QGIS processing
algorithm documentation can be kept within the same url path
regardless of which QGIS provider library it sits within.

This also allows us to freely move algorithms from the Python
'qgis' provider to c++ 'native' provider in future releases
without breaking the help URLs.

Fixes #17231
2018-02-09 11:26:03 +10:00
Alexander Bruy
068d74d51a [processing] allow enums values to be used in description files 2018-02-08 17:22:20 +02:00