345 Commits

Author SHA1 Message Date
Nyall Dawson
73e50bfc06 Ensure correct expression context is used when generating symbol preview
icons

Fixes #49106
2022-09-29 15:32:46 +10:00
Julien Cabieces
dcf64e80fe add an ok boolean to check if it exists a restricted symbol 2022-09-21 09:30:45 +02:00
Julien Cabieces
e24700df2d Move geom generator logic in QgsSymbolLayerUtils 2022-09-15 15:10:08 +02:00
Nyall Dawson
33788b6cb4 Remove more old qt fallbacks 2022-08-12 20:36:07 +10:00
Nyall Dawson
94ea21764b Fix storing reference to feature which goes out of scope leads
to crashes in rule based renderer
2022-08-10 17:00:48 +10:00
Zayne Tomlins
dc2bad87c2 [feature] Added new ellipse marker shapes
Added Pentagon, Hexagon, Octagon, Third Circle, Quarter Circle & Star to ellipse marker shapes.
2022-07-25 18:51:13 +10:00
Nyall Dawson
a3e72bdc52 Ensure that all units are changed when setting output unit for a symbol
Fixes #45961
2022-05-31 16:11:55 +10:00
Nyall Dawson
4f204c2dff Better approach to filtering lists by tags which works across different
styles

Fixes #48659
2022-05-24 13:26:03 +10:00
Nyall Dawson
c6ba421644 Cleanup some more of the default style/project instance initialisation spaghetti
And avoid some more QgsProject::instance() in core
2022-05-17 16:36:00 +10:00
Nyall Dawson
aa658465f8 Cleanup handling of default label format for project, and avoid a QgsProject::instance() use in core 2022-05-17 16:36:00 +10:00
Nyall Dawson
1251b115f4 Better way to mark styles as read only 2022-05-17 16:36:00 +10:00
Nyall Dawson
42a758ec6a Allow lazy setting of style manager QgsStyle 2022-05-17 16:36:00 +10:00
Nyall Dawson
66aaf36059 [feature] Show entities from all project style databases in symbol and label
selectors
2022-05-17 16:36:00 +10:00
Nyall Dawson
e4d2adda27 Add entity name to style model roles 2022-05-17 16:36:00 +10:00
Nyall Dawson
6529309f48 Fix header data for combined model 2022-05-17 16:36:00 +10:00
Nyall Dawson
406b714e50 Add method to remove style from combined model 2022-05-17 16:36:00 +10:00
Nyall Dawson
b420204916 Allow parent object for QgsStyle 2022-05-17 16:36:00 +10:00
Nyall Dawson
3fe263893a Expose style name and filename to models 2022-05-17 16:36:00 +10:00
Nyall Dawson
7e4a68ab00 Fix filename handling for QgsStyle 2022-05-17 16:36:00 +10:00
Nyall Dawson
bff6676877 Documentation, const 2022-05-17 16:36:00 +10:00
Nyall Dawson
173693116e Deprecate QgsStyle::save, which is a no-op call as all the functionality
is ifdefed out and does nothing
2022-05-17 16:36:00 +10:00
Nyall Dawson
79f748c65d Convenience python getter for QgsRendererRange bounds 2022-05-17 09:55:40 +10:00
Nyall Dawson
6f76f98f09 Add __repr__ for QgsRendererRange/QgsRendererCategory 2022-05-17 09:55:40 +10:00
Nyall Dawson
12c01e2072 Move QgsGraduatedSymbolRenderer::GraduatedSize enum to qgis 2022-05-17 09:55:40 +10:00
Nyall Dawson
065465e472 Improve some documentation 2022-05-17 09:55:40 +10:00
Nyall Dawson
86f7d4e89e [api] Add QgsCombinedStyleModel class, for combining entities from several
QgsStyle models into a single combined view
2022-05-12 19:58:04 +10:00
Nyall Dawson
6c73cfcd45 Add name to QgsStyle 2022-05-12 19:58:04 +10:00
Julien Cabieces
a57281c836 Vectorization of selective masking 2022-05-12 11:45:39 +10:00
Julien Cabieces
012b6a46db constify methods 2022-04-29 08:21:47 +10:00
Nyall Dawson
bc90217bc0 Add method to prepare animated images in advance, by extracting
all frames from the animation to a temporary directory

