This avoids the force conversion to a raster based pattern which currently occurs
when exporting maps/layouts to a vector format (e.g. PDF). The raster pattern
results in considerable quality loss, and the tiling edges of the raster brush
can sometimes be seen in outputs.
Additionally, fixes render corrupt when marker subsymbols have data defined properties
which affect the marker shape, such as data defined rotation or sizes
Refs #16100 (still needs fixing for line fill symbols)
and preparation stage from the symbol layer rendering stage, and
ensure that QgsSymbolLayer::startFeatureRender and ::stopFeatureRender
is correctly called in the right sequence when rendering multi-layer
symbols
This fixes issues with symbol layers which rely on startFeatureRender
and stopFeatureRender to correctly render, e.g. the Random Marker Fill
symbol layer.
Before this fix, the logic looked like:
- for every symbol layer in the symbol, call startFeatureRender
- for each part in polygon, prepare the part geometry and then render each symbol layer
- for every symbol layer in the symbol, call stopFeatureRender
The issue with this approach is that symbol layers which defer
rendering to the stopFeatureRender stage are always rendered
after ALL other symbol layers in the symbol, regardless of the actual
order of the symbol layers. Ultimately this causes Random Marker Fill
layers to always render on the top of symbols.
The new logic is:
- for each part in polygon, prepare the geometry and store the result
- for each symbol layer in the symbol:
- call startFeatureRender
- render the layer using each of the previously prepared parts
- call stopFeatureRender
This results in correct stacking of the random marker fill in multi
layer symbols, because the stopFeatureRender call is correctly called
before the next layer's startFeatureRender and renderPolygon calls
Also, use QVector instead of QList for rings for improved efficiency
Introduce a renderer for 1D mesh edges that can vary width over the line. The line can also have different color based on the actual dataset value on the line's point.
Co-authored-by: Peter Petrik <zilolv@gmail.com>
* [FEATURE] Selective masking
Advanced rendering feature that allows the definition of 'masks' areas around labels or with a new typ of symbol layer. These masks will "un-draw" symbol layers of other layers underneath.
It modifies the rendering process by adding an optional second pass.
rendering operations on a specific feature are performed
This allows symbol layer subclasses to know when a set of rendering
operations all relate to a single feature, e.g. when a number
of polygons are rendered which all belong to the same multi-polygon
geometry attached to a single feature.
Without these hooks, symbol layer subclasses have no stable method
of knowing that these parts all relate to a single feature, or
have no means of knowing when the final part of that feature has
been rendered.
This commit adds a new fill symbol layer type "Random marker fill". It
allows polygon features to be rendered using a marker symbol placed
at random locations within the polygon boundary.
Options include:
- number of marker symbols to render for the polygon
- whether markers rendered near the edges of polygons should be clipped
to the polygon boundary or not
- an optional random number seed, to give consistent placement
of markers whenever maps are refreshed (also allows random placement
to play nice with QGIS server and tile-based rendering)
Sponsored by the SLYR project
Whilst usually this is bad practice (reusing an existing expression context),
and instead you should make a new context for every batch of expression evaluations,
we can't do this in the style model and we end up potentially creating
thousands of new contexts. So instead, we use a single one, which is
safe because the actual expression context used here is a very
basic one...