QGIS API Documentation  master-59fd5e0
src/gui/raster/qgsrasterrendererwidget.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgsrasterrendererwidget.cpp
00003                          ---------------------------
00004     begin                : June 2012
00005     copyright            : (C) 2012 by Marco Hugentobler
00006     email                : marco at sourcepole dot ch
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "qgsrasterrendererwidget.h"
00019 #include "qgsrasterdataprovider.h"
00020 #include "qgsrasterlayer.h"
00021 
00022 
00023 QString QgsRasterRendererWidget::displayBandName( int band ) const
00024 {
00025   QString name;
00026   if ( !mRasterLayer )
00027   {
00028     return name;
00029   }
00030 
00031   const QgsRasterDataProvider* provider = mRasterLayer->dataProvider();
00032   if ( !provider )
00033   {
00034     return name;
00035   }
00036 
00037   name = provider->generateBandName( band );
00038 
00039   QString colorInterp = provider->colorInterpretationName( band );
00040   if ( colorInterp != "Undefined" )
00041   {
00042     name.append( QString( " (%1)" ).arg( colorInterp ) );
00043   }
00044   return name;
00045 }
00046 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines