QGIS API Documentation  2.99.0-Master (6a61179)
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 
22 #include "qgscolorrampshader.h"
23 #include "qgsrasterrenderer.h"
24 #include "ui_qgssinglebandpseudocolorrendererwidgetbase.h"
25 
27 
32  private Ui::QgsSingleBandPseudoColorRendererWidgetBase
33 {
34 
35  Q_OBJECT
36 
37  public:
38 
39  enum Mode
40  {
41  Continuous = 1, // Using breaks from color palette
42  EqualInterval = 2,
43  Quantile = 3
44  };
45 
48 
49  static QgsRasterRendererWidget* create( QgsRasterLayer* layer, const QgsRectangle &theExtent ) { return new QgsSingleBandPseudoColorRendererWidget( layer, theExtent ); }
50  QgsRasterRenderer* renderer() override;
51  void setMapCanvas( QgsMapCanvas* canvas ) override;
52 
53  void setFromRenderer( const QgsRasterRenderer* r );
54 
55  public slots:
56 
59  void classify();
60  void loadMinMax( int theBandNo, double theMin, double theMax, int theOrigin );
61 
62  private:
63 
64  enum Column
65  {
66  ValueColumn = 0,
67  ColorColumn = 1,
68  LabelColumn = 2,
69  };
70 
71  void populateColormapTreeWidget( const QList<QgsColorRampShader::ColorRampItem>& colorRampItems );
72  void autoLabel();
73  void setUnitFromLabels();
74 
75  private slots:
76 
77  void applyColorRamp();
78  void on_mAddEntryButton_clicked();
79  void on_mDeleteEntryButton_clicked();
80  void on_mLoadFromBandButton_clicked();
81  void on_mLoadFromFileButton_clicked();
82  void on_mExportToFileButton_clicked();
83  void on_mUnitLineEdit_textEdited( const QString & text ) { Q_UNUSED( text ); autoLabel(); }
84  void on_mColormapTreeWidget_itemDoubleClicked( QTreeWidgetItem* item, int column );
85  void mColormapTreeWidget_itemEdited( QTreeWidgetItem* item, int column );
86  void on_mBandComboBox_currentIndexChanged( int index );
87  void on_mColorInterpolationComboBox_currentIndexChanged( int index );
88  void on_mMinLineEdit_textChanged( const QString & text ) { Q_UNUSED( text ); resetClassifyButton(); }
89  void on_mMaxLineEdit_textChanged( const QString & text ) { Q_UNUSED( text ); resetClassifyButton(); }
90  void on_mMinLineEdit_textEdited( const QString & text ) { Q_UNUSED( text ); mMinMaxOrigin = QgsRasterRenderer::MinMaxUser; showMinMaxOrigin(); }
91  void on_mMaxLineEdit_textEdited( const QString & text ) { Q_UNUSED( text ); mMinMaxOrigin = QgsRasterRenderer::MinMaxUser; showMinMaxOrigin(); }
92  void on_mClassificationModeComboBox_currentIndexChanged( int index );
93 
94  private:
95 
96  void setLineEditValue( QLineEdit *theLineEdit, double theValue );
97  double lineEditValue( const QLineEdit *theLineEdit ) const;
98  void resetClassifyButton();
99  void showMinMaxOrigin();
100  QgsRasterMinMaxWidget * mMinMaxWidget;
101  int mMinMaxOrigin;
102 
103 };
104 
105 
106 #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.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:106
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &theExtent)
virtual QgsRasterRenderer * renderer()=0
Raster renderer pipe that applies colors to a raster.