74 Commits

Author SHA1 Message Date
Nyall Dawson
e04145f053 Add new enum for rasterised rendering policy 2025-06-03 11:34:13 +10:00
Nyall Dawson
3f6b490218 Sipify 2025-04-02 11:11:10 +10:00
Julien Cabieces
ed64834106 api(deprecated): add message to deprecated SIP annotation 2024-12-17 09:06:42 +01:00
Nyall Dawson
59e1dedd04 Remove private notes, fix malformed notes 2024-09-04 13:54:39 +10:00
Nyall Dawson
ef0289f3ec Fix formatting of Python ..deprecated annotations in docstrings
Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/174
2024-09-02 11:42:12 +10:00
Nyall Dawson
374f0a5fcc Fix bug with inverted polygon renderer vs OTF simplification
The simplification MUST be applied prior to transforming geometries,
or the precalculated simplification tolerance will no be correct
and may be excessive (eg when the simplification tolerance
was calculated for a map in meters, yet the rendered layer is
in degrees -- in this case we would simplify the inverted geometry
with a tolerance of ~1 degree!)

Ensure that we apply the simplification FIRST, then transform,
and disable further simplification when rendering the calculated
inverted feature. This is also a performance boost, because we
are simplifying geometries prior to transforming + calculating
the inversion, so usually end up with a lot less vertices
to handle in those operations...
2024-08-25 12:34:18 +10:00
Nyall Dawson
958d534965 Add convertFromPainterUnits method 2024-08-15 14:27:35 +10:00
Nyall Dawson
3a578d6712 Header update 2024-08-13 20:28:55 +10:00
Nyall Dawson
be8dce7d0d Valid improvements from new sipify 2024-08-13 20:28:55 +10:00
Nyall Dawson
8c067b2782 Rename QgsRenderContext custom "flags" to custom properties
And deprecate the old methods
2024-07-19 06:13:00 +10:00
Nyall Dawson
16c38f1d0e Remove old QPainterPath mask backend
Always use new geometry based backend, and deprecate related methods

The new method is more stable and results in better outputs
2024-06-25 12:42:16 +10:00
Nyall Dawson
f8172c48ed Add function to test whether clip geometries exist for a symbol layer 2024-06-20 05:41:37 +10:00
Nyall Dawson
e931b9ade6 Add mask render settings to QgsMapSettings/QgsRenderContext
And API mechanism to propagate these from layout exports down
to the render context

Gives us a place to specify fine-tuned control over masking
settings for map renders
2024-06-20 05:41:37 +10:00
Nyall Dawson
4eb35e466d Add hidden QSettings switch to use a QgsGeometry/GEOS backend for label masking
If the 'map/maskBackend' QSettings key is set to 'geometry', then
QgsGeometryPaintEngine will be used for calculating clip paths
for label masking instead of QPainterPath

The intention here is that we gain improved flexibility to optimise
the creation and logic behind clipping path generation, vs the
limited API we get from QPainterPath.
2024-06-05 11:06:10 +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
c7563cec70 Add generic API to allow map layer renderers to show temporary in
progress preview render results while drawing the layer, which
differ from the final layer render

The immediate use case here is for rendering tiled scene layers.
In order to generate the actual final render for these layers,
we need to first fetch ALL content for the render and then sort
the primitives by z value. But this means that the layer renders
can be extremely slow, with no visible changes on the map until
all the content fetching is complete. Not great user experience!

Instead, here we add the infrastructure so that a layer renderer
can get a temporary image to paint to for any partial renders.
This image gets used during map composition up until the layer
finally finishes rendering, at which time the layer's actual
destination image will be used for the composition.

This means that tiled scene renderers can now draw all tiles
(with unsorted primitives, and the artifacts which come with
that) as soon as we fetch each tile. This gives the user an
immediate visual reflection that the tiles are being fetched
and that how quickly (or slowly) that is happening. As soon
as we've got all tiles, the layer render will be immediately
switched to the version in which all content is rendered
in the correct z order.

As a bonus, we draw these temporary in progress renders
over any previously transformed cache version of the layer
available. So eg when you zoom in, you'll get a zoomed in pixelated
version of the last render which gets progressively drawn
over with each tile as it is fetched.

