7667 Commits

Author SHA1 Message Date
Nedjima Belgacem
d80c27d94b
Fix 3D point cloud position when layer CRS != project CRS (#41538)
* hopefully fixes CRS problem

* fix the 3D map position shift

* remove qDebug

* add catch throw around transformInPlace

* switch to using QgsCoordinateTransform::transform

* move QgsCoordinateTransform to transform context

* remove TODO and fix layout

* add docs

* rename variable

* hadle bounding box coordinate transformation
2021-02-18 09:41:39 +01:00
Nyall Dawson
eba9ffa46e Add option to control the plain text display method for fields using
the checkbox form widget

In QGIS 2.x we always displayed the underlying raw value of a field
using the checkbox widget in the attribute table or in identify results
(i.e. the text display of the field would always match the value
the user had set for the checked or unchecked representation status,
e.g. "yes"/"no", "present"/"absent", etc)

This was changed in 3.0 so that the representation status ONLY affected
how the underlying stored values are mapped to a boolean true or false
value, and accordingly the attribute table/identify results started
only showing "true" or "false" strings.

This new setting allows users to control whether they want plain text
displays of the field to use the 3.x "true"/"false" behavior (the
default), or if they want to see the 2.x style actual field value.
2021-02-16 11:17:28 +10:00
Nyall Dawson
48ce042c84 Take advantage of pre-computed static expression nodes when determining
the referenced fields of an expression

Avoids some cases where use of various expression functions which
normally trigger all attributes to be requested, yet can be pre-computed
during prepare stages, cause non-provider fields to be listed in
the referenced columns and accordingly prevent expression compilation.

Notably this can occur when using an expression like:

   aggregate( .... , filter:=
"some_child_field"=attribute(@atlas_feature, 'some_atlas_field_name') )

where the whole attribute(@atlas_feature....) part is a constant
static value and can be compiled down to a trivial, index-friendly
"some_child_field"=### filter for the aggregate provider request.
Ultimately giving a big performance boost to the atlas!
2021-02-15 12:12:00 +10:00
Loïc Bartoletti
e336b831c2 Remove automagic fix and tiny refacto 2021-02-13 09:25:19 +10:00
Loïc Bartoletti
7e7732218b Add a message if a geometry was fixed 2021-02-13 09:25:19 +10:00
Richard Duivenvoorde
80251ac97d Make FindBestFrameNumberForFramestart a lot faster 2021-02-13 06:41:56 +10:00
Nyall Dawson
22a4b881d3 Sipify 2021-02-12 15:41:14 +10:00
Nyall Dawson
980d9697a0 Simple line can cause tile artifacts if it's a dashed line 2021-02-12 15:41:14 +10:00
Nyall Dawson
f75c53bbd8 Add QgsSymbol::canCauseArtifactsBetweenAdjacentTiles()
Returns True if ANY of the symbol layers contained in the symbol
can cause tile rendering artifacts
2021-02-12 15:41:14 +10:00
Nyall Dawson
bdf5e4fe3b Add QgsSymbolLayer::canCauseArtifactsBetweenAdjacentTiles()
Returns true if the symbol layer rendering can cause visible
artifacts across a single feature when the feature is rendered
as a series of adjacent map tiles each containing a portion
of the feature's geometry.

This depends on the symbol layer derived class itself - eg
a simple solid color fill won't show any artifacts, but a shapeburst
fill WILL.
2021-02-12 15:41:14 +10:00
Nyall Dawson
cf43c60717 Fix clazy warnings 2021-02-12 12:42:22 +10:00
Nyall Dawson
8fa29ac6d2 When we are compiling expressions to handoff to backend providers,
check if a node has already been determined to evaluate to a static,
precalculated value, and if so, use this value for the node instead
of attempting to compile the actual contents of the node itself

If we are certain that a node is static and will never change,
the this potentially allows us to short-cut a large part of the
filter expressions content. We already use this short-cut when
evaluating expressions on the QGIS side since years, and its
proven to be stable and reliable. By respecting this during
expression compilation we can offer a huge speed up to certain
filter expressions, especially those which utilise QGIS variables
which are known to be static (such as atlas variables, map scales,
etc). Previously ANY use of a qgis variable would always cause
expression compilation to fail and require a full set of feature
fetching from the provider.

(Resulted in orders of magnitude faster atlas export for a complex
atlas.)
2021-02-12 06:05:56 +10:00
Nyall Dawson
c582967b6e Add "octagon", "asterisk" and "square with corners" shapes to simple marker
available shapes
2021-02-11 16:01:50 +10:00
NEDJIMAbelgacem
86a71391df remove point budget approach from 2D rendering 2021-02-10 13:49:28 +01:00
Belgacem
eb1ff089a6 implementation of point budget in 2D 2021-02-10 13:49:28 +01:00
Nyall Dawson
c6613593c7 Don't loop through all selected features multiple times (once per
field) when the attribute form is opened.

