Class: QgsVectorFieldTraceAnimationGenerator¶
Renders animated particle traces over a vector field.
Unlike the trace symbology of a layer renderer, which draws a single
static frame, this class keeps the particles alive between calls so that
successive imageRendered() calls produce the frames of an
animation.
The vector field can come from any source, so the same generator serves mesh layers and any other layer type able to expose a vector field.
Added in version 4.4.
List of all members, including inherited members
Class Hierarchy¶
Subclasses¶
A wrapper for |
Methods
Moves all the particles using frame per second (fps) to calculate the displacement and return the rendered frame |
|
Seeds particles in the vector field |
|
Sets the number of frames per seconds that will be rendered |
|
Sets the max number of pixels that can be go through by the particles in 1 second |
|
Sets the minimum tail length |
|
Sets colors of particle |
|
Sets maximum life time of particles in seconds |
|
Sets particle size in px |
|
Sets the tail factor, used to adjust the length of the tail. |
|
Sets the visual persistence of the tail |
Static Methods
Returns a generator for the active vector dataset of layer, or |
- class qgis.core.QgsVectorFieldTraceAnimationGenerator[source]¶
Bases:
object- static fromMeshLayer(layer: QgsMeshLayer | None, rendererContext: QgsRenderContext) QgsVectorFieldTraceAnimationGenerator | None[source]¶
Returns a generator for the active vector dataset of
layer, orNoneif the layer has no vector dataset to animate.The caller takes ownership of the returned generator.
- Parameters:
layer (QgsMeshLayer|None)
rendererContext (QgsRenderContext)
- Return type:
- imageRendered(self) QImage[source]¶
Moves all the particles using frame per second (fps) to calculate the displacement and return the rendered frame
- Return type:
QImage
- seedRandomParticles(self, count: int)[source]¶
Seeds particles in the vector field
- Parameters:
count (int)
- setFramesPerSecond(self, frames: int)[source]¶
Sets the number of frames per seconds that will be rendered
- Parameters:
frames (int)
- setMaximumSpeedPixel(self, pixels: int)[source]¶
Sets the max number of pixels that can be go through by the particles in 1 second
- Parameters:
pixels (int)
- setParticlesColor(self, c: QColor | Qt.GlobalColor | int)[source]¶
Sets colors of particle
- Parameters:
c (QColor|Qt.GlobalColor|int)
- setParticlesLifeTime(self, particleLifeTime: float)[source]¶
Sets maximum life time of particles in seconds
- Parameters:
particleLifeTime (float)