Skip to content

Commit

Permalink
Updates for raster props dialog
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@14629 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Nov 14, 2010
1 parent ca7b6c7 commit 60cb36c
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 316 deletions.
153 changes: 74 additions & 79 deletions src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -282,7 +282,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv


QSettings settings; QSettings settings;
restoreGeometry( settings.value( "/Windows/RasterLayerProperties/geometry" ).toByteArray() ); restoreGeometry( settings.value( "/Windows/RasterLayerProperties/geometry" ).toByteArray() );
listWidget->setCurrentRow( settings.value( "/Windows/RasterLayerProperties/row" ).toInt() ); tabBar->setCurrentIndex( settings.value( "/Windows/RasterLayerProperties/row" ).toInt() );


setWindowTitle( tr( "Layer Properties - %1" ).arg( lyr->name() ) ); setWindowTitle( tr( "Layer Properties - %1" ).arg( lyr->name() ) );
int myHistogramTab = 6; int myHistogramTab = 6;
Expand All @@ -297,7 +297,7 @@ QgsRasterLayerProperties::~QgsRasterLayerProperties()
{ {
QSettings settings; QSettings settings;
settings.setValue( "/Windows/RasterLayerProperties/geometry", saveGeometry() ); settings.setValue( "/Windows/RasterLayerProperties/geometry", saveGeometry() );
settings.setValue( "/Windows/RasterLayerProperties/row", listWidget->currentRow() ); settings.setValue( "/Windows/RasterLayerProperties/row", tabBar->currentIndex() );
if ( mPixelSelectorTool ) if ( mPixelSelectorTool )
{ {
delete mPixelSelectorTool; delete mPixelSelectorTool;
Expand Down Expand Up @@ -529,26 +529,15 @@ void QgsRasterLayerProperties::sync()


if ( mRasterLayerIsWms ) if ( mRasterLayerIsWms )
{ {
QListWidgetItem *symbologyItem = listWidget->item( 0 ); delete tabPageSymbology;
QListWidgetItem *colormapItem = listWidget->item( 2 ); delete tabPageColormap;
QListWidgetItem *metadataItem = listWidget->item( 4 ); delete tabPagePyramids;
QListWidgetItem *pyramidItem = listWidget->item( 5 ); delete tabPageHistogram;
QListWidgetItem *histogramItem = listWidget->item( 6 );

delete symbologyItem;
delete colormapItem;
delete pyramidItem;
delete histogramItem;

tabBar->removeWidget( tabPageSymbology );
tabBar->removeWidget( tabPageColormap );
tabBar->removeWidget( tabPagePyramids );
tabBar->removeWidget( tabPageHistogram );


gboxNoDataValue->setEnabled( false ); gboxNoDataValue->setEnabled( false );
gboxCustomTransparency->setEnabled( false ); gboxCustomTransparency->setEnabled( false );


listWidget->setCurrentItem( metadataItem ); tabBar->setCurrentWidget( tabPageMetadata );
} }


#if 0 #if 0
Expand Down Expand Up @@ -601,29 +590,32 @@ void QgsRasterLayerProperties::sync()
cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "User Defined" ) ) ); cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "User Defined" ) ) );
} }
} }
else else if ( !mRasterLayerIsWms )
{ {
cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "Grayscale" ) ) ); cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "Grayscale" ) ) );
} }


//set whether the layer histogram should be inverted if ( !mRasterLayerIsWms )
if ( mRasterLayer->invertHistogram() )
{ {
cboxInvertColorMap->setChecked( true ); //set whether the layer histogram should be inverted
} if ( mRasterLayer->invertHistogram() )
else {
{ cboxInvertColorMap->setChecked( true );
cboxInvertColorMap->setChecked( false ); }
} else
{
cboxInvertColorMap->setChecked( false );
}


//set the combos to the correct values //set the combos to the correct values
cboRed->setCurrentIndex( cboRed->findText( mRasterLayer->redBandName() ) ); cboRed->setCurrentIndex( cboRed->findText( mRasterLayer->redBandName() ) );
cboGreen->setCurrentIndex( cboGreen->findText( mRasterLayer->greenBandName() ) ); cboGreen->setCurrentIndex( cboGreen->findText( mRasterLayer->greenBandName() ) );
cboBlue->setCurrentIndex( cboBlue->findText( mRasterLayer->blueBandName() ) ); cboBlue->setCurrentIndex( cboBlue->findText( mRasterLayer->blueBandName() ) );
cboGray->setCurrentIndex( cboGray->findText( mRasterLayer->grayBandName() ) ); cboGray->setCurrentIndex( cboGray->findText( mRasterLayer->grayBandName() ) );


//set the stdDevs and min max values //set the stdDevs and min max values
mDefaultStandardDeviation = myQSettings.value( "/Raster/defaultStandardDeviation", 2.0 ).toDouble(); mDefaultStandardDeviation = myQSettings.value( "/Raster/defaultStandardDeviation", 2.0 ).toDouble();
}
if ( mRasterLayerIsGdal && rbtnThreeBand->isChecked() ) if ( mRasterLayerIsGdal && rbtnThreeBand->isChecked() )
{ {
mRGBMinimumMaximumEstimated = mRasterLayer->isRGBMinimumMaximumEstimated(); mRGBMinimumMaximumEstimated = mRasterLayer->isRGBMinimumMaximumEstimated();
Expand Down Expand Up @@ -709,54 +701,57 @@ void QgsRasterLayerProperties::sync()
setMinimumMaximumEstimateWarning(); setMinimumMaximumEstimateWarning();
} }


