16 #ifndef QGSRASTERANALYSISUTILS_H
17 #define QGSRASTERANALYSISUTILS_H
19 #include "qgis_analysis.h"
39 namespace QgsRasterAnalysisUtils
45 void cellInfoForBBox(
const QgsRectangle &rasterBBox,
const QgsRectangle &featureBBox,
double cellSizeX,
double cellSizeY,
int &nCellsX,
int &nCellsY,
46 int rasterWidth,
int rasterHeight,
51 double cellSizeX,
double cellSizeY,
const QgsRectangle &rasterBBox,
const std::function<
void(
double )> &addValue,
bool skipNodata =
true );
54 void statisticsFromPreciseIntersection(
QgsRasterInterface *rasterInterface,
int rasterBand,
const QgsGeometry &poly,
int nCellsX,
int nCellsY,
55 double cellSizeX,
double cellSizeY,
const QgsRectangle &rasterBBox,
const std::function<
void(
double,
double )> &addValue,
bool skipNodata =
true );
58 bool validPixel(
double value );
61 void mapToPixel(
const double x,
const double y,
const QgsRectangle bounds,
const double unitsPerPixelX,
const double unitsPerPixelY,
int &px,
int &py );
64 void pixelToMap(
const int px,
const int py,
const QgsRectangle bounds,
const double unitsPerPixelX,
const double unitsPerPixelY,
double &x,
double &y );
70 std::unique_ptr< QgsProcessingParameterDefinition > createRasterTypeParameter(
const QString &name,
71 const QString &description,
80 struct RasterLogicInput
82 std::unique_ptr< QgsRasterInterface > sourceDataProvider;
83 std::unique_ptr< QgsRasterProjector> projector;
85 bool hasNoDataValue =
false;
86 std::vector< int > bands { 1 };
89 ANALYSIS_EXPORT
void applyRasterLogicOperator(
const std::vector< QgsRasterAnalysisUtils::RasterLogicInput > &inputs,
QgsRasterDataProvider *destinationRaster,
double outputNoDataValue,
const bool treatNoDataAsFalse,
91 std::function<
void(
const std::vector< std::unique_ptr< QgsRasterBlock > > &,
bool &,
bool &,
int,
int,
bool )> &applyLogicFunc,
99 #endif // QGSRASTERANALYSISUTILS_H