Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use MDAL Groups instead of guessing them from dataset names
  • Loading branch information
PeterPetrik authored and wonder-sk committed Jul 19, 2018
1 parent 245d6e2 commit 21613cd
Show file tree
Hide file tree
Showing 32 changed files with 757 additions and 389 deletions.
149 changes: 125 additions & 24 deletions python/core/auto_generated/mesh/qgsmeshdataprovider.sip.in
Expand Up @@ -10,6 +10,43 @@



class QgsMeshDatasetIndex
{
%Docstring

QgsMeshDatasetIndex is index that identifies the dataset group (e.g. wind speed)
and a dataset in this group (e.g. magnitude of wind speed in particular time)

.. note::

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

.. versionadded:: 3.4
%End

%TypeHeaderCode
#include "qgsmeshdataprovider.h"
%End
public:
QgsMeshDatasetIndex( int group = -1, int dataset = -1 );
%Docstring
Creates an index. -1 represents invalid group/dataset
%End
int group() const;
%Docstring
Returns a group index
%End
int dataset() const;
%Docstring
Returns a dataset index within group()
%End
bool isValid() const;
%Docstring
Returns whether index is valid, ie at least groups is set
%End
bool operator == ( const QgsMeshDatasetIndex &other ) const;
};

typedef QgsPoint QgsMeshVertex;

typedef QVector<int> QgsMeshFace;
Expand All @@ -18,7 +55,7 @@ class QgsMeshDatasetValue
{
%Docstring

QgsMeshDatasetValue represents single mesh dataset value
QgsMeshDatasetValue represents single dataset value

could be scalar or vector. Nodata values are represented by NaNs.

Expand Down Expand Up @@ -85,63 +122,104 @@ Returns y value

};



class QgsMeshDatasetMetadata
class QgsMeshDatasetGroupMetadata
{
%Docstring

QgsMeshDatasetMetadata is a collection of mesh dataset metadata such
as whether the data is vector or scalar, etc.
QgsMeshDatasetGroupMetadata is a collection of dataset group metadata
such as whether the data is vector or scalar, name

.. note::

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

.. versionadded:: 3.2
.. versionadded:: 3.4
%End

%TypeHeaderCode
#include "qgsmeshdataprovider.h"
%End
public:
QgsMeshDatasetMetadata();
QgsMeshDatasetGroupMetadata();
%Docstring
Constructs an empty metadata object
%End

QgsMeshDatasetMetadata( bool isScalar,
bool isValid,
bool isOnVertices,
const QMap<QString, QString> &extraOptions );
QgsMeshDatasetGroupMetadata( const QString &name,
bool isScalar,
bool isOnVertices,
const QMap<QString, QString> &extraOptions );
%Docstring
Constructs a valid metadata object

:param name: name of the dataset group
:param isScalar: dataset contains scalar data, specifically the y-value of QgsMeshDatasetValue is NaN
:param isValid: dataset is loadad and valid for fetching the data
:param isOnVertices: dataset values are defined on mesh's vertices. If false, values are defined on faces.
:param extraOptions: dataset's extra options stored by the provider. Usually contains the name, time value, time units, data file vendor, ...
%End

QString name() const;
%Docstring
Returns name of the dataset group
%End

QMap<QString, QString> extraOptions() const;
%Docstring
Returns extra metadata options
Usually including name, description or time variable
Returns extra metadata options, for example description
%End

bool isVector() const;
%Docstring
Returns whether dataset has vector data
Returns whether dataset group has vector data
%End

bool isScalar() const;
%Docstring
Returns whether dataset has scalar data
Returns whether dataset group has scalar data
%End

bool isOnVertices() const;
%Docstring
Returns whether dataset data is defined on vertices
Returns whether dataset group data is defined on vertices
%End

};

