328 Commits

Author SHA1 Message Date
Nyall Dawson
b43537680c Add API to add list of geometries to collections
More efficient then adding one by one, and allows for efficient
transferral of geometries when pared with the new takeGeometries
method.
2024-06-03 14:38:57 +10:00
Nyall Dawson
27a2bcf064 Add API to take geometries from a collection
Removes the geometries from the collection and returns ownership
to the caller.

Can be used to avoid clones in some scenarios.
2024-06-03 14:38:57 +10:00
Mathieu Pellerin
f9d3ca3afe [qml] Add missing QgsProject's transactionMode property 2024-06-02 07:32:36 +07:00
Nyall Dawson
94b6003e3c Add list constructor for QgsMultiLineString too 2024-06-01 19:28:50 +10:00
Nyall Dawson
2871f5b8af Add constructor to directly create QgsMultiPolygon from list of polygons 2024-06-01 19:28:50 +10:00
Alessandro Pasotti
058601dcd5
Merge pull request #57630 from elpaso/qgsfeaturerequest-compare-method
[api] Add compare methods to QgsFeatureRequest
2024-06-01 11:04:36 +02:00
Alessandro Pasotti
30a1e36fe5
sipify 2024-06-01 08:09:57 +02:00
Alessandro Pasotti
f681cd459e [api] Add compare methods to QgsFeatureRequest
This will allow to reduce unnecessary expensive calls
when the request has not really changed.
2024-05-31 11:38:05 +02:00
Nyall Dawson
b89abdb64b Create optimised paint device to QgsGeometry converter 2024-05-31 15:02:35 +10:00
Nyall Dawson
0a493a0443 Move core painting related files to src/core/painting 2024-05-31 15:02:35 +10:00
Julien Cabieces
48bd417ded update qgsfield after rebase 2024-05-31 08:46:33 +10:00
Julien Cabieces
ad13ae8b32 fix doc TODO 2024-05-31 08:46:33 +10:00
Julien Cabieces
848fb16785 Add \deprecated tag 2024-05-31 08:46:33 +10:00
Julien Cabieces
1170aa15ee fix since rebase 2024-05-31 08:46:33 +10:00
Julien Cabieces
255d46230a sipify 2024-05-31 08:46:33 +10:00
Julien Cabieces
71e0b7ffcd manual fix rasterattibutetable 2024-05-31 08:46:33 +10:00
Julien Cabieces
97f1c8df97 make python API backward compatible 2024-05-31 08:46:33 +10:00
Julien Cabieces
0ccaf2d299 sipify 2024-05-31 08:46:33 +10:00
Nyall Dawson
e2157cfe1f Promote FieldOrigin to enum class, move to Qgis 2024-05-27 08:50:16 +02:00
Nyall Dawson
fce4ed06b8 Split fragments on tab characters 2024-05-25 06:10:28 +10:00
Nyall Dawson
25f00e2560 Don't try to render empty text strings 2024-05-25 06:10:28 +10:00
Nyall Dawson
f5853a7212 Add tab stop distance to QgsTextFormat 2024-05-25 06:10:28 +10:00
Nyall Dawson
0c41c22343 Fix bad merge 2024-05-24 16:34:33 +10:00
Nyall Dawson
6185675c93 Additional shortcut to QgsAttributes creation from Python
Avoid constructing a bunch of default QVariant objects which
we will just replace immediately
2024-05-24 16:34:33 +10:00
Nyall Dawson
280cd84652 Add more HoldGIL annotations to cheap methods 2024-05-24 16:34:33 +10:00
Nyall Dawson
8941bbf599 Optimise QgsAttributes python constructor
Avoid multiple checks for detachment for each attribute
2024-05-24 16:34:33 +10:00
Germán Carrillo
2768e41f0a Adjust docstring in qgsgeometryutils_base.h 2024-05-24 07:30:09 +10:00
Nyall Dawson
fe74b300be [feature] Add maximum distance setting for point labels
For the "Around point" and "Cartographic" placement modes, this
adds a new optional setting for the maximum distance of the labels from
the feature. It's used together with the existing distance setting
to define a range of distances at which labels may be placed
from their corresponding point features.

This adds more flexibility to the placement for these layers,
ultimately allowing for more labels to be placed in busy maps.

When the layer is set to the "around point" mode, then label
candidates which are closer to the point will always be prefered
over those which are further away.

When the layer is set to the "cartographic" mode, then the default
behavior is also to prioritize closer labels. A new combo box
allows users to control the priority, with an option for
prefering position ordering. If this option is set, then candidates
at the corresponding positions (eg top left) are preferred regardless
of how far they are from the point, with the labelling falling
back to alternate positions only when no labels can be placed
up to the maximum label distance.

