Skip to content
Permalink
Browse files

use MDAL Groups instead of guessing them from dataset names

  • Loading branch information
PeterPetrik authored and wonder-sk committed Jul 18, 2018
1 parent 245d6e2 commit 21613cd1325e514a4c825957e83f87452a7237a3
Showing with 757 additions and 389 deletions.
  1. +125 −24 python/core/auto_generated/mesh/qgsmeshdataprovider.sip.in
  2. +4 −6 python/core/auto_generated/mesh/qgsmeshlayer.sip.in
  3. +20 −46 src/app/mesh/qgsmeshdatasetgrouptreeview.cpp
  4. +4 −4 src/app/mesh/qgsmeshdatasetgrouptreeview.h
  5. +1 −1 src/app/mesh/qgsmeshlayerproperties.cpp
  6. +39 −29 src/app/mesh/qgsmeshrendereractivedatasetwidget.cpp
  7. +9 −8 src/app/mesh/qgsmeshrendereractivedatasetwidget.h
  8. +3 −3 src/app/mesh/qgsmeshrendererscalarsettingswidget.cpp
  9. +4 −3 src/app/mesh/qgsmeshrendererscalarsettingswidget.h
  10. +1 −1 src/app/mesh/qgsmeshrenderervectorsettingswidget.cpp
  11. +3 −2 src/app/mesh/qgsmeshrenderervectorsettingswidget.h
  12. +14 −14 src/app/mesh/qgsrenderermeshpropertieswidget.cpp
  13. +3 −3 src/app/mesh/qgsrenderermeshpropertieswidget.h
  14. +62 −10 src/core/mesh/qgsmeshdataprovider.cpp
  15. +115 −27 src/core/mesh/qgsmeshdataprovider.h
  16. +8 −8 src/core/mesh/qgsmeshlayer.cpp
  17. +6 −8 src/core/mesh/qgsmeshlayer.h
  18. +6 −6 src/core/mesh/qgsmeshlayerrenderer.cpp
  19. +88 −41 src/core/mesh/qgsmeshmemorydataprovider.cpp
  20. +32 −17 src/core/mesh/qgsmeshmemorydataprovider.h
  21. +50 −37 src/providers/mdal/qgsmdalprovider.cpp
  22. +8 −7 src/providers/mdal/qgsmdalprovider.h
  23. +87 −60 tests/src/core/testqgsmeshlayer.cpp
  24. +12 −12 tests/src/core/testqgsmeshlayerrenderer.cpp
  25. +3 −0 tests/testdata/mesh/quad_and_triangle_els_face_scalar.dat
  26. +3 −0 tests/testdata/mesh/quad_and_triangle_els_face_vector.dat
  27. +7 −3 tests/testdata/mesh/quad_and_triangle_face_scalar.txt
  28. +7 −3 tests/testdata/mesh/quad_and_triangle_face_vector.txt
  29. +6 −0 tests/testdata/mesh/quad_and_triangle_vertex_scalar.dat
  30. +11 −3 tests/testdata/mesh/quad_and_triangle_vertex_scalar.txt
  31. +6 −0 tests/testdata/mesh/quad_and_triangle_vertex_vector.dat
  32. +10 −3 tests/testdata/mesh/quad_and_triangle_vertex_vector.txt
@@ -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;
@@ -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.

@@ -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;
@@ -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

@@ -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
@@ -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

@@ -10,8 +10,6 @@



const int NO_ACTIVE_MESH_DATASET;


class QgsMeshLayer : QgsMapLayer
{
@@ -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

0 comments on commit 21613cd

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