This is incredibly expensive, yet only required in a very very small
corner case (field is from a joined layer without the upsert on edit
capabilities).

Refine logic to avoid the scan wherever we can.

Fixes #41366
Fixes #36863
2021-02-09 10:24:45 +10:00
Nyall Dawson
5a46dee738
Merge pull request #41260 from qgis/test-focal
Update test base image and move CI to Github workflow
2021-02-08 18:13:55 +10:00
Nyall Dawson
973682baa3 Use QgsRenderChecker to compare png images when comparing processing result
directories
2021-02-08 13:23:40 +10:00
Nyall Dawson
0aab3073d8 Fix Python based data providers on newer SIP versions 2021-02-08 13:23:37 +10:00
Nyall Dawson
4984de792d Use TRANSFER_BACK annotation instead of FACTORY for QgsProviderRegistry::createProvider
Paraphrasing Phil Thomson's advice on https://www.riverbankcomputing.com/pipermail/pyqt/2017-July/039450.html:

"
/Factory/ is used when the instance returned is guaranteed to be new to Python.
In this case it isn't because it has already been seen when being returned by by the python function
creating the provider subclass.

(However for a different sub-class implemented in C++ then it would be the first time it was seen
by Python so the /Factory/ on create() would be correct.)

You might try using /TransferBack/ on createProvider() instead - that might be the best compromise.
2021-02-08 13:23:37 +10:00
Nyall Dawson
cd2df66674 Use unique_ptr 2021-02-08 13:23:37 +10:00
Nyall Dawson
6f4b32f658 Create class QgsAbstractGeometryTransformer, which can be used
to transform the vertices of a QgsAbstractGeometry

E.g.

        class Transformer(QgsAbstractGeometryTransformer):

            def transformPoint(self, x, y, z, m):
                return True, x * 2, y + 1, z, m

        transformer = Transformer()
        g = QgsGeometry.fromWkt('LineString(3 0, 10 0, 10 10)')
        g.get().transform(transformer)
        print(g.asWkt()) # 'LineString (6 1, 20 1, 20 11)'
2021-02-08 12:12:53 +10:00
Nyall Dawson
8e57368133
Merge pull request #41355 from elpaso/bugfix-gh41342-gpkg-create-table-from-file-browser
GPKG Allow table creation from file browser
2021-02-08 10:34:28 +10:00
nirvn
e82df36c0d Add point cloud layer icon in the map layer model 2021-02-07 12:48:48 +07:00
Nyall Dawson
d0882d0f06 When auto selecting the default identifier field for a layer,
prefer something like "admin_name" over "type_name".

By penalising results with "type", "class", "cat" in their names
we are less likely to accidentally select a category field as the
friendly identifier when a better one exists.

Also add tests for this logic.
2021-02-06 10:10:51 +10:00
Alessandro Pasotti
5733970f84 Add DB connections factory to data items 2021-02-05 12:15:25 +01:00
Nyall Dawson
13fbcd1cff Expose additional GDAL supported resampling methods as options
for "early" raster resampling

Notably, this adds the "Average" resampling as an option for
early resampling methods. (A nice side effect is that we also
get mode, cubic spline, Lanczos, ... for free!)

Fixes #40746
2021-02-01 07:58:20 +10:00
Nyall Dawson
c253bee452 Fix typo 2021-01-31 05:41:22 +10:00
Nyall Dawson
50b9beaad6 [sipify] Catch more class references and insert :py:class: annotations 2021-01-31 05:41:22 +10:00
Harrissou Sant-anna
8a8d2a2c66 Fix some formatting in pyQGIS doc 2021-01-30 08:25:03 +10:00
Nyall Dawson
6ab0e4d954 Fix doxygen warning by renaming function 2021-01-29 09:17:58 +10:00
Nyall Dawson
6606471938 Sipify 2021-01-29 09:17:58 +10:00
Nyall Dawson
339516a4a9 Add API to limit the acceptable scale difference when searching
for any matching cache image in QgsMapRendererCache
2021-01-29 09:17:58 +10:00
Nyall Dawson
ead6d0651b Allow specifying an explicit extent and map to pixel when
setting a cache image, and prefer any cached image with
parameters which exactly match the current cache parameters

