Skip to content
Permalink
Browse files
Raster redesign: first prototype of paletted renderer
  • Loading branch information
mhugent committed Dec 18, 2011
1 parent 20ffb06 commit 70865e5dcfb2e039a4a1d03086398800c2018419
Showing with 20 additions and 0 deletions.
  1. +3 −0 src/core/CMakeLists.txt
  2. +17 −0 src/core/raster/qgsrasterlayer.cpp
@@ -164,6 +164,9 @@ SET(QGIS_CORE_SRCS
raster/qgsrastershader.cpp
raster/qgsrastershaderfunction.cpp

raster/qgsrasterrenderer.cpp
raster/qgspalettedrasterrenderer.cpp

renderer/qgscontinuouscolorrenderer.cpp
renderer/qgsgraduatedsymbolrenderer.cpp
renderer/qgsrenderer.cpp
@@ -36,6 +36,9 @@ email : tim at linfiniti.com
#include "qgsfreakoutshader.h"
#include "qgscolorrampshader.h"

//renderers
#include "qgspalettedrasterrenderer.h"

#include <cstdio>
#include <cmath>
#include <limits>
@@ -833,8 +836,22 @@ void QgsRasterLayer::draw( QPainter * theQPainter,
{
QgsDebugMsg( "PalettedColor drawing type detected..." );

//test
int bNumber = bandNumber( mGrayBandName );
QList<QgsColorRampShader::ColorRampItem> itemList = mRasterStatsList[ bNumber - 1].colorTable;
QColor* colorArray = new QColor[itemList.size()];
QList<QgsColorRampShader::ColorRampItem>::const_iterator colorIt = itemList.constBegin();
for ( ; colorIt != itemList.constEnd(); ++colorIt )
{
colorArray[( int )colorIt->value] = colorIt->color;
}

QgsPalettedRasterRenderer renderer( mDataProvider, bNumber, colorArray, itemList.size() );
renderer.draw( theQPainter, theRasterViewPort, theQgsMapToPixel );
#if 0
drawPalettedSingleBandColor( theQPainter, theRasterViewPort,
theQgsMapToPixel, bandNumber( mGrayBandName ) );
#endif //0
break;
}
// a "Palette" layer drawn in gray scale (using only one of the color components)

0 comments on commit 70865e5

Please sign in to comment.