14612 Commits

Author SHA1 Message Date
Luigi Pirelli
82e48f9c82 Added SLD 1.0 export for rasters 2019-01-31 15:21:05 +01:00
Peter Petrik
ebcc694ab1
fix #18954 add&rename vector fields (#8982)
fix #18954 add&rename vector fields at the same time
2019-01-31 09:20:49 +01:00
Nyall Dawson
4f6df2980f [processing] Fixes to distance inputs for models
- 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
2019-01-31 17:53:25 +11:00
Nyall Dawson
5bfec27938 [processing] do not show geometryless layers in extent selector
Fixes #21129
2019-01-31 17:52:29 +11:00
Nyall Dawson
e670371fa3 [layouts] Show an explicit warning when exporting a layout which contains a broken image 2019-01-31 10:02:18 +11:00
lbartoletti
2e92dabd20 [Processing][Grass] Add the possibility to return a shp if ogr is not compiled with gpkg 2019-01-31 09:55:29 +11:00
Alexander Bruy
19dcfb987b don't export features without category by default 2019-01-30 10:40:29 +02:00
Alexander Bruy
0cc483f621 set default value for newly added parameter 2019-01-30 08:12:22 +02:00
Alexander Bruy
67bc586036 fix formatting 2019-01-30 08:12:22 +02:00
Giovanni Manghi
5f99955b45 do not always use the -c flag to export vectors from GRASS 2019-01-30 08:12:22 +02:00
Juergen E. Fischer
806ae861e1 osgeo4w: rely on GRASS' GISBASE environment variable instead of
detecting the path (ie. use the same version for processing as the
version that the grass plugin uses)
2019-01-29 23:03:58 +01:00
Nyall Dawson
60b8d05278 [needs-docs][layouts] Add checkbox to disable raster tiling for PDF/SVG exports
This setting, which is disabled by default and placed into an
"advanced" group on PDF/SFG export, disables the built-in
raster layer tiled rendering. While the tiling is good for
memory usage, it can cause visible "seams" in the rasters
for generated PDF/SVG files.

The setting has a tooltip warning users that disabling the
tiling results in high memory usage during exports.

