23285 Commits

Author SHA1 Message Date
Maris Nartiss
cb63fe9a77 Processing: do not store Processing configuration keys if value matches default
If for some reason Processing configuration gets stored into configuration file,
previous code saved default menu paths in configuration. If GUI language changes,
custom values stored in the configuration take precedence over default ones
(= default translated ones are not used). This fix removes menu keys from config
for default value and thus allows to fall back to default menu items on language
switch.

Fixes #52449 (and related issues)
2024-05-01 10:31:23 +10:00
Nyall Dawson
a41f6f4333 Copy project vertical/3d crs logic to QgsMapLayer
This adds a new verticalCrs property for map layers, and a corresponding
crs3D() property. Logic is the same as that for QgsProject.
2024-04-30 06:06:10 +10:00
Nyall Dawson
cc6a840b52 Add QgsProjUtils and QgsCoordinateReferenceSystem ::hasVerticalAxis
Can be used to test if a crs contains a vertical axis
2024-04-26 20:26:41 +10:00
Nyall Dawson
1d52a7a8de Report proj error when creating compound crs fails 2024-04-26 20:26:41 +10:00
Nyall Dawson
264f426ba9 Expand documentation 2024-04-26 20:26:41 +10:00
Nyall Dawson
9f2b519d7e [api] Add QgsProject::crs3D
Returns the CRS to use for the project when transforming 3D data,
or when z/elevation value handling is important.

The returned CRS will take into account verticalCrs(), e.g. by
returning a compound CRS consisting of crs() + verticalCrs().

This method may still return a 2D CRS, e.g in the case that crs()
is a 2D CRS and no verticalCrs() has been set for the project.
I.E. It is NOT guaranteed that the returned CRS will actually
be a 3D CRS, but rather it is guaranteed that the returned CRS
is **ALWAYS** the most appropriate CRS to use when handling 3D data.
2024-04-26 20:26:41 +10:00
Matthias Kuhn
8f6fcdc423
Merge pull request #57200 from gacarrillor/dxf_harmonize_app_and_alg
[processing] Harmonize DXF Export app dialog and corresponding algorithm
2024-04-23 18:17:34 +02:00
Marco Hugentobler
17c83a9deb Constant for setting dxf data defined blocks by default 2024-04-22 04:27:56 -05:00
Andrea Giudiceandrea
2121644904 [DB Manager] Avoid printing HTML code in the Python console 2024-04-21 12:13:14 +10:00
Mathieu Pellerin
b9898d0fa1
Merge pull request #57166 from nirvn/fields_gadget
[qml] Make QgsFields a QGadet and make some functions Q_INVOKABLE
2024-04-21 05:53:41 +07:00
Nyall Dawson
a979931960 Function naming improvements 2024-04-21 06:46:35 +10:00
Nyall Dawson
0a877ea4af Documentation improvements 2024-04-21 06:46:35 +10:00
Nyall Dawson
de0f5cf87c Make API more future proof 2024-04-21 06:46:35 +10:00
Nyall Dawson
75455dffad Move class to own file 2024-04-21 06:46:35 +10:00
Nyall Dawson
e2d6b54f35 Add "View Log" action for child algorithms
This action shows the log of that child step, regardless of whether
or not it failed. This is handy for debugging model errors after
testing, when you've already closed the algorithm window...!
2024-04-21 06:46:35 +10:00
Nyall Dawson
d4369f714d Make log of each separate child algorithm available for retrieval after
running model
2024-04-21 06:46:35 +10:00
Nyall Dawson
172a1c2b03 Make execution status available for child algorithms 2024-04-21 06:46:35 +10:00
Nyall Dawson
8302259463 Make child results handling API more flexible 2024-04-21 06:46:35 +10:00
Nyall Dawson
6c22cd0355 [feature] Add "View Output Layers" option for model child algorithms
When editing a model through the designer (and after having run
that model), you can now right click any child step in the model
and select "View Output Layers". This will add the output layers
from that step as new layers in the current QGIS project.

