Skip to content
Permalink
Browse files
enable/disable better stretch histogram action
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15714 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Apr 15, 2011
1 parent 6bdffcc commit b9b024b5ead3f262114be0b8ab22d3dac3a69808
Showing with 21 additions and 7 deletions.
  1. +13 −5 src/app/qgisapp.cpp
  2. +8 −2 src/providers/gdal/qgsgdalprovider.cpp
@@ -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 );
@@ -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;
}

0 comments on commit b9b024b

Please sign in to comment.