QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsrasteriterator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasteriterator.h
3  ---------------------
4  begin : July 2012
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSRASTERITERATOR_H
16 #define QGSRASTERITERATOR_H
17 
18 #include "qgsrectangle.h"
19 #include <QMap>
20 
21 class QgsMapToPixel;
22 class QgsRasterBlock;
24 class QgsRasterInterface;
25 class QgsRasterProjector;
26 struct QgsRasterViewPort;
27 
31 class CORE_EXPORT QgsRasterIterator
32 {
33  public:
34 
36 
44  void startRasterRead( int bandNumber, int nCols, int nRows, const QgsRectangle& extent, QgsRasterBlockFeedback* feedback = nullptr );
45 
55  bool readNextRasterPart( int bandNumber,
56  int& nCols, int& nRows,
57  QgsRasterBlock **block,
58  int& topLeftCol, int& topLeftRow );
59 
60  void stopRasterRead( int bandNumber );
61 
62  const QgsRasterInterface* input() const { return mInput; }
63 
64  void setMaximumTileWidth( int w ) { mMaximumTileWidth = w; }
65  int maximumTileWidth() const { return mMaximumTileWidth; }
66 
67  void setMaximumTileHeight( int h ) { mMaximumTileHeight = h; }
68  int maximumTileHeight() const { return mMaximumTileHeight; }
69 
70  private:
71  //Stores information about reading of a raster band. Columns and rows are in unsampled coordinates
72  struct RasterPartInfo
73  {
74  int currentCol;
75  int currentRow;
76  int nCols;
77  int nRows;
78  QgsRasterProjector* prj; //raster projector (or 0 if no reprojection is done)
79  };
80 
81  QgsRasterInterface* mInput;
82  QMap<int, RasterPartInfo> mRasterPartInfos;
83  QgsRectangle mExtent;
84  QgsRasterBlockFeedback* mFeedback;
85 
86  int mMaximumTileWidth;
87  int mMaximumTileHeight;
88 
90  void removePartInfo( int bandNumber );
91 };
92 
93 #endif // QGSRASTERITERATOR_H
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Iterator for sequentially processing raster cells.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:34
Raster data container.
Base class for processing filters like renderers, reprojector, resampler etc.
QgsRasterProjector implements approximate projection support for it calculates grid of points in sour...
void setMaximumTileWidth(int w)
void setMaximumTileHeight(int h)
const QgsRasterInterface * input() const
int maximumTileHeight() const
This class provides details of the viewable area that a raster will be rendered into.
Feedback object tailored for raster block reading.
int maximumTileWidth() const