Skip to content
Permalink
Browse files

[FEATURE] Rendering of vector data on mesh layers

Rudimentary support of rendering of vector data (e.g. velocity) on mesh map layers.
Rendering can be adjusted by QgsMeshRenderer*Settings. Only in Python
API, no GUI widgets for styling present.
  • Loading branch information
PeterPetrik committed May 15, 2018
1 parent 9296528 commit aea3dccea78d253dbb8e2a9e51ae84ea1a110ec6
Showing with 1,639 additions and 225 deletions.
  1. +55 −10 python/core/auto_generated/mesh/qgsmeshdataprovider.sip.in
  2. +46 −12 python/core/auto_generated/mesh/qgsmeshlayer.sip.in
  3. +282 −0 python/core/auto_generated/mesh/qgsmeshrenderersettings.sip.in
  4. +1 −1 python/core/core_auto.sip
  5. +4 −0 src/core/CMakeLists.txt
  6. +33 −10 src/core/mesh/qgsmeshdataprovider.h
  7. +41 −26 src/core/mesh/qgsmeshlayer.cpp
  8. +39 −24 src/core/mesh/qgsmeshlayer.h
  9. +23 −77 src/core/mesh/qgsmeshlayerinterpolator.cpp
  10. +5 −4 src/core/mesh/qgsmeshlayerinterpolator.h
  11. +119 −45 src/core/mesh/qgsmeshlayerrenderer.cpp
  12. +41 −3 src/core/mesh/qgsmeshlayerrenderer.h
  13. +1 −1 src/core/mesh/qgsmeshmemorydataprovider.h
  14. +198 −0 src/core/mesh/qgsmeshrenderersettings.cpp
  15. +254 −0 src/core/mesh/qgsmeshrenderersettings.h
  16. +264 −0 src/core/mesh/qgsmeshvectorrenderer.cpp
  17. +103 −0 src/core/mesh/qgsmeshvectorrenderer.h
  18. +68 −0 src/core/mesh/qgstriangularmesh.cpp
  19. +11 −4 src/core/mesh/qgstriangularmesh.h
  20. +1 −1 src/providers/mdal/qgsmdaldataitems.h
  21. +50 −7 tests/src/core/testqgsmeshlayerrenderer.cpp
  22. BIN ...expected_quad_and_triangle_face_scalar_dataset/expected_quad_and_triangle_face_scalar_dataset.png
  23. BIN ...expected_quad_and_triangle_face_vector_dataset/expected_quad_and_triangle_face_vector_dataset.png
  24. BIN ...es/mesh/expected_quad_and_triangle_triangular_mesh/expected_quad_and_triangle_triangular_mesh.png
  25. BIN ...cted_quad_and_triangle_vertex_scalar_dataset/expected_quad_and_triangle_vertex_scalar_dataset.png
  26. BIN ...cted_quad_and_triangle_vertex_vector_dataset/expected_quad_and_triangle_vertex_vector_dataset.png
@@ -36,19 +36,64 @@ support of nodata values
public:
QgsMeshDatasetValue( double x,
double y );
%Docstring
Ctor
%End

QgsMeshDatasetValue( double scalar );
%Docstring
Ctor
%End

QgsMeshDatasetValue( );
%Docstring
Ctor
%End

~QgsMeshDatasetValue();

void setNodata( bool nodata = true );
%Docstring
Sets nodata value for this dataset value
%End
bool isNodata() const;
%Docstring
Returns whether it is nodata value
%End
bool isScalar() const;
double scalar() const; //length for vectors, value for scalars
%Docstring
Returns whether it is scalar value
%End
double scalar() const;
%Docstring
Returns scalar value. Length for vectors, value for scalars
%End

void set( double scalar );
%Docstring
Sets scalar value
%End

void setX( double x );
%Docstring
Sets X value
%End

void setY( double y );
%Docstring
Sets Y value
%End

double x() const;
%Docstring
Returns x value
%End

double y() const;
%Docstring
Returns y value
%End

bool operator==( const QgsMeshDatasetValue &other ) const;

};
@@ -78,14 +123,14 @@ read on demand

virtual int vertexCount() const = 0;
%Docstring
Return number of vertices in the native mesh
Returns number of vertices in the native mesh

:return: Number of vertices in the mesh
%End

