Skip to content

Commit

Permalink
[FEATURE] Streamlines Renderer for vector dataset on mesh layer. (#32996
Browse files Browse the repository at this point in the history
)

* [FEATURE] Mesh streamlines

fix #29534

The vector field data set in a mesh layer can currently be only rendered with arrows. This PR adds a new feature to render vector field in mesh layers with streamlines. 
The streamlines are seeded from start points. The seeding points can start from the vertices of the mesh, from a used grid or randomly. Streamlines could be coloured or width can be selected.
  • Loading branch information
vcloarec authored and PeterPetrik committed Nov 25, 2019
1 parent 0bbdf20 commit 938aa58
Show file tree
Hide file tree
Showing 21 changed files with 2,114 additions and 374 deletions.
223 changes: 169 additions & 54 deletions python/core/auto_generated/mesh/qgsmeshrenderersettings.sip.in
Expand Up @@ -10,7 +10,6 @@




class QgsMeshRendererMeshSettings
{
%Docstring
Expand Down Expand Up @@ -149,11 +148,11 @@ Reads configuration from the given DOM element

};

class QgsMeshRendererVectorSettings
class QgsMeshRendererVectorArrowSettings
{
%Docstring

Represents a mesh renderer settings for vector datasets
Represents a mesh renderer settings for vector datasets displayed with arrows

.. note::

Expand All @@ -177,55 +176,7 @@ Represents a mesh renderer settings for vector datasets
Fixed
};

double lineWidth() const;
%Docstring
Returns line width of the arrow (in millimeters)
%End
void setLineWidth( double lineWidth );
%Docstring
Sets line width of the arrow in pixels (in millimeters)
%End

QColor color() const;
%Docstring
Returns color used for drawing arrows
%End
void setColor( const QColor &color );
%Docstring
Sets color used for drawing arrows
%End

double filterMin() const;
%Docstring
Returns filter value for vector magnitudes.

If magnitude of the vector is lower than this value, the vector is not
drawn. -1 represents that filtering is not active.
%End

void setFilterMin( double filterMin );
%Docstring
Sets filter value for vector magnitudes.

.. seealso:: :py:func:`filterMin`
%End

double filterMax() const;
%Docstring
Returns filter value for vector magnitudes.

If magnitude of the vector is higher than this value, the vector is not
drawn. -1 represents that filtering is not active.
%End

void setFilterMax( double filterMax );
%Docstring
Sets filter value for vector magnitudes.

.. seealso:: :py:func:`filterMax`
%End

QgsMeshRendererVectorSettings::ArrowScalingMethod shaftLengthMethod() const;
QgsMeshRendererVectorArrowSettings::ArrowScalingMethod shaftLengthMethod() const;
%Docstring
Returns method used for drawing arrows
%End
Expand Down Expand Up @@ -306,6 +257,143 @@ Returns ratio of the head length of the arrow (range 0-1)
void setArrowHeadLengthRatio( double arrowHeadLengthRatio );
%Docstring
Sets ratio of the head length of the arrow (range 0-1)
%End

QDomElement writeXml( QDomDocument &doc ) const;
%Docstring
Writes configuration to a new DOM element
%End
void readXml( const QDomElement &elem );
%Docstring
Reads configuration from the given DOM element
%End

};

class QgsMeshRendererVectorStreamlineSettings
{
%Docstring

Represents a streamline renderer settings for vector datasets displayed by streamlines

.. note::

The API is considered EXPERIMENTAL and can be changed without a notice

.. versionadded:: 3.12
%End

%TypeHeaderCode
#include "qgsmeshrenderersettings.h"
%End
public:
enum SeedingStartPointsMethod
{

MeshGridded,

Random,
};

SeedingStartPointsMethod seedingMethod() const;
%Docstring
Returns the method used for seeding start points of strealines
%End
void setSeedingMethod( const SeedingStartPointsMethod &seedingMethod );
%Docstring
Sets the method used for seeding start points of strealines
%End
double seedingDensity() const;
%Docstring
Returns the density used for seeding start points
%End
void setSeedingDensity( double seedingDensity );
%Docstring
Sets the density used for seeding start points
%End
void readXml( const QDomElement &elem );
%Docstring
Reads configuration from the given DOM element
%End
QDomElement writeXml( QDomDocument &doc ) const;
%Docstring
Writes configuration to a new DOM element
%End

};

