Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New marker symbol type for "Animated Marker" #48060

Merged
merged 5 commits into from Apr 4, 2022

Conversation

nyalldawson
Copy link
Collaborator

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.

  1. 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.

Showcase

Animated marker in a standard map, no temporal animation settings

Peek 2022-04-03 07-56

Animated marker when used with temporal controller in animation mode

Peek 2022-04-03 07-59

image files

Allows selection of animated images from formats supported by
QMovie, e.g. animated gif, webp and mng animations.
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.
vector layer renderer, by hunting for any animated symbols
in the renderer
…e the

layer redrawing without requiring the user to setup these
settings themselves.
@nyalldawson nyalldawson added Feature Symbology Related to vector layer symbology or renderers Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo. Changelog Items that are queued to appear in the visual changelog - remove after harvesting Temporal Temporal filtering or animation labels Apr 2, 2022
@github-actions
Copy link

github-actions bot commented Apr 2, 2022

@nyalldawson
This pull request has been tagged as requiring documentation.

A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged.

Please update the description (not the comments) with helpful description and screenshot to help the work from documentors.
Also, any commit having [needs-doc] or [Needs Documentation] in will see its message pushed to the issue, so please be as verbose as you can.

Thank you!

@github-actions github-actions bot added this to the 3.26.0 milestone Apr 2, 2022
@timlinux
Copy link
Member

timlinux commented Apr 2, 2022

Thanks so much for this awesome PR!

@timlinux
Copy link
Member

timlinux commented Apr 2, 2022

Tested here, works really great!
ani

(Line artifact is from peek, not your code)

@nirvn
Copy link
Contributor

nirvn commented Apr 3, 2022

Tested, it is sweeeeet. I love the flawless animation integration in non-temporal (i.e. plain old canvas) context. Nicely done.

Haven't looked at the code yet, but my quick testing pointed out at a need to have a selected state rendering here (I think it should be easy to copy paste what we have for the raster marker et al)

@nyalldawson
Copy link
Collaborator Author

@nirvn

Haven't looked at the code yet, but my quick testing pointed out at a need to have a selected state rendering here (I think it should be easy to copy paste what we have for the raster marker et al)

That's already implemented:

image

@nyalldawson
Copy link
Collaborator Author

(unrelated test failure)

@nirvn
Copy link
Contributor

nirvn commented Apr 3, 2022

I'll give it a try m again. Maybe my large animation marker had me hit too far away from the small hit area for point features.

@nirvn
Copy link
Contributor

nirvn commented Apr 3, 2022

@nyalldawson , my bad, it does work:
image

Also, working flawlessly out of the box with QField:
Peek 2022-04-03 12-11

Copy link
Contributor

@nirvn nirvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyalldawson , brilliant stuff, I ❤️ this contribution to QGIS. And thanks @timlinux for being such a great muse 😉

src/core/symbology/qgsmarkersymbollayer.cpp Outdated Show resolved Hide resolved
src/gui/qgsfilecontentsourcelineedit.cpp Outdated Show resolved Hide resolved
src/ui/symbollayer/widget_animatedmarker.ui Show resolved Hide resolved
@nyalldawson
Copy link
Collaborator Author

Thanks for the review @nirvn!

Also, working flawlessly out of the box with QField:

I noticed that you've got the flashing "redraw" indicator happening here. If you want to avoid that you need to check the "deferredUpdate" flag when QgsMapLayer::repaintRequested is emitted, and if it's true then the redraw should happen "silently".

@github-actions
Copy link

github-actions bot commented Apr 4, 2022

@nyalldawson
A documentation ticket has been opened at qgis/QGIS-Documentation#7468
It is your responsibility to visit this ticket and add as much detail as possible for the documentation team to correctly document this change.
Thank you!

@zacharlie zacharlie added ChangelogHarvested This PR description has been harvested in the Changelog already. and removed Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ChangelogHarvested This PR description has been harvested in the Changelog already. Feature Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo. Symbology Related to vector layer symbology or renderers Temporal Temporal filtering or animation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants