Skip to content

Commit

Permalink
-some adjustments to the raster API as suggested by Timlinux
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@9566 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
ersts committed Nov 6, 2008
1 parent bfdb512 commit 8d970bf
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 85 deletions.
2 changes: 1 addition & 1 deletion python/core/qgscontrastenhancement.sip
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public:
StretchToMinimumMaximum, //linear histogram enhanceContrast
StretchAndClipToMinimumMaximum,
ClipToMinimumMaximum,
UserDefined
UserDefinedEnhancement
};

/*! These are exactly the same as GDAL pixel data types */
Expand Down
14 changes: 7 additions & 7 deletions python/core/qgsrasterlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public:
/** \brief This enumerator describes the types of shading that can be used */
enum ColorShadingAlgorithm
{
UndefinedShadingAlgorithm,
PseudoColor,
FreakOut,
ColorRamp,
UserDefined
UndefinedShader,
PseudoColorShader,
FreakOutShader,
ColorRampShader,
UserDefinedShader
};

/** \brief This enumerator describes the different kinds of drawing we can do */
Expand Down Expand Up @@ -214,7 +214,7 @@ public:
void setRGBMinimumMaximumEstimated( bool theBool );

/** \brief Mutator to alter the number of standard deviations that should be plotted */
void setStandardDeviationsToPlot( double theStdDevsToPlot );
void setStandardDeviations( double theStdDevsToPlot );

/** \brief Mutator for mUserDefinedGrayMinimumMaximum */
void setUserDefinedGrayMinimumMaximum( bool theBool );
Expand All @@ -223,7 +223,7 @@ public:
void setUserDefinedRGBMinimumMaximum( bool theBool );

/** \brief Accessor to find out how many standard deviations are being plotted */
double standardDeviationsToPlot() const;
double standardDeviations() const;

/** \brief Accessor for transparent band name mapping */
QString transparentBandName() const;
Expand Down
44 changes: 22 additions & 22 deletions src/app/qgsrasterlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,19 +588,19 @@ void QgsRasterLayerProperties::sync()
mRasterLayer->drawingStyle() == QgsRasterLayer::PalettedSingleBandPseudoColor ||
mRasterLayer->drawingStyle() == QgsRasterLayer::MultiBandSingleBandPseudoColor )
{
if ( mRasterLayer->colorShadingAlgorithm() == QgsRasterLayer::PseudoColor )
if ( mRasterLayer->colorShadingAlgorithm() == QgsRasterLayer::PseudoColorShader )
{
cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "Pseudocolor" ) ) );
}
else if ( mRasterLayer->colorShadingAlgorithm() == QgsRasterLayer::FreakOut )
else if ( mRasterLayer->colorShadingAlgorithm() == QgsRasterLayer::FreakOutShader )
{
cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "Freak Out" ) ) );
}
else if ( mRasterLayer->colorShadingAlgorithm() == QgsRasterLayer::ColorRamp )
else if ( mRasterLayer->colorShadingAlgorithm() == QgsRasterLayer::ColorRampShader )
{
cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "Colormap" ) ) );
}
else if ( mRasterLayer->colorShadingAlgorithm() == QgsRasterLayer::UserDefined )
else if ( mRasterLayer->colorShadingAlgorithm() == QgsRasterLayer::UserDefinedShader )
{
cboxColorMap->setCurrentIndex( cboxColorMap->findText( tr( "User Defined" ) ) );
}
Expand Down Expand Up @@ -638,7 +638,7 @@ void QgsRasterLayerProperties::sync()
}
else
{
sboxThreeBandStdDev->setValue( mRasterLayer->standardDeviationsToPlot() );
sboxThreeBandStdDev->setValue( mRasterLayer->standardDeviations() );
rbtnThreeBandStdDev->setChecked( true );
rbtnThreeBandMinMax->setChecked( false );
}
Expand Down Expand Up @@ -677,7 +677,7 @@ void QgsRasterLayerProperties::sync()
}
else
{
sboxSingleBandStdDev->setValue( mRasterLayer->standardDeviationsToPlot() );
sboxSingleBandStdDev->setValue( mRasterLayer->standardDeviations() );
rbtnSingleBandStdDev->setChecked( true );
rbtnSingleBandMinMax->setChecked( false );
}
Expand Down Expand Up @@ -709,7 +709,7 @@ void QgsRasterLayerProperties::sync()
{
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "Clip To MinMax" ) ) );
}
else if ( QgsContrastEnhancement::UserDefined == mRasterLayer->contrastEnhancementAlgorithm() )
else if ( QgsContrastEnhancement::UserDefinedEnhancement == mRasterLayer->contrastEnhancementAlgorithm() )
{
cboxContrastEnhancementAlgorithm->setCurrentIndex( cboxContrastEnhancementAlgorithm->findText( tr( "User Defined" ) ) );
}
Expand Down Expand Up @@ -851,7 +851,7 @@ void QgsRasterLayerProperties::syncColormapTab()
return;
}

if ( QgsRasterLayer::ColorRamp != mRasterLayer->colorShadingAlgorithm() )
if ( QgsRasterLayer::ColorRampShader != mRasterLayer->colorShadingAlgorithm() )
{
return;
}
Expand Down Expand Up @@ -1059,15 +1059,15 @@ void QgsRasterLayerProperties::apply()
//If UserDefined do nothing, user defined can only be set programatically
if ( cboxColorMap->currentText() == tr( "Pseudocolor" ) )
{
mRasterLayer->setColorShadingAlgorithm( QgsRasterLayer::PseudoColor );
mRasterLayer->setColorShadingAlgorithm( QgsRasterLayer::PseudoColorShader );
}
else if ( cboxColorMap->currentText() == tr( "Freak Out" ) )
{
mRasterLayer->setColorShadingAlgorithm( QgsRasterLayer::FreakOut );
mRasterLayer->setColorShadingAlgorithm( QgsRasterLayer::FreakOutShader );
}
else if ( cboxColorMap->currentText() == tr( "Colormap" ) )
{
mRasterLayer->setColorShadingAlgorithm( QgsRasterLayer::ColorRamp );
mRasterLayer->setColorShadingAlgorithm( QgsRasterLayer::ColorRampShader );
}

//set the color scaling algorithm
Expand All @@ -1086,7 +1086,7 @@ void QgsRasterLayerProperties::apply()
{
mRasterLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::ClipToMinimumMaximum, false );
}
else if ( QgsContrastEnhancement::UserDefined == mRasterLayer->contrastEnhancementAlgorithm() )
else if ( QgsContrastEnhancement::UserDefinedEnhancement == mRasterLayer->contrastEnhancementAlgorithm() )
{
//do nothing
}
Expand Down Expand Up @@ -1117,17 +1117,17 @@ void QgsRasterLayerProperties::apply()
mRasterLayer->setMinimumValue( cboBlue->currentText(), leBlueMin->text().toDouble(), false );
mRasterLayer->setMaximumValue( cboBlue->currentText(), leBlueMax->text().toDouble() );
}
mRasterLayer->setStandardDeviationsToPlot( 0.0 );
mRasterLayer->setStandardDeviations( 0.0 );
mRasterLayer->setUserDefinedRGBMinimumMaximum( true );
}
else if ( rbtnThreeBandStdDev->isEnabled() && rbtnThreeBandStdDev->isChecked() )
{
mRasterLayer->setStandardDeviationsToPlot( sboxThreeBandStdDev->value() );
mRasterLayer->setStandardDeviations( sboxThreeBandStdDev->value() );
mRasterLayer->setUserDefinedRGBMinimumMaximum( false );
}
else
{
mRasterLayer->setStandardDeviationsToPlot( 0.0 );
mRasterLayer->setStandardDeviations( 0.0 );
mRasterLayer->setUserDefinedRGBMinimumMaximum( false );
}
}
Expand All @@ -1142,17 +1142,17 @@ void QgsRasterLayerProperties::apply()
mRasterLayer->setMinimumValue( cboGray->currentText(), leGrayMin->text().toDouble(), false );
mRasterLayer->setMaximumValue( cboGray->currentText(), leGrayMax->text().toDouble() );
}
mRasterLayer->setStandardDeviationsToPlot( 0.0 );
mRasterLayer->setStandardDeviations( 0.0 );
mRasterLayer->setUserDefinedGrayMinimumMaximum( true );
}
else if ( rbtnSingleBandStdDev->isEnabled() && rbtnSingleBandStdDev->isChecked() )
{
mRasterLayer->setStandardDeviationsToPlot( sboxSingleBandStdDev->value() );
mRasterLayer->setStandardDeviations( sboxSingleBandStdDev->value() );
mRasterLayer->setUserDefinedGrayMinimumMaximum( false );
}
else
{
mRasterLayer->setStandardDeviationsToPlot( 0.0 );
mRasterLayer->setStandardDeviations( 0.0 );
mRasterLayer->setUserDefinedGrayMinimumMaximum( false );
}
}
Expand Down Expand Up @@ -1468,7 +1468,7 @@ void QgsRasterLayerProperties::apply()
{
if ( rbtnThreeBandStdDev->isEnabled() )
{
sboxThreeBandStdDev->setValue( mRasterLayer->standardDeviationsToPlot() );
sboxThreeBandStdDev->setValue( mRasterLayer->standardDeviations() );
}

if ( rbtnThreeBandMinMax->isEnabled() )
Expand Down Expand Up @@ -1496,7 +1496,7 @@ void QgsRasterLayerProperties::apply()
{
if ( rbtnSingleBandStdDev->isEnabled() )
{
sboxSingleBandStdDev->setValue( mRasterLayer->standardDeviationsToPlot() );
sboxSingleBandStdDev->setValue( mRasterLayer->standardDeviations() );
}

if ( rbtnSingleBandMinMax->isEnabled() )
Expand Down Expand Up @@ -2390,7 +2390,7 @@ void QgsRasterLayerProperties::on_rbtnSingleBand_toggled( bool theState )
}
else
{
sboxSingleBandStdDev->setValue( mRasterLayer->standardDeviationsToPlot() );
sboxSingleBandStdDev->setValue( mRasterLayer->standardDeviations() );
rbtnSingleBandStdDev->setChecked( true );
}

Expand Down Expand Up @@ -2471,7 +2471,7 @@ void QgsRasterLayerProperties::on_rbtnThreeBand_toggled( bool theState )
}
else
{
sboxThreeBandStdDev->setValue( mRasterLayer->standardDeviationsToPlot() );
sboxThreeBandStdDev->setValue( mRasterLayer->standardDeviations() );
rbtnThreeBandStdDev->setChecked( true );
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/raster/qgscontrastenhancement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void QgsContrastEnhancement::setContrastEnhancementAlgorithm( ContrastEnhancemen
case ClipToMinimumMaximum :
mContrastEnhancementFunction = new QgsClipToMinMaxEnhancement( mRasterDataType, mMinimumValue, mMaximumValue );
break;
case UserDefined :
case UserDefinedEnhancement :
//Do nothing
break;
default:
Expand Down Expand Up @@ -281,7 +281,7 @@ void QgsContrastEnhancement::setContrastEnhancementFunction( QgsContrastEnhancem
if ( 0 != theFunction )
{
mContrastEnhancementFunction = theFunction;
mContrastEnhancementAlgorithm = UserDefined;
mContrastEnhancementAlgorithm = UserDefinedEnhancement;
generateLookupTable();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgscontrastenhancement.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CORE_EXPORT QgsContrastEnhancement
StretchToMinimumMaximum, //linear histogram enhanceContrast
StretchAndClipToMinimumMaximum,
ClipToMinimumMaximum,
UserDefined
UserDefinedEnhancement
};

/** These are exactly the same as GDAL pixel data types
Expand Down
Loading

0 comments on commit 8d970bf

Please sign in to comment.