class QgsMeshRendererVectorSettings
{
%Docstring

Represents a streamline renderer settings for vector datasets

.. note::

The API is considered EXPERIMENTAL and can be changed without a notice

.. versionadded:: 3.12
%End

%TypeHeaderCode
#include "qgsmeshrenderersettings.h"
%End
public:
enum Symbology
{
//!Displying vctor dataset with arrows
Arrows,
//!Displying vctor dataset with streamlines
Streamlines
};


double lineWidth() const;
%Docstring
Returns line width of the arrow (in millimeters)
%End
void setLineWidth( double lineWidth );
%Docstring
Sets line width of the arrow in pixels (in millimeters)
%End

QColor color() const;
%Docstring
Returns color used for drawing arrows
%End
void setColor( const QColor &color );
%Docstring
Sets color used for drawing arrows
%End

double filterMin() const;
%Docstring
Returns filter value for vector magnitudes.

If magnitude of the vector is lower than this value, the vector is not
drawn. -1 represents that filtering is not active.
%End

void setFilterMin( double filterMin );
%Docstring
Sets filter value for vector magnitudes.

.. seealso:: :py:func:`filterMin`
%End

double filterMax() const;
%Docstring
Returns filter value for vector magnitudes.

If magnitude of the vector is higher than this value, the vector is not
drawn. -1 represents that filtering is not active.
%End

void setFilterMax( double filterMax );
%Docstring
Sets filter value for vector magnitudes.

.. seealso:: :py:func:`filterMax`
%End

bool isOnUserDefinedGrid() const;
Expand Down Expand Up @@ -333,6 +421,34 @@ Returns height in pixels of user grid cell
Sets height of user grid cell (in pixels)
%End

Symbology symbology() const;
%Docstring
Returns the displaying method used to render vector datasets
%End
void setSymbology( const Symbology &symbology );
%Docstring
Sets the displaying method used to render vector datasets
%End

QgsMeshRendererVectorArrowSettings arrowSettings() const;
%Docstring
Returns settings for vector rendered with arrows
%End
void setArrowsSettings( const QgsMeshRendererVectorArrowSettings &arrowSettings );
%Docstring
Sets settings for vector rendered with arrows
%End

QgsMeshRendererVectorStreamlineSettings streamLinesSettings() const;
%Docstring
Returns settings for vector rednered with streamlines
%End
void setStreamLinesSettings( const QgsMeshRendererVectorStreamlineSettings &streamLinesSettings );
%Docstring
Sets settings for vector rednered with streamlines
%End


QDomElement writeXml( QDomDocument &doc ) const;
%Docstring
Writes configuration to a new DOM element
Expand All @@ -342,8 +458,8 @@ Writes configuration to a new DOM element
Reads configuration from the given DOM element
%End

};

};

class QgsMeshRendererSettings
{
Expand All @@ -362,7 +478,6 @@ Represents all mesh renderer settings
#include "qgsmeshrenderersettings.h"
%End
public:

QgsMeshRendererMeshSettings nativeMeshSettings() const;
%Docstring
Returns renderer settings
Expand Down
2 changes: 2 additions & 0 deletions python/server/auto_additions/qgsserverrequest.py
@@ -0,0 +1,2 @@
# The following has been generated automatically from src/server/qgsserverrequest.h
QgsServerRequest.Method.baseClass = QgsServerRequest

0 comments on commit 938aa58

Please sign in to comment.