//set color scaling algorithm if ( !mRasterLayerIsWms )
if ( QgsContrastEnhancement::StretchToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
{ {
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Stretch To MinMax" ) ) ); //set color scaling algorithm
} if ( QgsContrastEnhancement::StretchToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
else if ( QgsContrastEnhancement::StretchAndClipToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() ) {
{ cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Stretch To MinMax" ) ) );
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Stretch And Clip To MinMax" ) ) ); }
} else if ( QgsContrastEnhancement::StretchAndClipToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
else if ( QgsContrastEnhancement::ClipToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() ) {
{ cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Stretch And Clip To MinMax" ) ) );
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Clip To MinMax" ) ) ); }
} else if ( QgsContrastEnhancement::ClipToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
else if ( QgsContrastEnhancement::UserDefinedEnhancement == mRasterLayer->contrastEnhancementAlgorithm() ) {
{ cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Clip To MinMax" ) ) );
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "User Defined" ) ) ); }
} else if ( QgsContrastEnhancement::UserDefinedEnhancement == mRasterLayer->contrastEnhancementAlgorithm() )
else {
{ cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "User Defined" ) ) );
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "No Stretch" ) ) ); }
} else
{
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "No Stretch" ) ) );
}


//Display the current default contrast enhancement algorithm //Display the current default contrast enhancement algorithm
mDefaultRedBand = myQSettings.value( "/Raster/defaultRedBand", 1 ).toInt(); mDefaultRedBand = myQSettings.value( "/Raster/defaultRedBand", 1 ).toInt();
mDefaultGreenBand = myQSettings.value( "/Raster/defaultGreenBand", 2 ).toInt(); mDefaultGreenBand = myQSettings.value( "/Raster/defaultGreenBand", 2 ).toInt();
mDefaultBlueBand = myQSettings.value( "/Raster/defaultBlueBand", 3 ).toInt(); mDefaultBlueBand = myQSettings.value( "/Raster/defaultBlueBand", 3 ).toInt();
labelDefaultBandCombination->setText( tr( "Default R:%1 G:%2 B:%3" ).arg( mDefaultRedBand ) .arg( mDefaultGreenBand ) .arg( mDefaultBlueBand ) ); labelDefaultBandCombination->setText( tr( "Default R:%1 G:%2 B:%3" ).arg( mDefaultRedBand ) .arg( mDefaultGreenBand ) .arg( mDefaultBlueBand ) );


mDefaultContrastEnhancementAlgorithm = myQSettings.value( "/Raster/defaultContrastEnhancementAlgorithm", "NoEnhancement" ).toString(); mDefaultContrastEnhancementAlgorithm = myQSettings.value( "/Raster/defaultContrastEnhancementAlgorithm", "NoEnhancement" ).toString();
if ( mDefaultContrastEnhancementAlgorithm == "NoEnhancement" ) if ( mDefaultContrastEnhancementAlgorithm == "NoEnhancement" )
{ {
labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) ); labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) );
} }
if ( mDefaultContrastEnhancementAlgorithm == "StretchToMinimumMaximum" ) if ( mDefaultContrastEnhancementAlgorithm == "StretchToMinimumMaximum" )
{ {
labelDefaultContrastEnhancementAlgorithm->setText( tr( "Stretch To MinMax" ) ); labelDefaultContrastEnhancementAlgorithm->setText( tr( "Stretch To MinMax" ) );
} }
else if ( mDefaultContrastEnhancementAlgorithm == "StretchAndClipToMinimumMaximum" ) else if ( mDefaultContrastEnhancementAlgorithm == "StretchAndClipToMinimumMaximum" )
{ {
labelDefaultContrastEnhancementAlgorithm->setText( tr( "Stretch And Clip To MinMax" ) ); labelDefaultContrastEnhancementAlgorithm->setText( tr( "Stretch And Clip To MinMax" ) );
} }
else if ( mDefaultContrastEnhancementAlgorithm == "ClipToMinimumMaximum" ) else if ( mDefaultContrastEnhancementAlgorithm == "ClipToMinimumMaximum" )
{ {
labelDefaultContrastEnhancementAlgorithm->setText( tr( "Clip To MinMax" ) ); labelDefaultContrastEnhancementAlgorithm->setText( tr( "Clip To MinMax" ) );
} }
else else
{ {
labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) ); labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) );
}
} }


QgsDebugMsg( "populate transparency tab" ); QgsDebugMsg( "populate transparency tab" );
Expand Down

0 comments on commit 60cb36c

Please sign in to comment.