5410 Commits

Author SHA1 Message Date
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
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
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
Denis Rouzaud
82ec1418c0
declare metatype for QgsDefaultValue (#9011)
* declare metatype for QgsDefaultValue

* sipify
2019-01-28 21:04:18 -05: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
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
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
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
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
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
Nyall Dawson
e50d9a1673 Make request a member of reply 2019-01-24 06:10:37 +11:00
Nyall Dawson
535965ba8c Deprecate older thread-unsafe signals 2019-01-24 06:10:37 +11:00
Nyall Dawson
5824faf674 Add thread safe QgsNetworkAccessManager::requestTimedOut signal 2019-01-24 06:10:37 +11:00
Nyall Dawson
ea1971fdf8 Add an unique id to requests, which can be used to link them to responses 2019-01-24 06:10:37 +11:00
Nyall Dawson
b5379ce055 New class QgsNetworkReplyContent, which encapsulates the useful
information from a QNetworkReply in a container which is safe
and cheap to pass between threads

(QNetworkReplys are QObject based, so not safe to access or
pass between threads)

Use this new class in a thread safe QgsNetworkAccessManager::finished
signal, which is fired on the main thread QgsNetworkAccessManager instance
when responses are finished from any thread
2019-01-24 06:10:37 +11:00
Pierre-Eric Pelloux-Prayer
08634c4e6f fix style 2019-01-23 14:59:19 +01:00
Pierre-Eric Pelloux-Prayer
f1760ee56b Remove include "qgsapplication.h" from qgswkbptr.h
qgswkbptr.h is included indirectly by a large number of source files.
So this commit does the following:
  - remove #include "qgsapplication.h" from qgswkbptr.h, and copy-paste the swap_endian
    function where it's used.
  - add the missing #include "qgsapplication.h" in other files

The rationale for this change is:
  - qgswkbptr.h doesn't really needs QgsApplication, since it only used swap_endian.
    We don't need to add a fake dependency on QgsApplication on every (indirect) "includers"
    of qgswkbptr.h
 - qgsapplication.h depends on qgsconfig.h which itself changes quite often (on every git op
   at least). Before this change, a 'git commit' would trigger a rebuild of about 3500 files.
   With this change we're down to ~700.
2019-01-22 21:45:38 +01:00
Pierre-Eric Pelloux-Prayer
96a9a7238a Remove unnecessary includes 2019-01-22 21:45:38 +01:00
Nyall Dawson
9cf2ff31d8 Fix evaluation of data defined properties for subsymbols of subsymbols
Fixes #18384
2019-01-23 03:36:41 +11:00
Marco Hugentobler
ffae79b7d0 Consider feedback 2019-01-22 16:11:04 +01:00
Nyall Dawson
8a920e0bc2 Rework QgsNetworkAccessManager::requestAboutToBeCreated() to be thread
safe, and encapsulate more useful request information
2019-01-22 18:27:06 +11:00
Nyall Dawson
ddd357c2ea Add API to QgsRasterBlock to obtain both pixel value AND no data
flag in a single call

This is much more efficient then making two calls, since the
QgsRasterBlock::isNoData() check internally calls QgsRasterBlock::value().
So by requiring API users to make the two separate calls individually,
we double the time this process takes...
2019-01-22 12:13:39 +11:00
Nyall Dawson
d57c182d8b Allow QgsRasterIterator to iterate over a raster layer, WITHOUT
actually fetching the raster block data

This allows for efficient iteration over a "reference" layer, where
you require the block extent/origin/pixel size/etc (but not the
reference layer block data itself!), in order to fetch a block from
a DIFFERENT set of rasters (but keeping these pixel-aligned to the
reference raster).
2019-01-22 07:52:45 +11:00
Peter Petrik
1b11ba43a2 fix docs 2019-01-21 11:01:12 +01:00
Peter Petrik
7423a74915 add option to export mesh dataset to raster block (for processing algs) 2019-01-21 11:01:12 +01:00
Nyall Dawson
eafedeeb8b Sipify 2019-01-21 14:48:19 +11:00
Marco Hugentobler
575d385e57 Use QgsMapRendererJob::Errors instead of QList< QPair > 2019-01-18 15:46:39 +01:00
Nyall Dawson
eb256e9498 Fix doxygen warnings 2019-01-18 20:36:30 +11:00
Nyall Dawson
7ba5998db2 Calculate correct legend size when using expression based labels 2019-01-18 20:36:30 +11:00
Nyall Dawson
d70b60d48f [FEATURE][layouts] Allow expressions to be embedded inside legend item text
This feature allows for expressions to be embedded directly inside
legend item text (e.g. group, subgroup and item text). The expressions
are evaluated at render time, with full knowledge of the legend's
expression context (so can utilise variables from the layout/layout item/
etc)

There's no UI for this yet (that will come in 3.8), but expressions are
entered using the standard [% 1 + 2 %] format.

E.g. a legend item text of

    My layer (rendered at 1:[% @map_scale %])

will show in the output as

    My layer (renderer at 1:1000)
2019-01-18 20:36:30 +11:00
Alex
b43943a9b0 [FEATURE] New expression variables for legend items
Adds new variables for use in data defined expressions for layout legend items, including

- @legend_title
- @legend_column_count
- @legend_split_layers
- @legend_wrap_string
- @legend_filter_by_map
- @legend_filter_out_atlas

Additionally, if the legend is linked to a map, then expressions used in that legend will also have access to the linked variables, including @map_scale, @map_extent, etc.
2019-01-18 13:38:21 +11:00
Nyall Dawson
a0e91f3798 Add API to read/write QgsExpressionContextScope from/to XML 2019-01-18 12:56:05 +11:00
Denis Rouzaud
5fa5631bbd
add enum value to key and reverse helpers (#8879)
* add enum value to key and reverse helpers

* cast cont char* to QString

* use QStringLiteral
2019-01-17 09:40:13 -05:00
Marco Hugentobler
0f3c39deb7 Server: throw exception in GetMap if DB connection is not ok 2019-01-17 08:55:18 +01:00
Nyall Dawson
2aab28380c [browser] Don't show gdal/ogr layer items for QGIS style xml files
These aren't layers, so the extra entries are just distracting noise.
2019-01-16 12:10:25 +11:00
lbartoletti
c885cd7267 add toString and repr for qgsvector 2019-01-16 01:10:33 +11:00
Alex
004d6bae5f Add QgsRenderContext to QgsLayerTreeModelLegendNode::ItemContext 2019-01-15 13:37:36 +11:00
lbartoletti
edadcb773f Refactoring of rectangle maptools
Adds a new geometry class QgsQuadrilateral, for 4 sided geometries.
2019-01-15 10:24:16 +11:00