QGIS API Documentation  3.23.0-Master (eb871beae0)
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
DataType
Raster data types.
Definition: qgis.h:121
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Class for doing transforms between two map coordinate systems.
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e....
DataType
Location of where data is specified for datasets in the dataset group.
QgsMeshDatasetIndex is index that identifies the dataset group (e.g.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:97
Feedback object tailored for raster block reading.
Raster data container.
Base class for processing filters like renderers, reprojector, resampler etc.
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.
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
virtual int bandCount() const =0
Gets number of bands.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Contains information about the context of a rendering operation.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:38
Triangular/Derived Mesh is mesh with vertices in map coordinates.
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.
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_FACTORY
Definition: qgis_sip.h:76