This same API could be used in future eg with point cloud
rendering when points are being sorted by z value to give
timely visual feedback.
2023-08-16 11:00:37 +10:00
Nyall Dawson
50c76929e1
Followup 30700f1, ensure links to Qgis members are set in docstrings 2023-03-31 10:46:24 +10:00
Julien Cabieces
8f32f07433 Treat review comments
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
2023-02-27 09:24:40 +01:00
Julien Cabieces
7a2a252d0d fix doc and typos 2023-02-27 09:24:40 +01:00
Julien Cabieces
11e88ad425 fix documentation 2023-02-27 09:24:40 +01:00
Julien Cabieces
b3af80e3e4 [Selective masking]Fixes #34352 : use QUUid to identify symbol layer
Don't use pointers anymore because there are not stable when it comes
to clone
2023-02-27 09:23:16 +01:00
Nyall Dawson
f9c3da1e06 Move unit enums to Qgis, promote to enum class 2023-02-19 13:29:06 +10:00
Vincent Cloarec
3ca858af66
Global map terrain shading (#51535)
* QgsShadingRendering and pipe to render global elevation map

* gdal utils with datatype and resampling method enum

* raster layer elevation map

* optimize raster elevation map with rotation

* handle  no data value in the map elevation raster pipe

* mesh layer and some little fixes

* fix nodata and hillshading z factor

* render shading on layout

* activate/deactivate the shading from ui

* shading only for layer that have elevation

* apply Z scale and offset of layer elevation properties

* ui settings

* allow elevation from point cloud even edl is deactivate for pointcloud

* fix ui

* sipify

* Shading renderer widget in styling panel

* icone for shading renderer settings widget

* two methods to combin elevation

* rewording

* remove check box at the bottom of canvas

* use band of elevation properties

* fix styling pannel

* render shading in layout

* keep EDL point cloud shading individually

* add shading rendering tests

* add missing code for local EDL for point cloud

* shading inactive by default

* rework raster layer resampling

* improve nodata in elevation map

* don't allow elevation map with != size to be combined

* remove EDL from point cloud

* renaming

* sipify

* colorize tests

* renaming

* RGB32

* renaming leftover

* some ui fixes

* fix border for EDL alg

* fix EDL closed next to nodata value

* fix first shading when activated

* renaming and typo

* fixes for doc, doxygen, indentation and spelling

* remove leftover member

* fix clang-tidy

* fix edl tests

* fix dll export

* minor fixes

* adapt images of tests

* fix narrowing

* fix indentation

* sipify

* WIP

* minor ui changes
2023-01-26 15:02:16 +01:00
Julien Cabieces
a57281c836 Vectorization of selective masking 2022-05-12 11:45:39 +10:00
Nyall Dawson
2e960aaeed Add map frame rate and current frame numbers to QgsMapSettings/QgsRenderContext
Makes this information available for symbol rendering logic when
a map is being rendered as part of an animation.
2022-03-27 15:40:05 +10:00
Vincent Cloarec
9965eccdce
Template parameter {usage} for XYZ raster and vector tiles (#46731) 2022-01-13 15:11:31 +01:00
nirvn
4dbcd389fc [feature][api] Allow a custom label sink to be used with map renderer jobs 2021-12-28 20:04:49 +07:00
Nyall Dawson
b54001c358 Copy output image format and output size to QgsRenderContext
These QgsMapSettings properties are useful to rendering operations
to use when they need to create temporary QImages during the
rendering
2021-10-02 07:16:40 +10:00
Nyall Dawson
f2856db943 Implement a more robust way of limiting sizes for symbol preview icons 2021-09-27 11:42:33 +10:00
Nyall Dawson
0ab6113e88 Promote QgsMapSettings and QgsRenderContext enums to enum class, move to Qgis 2021-09-26 11:24:51 +10:00
Nyall Dawson
7027d72b3d Spelling 2021-09-24 12:15:43 +10:00
Nyall Dawson
d838ce709e Allow a QgsFeedback object to be associated with a render context,
for cancelation check support

While there is the existing QgsRenderContext::renderingStopped()
check, this doesn't play well with other parts of QGIS which utilise
a QgsFeedback object for cancelation support. By adding support
for a proper QgsFeedback object in render contexts then it becomes
trivial to pass this on to feature requests, expression contexts,
and other potentially expensive functions so that these can
all be canceled responsively too.

(At some stage in the future we should consider deprecating
QgsRenderContext::rendereringStopped(), but that's not done here)
2021-09-24 12:15:43 +10:00
Nyall Dawson
849819cd0d [api] Allow reference scale for vector layer renderer to be set
Gives a means of setting the reference scale for a vector layer
renderer, so that symbol sizes in the rendered layer will be
scaled accordingly depending on the actual scale of the
rendered map.
2021-06-29 07:33:35 +10:00
Nyall Dawson
54610b293c [api] Allow a symbology reference scale to be set on a QgsRenderContext
This should match the desired scale denominator for the rendered map,
eg 1000.0 for a 1:1000 map render. Set (by default) to -1 to disable
symbology scaling by reference scale.

The symbology reference scale is an optional property which specifies
the reference scale at which symbology in paper units (such as
millimeters or points) is fixed to. For instance, if \a scale is set
to 1000 then a 2mm thick line will be rendered at exactly 2mm thick
when a map is rendered at 1:1000, or 1mm thick when rendered at
1:2000, or 4mm thick at 1:500.
2021-06-29 07:33:35 +10:00
Mathieu Pellerin
8299547682 Address review 2021-05-03 20:43:37 +07:00
Mathieu Pellerin
8d1371f3e9 [layouts] Respect XYZ output zoom level when previewing map items in the layout designer 2021-05-03 18:01:24 +07:00
Denis Rouzaud
ba8a445850 run sipify 2021-03-22 21:13:52 +01:00
Nyall Dawson
7dfef3a0b1 Newer doxygen versions don't auto convert the first line in a class'
documentation to a brief note, so we have to do it explicitly...
2021-02-19 08:15:29 +10:00
Nyall Dawson
50b9beaad6 [sipify] Catch more class references and insert :py:class: annotations 2021-01-31 05:41:22 +10:00
Nyall Dawson
f6f03cd8e1 [api] Add z range filtering option to QgsMapSettings/QgsRenderContext/QgsMapCanvas
Allows for map renders to be filtered by a z or elevation range,
such that only parts of the layer which are considered within
this range will be rendered.

Implements https://github.com/qgis/QGIS-Enhancement-Proposals/issues/201

*Requires support for respecting the QgsRenderContext zRange to be added
to the relevant map layer renderers
2020-11-26 04:18:01 +10:00
Nyall Dawson
f3f226aa69 In cases where we cannot convert the map extent back to a layer's
extent and have had to resort to fetching all features from a layer,
defer the geometry clipping the map extent so that it occurs
AFTER transforming the layer's geometries to the target map extent.

This allows us to correctly clip the feature geometries in the case
that the visible extent available from the render context for the layer
is not accurate (i.e. it's a whole of globe fallback), and avoids
rendering features which fall far outside of the visible map
region.

Fixes #38878
2020-09-22 06:50:34 +10:00
Nyall Dawson
9e1cddaa8e Add render context flag to use when a map render job is part of a 3d map 2020-07-29 04:21:56 +10:00
Nyall Dawson
28c8eefa6e Avoid texture jump when panning maps
We don't need the whole expense of the "Avoid artifacts when rendering as map tiles"
option, because that disables to default clipping of geometry parts which fall
outside the visible canvas extent and accordingly results in a lot of wasted rendering
calculations. Instead, we can just always use the upper left corner of the original
feature geometry before the optimisations like clipping to visible regions are applied,
and use this as the texture origin.

This means we can safely make this handling always applied and not an opt-in setting
2020-07-11 12:54:07 +10:00
Nyall Dawson
6eee1fa69f Don't apply font scaling workaround by default, but instead make it
opt-in through the render context flags

Avoids potential performance regression when rendering labels
2020-07-08 08:49:57 +10:00
Nyall Dawson
b2cef7377c [feature][layouts] Expose option to control PDF image compression
method when exporting layouts to PDF

Options are for Lossy compression, which is the default JPEG compression
used, and Lossless compression (which creates bigger files in most
cases, but is much more suitable for professional printing outputs
or for post-production in Illustrator/etc)

The Bad news: this option is available in builds based on Qt 5.14
or later.
2020-07-05 15:40:48 +10:00
Nyall Dawson
61193fc841 Simplify some painter related operations and make safer 2020-07-04 19:11:10 +10:00
Nyall Dawson
5cbdc4c896 Ensure feature clipping occurs for render only, and doesn't affect
feature geometry when used in rule based renderers and other
geometry dependent rendering options
2020-07-02 12:07:51 +10:00
Nyall Dawson
e38bb541a6 Add clipping regions to QgsMapSettings/QgsRenderContext API 2020-07-02 12:07:51 +10:00
Nyall Dawson
b7eac07721 Add a render context flag so we know when a render operation is
occurring for drawing a symbol preview

Because these have no map association, certain settings like
sizes in "meters in map units" will have no meaning, and may need
special handling

Refs #28690
2020-06-17 08:02:49 +10:00