Sponsored by Rubicon Concierge Real Estate Services
2024-05-23 17:20:30 +10:00
Nyall Dawson
587a80dcc2 Move label quadrant setting to QgsLabelPointSettings 2024-05-23 17:20:30 +10:00
Nyall Dawson
49cbe3bec3 Better documentation 2024-05-23 17:20:30 +10:00
Nyall Dawson
24cc226a64 Expose a useful method to python 2024-05-23 17:20:30 +10:00
Nyall Dawson
dda755d058 Move predefined position order member to QgsLabelPointSettings 2024-05-23 17:20:30 +10:00
Nyall Dawson
e81fcd0b09 Start on QgsLabelPointSettings class 2024-05-23 17:20:30 +10:00
Even Rouault
9c989ee84c Add a QgsTaskWithSerialSubTasks class 2024-05-23 11:49:49 +10:00
Mathieu Pellerin
8413982ad6 Let the signal carry whether a feature has been found, that might come in handy 2024-05-23 11:00:34 +10:00
Mathieu Pellerin
8c389cf613 [attribute form] Fix initial multi editing state of relation reference editor widgets 2024-05-23 11:00:34 +10:00
Jean Felder
f630efa59c qgsfeature: Optimize __set_item__ python call
This change is similar to the one done for `setAttribute`.
2024-05-23 05:15:16 +10:00
Jean Felder
27ebce6dad qgsfeature: Optimize setAttribute python call
This change is similar to the one introduced in the previous
commit for `QgsAttributes` . The python call of `setAttribute` expects
a `QVariant` as input. sip is able to directly handle `QVariant` but
this allocation can be slow.

In some cases, it is possible to speed-up the `setAttribute` call by
checking the type of the attribute. If the attribute is a boolean, an
integer, a float or a string, it is possible to avoid the intermediate
sip QVariant allocation done by `sipConvertToType`.

Based on some testing, this allows to speed-up a python `setAttribute`
call up to 80%. If the python attribute is already a `QVariant`, then
one get the same time.
2024-05-23 05:15:16 +10:00
Jean Felder
0446f85409 qgsattributes: Optimize QgsAttributes python allocation
The python `QgsFeature.setAttributes()` calls is relatively slow
because of the call to `sipConvertToType` which needs to make in
intermediate allocation for each attribute QVariant creation.

This change aims to speed up this call by avoiding the call to
`sipConvertToType` for the most common types.
The change itself is quite simple. If the input attribute is a
boolean, an integer, a string or a floating, a QVariant is directly
created by using the python C API instead of calling
`sipConvertToType`.

Based on some testing on lists which can contain between 5 and 10
elements, I have measured an acceleration up up to 70%.
2024-05-23 05:15:16 +10:00
Nyall Dawson
80b61d3d52 Add constBits methods to QgsRasterBlock
These can avoid an unwanted QImage detach when we are just
reading block data and don't need to modify it
2024-05-22 14:28:12 +10:00
Nyall Dawson
fb1eabbf0b const correct method 2024-05-22 14:28:12 +10:00
Nyall Dawson
7a3bf17bf1 Provide detailed error message when creating GeoPDF from layout fails
Instead of a generic message (which is not very helpful), show the
full error message we receive from GDAL to the user
2024-05-22 14:28:03 +10:00
Germán Carrillo
127ec157e9 [profile] Address review 2024-05-22 13:44:52 +10:00
Germán Carrillo
c20fec2aca Update SIP file for PyQt6 2024-05-22 13:44:52 +10:00
Germán Carrillo
65ad23a769 [core] Introduce QgsProfileSourceRegistry to store sources other than map layers, e.g., based on web services 2024-05-22 13:44:52 +10:00
Nyall Dawson
cbd25c1fdd Promote QgsColorRampShader enums to enum class, move to Qgis 2024-05-22 12:37:44 +10:00
Nyall Dawson
04665953ed Also add variant which takes a list of layers 2024-05-20 11:52:10 +02:00
Nyall Dawson
c79168a6bc Add elevation utils method to collect significant elevation values for a project 2024-05-20 11:52:10 +02:00
Nyall Dawson
c8d66e1e8d Add method to retrieve significant elevation values from a layer 2024-05-20 11:52:10 +02:00
Nyall Dawson
91c17de4d5 Correct handle many-to-one and one-to-one relationships in expansions 2024-05-16 15:14:49 +10:00