Skip to content

Commit

Permalink
[FEATURE] Rendering of vector data on mesh layers
Browse files Browse the repository at this point in the history
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 16, 2018
1 parent 9296528 commit aea3dcc
Show file tree
Hide file tree
Showing 26 changed files with 1,639 additions and 225 deletions.
65 changes: 55 additions & 10 deletions python/core/auto_generated/mesh/qgsmeshdataprovider.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -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;

};
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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
};

Expand Down
58 changes: 46 additions & 12 deletions python/core/auto_generated/mesh/qgsmeshlayer.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down
Loading

0 comments on commit aea3dcc

Please sign in to comment.