Skip to content

Commit

Permalink
enable/disable better stretch histogram action
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15714 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Apr 15, 2011
1 parent 8a3a5a5 commit 0ba6f3e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
18 changes: 13 additions & 5 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6040,15 +6040,23 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
else if ( layer->type() == QgsMapLayer::RasterLayer )
{
const QgsRasterLayer *rlayer = qobject_cast<const QgsRasterLayer *>( layer );
if ( rlayer->providerKey() == "wms" )
if ( rlayer->dataProvider()->dataType( 1 ) != QgsRasterDataProvider::ARGBDataType )
{
mActionLocalHistogramStretch->setEnabled( false );
mActionFullHistogramStretch->setEnabled( false );
if ( rlayer->dataProvider()->capabilities() & QgsRasterDataProvider::Size )
{
mActionFullHistogramStretch->setEnabled( true );
}
else
{
// it would hang up reading the data for WMS for example
mActionFullHistogramStretch->setEnabled( false );
}
mActionLocalHistogramStretch->setEnabled( true );
}
else
{
mActionLocalHistogramStretch->setEnabled( true );
mActionFullHistogramStretch->setEnabled( true );
mActionLocalHistogramStretch->setEnabled( false );
mActionFullHistogramStretch->setEnabled( false );
}
mActionLayerSubsetString->setEnabled( false );
mActionSelect->setEnabled( false );
Expand Down
10 changes: 8 additions & 2 deletions src/providers/gdal/qgsgdalprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1126,8 +1126,14 @@ int QgsGdalProvider::capabilities() const
| QgsRasterDataProvider::ExactResolution
| QgsRasterDataProvider::EstimatedMinimumMaximum
| QgsRasterDataProvider::BuildPyramids
| QgsRasterDataProvider::Histogram
| QgsRasterDataProvider::Size;
| QgsRasterDataProvider::Histogram;
GDALDriverH myDriver = GDALGetDatasetDriver( mGdalDataset );
QString name = GDALGetDriverShortName( myDriver );
QgsDebugMsg( "driver short name = " + name );
if ( name != "WMS" )
{
capability |= QgsRasterDataProvider::Size;
}
return capability;
}

Expand Down

0 comments on commit 0ba6f3e

Please sign in to comment.