QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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