46 Commits

Author SHA1 Message Date
Nyall Dawson
a7a19a7fc0 Don't use raw int for QgsRasterInterface capabilities 2024-06-06 13:57:48 +10:00
Julien Cabieces
848fb16785 Add \deprecated tag 2024-05-31 08:46:33 +10:00
Julien Cabieces
71e0b7ffcd manual fix rasterattibutetable 2024-05-31 08:46:33 +10:00
Julien Cabieces
0ccaf2d299 sipify 2024-05-31 08:46:33 +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
cbd25c1fdd Promote QgsColorRampShader enums to enum class, move to Qgis 2024-05-22 12:37:44 +10:00
Nyall Dawson
c8d66e1e8d Add method to retrieve significant elevation values from a layer 2024-05-20 11:52:10 +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
Mathieu Pellerin
d68a428f6e Address review 2024-04-08 11:47:51 +07:00
Mathieu Pellerin
4bd2e66b3f Rename classes 2024-04-08 11:18:35 +07:00
Mathieu Pellerin
d7325cba40 [raster] New single color renderer 2024-04-08 11:18:35 +07:00
Mathieu Pellerin
6dafb5d495 More review addressed 2024-04-08 09:27:58 +10:00
Mathieu Pellerin
e9b3408a6c Optimize a bit 2024-04-08 09:27:58 +10:00
Mathieu Pellerin
feabbe722e Address review 2024-04-08 09:27:58 +10:00
Mathieu Pellerin
891a8efc84 [raster][temporal] Add a brand new temporal mode: pixel value as temporal datetime 2024-04-08 09:27:58 +10:00
Nyall Dawson
94bef546b2 Ensure temporal and elevation filters work correctly in conjunction
Fixes #56938
2024-03-26 08:54:31 +10:00
Nyall Dawson
3f44760a82 Add "Fixed Time Range Per Band" mode for raster temporal control
This mode can be used when each band in the raster layer is associated
with a fixed time range, eg. NetCDF files.

The user can either manually populate a table with begin/end dates for
each band in the raster, or build the table using QGIS expressions
which return datetime values.
2024-03-22 12:40:54 +10:00
Nyall Dawson
4383a3a225 Add "dynamic elevation range per band" mode for rasters
In this mode, the user can specify a QGIS expression for the
lower and upper value corresponding to raster bands, using
variables like @band, @band_name and @band_description.

E.g

    @band * 100

Can be used when each band represents a 100 m vertical slice
of data.

The expression will be evaluated when required to determine
the actual elevation range corresponding to each band.

This differs from the existing "Fixed Elevation Range Per Band"
mode in that "Fixed Elevation Range Per Band" requires users
to manually enter an elevation for each band separately,
and these values are then treated as constants. That mode works
best for rasters with non-regular steps in the band
elevation values, while this new mode is better for regular
band elevation steps
2024-03-21 12:33:33 +01:00
Nyall Dawson
40847d0596 Avoid some unnecessary redraws 2024-03-19 13:29:40 +10:00
Nyall Dawson
e9730b1bb3 Add capabilities for raster renderers
And selectively expose some of QgsRasterRendererRegistry to python
2024-03-18 21:26:20 +01:00
Nyall Dawson
1796318afe Add a "fixed range per band" elevation mode for rasters
In this mode, each band in the raster can have a fixed elevation
range associated with it. This is designed for data sources which
expose elevation related data in bands, eg netcdf files, such
as a raster with temperate data at different ocean depths.
2024-03-18 21:26:20 +01:00
Nyall Dawson
253623feb0 Introduce fixed elevation range for raster layers
This introduces a new option for specifying how raster layers
have associated elevation. It permits a fixed elevation range
to be set for the layer. It can be used when the layer has
a single fixed elevation, or a range (slice) of elevation values.

Users can set the lower and upper elevation range for the layer,
and whether the lower or upper limits are inclusive or
exclusive.