This action is available for ALL child algorithms in the model,
even if the model is not configured to use the outputs from those
children as model outputs.

This is designed as a helpful debugging action. If a user's model
fails (or gives unexpected results), they can then trace through
the model and view the outputs for suspected problematic steps.
It avoids the need to add temporary outputs to a model and re-run
to test.

Additionally, this action is always available after running the model,
EVEN if the model itself failed (eg because of a misconfigured
step later in the model).

Sponsored by City of Canning
2024-04-21 06:46:35 +10:00
Nyall Dawson
5ebbb3da46 Make child results and inputs always available for models
Even when the model execution fails, store the child inputs and
results for all steps which successfully completed in the context.

This gives more debugging information to a user when a model fails,
because these values will now be reflected in the model designer
view for all steps which completed.
2024-04-21 06:46:35 +10:00
Nyall Dawson
133bad76ee Move some model designer code to c++ 2024-04-21 06:46:35 +10:00
Nyall Dawson
7f4fe65bee Ensure that QgsProcessingAlgorithm::postProcess is always called
We now always call QgsProcessingAlgorithm::postProcess, even when
the algorithm fails for some reason (eg it raises an exception).
This ensures that the context cleanup logic in postProcess is
always run. Note that we still ONLY call an algorithm's specific
postProcessAlgorithm implementation for successful executions,
so the public facing API and behavior remains unchanged.

This is intented to provide a consistent handling of the cleanup
logic in postProcess, specifically to make sure that that the
context thread handling logic is triggered in all cases.
2024-04-21 06:46:35 +10:00
Nyall Dawson
9d6faf3d00 Prevent changing ID if layer is owned 2024-04-20 16:50:56 +10:00
Nyall Dawson
ed2d4f559b Add idChanged signal, property 2024-04-20 16:50:56 +10:00
Nyall Dawson
19585bf1fd Add api to set QgsMapLayer IDs
With appropriate warnings on when this should be used...
2024-04-20 16:50:56 +10:00
Nyall Dawson
7355c24db8 [processing] Endpoint distance threshold for network analysis
Adds an optional end point distance threshold parameter to the
network analysis tools. Previously (and still, by default) endpoints
will ALWAYS be snapped to the nearest point in the network layer,
regardless of how far away from the network they actually are. This
can result in meaningless results, as the tools will happily snap
points to a road hundreds of kilometers away :)

Now, there's an optional end point distance threshold parameter
for these tools. The behaviour of the threshold depends on the
algorithm:

- For the “Service area (from layer)” tool an optional new output
was added for “non routable features”. This output will contain
any features which were deemed too far from the network. All
other features which are within tolerance distance to the
network will be stored in the standard output from the tool.
- For the “Service area (from point)” tool an error will be raised
if the point is too far from the network
- For the “Shortest path (point to point)” tool an error will
be raised if either the source or destination points are too far
from the network.
- For the “Shortest path (layer to point)” and “Shortest path (point
to layer)” tools:
  - An error will be raised if the **point** is too far from the network.
  - A new optional output was added for “non routable features”. This
    output will contain any features which were deemed too far from the
    network. All other features which are within tolerance distance to
    the network will be stored in the standard output from the tool.

Sponsored by City of Canning
2024-04-20 08:50:00 +10:00
Nyall Dawson
fc1922ae43 [processing] When no specific layer group is required for an output,
place it above the current selected layer