virtual int faceCount() const = 0;
%Docstring
Return number of faces in the native mesh
Returns number of faces in the native mesh

:return: Number of faces in the mesh
%End
@@ -94,7 +139,7 @@ read on demand
%Docstring
Factory for mesh vertex with index

:return: new mesh vertex on index
:return: New mesh vertex on index
%End

virtual QgsMeshFace face( int index ) const = 0;
@@ -133,32 +178,32 @@ read on demand

virtual int datasetCount() const = 0;
%Docstring
Return number of datasets loaded
Returns number of datasets loaded
%End

virtual bool datasetHasScalarData( int index ) const = 0;
%Docstring
Whether dataset has scalar data associated
Returns whether dataset has scalar data associated
%End

virtual bool datasetIsOnVertices( int index ) const = 0;
%Docstring
Whether dataset is on vertices
Returns whether dataset is on vertices
%End

virtual QgsMeshDatasetMetadata datasetMetadata( int index ) const = 0;
%Docstring
Return dataset metadata
Returns dataset metadata
%End

virtual QgsMeshDatasetValue datasetValue( int datasetIndex, int valueIndex ) const = 0;
%Docstring
Return value associated with the index from the dataset
Returns value associated with the index from the dataset
%End

virtual bool datasetIsValid( int index ) const = 0;
%Docstring
Return whether dataset is valid
Returns whether dataset is valid
%End
};

@@ -52,8 +52,6 @@ E.g. to create mesh with one quad and one triangle
);
QgsMeshLayer *scratchLayer = new QgsMeshLayer(uri, "My Scratch layer", "memory_mesh");

Add datasets by adding them through data provider, :py:func:`QgsMeshDatasetSource.addDataset`

\subsection mdal MDAL data provider (mdal)

Accesses data using the MDAL drivers (https://github.com/lutraconsulting/MDAL). The url
@@ -118,32 +116,68 @@ QgsMeshLayer cannot be copied.

QString providerType() const;
%Docstring
Return the provider type for this layer
Returns the provider type for this layer
%End



QgsSymbol *nativeMeshSymbol();
QgsMeshRendererMeshSettings rendererNativeMeshSettings() const /Factory/;
%Docstring
Returns a line symbol used for rendering native mesh.
Returns rendrer settings
%End

QgsSymbol *triangularMeshSymbol();
void setRendererNativeMeshSettings( const QgsMeshRendererMeshSettings &settings );
%Docstring
Returns a line symbol used for rendering of triangular (derived) mesh.
Sets new rendering settings, triggers repaint
%End

.. seealso:: :py:func:`toggleTriangularMeshRendering`
QgsMeshRendererMeshSettings rendererTriangularMeshSettings() const /Factory/;
%Docstring
Returns rendrer settings
%End

void toggleTriangularMeshRendering( bool toggle );
void setRendererTriangularMeshSettings( const QgsMeshRendererMeshSettings &settings );
%Docstring
Toggle rendering of triangular (derived) mesh. Off by default
Sets new rendering settings, triggers repaint
%End

void setActiveScalarDataset( int index = -1 );
void setActiveVectorDataset( int index = -1 );
QgsMeshRendererScalarSettings rendererScalarSettings() const /Factory/;
%Docstring
Returns rendrer settings
%End

void setRendererScalarSettings( const QgsMeshRendererScalarSettings &settings );
%Docstring
Sets new rendering settings, triggers repaint
%End

QgsMeshRendererVectorSettings rendererVectorSettings() const /Factory/;
%Docstring
Returns rendrer settings
%End

void setRendererVectorSettings( const QgsMeshRendererVectorSettings &settings );
%Docstring
Sets new rendering settings, triggers repaint
%End

void setActiveScalarDataset( int index = -1 );
%Docstring
Sets active scalar dataset for rendering
%End
int activeScalarDataset() const;
%Docstring
Returns active scalar dataset
%End

void setActiveVectorDataset( int index = -1 );
%Docstring
Sets active vector dataset for rendering. If dataset is not vector based, do nothing
%End
int activeVectorDataset() const;
%Docstring
Returns active vector dataset
%End

private: // Private methods
QgsMeshLayer( const QgsMeshLayer &rhs );

0 comments on commit aea3dcc

Please sign in to comment.
You can’t perform that action at this time.