Skip to content

Commit 3862f6d

Browse files
author
timlinux
committedNov 14, 2010
Updates for raster props dialog
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14629 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 247783b commit 3862f6d

File tree

2 files changed

+180
-316
lines changed

2 files changed

+180
-316
lines changed
 

‎src/app/qgsrasterlayerproperties.cpp

Lines changed: 74 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
282282

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

287287
setWindowTitle( tr( "Layer Properties - %1" ).arg( lyr->name() ) );
288288
int myHistogramTab = 6;
@@ -297,7 +297,7 @@ QgsRasterLayerProperties::~QgsRasterLayerProperties()
297297
{
298298
QSettings settings;
299299
settings.setValue( "/Windows/RasterLayerProperties/geometry", saveGeometry() );
300-
settings.setValue( "/Windows/RasterLayerProperties/row", listWidget->currentRow() );
300+
settings.setValue( "/Windows/RasterLayerProperties/row", tabBar->currentIndex() );
301301
if ( mPixelSelectorTool )
302302
{
303303
delete mPixelSelectorTool;
@@ -529,26 +529,15 @@ void QgsRasterLayerProperties::sync()
529529

530530
if ( mRasterLayerIsWms )
531531
{
532-
QListWidgetItem *symbologyItem = listWidget->item( 0 );
533-
QListWidgetItem *colormapItem = listWidget->item( 2 );
534-
QListWidgetItem *metadataItem = listWidget->item( 4 );
535-
QListWidgetItem *pyramidItem = listWidget->item( 5 );
536-
QListWidgetItem *histogramItem = listWidget->item( 6 );
537-
538-
delete symbologyItem;
539-
delete colormapItem;
540-
delete pyramidItem;
541-
delete histogramItem;
542-
543-
tabBar->removeWidget( tabPageSymbology );
544-
tabBar->removeWidget( tabPageColormap );
545-
tabBar->removeWidget( tabPagePyramids );
546-
tabBar->removeWidget( tabPageHistogram );
532+
delete tabPageSymbology;
533+
delete tabPageColormap;
534+
delete tabPagePyramids;
535+
delete tabPageHistogram;
547536

548537
gboxNoDataValue->setEnabled( false );
549538
gboxCustomTransparency->setEnabled( false );
550539

551-
listWidget->setCurrentItem( metadataItem );
540+
tabBar->setCurrentWidget( tabPageMetadata );
552541
}
553542

554543
#if 0
@@ -601,29 +590,32 @@ void QgsRasterLayerProperties::sync()
601590
cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "User Defined" ) ) );
602591
}
603592
}
604-
else
593+
else if ( !mRasterLayerIsWms )
605594
{
606595
cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "Grayscale" ) ) );
607596
}
608597

609-
//set whether the layer histogram should be inverted
610-
if ( mRasterLayer->invertHistogram() )
598+
if ( !mRasterLayerIsWms )
611599
{
612-
cboxInvertColorMap->setChecked( true );
613-
}
614-
else
615-
{
616-
cboxInvertColorMap->setChecked( false );
617-
}
600+
//set whether the layer histogram should be inverted
601+
if ( mRasterLayer->invertHistogram() )
602+
{
603+
cboxInvertColorMap->setChecked( true );
604+
}
605+
else
606+
{
607+
cboxInvertColorMap->setChecked( false );
608+
}
618609

619-
//set the combos to the correct values
620-
cboRed->setCurrentIndex( cboRed->findText( mRasterLayer->redBandName() ) );
621-
cboGreen->setCurrentIndex( cboGreen->findText( mRasterLayer->greenBandName() ) );
622-
cboBlue->setCurrentIndex( cboBlue->findText( mRasterLayer->blueBandName() ) );
623-
cboGray->setCurrentIndex( cboGray->findText( mRasterLayer->grayBandName() ) );
610+
//set the combos to the correct values
611+
cboRed->setCurrentIndex( cboRed->findText( mRasterLayer->redBandName() ) );
612+
cboGreen->setCurrentIndex( cboGreen->findText( mRasterLayer->greenBandName() ) );
613+
cboBlue->setCurrentIndex( cboBlue->findText( mRasterLayer->blueBandName() ) );
614+
cboGray->setCurrentIndex( cboGray->findText( mRasterLayer->grayBandName() ) );
624615

625-
//set the stdDevs and min max values
626-
mDefaultStandardDeviation = myQSettings.value( "/Raster/defaultStandardDeviation", 2.0 ).toDouble();
616+
//set the stdDevs and min max values
617+
mDefaultStandardDeviation = myQSettings.value( "/Raster/defaultStandardDeviation", 2.0 ).toDouble();
618+
}
627619
if ( mRasterLayerIsGdal && rbtnThreeBand->isChecked() )
628620
{
629621
mRGBMinimumMaximumEstimated = mRasterLayer->isRGBMinimumMaximumEstimated();
@@ -709,54 +701,57 @@ void QgsRasterLayerProperties::sync()
709701
setMinimumMaximumEstimateWarning();
710702
}
711703