Fixes #56129
2024-04-20 08:49:45 +10:00
Nyall Dawson
51378f9827 [processing] Set the active layer to one of the generated outputs
Fixes #57003
2024-04-20 08:49:45 +10:00
Mathieu Pellerin
d9677bcb1c
Merge pull request #57016 from gacarrillor/dxf_overridden_name
[dxf] Allow users to override the layer name to be exported to DXF
2024-04-19 20:44:09 +07:00
Nyall Dawson
d95ac4a7ea Better reporting for invalid field names for some algorithms 2024-04-18 13:25:06 +10:00
Nyall Dawson
5b912fab9d Escape filenames correctly 2024-04-18 11:32:28 +10:00
Nyall Dawson
c033ac8ccd Show filename in exceptions raised from Python console scripts
Instead of "", ensure the actual filename (or tab title, for unsaved
scripts) is shown in exceptions
2024-04-18 11:32:28 +10:00
Nyall Dawson
3688035942 Ensure filename is shown when an exception occurs in a dropped Py script 2024-04-18 11:32:28 +10:00
Nyall Dawson
3ac4fd4ca8 Ensure __file__ is set when running python scripts dropped onto QGIS 2024-04-18 11:32:28 +10:00
Nyall Dawson
b70fba6762 Download Google fonts from github, not broken Google fonts download url
Note that not all fonts available from Google fonts are present on
the github repo for some reason, eg Open Sans Condensed is not.

Fixes #57070
2024-04-18 11:31:55 +10:00
Mathieu Pellerin
6709debbac Fix sipify.pl script not handling Q_INVOKABLE inline 2024-04-17 18:07:43 +07:00
Mathieu Pellerin
6f1f5d2ef6 [qml] Make a couple of vector layer editing/deletion functions invokable 2024-04-17 18:07:43 +07:00
Mathieu Pellerin
5d796e9dfa [qml] Make QgsFields a QGadet and make some functions invokable 2024-04-17 11:15:23 +07:00
Nyall Dawson
f53fbfb4dd Avoid a bunch of text to double round trip conversions
Simplify api, and add a bunch of tests
2024-04-16 13:12:23 +10:00
Denis Rouzaud
709690551d
[sipify] support different since versions in C++ bs PyQGIS 2024-04-11 11:01:19 +02:00
Germán Carrillo
4b2c7deedc [core] Allow users to override a layer name when exporting to DXF; DxfLayerJob->layerTitle replaced by layerDerivedName, to avoid confusion with one of the final DXF layer name sources (layer metadata title, layer server properties title, layer name, layer's overridden name) 2024-04-10 16:09:17 +02:00
Nyall Dawson
3d59b88329 Move server specific layer properties to QgsMapLayerServerProperties
Eg server layer title, abstract, etc, and deprecate the related
methods at the QgsMapLayer level

This should avoid accidental creep of these specifically server-related
properties into wider use, and help disambiguate them from the
standard layer metadata properties
2024-04-10 19:03:15 +10:00
mhugent
6a1b775dcc
Merge pull request #57036 from mhugent/dxf_dd_blocks_default_on
Enable dd blocks by default and remove global setting
2024-04-10 10:29:06 +02:00
Nyall Dawson
365d26ece4 Ensure raster elevation filtering works nicely with contour renderer
With the contour renderer we must treat out of range pixels as
no data values, so that the gdal contouring algorithm correctly
ignores them
2024-04-10 12:10:08 +10:00
Nyall Dawson
b5a8722446 Improve documentation 2024-04-10 09:05:23 +10:00
Nyall Dawson
37c69d1b60 Add validation to calls to QgsProject.setVerticalCrs 2024-04-10 09:05:23 +10:00
Nyall Dawson
e2a3edc76d [api] Add vertical crs option to QgsProject
If the project crs() is a compound CRS, then the CRS returned
by QgsProject::verticalCrs()  be the vertical component of
QgsProject::crs(). Otherwise it will be the value explicitly
set by a call to setVerticalCrs().

The vertical crs is a persistent property of a project, which
is saved/restored to xml.
2024-04-10 09:05:23 +10:00
Marco Hugentobler
5a23cc4bb5 Enable dd blocks by default and remove global setting 'enable-datadefined-blocks' 2024-04-09 16:37:30 +02:00
David Koňařík
534926b46a Add QtWebEngine re-exports to qgis.PyQt 2024-04-09 06:54:08 +10:00
Marco Hugentobler
077a161ef1 Move query of layerTreeInsertionMethod setting out of core 2024-04-09 06:52:29 +10:00