QGIS API Documentation  2.99.0-Master (5753576)
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 #include "qgis_gui.h"
26 
28 
33  private Ui::QgsSingleBandPseudoColorRendererWidgetBase
34 {
35 
36  Q_OBJECT
37 
38  public:
39 
41 
42  static QgsRasterRendererWidget* create( QgsRasterLayer* layer, const QgsRectangle &theExtent ) { return new QgsSingleBandPseudoColorRendererWidget( layer, theExtent ); }
43  QgsRasterRenderer* renderer() override;
44  void setMapCanvas( QgsMapCanvas* canvas ) override;
45  void doComputations() override;
46  QgsRasterMinMaxWidget* minMaxWidget() override { return mMinMaxWidget; }
47 
48  void setFromRenderer( const QgsRasterRenderer* r );
49 
50  public slots:
51 
54  void classify();
56  void loadMinMax( int theBandNo, double theMin, double theMax );
57 
58  private:
59 
60  enum Column
61  {
62  ValueColumn = 0,
63  ColorColumn = 1,
64  LabelColumn = 2,
65  };
66 
67  void populateColormapTreeWidget( const QList<QgsColorRampShader::ColorRampItem>& colorRampItems );
68  void autoLabel();
69  void setUnitFromLabels();
70 
71  QMenu* contextMenu;
72 
73  private slots:
74 
75  void applyColorRamp();
76  void on_mAddEntryButton_clicked();
77  void on_mDeleteEntryButton_clicked();
78  void on_mLoadFromBandButton_clicked();
79  void on_mLoadFromFileButton_clicked();
80  void on_mExportToFileButton_clicked();
81  void on_mUnitLineEdit_textEdited( const QString & text ) { Q_UNUSED( text ); autoLabel(); }
82  void on_mColormapTreeWidget_itemDoubleClicked( QTreeWidgetItem* item, int column );
83  void mColormapTreeWidget_itemEdited( QTreeWidgetItem* item, int column );
84  void on_mBandComboBox_currentIndexChanged( int index );
85  void on_mColorInterpolationComboBox_currentIndexChanged( int index );
86  void on_mMinLineEdit_textChanged( const QString & ) { resetClassifyButton(); }
87  void on_mMaxLineEdit_textChanged( const QString & ) { resetClassifyButton(); }
88  void on_mMinLineEdit_textEdited( const QString & text ) ;
89  void on_mMaxLineEdit_textEdited( const QString & text ) ;
90  void on_mClassificationModeComboBox_currentIndexChanged( int index );
91  void changeColor();
92  void changeTransparency();
93 
94  private:
95 
96  void setLineEditValue( QLineEdit *theLineEdit, double theValue );
97  double lineEditValue( const QLineEdit *theLineEdit ) const;
98  void resetClassifyButton();
99  QgsRasterMinMaxWidget * mMinMaxWidget;
100  bool mDisableMinMaxWidgetRefresh;
101  int mMinMaxOrigin;
102 
103  void minMaxModified();
104 };
105 
106 
107 #endif // QGSSINGLEBANDCOLORRENDERERWIDGET_H
static unsigned index
A rectangle specified with double values.
Definition: qgsrectangle.h:36
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:74
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
QgsRasterMinMaxWidget * minMaxWidget() override
Return min/max widget when it exists.
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &theExtent)
virtual void doComputations()
Load programmatically with current values.
virtual QgsRasterRenderer * renderer()=0
Raster renderer pipe that applies colors to a raster.