QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsmeshlayerinterpolator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshlayerinterpolator.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 QGSMESHLAYERINTERPOLATOR_H
19 #define QGSMESHLAYERINTERPOLATOR_H
20 
21 class QgsMeshLayer;
22 class QgsSymbol;
26 
27 #include "qgis.h"
28 #include "qgis_sip.h"
29 
30 #include <QSize>
31 #include "qgsmaplayerrenderer.h"
32 #include "qgstriangularmesh.h"
33 #include "qgsrasterinterface.h"
35 #include "qgsrastershader.h"
36 
37 class QgsRenderContext;
38 
39 #ifdef SIP_RUN
40 % ModuleHeaderCode
42 % End
43 #endif
44 
46 
54 class QgsMeshLayerInterpolator : public QgsRasterInterface SIP_SKIP
55 {
56  public:
58  QgsMeshLayerInterpolator( const QgsTriangularMesh &m,
59  const QVector<double> &datasetValues,
60  const QgsMeshDataBlock &activeFaceFlagValues,
62  const QgsRenderContext &context,
63  const QSize &size );
64  ~QgsMeshLayerInterpolator() override;
65 
66  QgsRasterInterface *clone() const override;
67  Qgis::DataType dataType( int ) const override;
68  int bandCount() const override;
69  QgsRasterBlock *block( int, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override;
70 
71  void setSpatialIndexActive( bool active );
72 
73  private:
74  const QgsTriangularMesh &mTriangularMesh;
75  const QVector<double> &mDatasetValues;
76  const QgsMeshDataBlock &mActiveFaceFlagValues;
77  const QgsRenderContext &mContext;
78  QgsMeshDatasetGroupMetadata::DataType mDataType = QgsMeshDatasetGroupMetadata::DataType::DataOnVertices;
79  QSize mOutputSize;
80  bool mSpatialIndexActive = false;
81 };
82 
84 
85 namespace QgsMeshUtils
86 {
87 
105  CORE_EXPORT QgsRasterBlock *exportRasterBlock(
106  const QgsMeshLayer &layer,
107  const QgsMeshDatasetIndex &datasetIndex,
108  const QgsCoordinateReferenceSystem &destinationCrs,
109  const QgsCoordinateTransformContext &transformContext,
110  double mapUnitsPerPixel,
111  const QgsRectangle &extent,
112  QgsRasterBlockFeedback *feedback = nullptr
113  ) SIP_FACTORY;
114 };
115 
116 #endif // QGSMESHLAYERINTERPOLATOR_H
Qgis::DataType
DataType
Raster data types.
Definition: qgis.h:114
QgsCoordinateTransformContext
Definition: qgscoordinatetransformcontext.h:57
QgsMeshUtils
Definition: qgsmeshlayerinterpolator.h:85
qgis.h
QgsRenderContext
Definition: qgsrendercontext.h:57
QgsSymbol
Definition: qgssymbol.h:63
qgssinglebandpseudocolorrenderer.h
QgsRectangle
Definition: qgsrectangle.h:41
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
qgstriangularmesh.h
qgsrasterinterface.h
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgsmeshlayerinterpolator.h
QgsMeshUtils::exportRasterBlock
CORE_EXPORT QgsRasterBlock * exportRasterBlock(const QgsMeshLayer &layer, const QgsMeshDatasetIndex &datasetIndex, const QgsCoordinateReferenceSystem &destinationCrs, const QgsCoordinateTransformContext &transformContext, double mapUnitsPerPixel, const QgsRectangle &extent, QgsRasterBlockFeedback *feedback=nullptr)
Exports mesh layer's dataset values as raster block.
Definition: qgsmeshlayerinterpolator.cpp:179
QgsRasterInterface::dataType
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
QgsMeshDatasetIndex
Definition: qgsmeshdataset.h:45
QgsMeshLayer
Definition: qgsmeshlayer.h:94
qgis_sip.h
QgsRasterInterface::clone
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
qgsmaplayerrenderer.h
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
qgsrastershader.h
QgsRasterInterface
Definition: qgsrasterinterface.h:116
QgsMeshDatasetGroupMetadata::DataType
DataType
Location of where data is specified for datasets in the dataset group.
Definition: qgsmeshdataset.h:353
QgsRasterBlockFeedback
Definition: qgsrasterinterface.h:40
QgsMeshDataBlock
Definition: qgsmeshdataset.h:134
QgsTriangularMesh
Definition: qgstriangularmesh.h:49
QgsRasterInterface::bandCount
virtual int bandCount() const =0
Gets number of bands.
QgsRasterInterface::block
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)=0
Read block of data using given extent and size.
QgsRasterBlock
Definition: qgsrasterblock.h:36