QGIS API Documentation  3.0.2-Girona (307d082)
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 "qgis_core.h"
19 #include "qgsrectangle.h"
20 #include <QMap>
21 
22 class QgsMapToPixel;
23 class QgsRasterBlock;
25 class QgsRasterInterface;
26 class QgsRasterProjector;
27 struct QgsRasterViewPort;
28 
33 class CORE_EXPORT QgsRasterIterator
34 {
35  public:
36 
38 
47  void startRasterRead( int bandNumber, int nCols, int nRows, const QgsRectangle &extent, QgsRasterBlockFeedback *feedback = nullptr );
48 
59  bool readNextRasterPart( int bandNumber,
60  int &nCols, int &nRows,
61  QgsRasterBlock **block,
62  int &topLeftCol, int &topLeftRow );
63 
64  void stopRasterRead( int bandNumber );
65 
66  const QgsRasterInterface *input() const { return mInput; }
67 
68  void setMaximumTileWidth( int w ) { mMaximumTileWidth = w; }
69  int maximumTileWidth() const { return mMaximumTileWidth; }
70 
71  void setMaximumTileHeight( int h ) { mMaximumTileHeight = h; }
72  int maximumTileHeight() const { return mMaximumTileHeight; }
73 
74  static const int DEFAULT_MAXIMUM_TILE_WIDTH = 2000;
75  static const int DEFAULT_MAXIMUM_TILE_HEIGHT = 2000;
76 
77  private:
78  //Stores information about reading of a raster band. Columns and rows are in unsampled coordinates
79  struct RasterPartInfo
80  {
81  int currentCol;
82  int currentRow;
83  int nCols;
84  int nRows;
85  QgsRasterProjector *prj; //raster projector (or 0 if no reprojection is done)
86  };
87 
88  QgsRasterInterface *mInput = nullptr;
89  QMap<int, RasterPartInfo> mRasterPartInfos;
90  QgsRectangle mExtent;
91  QgsRasterBlockFeedback *mFeedback = nullptr;
92 
93  int mMaximumTileWidth;
94  int mMaximumTileHeight;
95 
97  void removePartInfo( int bandNumber );
98 };
99 
100 #endif // QGSRASTERITERATOR_H
A rectangle specified with double values.
Definition: qgsrectangle.h:39
Iterator for sequentially processing raster cells.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:36
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