QGIS API Documentation  2.12.0-Lyon
qgsrasterrendererwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterrendererwidget.cpp
3  ---------------------------
4  begin : June 2012
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
19 #include "qgsrasterdataprovider.h"
20 #include "qgsrasterlayer.h"
21 
22 
24 {
25  QString name;
26  if ( !mRasterLayer )
27  {
28  return name;
29  }
30 
31  const QgsRasterDataProvider* provider = mRasterLayer->dataProvider();
32  if ( !provider )
33  {
34  return name;
35  }
36 
37  name = provider->generateBandName( band );
38 
39  QString colorInterp = provider->colorInterpretationName( band );
40  if ( colorInterp != "Undefined" )
41  {
42  name.append( QString( " (%1)" ).arg( colorInterp ) );
43  }
44  return name;
45 }
46 
QString & append(QChar ch)
const char * name() const
virtual QString generateBandName(int theBandNumber) const
helper function to create zero padded band names
virtual QString colorInterpretationName(int theBandNo) const
QString displayBandName(int band) const
Returns a band name for display.
QgsRasterDataProvider * dataProvider()
Returns the data provider.
Base class for raster data providers.