When enabled, the layer will only be visible in elevation
filtered 2d maps when the layer's range is included in the map's
z range.
2024-03-16 13:11:54 +10:00
Nyall Dawson
4a0bc4ae99 Deprecated subclass methods 2024-03-16 06:35:16 +10:00
Nyall Dawson
2556a6674d Also add virtual inputBand getter 2024-03-16 06:35:16 +10:00
Nyall Dawson
e297f54871 Add some see links 2024-03-16 06:35:16 +10:00
Nyall Dawson
5d29d49869 [api] Add virtual QgsRasterRenderer::setInputBand method
Attempts to set the input band for the renderer.
Returns TRUE if the band was successfully set, or FALSE if the
band could not be set.

This was implemented in various raster renderer subclasses,
but it was necessary to down cast and then call the individual
methods (which don't have consistent names!).

Instead, add a top level virtual method so that it's easy to
change the input band for the renderers.
2024-03-16 06:35:16 +10:00
Nyall Dawson
56af3498e8 Add method to convert raw pixel values to elevation values 2024-03-13 05:56:05 +10:00
Nyall Dawson
4284b8645b Use vector instead of list for better performance
This container is expected to have only a handful of items in it
in most cases and will rarely change => QVector is a better choice
2024-03-04 07:25:51 +10:00
Nyall Dawson
c40a1ef3bb Further cleanups to QgsRasterTransparency API
Avoid confusing mix of transparency vs opacity, multiple scaling
and round trips through integers.
2024-03-04 07:25:51 +10:00
Nyall Dawson
c162375965 [api] Add explicit setting for includeMinimum/Maximum
to QgsRasterTransparency.TransparentSingleValuePixel. Allows (via
API only) control over whether the extremities of the range
should be included in the transparency.

Also add equality operator, repr to these classes, and additional
tests
2024-03-04 07:25:51 +10:00
Nyall Dawson
65ba3ddfef Cleanup QgsRasterTransparency API
- Make classes less like to be created with uninitialized members
- Use opacity instead of transparency, to match API from elsewhere in
  QGIS
2024-03-04 07:25:51 +10:00
Even Rouault
15ea5c46bc
Header files: remove all mentions of '\since QGIS 3.0' 2024-02-18 20:57:23 +01:00
Even Rouault
02caeb9db7
Header files: remove all mentions of '\since QGIS 2.' 2024-02-18 20:46:01 +01:00
Nyall Dawson
0096246afe Sipify 2024-02-13 20:51:03 +10:00
Nyall Dawson
814e6db3b4 Don't map non-list of QVariantMaps to QMap<QString,QVariant>
The original workaround was only supposed to apply to QList/
QVector of QVariantMaps. By replacing them all in sip we
break mapping of signals defined in c++ which are emitted
by Python code.

Fixes exceptions after running processing algorithms in Qt6
builds.
2024-02-12 12:16:14 +10:00
Nyall Dawson
f9ad9e4e25 Documentation 2024-02-02 04:59:04 +10:00
Nyall Dawson
6aae7380cd Cleanup int arguments which should be Qgis::RasterBandStatistic values
And ensure python compatibility remains intact
2024-02-02 04:59:04 +10:00
Nyall Dawson
503a95a1a1 Move enums to Qgis namespace for consistency 2024-02-02 04:59:04 +10:00
Nyall Dawson
179e2ca59a Promote some more enums to enum class to fix PyQt6 support 2024-02-02 04:59:04 +10:00
Nyall Dawson
fae7c83437 Fix doxygen 2024-01-31 17:16:18 +10:00
Nyall Dawson
f2c74f377d Sipify 2024-01-31 17:16:18 +10:00
Nyall Dawson
f1e3ba9e2d Use correct sip method
And use INDENT-OFF annotations to avoid astyle messing up
formatting of enum with inline macros
2024-01-31 13:48:49 +10:00
Nyall Dawson
23f3af4290 Use enum classes for QgsProperty property keys
Should fix usage on Qt 6 builds
2024-01-31 13:48:49 +10:00
Nyall Dawson
4654ad3db5 Sipify 2024-01-23 08:32:38 +01:00
Julien Cabieces
bb3c36a69b Initialize sip bindings for PyQt6
use exactly the ones from PyQt5 so we can study the difference when
generating for PyQt6
2023-12-08 03:38:42 +10:00