This allows us to properly handle the case where:
- one map job is canceled, but some layers did finish rendering
- while the canceling is occuring on a different thread, we start
a new map render using the same cache and set new extent/map to pixel
for it
- the canceled job cleans up and stores the cache images for
the layers which DID finish rendering -- in this case we need
to explicitly state the previous extent/map to pixel when storing
the cache image, as they won't match the cache's current parameters
2021-01-29 09:17:58 +10:00
Nyall Dawson
ebf16b052b Move a bunch of QgsMapToPixel methods to header so that they can be
optimised by the compiler, and add equality operator to QgsMapToPixel
2021-01-29 09:17:58 +10:00
Nyall Dawson
c64216963b Apply same logic as we use for rendering preview cached versions
of vector layers to point cloud layer renders
2021-01-29 09:17:58 +10:00
Nyall Dawson
a138921179 Ensure all layer render subclasses correctly return false if the
rendering is aborted early
2021-01-29 09:17:58 +10:00
Denis Rouzaud
e071f31a58 add an argument to configure preview length in QgsExpression::formatPreviewString 2021-01-28 15:18:32 +01:00
Peter Petrik
0a74eef133 ifdef out whole class on iOS 2021-01-28 06:18:20 +10:00
Peter Petrik
6a1bb9c01d fix sip 2021-01-28 06:18:20 +10:00
Peter Petrik
ed45bc1319 do not use QProcess on iOS 2021-01-28 06:18:20 +10:00
Nyall Dawson
d6c8133b92 Dox 2021-01-28 02:25:09 +10:00
Nyall Dawson
ddf6245f36 Move responsibility for retrieving lists of custom user CRSes to
QgsCoordinateReferenceSystemRegistry

This was the last bit of untested, direct sql database access relating
to custom projections. Now everything is nice and central and protected
by unit tests.
2021-01-28 02:25:09 +10:00
Nyall Dawson
8e26132404 More logic to QgsCoordinateReferenceSystemRegistry 2021-01-28 02:25:09 +10:00
Nyall Dawson
fae30b56ab Move logic for removing user crs to QgsCoordinateReferenceSystemRegistry 2021-01-28 02:25:09 +10:00
Nyall Dawson
2fe110c7c0 Add a method to refresh the definition of an existing QgsCoordinateReferenceSystem
object

Updates the definition and parameters of the coordinate reference system to their
latest values.

This only has an effect if the CRS is a user defined custom CRS, and the definition
of that custom CRS has changed. In this case the parameters of the object (such as the
proj and WKT string definitions, and other related properties) will be updated to
reflect the current definition of the custom CRS.

Any objects which store CRS objects should connect to the QgsApplication::coordinateReferenceSystemRegistry()'s
QgsCoordinateReferenceSystemRegistry::userCrsChanged() signal and call this method
on their stored CRS objects whenever the signal is emitted in order to update these
CRSes to their new definitions.

Refs #40704
2021-01-28 02:25:09 +10:00
Nyall Dawson
149925043c Add a new QgsCoordinateReferenceSystemRegistry singleton attached
to QgsApplication

In the long term all methods for retrieving available CRS details
should be moved here (instead of being scattered all over the place,
as they are now). But for now the logic for saving and updating
user CRS definitions has been moved here only.

The initial motivation is to create a central place where objects
can connect to in order to listen for when a user makes changes
to their custom projections.

Refs #40704
2021-01-28 02:25:09 +10:00
Nyall Dawson
c4818a0de7 Unlock composition using transformed previewed cache image of labeling
results as well as map layers

This extends the recent addition of smooth map updates for raster
layers to also apply to map labels. Now you'll see a scaled/transformed
version of the previous map render's labels while the new labeling
results are being generated in the background.

Avoids "flashy" redraws of map labels
2021-01-27 21:50:13 +10:00
Nyall Dawson
bb746c6266 Add API to pass approximate layer rendering time estimatation to
map layer renderers

These renderers can then use the layer rendering time for the previous
map render job to refine their logic regarding when its appropriate
to start compositing the layer render
2021-01-27 21:50:13 +10:00
Matthias Kuhn
a84f2a2065
Merge pull request #41009 from suricactus/dms_gui
Document management system a.k.a. polymorphic relations GUI
2021-01-22 08:39:35 +01:00