QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
131  CORE_EXPORT QgsRasterBlock *exportRasterBlock(
132  const QgsTriangularMesh &triangularMesh,
133  const QgsMeshDataBlock &datasetValues,
134  const QgsMeshDataBlock &activeFlags,
136  const QgsCoordinateTransform &transform,
137  double mapUnitsPerPixel,
138  const QgsRectangle &extent,
139  QgsRasterBlockFeedback *feedback = nullptr
140  ) SIP_SKIP;
141 };
142 
143 #endif // QGSMESHLAYERINTERPOLATOR_H
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition: qgscoordinatetransformcontext.h:57
QgsMeshUtils
Definition: qgsmeshlayerinterpolator.h:85
Qgis::DataType
DataType
Raster data types.
Definition: qgis.h:128
qgis.h
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:59
QgsSymbol
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:92
qgssinglebandpseudocolorrenderer.h
QgsRectangle
A rectangle specified with double values.
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:194
QgsRasterInterface::dataType
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
QgsMeshDatasetIndex
QgsMeshDatasetIndex is index that identifies the dataset group (e.g. wind speed) and a dataset in thi...
Definition: qgsmeshdataset.h:48
QgsMeshLayer
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:98
qgis_sip.h
QgsRasterInterface::clone
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
qgsmaplayerrenderer.h
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:211
qgsrastershader.h
QgsRasterInterface
Base class for processing filters like renderers, reprojector, resampler etc.
Definition: qgsrasterinterface.h:135
QgsMeshDatasetGroupMetadata::DataType
DataType
Location of where data is specified for datasets in the dataset group.
Definition: qgsmeshdataset.h:356
QgsRasterBlockFeedback
Feedback object tailored for raster block reading.
Definition: qgsrasterinterface.h:41
QgsMeshDataBlock
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e....
Definition: qgsmeshdataset.h:137
QgsTriangularMesh
Triangular/Derived Mesh is mesh with vertices in map coordinates.
Definition: qgstriangularmesh.h:51
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.
QgsCoordinateTransform
Class for doing transforms between two map coordinate systems.
Definition: qgscoordinatetransform.h:57
QgsRasterBlock
Raster data container.
Definition: qgsrasterblock.h:36