1,561 changes: 65 additions & 1,496 deletions src/core/raster/qgsrasterlayer.cpp

Large diffs are not rendered by default.

62 changes: 1 addition & 61 deletions src/core/raster/qgsrasterlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
PalettedSingleBandGray, // a "Palette" layer drawn in gray scale
PalettedSingleBandPseudoColor, // a "Palette" layerdrawn using a pseudocolor algorithm
PalettedMultiBandColor, // currently not supported
MultiBandSingleGandGray, // a layer containing 2 or more bands, but a single band drawn as a range of gray colors
//added in 1.6 to fix naming glitch
MultiBandSingleBandGray = MultiBandSingleGandGray, // a layer containing 2 or more bands, but a single band drawn as a range of gray colors
MultiBandSingleBandGray, // a layer containing 2 or more bands, but a single band drawn as a range of gray colors
MultiBandSingleBandPseudoColor, //a layer containing 2 or more bands, but a single band drawn using a pseudocolor algorithm
MultiBandColor, //a layer containing 2 or more bands, mapped to RGB color space. In the case of a multiband with only two bands, one band will be mapped to more than one color.
SingleBandColorDataStyle // ARGB values rendered directly
Expand Down Expand Up @@ -946,62 +944,4 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
QgsRasterRenderer* mRenderer;
};

/*#include <QColor>
typedef void* GDALRasterBandH;
class QgsMapToPixel;
struct QgsRasterViewPort;
class QImage;
class QPainter;*/

/**A class encapsulates reading from a raster band and drawing the pixels to a painter.
The class allows sequential reading of the scan lines and setting the image scan line pixels. It automatically decides
on how much of the band / image should stay in virtual memory at a time*/
class CORE_EXPORT QgsRasterImageBuffer
{
public:
QgsRasterImageBuffer( QgsRasterDataProvider *dataProvider, int bandNo, QPainter* p,
QgsRasterViewPort* viewPort, const QgsMapToPixel* mapToPixel, double* mGeoTransform );
~QgsRasterImageBuffer();
void reset( int maxPixelsInVirtualMemory = 5000000 );
/**Returns a pointer to the next scan line (or 0 if end)*/
bool nextScanLine( QRgb** imageScanLine, void** rasterScanLine );

void setWritingEnabled( bool enabled ) { mWritingEnabled = enabled; }

private:
QgsRasterImageBuffer(); //forbidden
/**Creates next part image. Returns false if at end*/
bool createNextPartImage();

/**Peter's fix for zoomed in rasters*/
void drawPixelRectangle();

QgsRasterDataProvider* mDataProvider;
int mBandNo;
QPainter* mPainter;
QgsRasterViewPort* mViewPort;
const QgsMapToPixel* mMapToPixel;
double* mGeoTransform;

bool mValid;
/**True (default), if values are written to an image. If false, the class only reads the values, but does not create an image*/
bool mWritingEnabled;
/**Draws the raster pixels as rectangles. This is only used if the map units per pixel is very, very small*/
bool mDrawPixelRect;
int mCurrentRow;
int mNumPartImages; //number of part images
int mNumRasterRowsPerPart; //number of (raster source) rows per part
int mCurrentPartRasterMin; //minimum (raster source) row of current image
int mCurrentPartRasterMax; //maximum (raster source) row of current image
int mCurrentPartImageRow; //current image row
int mNumCurrentImageRows; //number of image rows for the current part

int mCurrentPart;

//current memory image and gdal scan data
QImage* mCurrentImage;
void* mCurrentGDALData;
};

#endif