mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
Added more logic to determine the drawing style for the raster layer.
git-svn-id: http://svn.osgeo.org/qgis/trunk@552 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
f7680e3854
commit
ad6e65bbe8
@ -79,9 +79,9 @@ QgsRasterLayerProperties::QgsRasterLayerProperties(QgsMapLayer * lyr) : QgsRaste
|
|||||||
//
|
//
|
||||||
cboColorMap->insertItem("Grayscale");
|
cboColorMap->insertItem("Grayscale");
|
||||||
cboColorMap->insertItem("Pseudocolor");
|
cboColorMap->insertItem("Pseudocolor");
|
||||||
if (rasterLayer->getDrawingStyle()==QgsRasterLayer::SINGLE_BAND_PSEUDO_COLOR ||
|
if (rasterLayer->getDrawingStyle()==QgsRasterLayer::SINGLE_BAND_PSEUDO_COLOR ||
|
||||||
rasterLayer->getDrawingStyle()==QgsRasterLayer::PALETTED_SINGLE_BAND_PSEUDO_COLOR ||
|
rasterLayer->getDrawingStyle()==QgsRasterLayer::PALETTED_SINGLE_BAND_PSEUDO_COLOR ||
|
||||||
rasterLayer->getDrawingStyle()==QgsRasterLayer::MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR )
|
rasterLayer->getDrawingStyle()==QgsRasterLayer::MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR )
|
||||||
{
|
{
|
||||||
cboColorMap->setCurrentText(tr("Pseudocolor"));
|
cboColorMap->setCurrentText(tr("Pseudocolor"));
|
||||||
}
|
}
|
||||||
@ -138,7 +138,8 @@ QgsRasterLayerProperties::QgsRasterLayerProperties(QgsMapLayer * lyr) : QgsRaste
|
|||||||
++myIteratorInt)
|
++myIteratorInt)
|
||||||
{
|
{
|
||||||
|
|
||||||
RasterBandStats myRasterBandStats=rasterLayer->getRasterBandStats(myIteratorInt);
|
RasterBandStats myRasterBandStats=rasterLayer->getRasterBandStats(myIteratorInt)
|
||||||
|
;
|
||||||
//keep a list of band names for later use
|
//keep a list of band names for later use
|
||||||
myBandNameQStringList.append(myRasterBandStats.bandName);
|
myBandNameQStringList.append(myRasterBandStats.bandName);
|
||||||
}
|
}
|
||||||
@ -240,23 +241,54 @@ void QgsRasterLayerProperties::apply()
|
|||||||
{
|
{
|
||||||
if(cboColorMap->currentText()=="Pseudocolor")
|
if(cboColorMap->currentText()=="Pseudocolor")
|
||||||
{
|
{
|
||||||
std::cout << "Setting Raster Drawing Style to :: PALETTED_SINGLE_BAND_PSEUDO_COLOR" << std::endl;
|
std::cout << "Setting Raster Drawing Style to :: PALETTED_SINGLE_BAND_PSEUDO_COLOR" << std::endl;
|
||||||
rasterLayer->setDrawingStyle(QgsRasterLayer::PALETTED_SINGLE_BAND_PSEUDO_COLOR);
|
rasterLayer->setDrawingStyle(QgsRasterLayer::PALETTED_SINGLE_BAND_PSEUDO_COLOR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Setting Raster Drawing Style to :: PALETTED_SINGLE_BAND_GRAY" << std::endl;
|
std::cout << "Setting Raster Drawing Style to :: PALETTED_SINGLE_BAND_GRAY" << std::endl;
|
||||||
rasterLayer->setDrawingStyle(QgsRasterLayer::PALETTED_SINGLE_BAND_GRAY);
|
rasterLayer->setDrawingStyle(QgsRasterLayer::PALETTED_SINGLE_BAND_GRAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (rasterLayer->rasterLayerType==QgsRasterLayer::GRAY_OR_UNDEFINED)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(cboColorMap->currentText()=="Pseudocolor")
|
||||||
|
{
|
||||||
|
std::cout << "Setting Raster Drawing Style to :: SINGLE_BAND_PSEUDO_COLOR" << std::endl;
|
||||||
|
rasterLayer->setDrawingStyle(QgsRasterLayer::SINGLE_BAND_PSEUDO_COLOR);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Setting Raster Drawing Style to :: SINGLE_BAND_GRAY" << std::endl;
|
||||||
|
rasterLayer->setDrawingStyle(QgsRasterLayer::SINGLE_BAND_GRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (rasterLayer->rasterLayerType==QgsRasterLayer::MULTIBAND)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (rbtnSingleBand->isChecked()) //render in gray or pseudocolor
|
||||||
|
{
|
||||||
|
if(cboColorMap->currentText()=="Pseudocolor")
|
||||||
|
{
|
||||||
|
std::cout << "Setting Raster Drawing Style to ::MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR " << std::endl;
|
||||||
|
rasterLayer->setDrawingStyle(QgsRasterLayer::MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Setting Raster Drawing Style to :: MULTI_BAND_SINGLE_BAND_GRAY" << std::endl;
|
||||||
|
rasterLayer->setDrawingStyle(QgsRasterLayer::MULTI_BAND_SINGLE_BAND_GRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else //render in rgb color
|
else //render in rgb color
|
||||||
{
|
{
|
||||||
rasterLayer->setDrawingStyle(QgsRasterLayer::PALETTED_MULTI_BAND_COLOR);
|
rasterLayer->setDrawingStyle(QgsRasterLayer::PALETTED_MULTI_BAND_COLOR);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -267,7 +299,8 @@ void QgsRasterLayerProperties::apply()
|
|||||||
|
|
||||||
rasterLayer->setlayerName(leDisplayName->text());
|
rasterLayer->setlayerName(leDisplayName->text());
|
||||||
//see if the user would like debug overlays
|
//see if the user would like debug overlays
|
||||||
if (cboxShowDebugInfo->isChecked()==true)
|
if (cboxShowDebugInfo->isChecked()
|
||||||
|
==true)
|
||||||
{
|
{
|
||||||
rasterLayer->setShowDebugOverlayFlag(true);
|
rasterLayer->setShowDebugOverlayFlag(true);
|
||||||
}
|
}
|
||||||
@ -549,11 +582,11 @@ void QgsRasterLayerProperties::fillStatsTable()
|
|||||||
++myIteratorInt)
|
++myIteratorInt)
|
||||||
{
|
{
|
||||||
|
|
||||||
RasterBandStats myRasterBandStats=rasterLayer->getRasterBandStats(myIteratorInt);
|
RasterBandStats myRasterBandStats=rasterLayer->getRasterBandStats(myIteratorInt);
|
||||||
|
|
||||||
tblStats->setText(myRowInt,0,"Band");
|
tblStats->setText(myRowInt,0,"Band");
|
||||||
tblStats->setText(myRowInt,1,myRasterBandStats.bandName);
|
tblStats->setText(myRowInt,1,myRasterBandStats.bandName);
|
||||||
++myRowInt;
|
++myRowInt;
|
||||||
|
|
||||||
tblStats->setText(myRowInt,0,"Band No");
|
tblStats->setText(myRowInt,0,"Band No");
|
||||||
tblStats->setText(myRowInt,1,QString::number(myRasterBandStats.bandNo));
|
tblStats->setText(myRowInt,1,QString::number(myRasterBandStats.bandNo));
|
||||||
@ -586,4 +619,4 @@ void QgsRasterLayerProperties::fillStatsTable()
|
|||||||
tblStats->setText(myRowInt,1,QString::number(myRasterBandStats.noDataDouble));
|
tblStats->setText(myRowInt,1,QString::number(myRasterBandStats.noDataDouble));
|
||||||
++myRowInt;
|
++myRowInt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user