QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
36 
43  void startRasterRead( int bandNumber, int nCols, int nRows, const QgsRectangle& extent );
44 
54  bool readNextRasterPart( int bandNumber,
55  int& nCols, int& nRows,
56  QgsRasterBlock **block,
57  int& topLeftCol, int& topLeftRow );
58 
59  void stopRasterRead( int bandNumber );
60 
61  const QgsRasterInterface* input() const { return mInput; }
62 
63  void setMaximumTileWidth( int w ) { mMaximumTileWidth = w; }
64  int maximumTileWidth() const { return mMaximumTileWidth; }
65 
66  void setMaximumTileHeight( int h ) { mMaximumTileHeight = h; }
67  int maximumTileHeight() const { return mMaximumTileHeight; }
68 
69  private:
70  //Stores information about reading of a raster band. Columns and rows are in unsampled coordinates
71  struct RasterPartInfo
72  {
73  int currentCol;
74  int currentRow;
75  int nCols;
76  int nRows;
77  QgsRasterProjector* prj; //raster projector (or 0 if no reprojection is done)
78  };
79 
80  QgsRasterInterface* mInput;
81  QMap<int, RasterPartInfo> mRasterPartInfos;
82  QgsRectangle mExtent;
83 
84  int mMaximumTileWidth;
85  int mMaximumTileHeight;
86 
88  void removePartInfo( int bandNumber );
89 };
90 
91 #endif // QGSRASTERITERATOR_H
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Iterator for sequentially processing raster cells.
Definition: qgsrasteriterator.h:30
int maximumTileWidth() const
Definition: qgsrasteriterator.h:64
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:33
Raster data container.
Definition: qgsrasterblock.h:32
int maximumTileHeight() const
Definition: qgsrasteriterator.h:67
Base class for processing filters like renderers, reprojector, resampler etc.
Definition: qgsrasterinterface.h:35
Definition: qgsrasterprojector.h:38
void setMaximumTileWidth(int w)
Definition: qgsrasteriterator.h:63
void setMaximumTileHeight(int h)
Definition: qgsrasteriterator.h:66
This class provides details of the viewable area that a raster will be rendered into.
Definition: qgsrasterviewport.h:31
const QgsRasterInterface * input() const
Definition: qgsrasteriterator.h:61