QGIS API Documentation  2.14.11-Essen
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;
23 class QgsRasterInterface;
24 class QgsRasterProjector;
25 struct QgsRasterViewPort;
26 
30 class CORE_EXPORT QgsRasterIterator
31 {
32  public:
33 
35 
42  void startRasterRead( int bandNumber, int nCols, int nRows, const QgsRectangle& extent );
43 
53  bool readNextRasterPart( int bandNumber,
54  int& nCols, int& nRows,
55  QgsRasterBlock **block,
56  int& topLeftCol, int& topLeftRow );
57 
58  void stopRasterRead( int bandNumber );
59 
60  const QgsRasterInterface* input() const { return mInput; }
61 
62  void setMaximumTileWidth( int w ) { mMaximumTileWidth = w; }
63  int maximumTileWidth() const { return mMaximumTileWidth; }
64 
65  void setMaximumTileHeight( int h ) { mMaximumTileHeight = h; }
66  int maximumTileHeight() const { return mMaximumTileHeight; }
67 
68  private:
69  //Stores information about reading of a raster band. Columns and rows are in unsampled coordinates
70  struct RasterPartInfo
71  {
72  int currentCol;
73  int currentRow;
74  int nCols;
75  int nRows;
76  QgsRasterProjector* prj; //raster projector (or 0 if no reprojection is done)
77  };
78 
79  QgsRasterInterface* mInput;
80  QMap<int, RasterPartInfo> mRasterPartInfos;
81  QgsRectangle mExtent;
82 
83  int mMaximumTileWidth;
84  int mMaximumTileHeight;
85 
87  void removePartInfo( int bandNumber );
88 };
89 
90 #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.
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.
int maximumTileWidth() const