This avoids lengthy delays when trying to render a specific frame
from the animation, as most animation formats require us to
iterate through all preceding frames in order to retrieve a specific
frame. By iterating once in advance and saving the results out we
gain instant access to any individual frame from the animation.
2022-04-27 05:57:21 +10:00
Nyall Dawson
4eede35d55 Allow any symbol to be an animated symbol
Users can now indicate that a symbol should be treated as a animated
symbol, through the new "Animation Settings" option in the symbol
widget's Advanced menu.

This settings panel allows users to enable animation for the symbol
and set a specific frame rate at which the symbol should be redrawn.
When enabled, the @symbol_frame variable can be used in any
symbol data defined property in order to animate that property.

For instance, setting the symbol's rotation to the data defined
expression

    @symbol_frame % 360

will cause the symbol to rotate over time. (with rotation speed
dictated by the symbol's refresh rate)
2022-04-09 18:14:44 +10:00
Nyall Dawson
833685a21e Add utility function to calculate the ideal refresh rate of a
vector layer renderer, by hunting for any animated symbols
in the renderer
2022-04-04 11:43:47 +10:00
Nyall Dawson
78c8a670e3 [feature] New marker symbol type for "Animated Marker"
This new marker symbol type allows points to be rendered using
an animated marker, sourced from an animated gif, webp or mng
animation.

Options are present for marker file, size, angle and frame rate.

There are two ways in which animated symbols are handled:

1. If the map itself is considered an animation, then the frame
rendered for the animated marker is based on the map animation
frame and frame rate. This is the case when the temporal
controller is set to the Animation mode. In this case the
animated markers will follow the temporal controller animation,
e.g. pausing when the animation is paused, advancing frames
with the animation, etc. The map will also be redrawn using
the frame rate set for the temporal animation.

This mode also applies when exporting an animation from the
temporal controller.

It's also the mode used when a plugin specifically sets the
frame rate and current frame QgsMapSettings properties, so
e.g. @timlinux's QGIS Animation Workbench plugin will dictate
the marker animation frame to render.

2. If the map is NOT considered an animation (i.e. it's just
a plain old normal QGIS project), then the frame to render
will be based on the current timestamp alone.

Markers will be animated when their corresponding layer is set
to a temporal mode, and a temporal animation is playing.
2022-04-04 11:43:47 +10:00
Nyall Dawson
793f887dd6 Add method to convert vector renderer legend rule keys to equivalent
QgsExpression filter
2022-03-22 11:18:54 +10:00
Nyall Dawson
5b317e6808 Ignore symbol layer types which do not have colors (raster fill, marker,
etc) when calculating overall symbol colors

Fixes #47723
2022-03-21 17:24:45 +10:00
Denis Rouzaud
99194ced57 allow remove symbol layer from registry 2021-11-26 13:24:55 +01:00
Nyall Dawson
637e5ca748 Rename "respect multipart" to "place on every part" 2021-11-13 20:18:38 +11:00
Nyall Dawson
9cfeb1efe6 [feature] Add an option to marker/has line symbol layers to control
whether the first/last vertex option should respect multipart geometries

The default is not to respect these, so first and last vertices
are symbolized for every part of a multi-part geometry (this matches
the old behaviour). By opting in to the "respect multipart geometries"
option, the symbols will only be placed on the VERY first or very LAST
vertex in the whole multi-part geometry.

Sponsored by North Road, thanks to SLYR
2021-11-12 18:51:02 +11:00
Nyall Dawson
aaafd786df
Make placement options in marker and hash line symbol layers checkboxes instead of mutually exclusive buttons
Makes it considerably quicker to create a marker line with the
markers on the first AND last vertex, amongst other things...

Fixes #18433

Sponsored by North Road, thanks to SLYR
2021-11-12 04:44:08 +10:00
Nyall Dawson
dabc17bbcb Ensure correct symbol geometry type is used for more preview icons 2021-11-02 06:29:25 +11:00
Alessandro Pasotti
5c3915b9ed
Merge pull request #45587 from elpaso/bugfix-gh45582-vector-renderer-localization-issues
Fix multiple localization issues with vector renderers
2021-10-29 15:49:14 +02:00
Nyall Dawson
4a4e0061e1 [feature][symbology] New "Lineburst" line symbol layer type
This adds a new "Lineburst" symbol layer type, which renders
a gradient along the WIDTH of a line (as opposed to the interpolated
line renderer, which renders a gradient along the LENGTH of
a line). It's like the shapeburst fill symbol type, but for lines!

Sponsored by North Road, thanks to SLYR
2021-10-29 05:34:08 +11:00
Nyall Dawson
0667363261 [feature][symbology] New "Raster Line" symbol layer type
This new symbol layer type renders a raster image following
a line feature's shape.

Options are present for:
- picture path (including data defined path)
- line width
- opacity
- line join/cap styles

Sponsored by North Road, thanks to SLYR
2021-10-28 12:13:54 +11:00
Nyall Dawson
b06e136a57 [feature][symbolgy] Expose choice of clipping behaviour for line
pattern fill

This allows users to control how lines in the fill should be
clipped to the polygon shape. Options are:

- Clip During Render Only: existing behaviour, lines are created
covering the whole bounding box of the feature and then clipped
while drawing. Line extremities (beginning and end) will not be
visible
- Clip Lines Before Render: lines are clipped to the exact
shape of the polygon prior to rendering. Line extremities (including
cap styles, start/end marker line objects, etc) will be visible,
and may sometimes extend outside of the polygon (depending
on the line symbol settings)
- No Clipping: no clipping at all is done - line will cover the
whole bounding box of the feature

Sponsored by North Road, thanks to SLYR
2021-10-26 14:30:13 +11:00
Nyall Dawson
088ffe6a46 [symbology] Add support for rendering line pattern fills line-by-line
When exporting to a vector format (e.g. PDF) or when a line subsymbol
has dynamic (data defined properties), automatically switch to
a line-by-line based approach for rendering the fill instead of the
previous raster tiled pattern based approach.

While it's slower to render (not noticable for desktop users, but
likely enough to affect server deployments), this has many benefits:

1. Smaller PDF/SVG output file sizes, since the fills aren't rasterized
2. PDF/SVG files which are easier to modify in external apps for
post production, as each individual line in the pattern can be
modified.
3. Better quality PDF/SVG outputs, since the fill isn't DPI
dependant and looks awesome regardless of how close in you zoom
4. No visible artefacts at certain angles/distances/line symbol
styles

And even more excitingly, it opens the door for a range of
new symbol styles, eg.

- line patterns where the individual lines change color/width/dash/...
- line patterns with marker line symbols on center point/etc
- geometry generator effects per line, e.g. wavy line patterns, hand
drawn line styles, etc

Sponsored by North Road, thanks to SLYR

Fixes #16100
2021-10-25 18:55:07 +11:00
Nyall Dawson
0785488631 Fix geometry generator used in subsymbol of point pattern fill results
in only a single marker being rendered
2021-10-25 13:53:11 +10:00
Nyall Dawson
87094024af [feature][symbology] Add optional rotation angle for point pattern
fill

Allows the fill pattern to be rotated

Sponsored by North Road, thanks to SLYR
2021-10-24 18:00:25 +10:00
Nyall Dawson
ec41cb59b4 Don't expose an outline subsymbol for SVG fill symbol layers
This is inconsistent with all other fill types, which don't
have a special outline subsymbol. Users should be creating
outline layers when they want an outline instead.

When reading an SVG fill symbol layer from XML, automatically
upgrade any outline subsymbol which is used by the fill to
be separate symbol layers for the parent fill symbol so
that existing symbols will appear as designed in older QGIS
versions.

Fixes qgis#14103
2021-10-23 23:50:52 +10:00
Nyall Dawson
757c69e1ef [feature][symbology] Add random point offset for point pattern fills
This optional setting allows each point to be randomly shifted up
to the specified maximum distance in the x/y directions. Maximum
offset can be set in mm, points, map units, etc OR "percentage"
(which is percentage of the pattern width/height)

An optional random number seed can be set to avoid patterns
jumping around between map refreshes.

Data defined overrides are also supported.

Sponsored by North Road, thanks to SLYR
2021-10-23 19:05:33 +10:00
nirvn
6a37ee72fa [FEATURE][symbology] Add coordinate reference mode (i.e. pattern alignment) to line pattern and point pattern symbol layer types 2021-10-22 22:45:33 -07:00