QGIS API Documentation 4.3.0-Master (c0a40176c6f)
Loading...
Searching...
No Matches
qgsvectorfieldtraceanimationgenerator.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorfieldtraceanimationgenerator.h
3 ---------------------------------------
4 begin : November 2019
5 copyright : (C) 2019 by Vincent Cloarec
6 email : vcloarec at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSVECTORFIELDTRACEANIMATIONGENERATOR_H
19#define QGSVECTORFIELDTRACEANIMATIONGENERATOR_H
20
21#include <memory>
22
23#include "qgis_core.h"
24#include "qgis_sip.h"
25#include "qgsrendercontext.h"
26
27#include <QImage>
28
29class QgsMeshLayer;
30class QgsVectorFieldParticleTracesField;
33
49{
50 public:
58 std::unique_ptr<QgsVectorFieldValueSource> source, const QgsRenderContext &rendererContext, const QgsVectorFieldSettings &vectorSettings, bool minimizeFieldSize = true
59 ) SIP_SKIP;
60
68
70
72
74 void seedRandomParticles( int count );
75
77 QImage imageRendered();
78
80 void setFramesPerSecond( int frames );
81
83 void setMaximumSpeedPixel( int pixels );
84
86 void setParticlesLifeTime( double particleLifeTime );
87
89 void setParticlesColor( const QColor &c );
90
92 void setParticlesSize( double width );
93
95 void setTailFactor( double fct );
96
98 void setMinimumTailLength( int l );
99
101 void setTailPersitence( double p );
102
104
105 private:
106 std::unique_ptr<QgsVectorFieldParticleTracesField> mParticleField;
107 const QgsRenderContext &mRendererContext;
108 int mFps = 15; //frame per second of the output, used to calculate orher parameters of the field
109 int mVpixMax = 2000; //is the number of pixels that are going through for 1 s
110 double mParticleLifeTime = 5;
111
112 void updateFieldParameter();
113
114 protected:
122};
123
124#endif // QGSVECTORFIELDTRACEANIMATIONGENERATOR_H
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Contains information about the context of a rendering operation.
Represents a renderer settings for vector datasets.
QgsVectorFieldTraceAnimationGenerator & operator=(const QgsVectorFieldTraceAnimationGenerator &other)
void setMinimumTailLength(int l)
Sets the minimum tail length.
QgsVectorFieldTraceAnimationGenerator(std::unique_ptr< QgsVectorFieldValueSource > source, const QgsRenderContext &rendererContext, const QgsVectorFieldSettings &vectorSettings, bool minimizeFieldSize=true)
Constructs a generator sampling the vector field from source, which is taken ownership of.
void seedRandomParticles(int count)
Seeds particles in the vector field.
void setParticlesSize(double width)
Sets particle size in px.
void setMaximumSpeedPixel(int pixels)
Sets the max number of pixels that can be go through by the particles in 1 second.
void setParticlesLifeTime(double particleLifeTime)
Sets maximum life time of particles in seconds.
void setTailFactor(double fct)
Sets the tail factor, used to adjust the length of the tail. 0 : minimum length, >1 increase the tail...
void setTailPersitence(double p)
Sets the visual persistence of the tail.
static QgsVectorFieldTraceAnimationGenerator * fromMeshLayer(QgsMeshLayer *layer, const QgsRenderContext &rendererContext)
Returns a generator for the active vector dataset of layer, or nullptr if the layer has no vector dat...
void setParticlesColor(const QColor &c)
Sets colors of particle.
QImage imageRendered()
Moves all the particles using frame per second (fps) to calculate the displacement and return the ren...
void setFramesPerSecond(int frames)
Sets the number of frames per seconds that will be rendered.
Abstract source of vector (u/v) values sampled at arbitrary map positions.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define SIP_SKIP
Definition qgis_sip.h:138
#define SIP_FACTORY
Definition qgis_sip.h:83
#define SIP_NODEFAULTCTORS
Definition qgis_sip.h:108