QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 <QVector>
22 #include <QString>
23 #include <QMap>
24 #include <QPair>
25 
26 #include <limits>
27 
28 #include "qgis_core.h"
29 #include "qgspoint.h"
30 #include "qgsdataprovider.h"
31 #include "qgsmeshdataset.h"
33 
34 
36 
38 typedef QgsPoint QgsMeshVertex;
39 
41 typedef QVector<int> QgsMeshFace;
42 
48 typedef QPair<int, int> QgsMeshEdge;
49 
57 struct CORE_EXPORT QgsMesh
58 {
59 
65  {
66  Vertex = 1,
67  Edge = 2,
68  Face = 4
69  };
70 
75  bool contains( const ElementType &type ) const;
76 
78  int vertexCount() const;
80  int faceCount() const;
81 
86  int edgeCount() const;
87 
89  QgsMeshVertex vertex( int index ) const;
91  QgsMeshFace face( int index ) const;
92 
97  QgsMeshEdge edge( int index ) const;
98 
103  void clear();
104 
105  QVector<QgsMeshVertex> vertices SIP_SKIP;
106  QVector<QgsMeshEdge> edges SIP_SKIP;
107  QVector<QgsMeshFace> faces SIP_SKIP;
108 };
109 
129 {
130  public:
132  virtual ~QgsMeshDataSourceInterface() = default;
133 
138  bool contains( const QgsMesh::ElementType &type ) const;
139 
144  virtual int vertexCount() const = 0;
145 
150  virtual int faceCount() const = 0;
151 
158  virtual int edgeCount() const = 0;
159 
164  virtual void populateMesh( QgsMesh *mesh ) const = 0;
165 };
166 
183 {
184  public:
186  virtual ~QgsMeshDatasetSourceInterface() = default;
187 
193  virtual bool addDataset( const QString &uri ) = 0;
194 
198  virtual QStringList extraDatasets() const = 0;
199 
203  virtual int datasetGroupCount( ) const = 0;
204 
208  virtual int datasetCount( int groupIndex ) const = 0;
209 
213  int datasetCount( QgsMeshDatasetIndex index ) const;
214 
218  virtual QgsMeshDatasetGroupMetadata datasetGroupMetadata( int groupIndex ) const = 0;
219 
223  QgsMeshDatasetGroupMetadata datasetGroupMetadata( QgsMeshDatasetIndex index ) const;
224 
228  virtual QgsMeshDatasetMetadata datasetMetadata( QgsMeshDatasetIndex index ) const = 0;
229 
241  virtual QgsMeshDatasetValue datasetValue( QgsMeshDatasetIndex index, int valueIndex ) const = 0;
242 
254  virtual QgsMeshDataBlock datasetValues( QgsMeshDatasetIndex index, int valueIndex, int count ) const = 0;
255 
267  virtual QgsMesh3dDataBlock dataset3dValues( QgsMeshDatasetIndex index, int faceIndex, int count ) const = 0;
268 
279  virtual bool isFaceActive( QgsMeshDatasetIndex index, int faceIndex ) const = 0;
280 
286  virtual QgsMeshDataBlock areFacesActive( QgsMeshDatasetIndex index, int faceIndex, int count ) const = 0;
287 
307  Q_DECL_DEPRECATED virtual bool persistDatasetGroup( const QString &path,
308  const QgsMeshDatasetGroupMetadata &meta,
309  const QVector<QgsMeshDataBlock> &datasetValues,
310  const QVector<QgsMeshDataBlock> &datasetActive,
311  const QVector<double> &times
312  ) SIP_DEPRECATED;
313 
331  virtual bool persistDatasetGroup( const QString &outputFilePath,
332  const QString &outputDriver,
333  const QgsMeshDatasetGroupMetadata &meta,
334  const QVector<QgsMeshDataBlock> &datasetValues,
335  const QVector<QgsMeshDataBlock> &datasetActive,
336  const QVector<double> &times
337  ) = 0;
338 };
339 
340 
352 {
353  Q_OBJECT
354 
355  public:
357  QgsMeshDataProvider( const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions );
358 
361 
369  void setTemporalUnit( QgsUnitTypes::TemporalUnit unit );
370 
371  signals:
373  void datasetGroupsAdded( int count );
374 
375  private:
376  std::unique_ptr<QgsMeshDataProviderTemporalCapabilities> mTemporalCapabilities;
377 };
378 
379 #endif // QGSMESHDATAPROVIDER_H
QgsDataProvider::ProviderOptions
Setting options for creating vector data providers.
Definition: qgsdataprovider.h:104
QgsDataProvider
Definition: qgsdataprovider.h:41
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
QgsMeshVertex
QgsPoint QgsMeshVertex
xyz coords of vertex
Definition: qgsmeshdataprovider.h:35
QgsMeshDataProviderTemporalCapabilities
Definition: qgsmeshdataprovidertemporalcapabilities.h:33
Face_t
Definition: qgsgeometrymakevalid.cpp:36
QgsMeshDatasetValue
Definition: qgsmeshdataset.h:76
qgspoint.h
QgsMesh
Definition: qgsmeshdataprovider.h:57
QgsUnitTypes::TemporalUnit
TemporalUnit
Temporal units.
Definition: qgsunittypes.h:149
QgsRectangle
Definition: qgsrectangle.h:41
QgsMeshDatasetMetadata
Definition: qgsmeshdataset.h:467
QgsMesh3dDataBlock
Definition: qgsmeshdataset.h:243
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsMeshDataSourceInterface
Definition: qgsmeshdataprovider.h:128
QgsMesh::ElementType
ElementType
Defines type of mesh elements.
Definition: qgsmeshdataprovider.h:64
QgsMeshDatasetIndex
Definition: qgsmeshdataset.h:45
QgsMeshDataProvider
Definition: qgsmeshdataprovider.h:351
QgsMeshDatasetSourceInterface
Definition: qgsmeshdataprovider.h:182
QgsMeshFace
QVector< int > QgsMeshFace
List of vertex indexes.
Definition: qgsmeshdataprovider.h:41
QgsDataProvider::temporalCapabilities
virtual QgsDataProviderTemporalCapabilities * temporalCapabilities()
Returns the provider's temporal capabilities.
Definition: qgsdataprovider.cpp:28
QgsMeshDatasetGroupMetadata
Definition: qgsmeshdataset.h:348
QgsMeshEdge
QPair< int, int > QgsMeshEdge
Edge is a straight line seqment between 2 points.
Definition: qgsmeshdataprovider.h:48
qgsmeshdataset.h
qgsmeshdataprovidertemporalcapabilities.h
qgsdataprovider.h
QgsMeshDataBlock
Definition: qgsmeshdataset.h:134
SIP_ABSTRACT
#define SIP_ABSTRACT
Definition: qgis_sip.h:194