class QgsMeshDatasetMetadata
{
%Docstring

QgsMeshDatasetMetadata is a collection of mesh dataset metadata such
as whether the data is valid or associated time for the dataset

.. note::

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

.. versionadded:: 3.2
%End

%TypeHeaderCode
#include "qgsmeshdataprovider.h"
%End
public:
QgsMeshDatasetMetadata();
%Docstring
Constructs an empty metadata object
%End

QgsMeshDatasetMetadata( double time,
bool isValid );
%Docstring
Constructs a valid metadata object

:param time: a time which this dataset represents in the dataset group
:param isValid: dataset is loadad and valid for fetching the data
%End

double time() const;
%Docstring
Returns the time value for this dataset
%End

bool isValid() const;
Expand All @@ -157,7 +235,7 @@ class QgsMeshDataSourceInterface /Abstract/

Interface for mesh data sources

Mesh is a collection of vertices and faces in 2D or 3D space
Mesh is a collection of vertices and faces in 2D or 3D space
- vertex - XY(Z) point (in the mesh's coordinate reference system)
- faces - sets of vertices forming a closed shape - typically triangles or quadrilaterals

Expand Down Expand Up @@ -205,12 +283,15 @@ Returns the mesh face at index
class QgsMeshDatasetSourceInterface /Abstract/
{
%Docstring
Interface for mesh datasets
Interface for mesh datasets and dataset groups

Dataset is a collection of vector or scalar values on vertices or faces of the mesh.
Based on the underlying data provider/format, whole dataset is either stored in memory
or read on demand

Datasets are grouped in the dataset groups. A dataset group represents a measured quantity
(e.g. depth or wind speed), dataset represents values of the quantity in a particular time.

.. note::

The API is considered EXPERIMENTAL and can be changed without a notice
Expand All @@ -231,17 +312,37 @@ Associate dataset with the mesh
emits dataChanged when successful
%End

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

virtual int datasetCount( int groupIndex ) const = 0;
%Docstring
Returns number of datasets loaded in the group
%End

int datasetCount( QgsMeshDatasetIndex index ) const;
%Docstring
Returns number of datasets loaded in the group
%End

virtual QgsMeshDatasetGroupMetadata datasetGroupMetadata( int groupIndex ) const = 0;
%Docstring
Returns dataset group metadata
%End

QgsMeshDatasetGroupMetadata datasetGroupMetadata( QgsMeshDatasetIndex index ) const;
%Docstring
Returns number of datasets loaded
Returns dataset group metadata
%End

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

virtual QgsMeshDatasetValue datasetValue( int datasetIndex, int valueIndex ) const = 0;
virtual QgsMeshDatasetValue datasetValue( QgsMeshDatasetIndex index, int valueIndex ) const = 0;
%Docstring
Returns vector/scalar value associated with the index from the dataset

Expand Down
10 changes: 4 additions & 6 deletions python/core/auto_generated/mesh/qgsmeshlayer.sip.in
Expand Up @@ -10,8 +10,6 @@



const int NO_ACTIVE_MESH_DATASET;


class QgsMeshLayer : QgsMapLayer
{
Expand Down Expand Up @@ -171,24 +169,24 @@ Returns renderer settings
Sets new renderer settings, triggers repaint
%End

void setActiveScalarDataset( int index = NO_ACTIVE_MESH_DATASET );
void setActiveScalarDataset( QgsMeshDatasetIndex index = QgsMeshDatasetIndex() );
%Docstring
Sets active scalar dataset for rendering

Triggers repaint
%End
int activeScalarDataset() const;
QgsMeshDatasetIndex activeScalarDataset() const;
%Docstring
Returns active scalar dataset
%End

void setActiveVectorDataset( int index = NO_ACTIVE_MESH_DATASET );
void setActiveVectorDataset( QgsMeshDatasetIndex index = QgsMeshDatasetIndex() );
%Docstring
Sets active vector dataset for rendering.

If dataset is not vector based, do nothing. Triggers repaint
%End
int activeVectorDataset() const;
QgsMeshDatasetIndex activeVectorDataset() const;
%Docstring
Returns active vector dataset
%End
Expand Down

0 comments on commit 21613cd

Please sign in to comment.