Skip to content

Commit

Permalink
[FEATURE] API for rendering frames for mesh vector dataset animation …
Browse files Browse the repository at this point in the history
…(particles) (#33110)

* [FEATURE] API for rendering frames for mesh vector dataset animation (particles) 

Adds a renderer to generate frames that represent particle traces in a vector field of a mesh layer. The renderer cannot be chosen in the current GUI, however crayfish plugin can use API to generate avi/gif files with nice animations representing the movement of (random) particles in the mesh layer vector field.
  • Loading branch information
vcloarec authored and PeterPetrik committed Nov 29, 2019
1 parent a1002c4 commit 6d4c995
Show file tree
Hide file tree
Showing 10 changed files with 1,166 additions and 111 deletions.
Expand Up @@ -342,9 +342,9 @@ Represents a streamline renderer settings for vector datasets

enum Symbology
{
//! Displying vector dataset with arrows
//! Displaying vector dataset with arrows
Arrows,
//! Displying vector dataset with streamlines
//! Displaying vector dataset with streamlines
Streamlines
};

Expand Down
102 changes: 102 additions & 0 deletions python/core/auto_generated/mesh/qgsmeshtracerenderer.sip.in
@@ -0,0 +1,102 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/mesh/qgsmeshtracerenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/










class QgsMeshVectorTraceRenderer
{
%Docstring

A wrapper for QgsMeshParticuleTracesField used to render the particles. Available for Python binding

.. versionadded:: 3.12
%End

%TypeHeaderCode
#include "qgsmeshtracerenderer.h"
%End
public:

QgsMeshVectorTraceRenderer( QgsMeshLayer *layer, const QgsRenderContext &rendererContext );
%Docstring
Constructor to use with Python binding
%End

QgsMeshVectorTraceRenderer( const QgsMeshVectorTraceRenderer &other );
%Docstring
Copy constructor
%End

~QgsMeshVectorTraceRenderer();

void seedRandomParticles( int count );
%Docstring
seeds particles in the vector fields
%End

QImage imageRendered();
%Docstring
Moves all the particles using frame per second (fps) to calculate the displacement
%End

void setFPS( int FPS );
%Docstring
Sets the number of frames per seconds that will be rendered
%End

void setMaxSpeedPixel( int max );
%Docstring
Sets the max number of pixels that can be go through by the particles in 1 second
%End

void setParticlesLifeTime( double particleLifeTime );
%Docstring
Sets maximum life time of particles in seconds
%End

void setParticlesColor( const QColor &c );
%Docstring
Sets colors of particle
%End

void setParticlesSize( double width );
%Docstring
Sets particle size
%End

void setTailFactor( double fct );
%Docstring
Sets the tail factor, used to adjust the length of the tail. 0 : minimum length, >1 increase the tail
%End

void setMinimumTailLength( int l );
%Docstring
Sets the minimum tail length
%End

void setTailPersitence( double p );
%Docstring
Sets the visual persistence of the tail
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/mesh/qgsmeshtracerenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -385,6 +385,7 @@
%Include auto_generated/mesh/qgsmeshrenderersettings.sip
%Include auto_generated/mesh/qgsmeshspatialindex.sip
%Include auto_generated/mesh/qgsmeshtimesettings.sip
%Include auto_generated/mesh/qgsmeshtracerenderer.sip
%Include auto_generated/metadata/qgsabstractmetadatabase.sip
%Include auto_generated/metadata/qgslayermetadata.sip
%Include auto_generated/metadata/qgslayermetadataformatter.sip
Expand Down
16 changes: 8 additions & 8 deletions src/core/mesh/qgsmeshrenderersettings.h
Expand Up @@ -323,9 +323,9 @@ class CORE_EXPORT QgsMeshRendererVectorSettings
*/
enum Symbology
{
//! Displying vector dataset with arrows
//! Displaying vector dataset with arrows
Arrows = 0,
//! Displying vector dataset with streamlines
//! Displaying vector dataset with streamlines
Streamlines
};

Expand Down Expand Up @@ -382,9 +382,9 @@ class CORE_EXPORT QgsMeshRendererVectorSettings
void setUserGridCellHeight( int height );

/**
* Returns the displaying method used to render vector datasets
* \since QGIS 3.12
*/
* Returns the displaying method used to render vector datasets
* \since QGIS 3.12
*/
Symbology symbology() const;

/**
Expand All @@ -394,9 +394,9 @@ class CORE_EXPORT QgsMeshRendererVectorSettings
void setSymbology( const Symbology &symbology );

/**
* Returns settings for vector rendered with arrows
* \since QGIS 3.12
*/
* Returns settings for vector rendered with arrows
* \since QGIS 3.12
*/
QgsMeshRendererVectorArrowSettings arrowSettings() const;

/**
Expand Down

0 comments on commit 6d4c995

Please sign in to comment.