Fixes #19500
2019-01-30 05:09:29 +11:00
Nyall Dawson
9a723d91e8 New Shapefile Layer dialog: avoid warning message on user cancel
Also add better error message reporting, and deprecate horrible API.
2019-01-30 05:08:59 +11:00
Julien Cabieces
b82ce0e522 fix crash when print from qgis processing algorithm while the python console is displayed 2019-01-29 21:34:45 +11:00
Nyall Dawson
63b6a77702 [processing] Add API to convert a parameter definition to an equivalent
Python constructor string
2019-01-29 18:15:40 +11:00
Nyall Dawson
d4b262cdb0 Add method to convert QgsProcessing::SourceType to string representation 2019-01-29 18:15:40 +11:00
Nyall Dawson
7f7c7a9789 [processing][needs-docs] Add friendlier API for running algorithms as 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}
2019-01-29 18:04:16 +11:00
Denis Rouzaud
82ec1418c0
declare metatype for QgsDefaultValue (#9011)
* declare metatype for QgsDefaultValue

* sipify
2019-01-28 21:04:18 -05:00
Víctor Olaya
6eaa511eed [processing] show warning when file-based layer could not be loaded and dependent params updated
For algorithms with multiple parameters depending on a vector layer parameter, the code that loads the layer in the background is called repeatedly, impacting performance. A small layer cache is implemented with these changes, so the dialog only tries to load the layer once.
2019-01-29 11:12:23 +11:00
Alexander Bruy
8446d3bdf0 [processing][needs-docs] native vector split algorithm now outputs
GeoPackages instead of shapefiles (refs #20557)

Also remove default output extension Processing settings as they are not
used anymore.
2019-01-29 11:05:37 +11:00
Jürnjakob Dugge
1cdff21c85 [layouts] Use polyline shape instead of bounding box for selection, makes polylines selectable via single click
Fixes #20940
2019-01-29 10:59:55 +11:00
Víctor Olaya
1b4a9132c2 [processing] avoid exception when listing DB schemas
do not fail if cert file cannot be deleted when creating GeoDB object

fixes #21099
2019-01-29 08:01:20 +11:00
Denis Rouzaud
3a19182fe8
add QgsField::isDateTime (#9007)
* add QgsField::isDateTime

* use QgsField::isDateTime

* rename to isDateOrTime
2019-01-28 13:53:16 -05:00
Denis Rouzaud
aef0b6586c
move QgsDefaultValue to moc headers (#9000)
* move QgsDefaultValue to moc headers

because it is a Q_GADGET

* sip include
2019-01-28 09:12:10 -05:00
Blottiere Paul
7dbc96b614 Update sip 2019-01-28 11:42:14 +00:00
Blottiere Paul
7f19cb81e6 Update sip 2019-01-28 11:42:14 +00:00
Blottiere Paul
8e3f7b131b Update sip 2019-01-28 11:42:14 +00:00
Nyall Dawson
2e3a717e44 Make SSL error handling thread safe, avoid races and crashes when
SSL error occurs in non-main thread

This commit reworks how SSL errors are handled in QGIS. Previously,
ssl errors emitted by non-main thread QgsNetworkAccessManager instances
were handled by the main thread in QgisApp on next event loop. But
app (in the main thread) tried to pause the timeout timer for the
QNetworkReply containing the error, which doesn't work, because you
can't stop a timer in the main thread for a timer object created
in another thread. This meant that the reply could get deleted in
the background thread while the main thread was still using it
and waiting for users to respond to the SSL error. Now the timer
handling is done in the background thread's network access manager
instance, so in the thread matching the reply's timeout timer. We
then have to do some fancy thread locking using QWaitCondition,
because we need to "pause" that thread until the SSL error
is handled in the main thread -- if we don't pause the background
thread, Qt immediately resumes the QNetworkReply without ever
giving us the change to ignore ssl errors in the reply. Phew!

Additionally, the previous approach had a shortcoming in that
there was no way to notify background threads that ssl errors
had actually be handled. To do this we need a new signal which
can be fired after app has shown the ssl dialog and given users
a chance to respond. BUT... we can't safely do this -- if we
add a method to notify background threads when ssl errors have
been handled, then it CANNOT safely reside in app -- doing so
would break for QGIS server and QField etc, where theres no
app instance around to provide this notification. As a result
I've abstracted out the ssl error handling. By default there's
a simple error handler which just logs errors and returns
without ignoring them (i.e. default Qt behavior, an ssl error
cancels the request). App has a specific subclass of the ssl
error handler which presents the nice dialog and asks users to
choose what to do. Potentially server could decide to make
its own subclass too, which could e.g. ignore SSL warnings
if an environment variable is present (but at the moment
the behavior is effectively unchanged for server).

The end result is that SSL error handling should now be
totally thread safe, and we shouldn't hit any more deadlocks
and crashes when ssl errors occur in background threads.

I've also taken the opportunity to add a new signal which
is always emitted by the main thread QgsNetworkAccessManager
instance, which is emitted whenever ANY request on any
thread encounters an SSL error, and contains the requestId
so that the ssl error can be linked back to the originating
request. This is for debugging, and for use by the
network monitoring plugin to show ssl errors encountered
by requests.
2019-01-28 15:21:40 +11:00
Nyall Dawson
27bb2c156f Fix undersized layertree icons on hidpi displays 2019-01-28 07:16:33 +11:00
Juergen E. Fischer
febbc4f0b9 osgeo4w: handle grass svn versions (fixes #21114) 2019-01-27 17:37:39 +01:00
Nyall Dawson
ca06d407a0 Add custom QNetworkRequest::Attributes for initiator network request class name and internal id
And allow these to be retrieved from QgsNetworkRequestParameters.
This allows logging code to identify the area of code where a request
originated from, making debugging much easier!

Tag all requests created with appropriate class name and IDs
2019-01-25 23:47:05 +11:00
Nyall Dawson
a491e90a04 Add QgsNetworkAccessManager signal for reply download progress
This signal is propagated to the main thread QgsNetworkAccessManager
instance, so it is necessary only to connect to the main thread's signal
in order to receive notifications about requests created in any thread.

Also includes the original requestId to allow linked download progress
to original request
2019-01-25 23:47:05 +11:00
Mathieu Pellerin
df1d47b86a
[gui] Fix style manager's add button when the 'all' tab is selected 2019-01-25 19:38:28 +07:00
Nyall Dawson
4022c5fc38 Make QgsSymbolLayerUtils::symbolPreview* methods const, and utilise
internal symbol clones

Rendering symbols is a NON-CONST operation, which can permanently
alter the symbol instance (e.g. via changes made by the symbol
or symbol layer's startRender methods.).

This makes debugging super complex - because methods which look
like they are just generating previews of symbols can actually
change the original symbol instances, resulting in permanent changes
to a layer's style.

Refs #19910 (specifically, me pulling my hair out trying to deduce
seemingly random changes to layer's symbols)
2019-01-25 23:27:52 +11:00
Nyall Dawson
431861a468 [processing] Add a better API for specifying that outputs are temporary
Instead of requiring clients to generate temporary file names themselves,
(or use the cryptic "memory:" string!), this PR adds a static constant

    QgsProcessing.TEMPORARY_OUTPUT

If a layer/sink output parameter is set to QgsProcessing.TEMPORARY_OUTPUT,
then the temporary output filename will be generated automatically at
algorithm run time. This means callers don't need to mess around with
finding appropriate temporary folders and paths.

Another benefit is that TEMPORARY_OUTPUT is stored in the processing
history, so if you re-run a previous algorithm which was set to
output to a temporary file, it no longer tries to use that same
previous temporary path and instead generates a new one.
2019-01-25 23:27:08 +11:00
Alexander Bruy
a90fb87c8e
Merge pull request #8973 from alexbruy/grass-buffer
[processing] fix GRASS v.buffer algorithm for variable buffer case (fix #19377)
2019-01-25 12:49:12 +02:00
Nyall Dawson
3cb6a40ef2 [processing] Add API to get an import statement and classname for a parameter type 2019-01-25 18:12:11 +11:00
Nyall Dawson
009ee572d8 Allow access to content of POST requests in QgsNetworkReplyContent 2019-01-25 11:06:31 +11:00
Alexander Bruy
8919d604a8 [processing] use background color from the project settings in the rasterize algorithm (fix #19866) 2019-01-25 10:06:12 +11:00
Alexander Bruy
32f6034be7 [processing][needs-docs] force multipart output from GDAL-based dissolve
algorithm (fix #20025)
2019-01-25 09:57:31 +11:00
Alexander Bruy
bfb60e4dc7 [processing] fix GRASS v.buffer algorithm for case when buffer distance
is taken from the field (fix #19377)
2019-01-24 21:01:12 +02:00
Matthias Kuhn
7482f7a448
Merge pull request #8957 from volaya/#19607
[processing] do not allow editing model if it's missing algorithms
2019-01-24 19:53:12 +01:00
Pierre-Eric Pelloux-Prayer
25f2aba44d Include qgis_sip.h instead of qgis.h where possible (#8961)
This PR continues the work started in PR #8951.

This commit replaces occurences of #include "qgis.h" by #include "qgis_sip.h",
where possible = when files only depends on SIP_XXX features.
2019-01-24 11:33:22 -05:00
mhugent
b5febe5189
Merge pull request #8922 from mhugent/server_datasource_error
Server: catch datasource error
2019-01-24 17:27:13 +01:00
Peter Petrik
27c670e78d expose mesh spatial index similarly to vector spatial index to API. fix travis issues and documentation 2019-01-24 16:24:46 +01:00
Matthias Kuhn
9bdaac9dd0
Update python/plugins/processing/modeler/EditModelAction.py
Co-Authored-By: volaya <volayaf@gmail.com>
2019-01-24 10:50:19 +01:00
Marco Hugentobler
9eeaa31c9e =default with extra-asterisk 2019-01-24 09:58:39 +01:00
Nyall Dawson
996f48670d [afs][needs-docs] Allow users to set a specific referer for AFS connections, for
use with ArcGIS feature server requests

Some servers are locked down to only allow requests with a specific
referer URL - this allows us to open them in QGIS (but it requires
users to manually determine the correct referer string and populate
this setting for the connection -- we cannot do this for them!)
2019-01-24 18:05:45 +11:00
Alexander Bruy
c6540a6276 [processing] fix description files for SVM SAGA algs (fix #20796) 2019-01-24 09:31:18 +11:00
Alexander Bruy
34ec183354 [processing] split v.surf.rst algorithm into two (fix #19472)
This algorithm cannot output cross-validation results and topographic
parameters simultaneously, hence two tools needed. Thanks to Pedro Venâncio
for finding this and proposing a fix.
2019-01-24 06:45:23 +11:00