712-
//set color scaling algorithm
713-
if ( QgsContrastEnhancement::StretchToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
704+
if ( !mRasterLayerIsWms )
714705
{
715-
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Stretch To MinMax" ) ) );
716-
}
717-
else if ( QgsContrastEnhancement::StretchAndClipToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
718-
{
719-
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Stretch And Clip To MinMax" ) ) );
720-
}
721-
else if ( QgsContrastEnhancement::ClipToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
722-
{
723-
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Clip To MinMax" ) ) );
724-
}
725-
else if ( QgsContrastEnhancement::UserDefinedEnhancement == mRasterLayer->contrastEnhancementAlgorithm() )
726-
{
727-
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "User Defined" ) ) );
728-
}
729-
else
730-
{
731-
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "No Stretch" ) ) );
732-
}
706+
//set color scaling algorithm
707+
if ( QgsContrastEnhancement::StretchToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
708+
{
709+
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Stretch To MinMax" ) ) );
710+
}
711+
else if ( QgsContrastEnhancement::StretchAndClipToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
712+
{
713+
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Stretch And Clip To MinMax" ) ) );
714+
}
715+
else if ( QgsContrastEnhancement::ClipToMinimumMaximum == mRasterLayer->contrastEnhancementAlgorithm() )
716+
{
717+
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Clip To MinMax" ) ) );
718+
}
719+
else if ( QgsContrastEnhancement::UserDefinedEnhancement == mRasterLayer->contrastEnhancementAlgorithm() )
720+
{
721+
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "User Defined" ) ) );
722+
}
723+
else
724+
{
725+
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "No Stretch" ) ) );
726+
}
733727

734-
//Display the current default contrast enhancement algorithm
735-
mDefaultRedBand = myQSettings.value( "/Raster/defaultRedBand", 1 ).toInt();
736-
mDefaultGreenBand = myQSettings.value( "/Raster/defaultGreenBand", 2 ).toInt();
737-
mDefaultBlueBand = myQSettings.value( "/Raster/defaultBlueBand", 3 ).toInt();
738-
labelDefaultBandCombination->setText( tr( "Default R:%1 G:%2 B:%3" ).arg( mDefaultRedBand ) .arg( mDefaultGreenBand ) .arg( mDefaultBlueBand ) );
728+
//Display the current default contrast enhancement algorithm
729+
mDefaultRedBand = myQSettings.value( "/Raster/defaultRedBand", 1 ).toInt();
730+
mDefaultGreenBand = myQSettings.value( "/Raster/defaultGreenBand", 2 ).toInt();
731+
mDefaultBlueBand = myQSettings.value( "/Raster/defaultBlueBand", 3 ).toInt();
732+
labelDefaultBandCombination->setText( tr( "Default R:%1 G:%2 B:%3" ).arg( mDefaultRedBand ) .arg( mDefaultGreenBand ) .arg( mDefaultBlueBand ) );
739733

740-
mDefaultContrastEnhancementAlgorithm = myQSettings.value( "/Raster/defaultContrastEnhancementAlgorithm", "NoEnhancement" ).toString();
741-
if ( mDefaultContrastEnhancementAlgorithm == "NoEnhancement" )
742-
{
743-
labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) );
744-
}
745-
if ( mDefaultContrastEnhancementAlgorithm == "StretchToMinimumMaximum" )
746-
{
747-
labelDefaultContrastEnhancementAlgorithm->setText( tr( "Stretch To MinMax" ) );
748-
}
749-
else if ( mDefaultContrastEnhancementAlgorithm == "StretchAndClipToMinimumMaximum" )
750-
{
751-
labelDefaultContrastEnhancementAlgorithm->setText( tr( "Stretch And Clip To MinMax" ) );
752-
}
753-
else if ( mDefaultContrastEnhancementAlgorithm == "ClipToMinimumMaximum" )
754-
{
755-
labelDefaultContrastEnhancementAlgorithm->setText( tr( "Clip To MinMax" ) );
756-
}
757-
else
758-
{
759-
labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) );
734+
mDefaultContrastEnhancementAlgorithm = myQSettings.value( "/Raster/defaultContrastEnhancementAlgorithm", "NoEnhancement" ).toString();
735+
if ( mDefaultContrastEnhancementAlgorithm == "NoEnhancement" )
736+
{
737+
labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) );
738+
}
739+
if ( mDefaultContrastEnhancementAlgorithm == "StretchToMinimumMaximum" )
740+
{
741+
labelDefaultContrastEnhancementAlgorithm->setText( tr( "Stretch To MinMax" ) );
742+
}
743+
else if ( mDefaultContrastEnhancementAlgorithm == "StretchAndClipToMinimumMaximum" )
744+
{
745+
labelDefaultContrastEnhancementAlgorithm->setText( tr( "Stretch And Clip To MinMax" ) );
746+
}
747+
else if ( mDefaultContrastEnhancementAlgorithm == "ClipToMinimumMaximum" )
748+
{
749+
labelDefaultContrastEnhancementAlgorithm->setText( tr( "Clip To MinMax" ) );
750+
}
751+
else
752+
{
753+
labelDefaultContrastEnhancementAlgorithm->setText( tr( "No Stretch" ) );
754+
}
760755
}
761756

762757
QgsDebugMsg( "populate transparency tab" );

0 commit comments

Comments
 (0)