QGIS API Documentation  3.2.0-Bonn (bc43194)
qgsmeshdataprovider.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshdataprovider.h
3  ---------------------
4  begin : April 2018
5  copyright : (C) 2018 by Peter Petrik
6  email : zilolv at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSMESHDATAPROVIDER_H
19 #define QGSMESHDATAPROVIDER_H
20 
21 #include "qgis_core.h"
22 #include "qgspoint.h"
23 #include "qgsrectangle.h"
24 #include "qgsdataprovider.h"
25 
26 #include <QVector>
27 #include <QString>
28 #include <QMap>
29 #include <limits>
30 
33 
35 typedef QVector<int> QgsMeshFace;
36 
48 class CORE_EXPORT QgsMeshDatasetValue
49 {
50  public:
52  QgsMeshDatasetValue( double x,
53  double y );
54 
56  QgsMeshDatasetValue( double scalar );
57 
59  QgsMeshDatasetValue() = default;
60 
62  ~QgsMeshDatasetValue() = default;
63 
65  void set( double scalar );
66 
68  void setX( double x );
69 
71  void setY( double y ) ;
72 
74  double scalar() const;
75 
77  double x() const;
78 
80  double y() const;
81 
82  bool operator==( const QgsMeshDatasetValue &other ) const;
83 
84  private:
85  double mX = std::numeric_limits<double>::quiet_NaN();
86  double mY = std::numeric_limits<double>::quiet_NaN();
87 };
88 
89 
90 
101 class CORE_EXPORT QgsMeshDatasetMetadata
102 {
103  public:
105  QgsMeshDatasetMetadata() = default;
106 
115  QgsMeshDatasetMetadata( bool isScalar,
116  bool isValid,
117  bool isOnVertices,
118  const QMap<QString, QString> &extraOptions );
119 
124  QMap<QString, QString> extraOptions() const;
125 
129  bool isVector() const;
130 
134  bool isScalar() const;
135 
139  bool isOnVertices() const;
140 
144  bool isValid() const;
145 
146  private:
147  bool mIsScalar = false;
148  bool mIsValid = false;
149  bool mIsOnVertices = false;
150  QMap<QString, QString> mExtraOptions;
151 };
152 
170 {
171  public:
173  virtual ~QgsMeshDataSourceInterface() = default;
174 
179  virtual int vertexCount() const = 0;
180 
185  virtual int faceCount() const = 0;
186 
190  virtual QgsMeshVertex vertex( int index ) const = 0;
191 
195  virtual QgsMeshFace face( int index ) const = 0;
196 };
197 
211 {
212  public:
214  virtual ~QgsMeshDatasetSourceInterface() = default;
215 
219  virtual bool addDataset( const QString &uri ) = 0;
220 
224  virtual int datasetCount() const = 0;
225 
229  virtual QgsMeshDatasetMetadata datasetMetadata( int datasetIndex ) const = 0;
230 
236  virtual QgsMeshDatasetValue datasetValue( int datasetIndex, int valueIndex ) const = 0;
237 };
238 
239 
251 {
252  Q_OBJECT
253 
254  public:
256  QgsMeshDataProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options );
257 
262  QgsRectangle extent() const override;
263 };
264 
265 #endif // QGSMESHDATAPROVIDER_H
A rectangle specified with double values.
Definition: qgsrectangle.h:40
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Abstract base class for spatial data provider implementations.
#define SIP_ABSTRACT
Definition: qgis_sip.h:187
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
Base class for providing data for QgsMeshLayer.
Setting options for creating vector data providers.
Interface for mesh datasets.
QVector< int > QgsMeshFace
List of vertex indexes.
virtual QgsRectangle extent() const =0
Returns the extent of the layer.
QgsMeshDatasetValue represents single mesh dataset value.
QgsMeshDatasetMetadata is a collection of mesh dataset metadata such as whether the data is vector or...
Interface for mesh data sources.
QgsPoint QgsMeshVertex
xyz coords of vertex