QGIS API Documentation  2.12.0-Lyon
qgssinglebandpseudocolorrendererwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssinglebandpseudocolorrendererwidget.h
3  ----------------------------------------
4  begin : February 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 
18 #ifndef QGSSINGLEBANDCOLORRENDERERWIDGET_H
19 #define QGSSINGLEBANDCOLORRENDERERWIDGET_H
20 
21 #include "qgsrasterminmaxwidget.h"
23 #include "qgscolorrampshader.h"
24 #include "ui_qgssinglebandpseudocolorrendererwidgetbase.h"
25 
27  private Ui::QgsSingleBandPseudoColorRendererWidgetBase
28 {
29  Q_OBJECT
30  public:
31  enum Mode
32  {
33  Continuous = 1, // Using breaks from color palette
34  EqualInterval = 2
35  };
36 
39 
40  static QgsRasterRendererWidget* create( QgsRasterLayer* layer, const QgsRectangle &theExtent ) { return new QgsSingleBandPseudoColorRendererWidget( layer, theExtent ); }
41  QgsRasterRenderer* renderer() override;
42 
43  void setFromRenderer( const QgsRasterRenderer* r );
44 
45  public slots:
46  void loadMinMax( int theBandNo, double theMin, double theMax, int theOrigin );
47 
48  private:
49  void populateColormapTreeWidget( const QList<QgsColorRampShader::ColorRampItem>& colorRampItems );
50 
51  private slots:
52  void on_mAddEntryButton_clicked();
53  void on_mDeleteEntryButton_clicked();
54  void on_mSortButton_clicked();
55  void on_mClassifyButton_clicked();
56  void on_mLoadFromBandButton_clicked();
57  void on_mLoadFromFileButton_clicked();
58  void on_mExportToFileButton_clicked();
59  void on_mColormapTreeWidget_itemDoubleClicked( QTreeWidgetItem* item, int column );
60  void on_mBandComboBox_currentIndexChanged( int index );
61  void on_mMinLineEdit_textChanged( const QString & text ) { Q_UNUSED( text ); resetClassifyButton(); }
62  void on_mMaxLineEdit_textChanged( const QString & text ) { Q_UNUSED( text ); resetClassifyButton(); }
63  void on_mMinLineEdit_textEdited( const QString & text ) { Q_UNUSED( text ); mMinMaxOrigin = QgsRasterRenderer::MinMaxUser; showMinMaxOrigin(); }
64  void on_mMaxLineEdit_textEdited( const QString & text ) { Q_UNUSED( text ); mMinMaxOrigin = QgsRasterRenderer::MinMaxUser; showMinMaxOrigin(); }
65  void on_mClassificationModeComboBox_currentIndexChanged( int index );
66  void on_mColorRampComboBox_currentIndexChanged( int index );
67 
68  private:
69  void setLineEditValue( QLineEdit *theLineEdit, double theValue );
70  double lineEditValue( const QLineEdit *theLineEdit ) const;
71  void resetClassifyButton();
72  void showMinMaxOrigin();
73  QgsRasterMinMaxWidget * mMinMaxWidget;
74  int mMinMaxOrigin;
75 };
76 
77 #endif // QGSSINGLEBANDCOLORRENDERERWIDGET_H
static unsigned index
A rectangle specified with double values.
Definition: qgsrectangle.h:35
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &theExtent)
virtual QgsRasterRenderer * renderer()=0
Raster renderer pipe that applies colors to a raster.