mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Added QgsRasterLayer::filterLayer which gets called near the end of each of the 8 renderers. This is the place to inline filters. Note taht eventually filters will be hived out to a filter plugin mechanism.
git-svn-id: http://svn.osgeo.org/qgis/trunk@985 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
c9261d9ba4
commit
f3c97369a7
@ -622,6 +622,8 @@ void QgsRasterLayer::drawSingleBandGray(QPainter * theQPainter, RasterViewPort *
|
||||
}
|
||||
}
|
||||
}
|
||||
//render any inline filters
|
||||
filterLayer(&myQImage);
|
||||
//part of the experimental transaparency support
|
||||
theQPainter->drawImage(theRasterViewPort->topLeftPoint.xToInt(), theRasterViewPort->topLeftPoint.yToInt(), myQImage);
|
||||
}
|
||||
@ -725,6 +727,7 @@ void QgsRasterLayer::drawSingleBandPseudoColor(QPainter * theQPainter, RasterVie
|
||||
//check if we are in the first class break
|
||||
if ((myInt >= myClassBreakMin1) && (myInt < myClassBreakMax1))
|
||||
{
|
||||
std::cout << "Class break 1 value : " << myInt << endl;
|
||||
myRedInt = 0;
|
||||
myBlueInt = 255;
|
||||
myGreenInt =
|
||||
@ -733,6 +736,7 @@ void QgsRasterLayer::drawSingleBandPseudoColor(QPainter * theQPainter, RasterVie
|
||||
//check if we are in the second class break
|
||||
else if ((myInt >= myClassBreakMin2) && (myInt < myClassBreakMax2))
|
||||
{
|
||||
std::cout << "Class break 2 value : " << myInt << endl;
|
||||
myRedInt =
|
||||
static_cast < int >(((255 / myAdjustedRasterBandStats.rangeDouble) * ((myInt - myClassBreakMin2) / 1)) * 3);
|
||||
myBlueInt =
|
||||
@ -743,6 +747,7 @@ void QgsRasterLayer::drawSingleBandPseudoColor(QPainter * theQPainter, RasterVie
|
||||
//otherwise we must be in the third classbreak
|
||||
else
|
||||
{
|
||||
std::cout << "Class break 3 value : " << myInt << endl;
|
||||
myRedInt = 255;
|
||||
myBlueInt = 0;
|
||||
myGreenInt =
|
||||
@ -787,6 +792,8 @@ void QgsRasterLayer::drawSingleBandPseudoColor(QPainter * theQPainter, RasterVie
|
||||
}
|
||||
} //end of columnwise loop
|
||||
} //end of towwise loop
|
||||
//render any inline filters
|
||||
filterLayer(&myQImage);
|
||||
//draw with the experimental transaparency support
|
||||
theQPainter->drawImage(theRasterViewPort->topLeftPoint.xToInt(), theRasterViewPort->topLeftPoint.yToInt(), myQImage);
|
||||
}
|
||||
@ -867,6 +874,8 @@ void QgsRasterLayer::drawPalettedSingleBandGray(QPainter * theQPainter,
|
||||
}
|
||||
}
|
||||
}
|
||||
//render any inline filters
|
||||
filterLayer(&myQImage);
|
||||
//part of the experimental transaparency support
|
||||
theQPainter->drawImage(theRasterViewPort->topLeftPoint.xToInt(), theRasterViewPort->topLeftPoint.yToInt(), myQImage);
|
||||
}
|
||||
@ -1064,6 +1073,8 @@ void QgsRasterLayer::drawPalettedSingleBandPseudoColor(QPainter * theQPainter,
|
||||
}
|
||||
}
|
||||
|
||||
//render any inline filters
|
||||
filterLayer(&myQImage);
|
||||
//part of the experimental transaparency support
|
||||
theQPainter->drawImage(theRasterViewPort->topLeftPoint.xToInt(), theRasterViewPort->topLeftPoint.yToInt(), myQImage);
|
||||
}
|
||||
@ -1157,6 +1168,8 @@ void QgsRasterLayer::drawPalettedMultiBandColor(QPainter * theQPainter, RasterVi
|
||||
}
|
||||
}
|
||||
}
|
||||
//render any inline filters
|
||||
filterLayer(&myQImage);
|
||||
//part of the experimental transaparency support
|
||||
theQPainter->drawImage(theRasterViewPort->topLeftPoint.xToInt(), theRasterViewPort->topLeftPoint.yToInt(), myQImage);
|
||||
|
||||
@ -1248,6 +1261,8 @@ void QgsRasterLayer::drawMultiBandColor(QPainter * theQPainter, RasterViewPort *
|
||||
myQImage.setPixel(myRowInt, myColumnInt, qRgba(myRedValueInt, myGreenValueInt, myBlueValueInt, transparencyLevelInt));
|
||||
}
|
||||
}
|
||||
//render any inline filters
|
||||
filterLayer(&myQImage);
|
||||
//part of the experimental transaparency support
|
||||
theQPainter->drawImage(theRasterViewPort->topLeftPoint.xToInt(), theRasterViewPort->topLeftPoint.yToInt(), myQImage);
|
||||
|
||||
@ -1257,6 +1272,15 @@ void QgsRasterLayer::drawMultiBandColor(QPainter * theQPainter, RasterViewPort *
|
||||
CPLFree(myGdalBlueData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call any inline filters
|
||||
*/
|
||||
void QgsRasterLayer::filterLayer(QImage * theQImage)
|
||||
{
|
||||
//do stuff here....
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
Print some debug info to the qpainter
|
||||
*/
|
||||
|
@ -177,7 +177,7 @@ The [type] part of the variable should be the type class of the variable written
|
||||
class QgsRect;
|
||||
class GDALDataset;
|
||||
class GDALRasterBand;
|
||||
|
||||
class QImage;
|
||||
|
||||
//
|
||||
// Structs
|
||||
@ -368,6 +368,8 @@ public:
|
||||
unsigned int getTransparency();
|
||||
/** \brief Mutator for transparency level. Should be between 0 and 255 */
|
||||
void setTransparency(unsigned int); //
|
||||
/** \brief Call any inline image manipulation filters */
|
||||
void filterLayer(QImage * theQImage);
|
||||
/** \brief Accessor for red band name (allows alternate mappings e.g. map blue as red colour). */
|
||||
QString getRedBandName()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user