QGIS API Documentation  2.99.0-Master (9fdd060)
qgsrasterhistogramwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterrendererwidget.h
3  ---------------------------
4  begin : July 2012
5  copyright : (C) 2012 by Etienne Tourigny
6  email : etourigny dot dev at gmail dot com
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 #ifndef QGSRASTERHISTOGRAMWIDGET_H
18 #define QGSRASTERHISTOGRAMWIDGET_H
19 
20 #include "ui_qgsrasterhistogramwidgetbase.h"
21 #include "qgis_sip.h"
22 #include "qgis.h"
23 
25 #include "qgis_gui.h"
26 
27 class QgsRasterLayer;
29 class QwtPlotPicker;
30 class QwtPlotMarker;
31 class QwtPlotZoomer;
32 
33 // fix for qwt5/qwt6 QwtDoublePoint vs. QPointF
34 typedef QPointF QwtDoublePoint SIP_SKIP;
35 
41 class GUI_EXPORT QgsRasterHistogramWidget : public QgsMapLayerConfigWidget, private Ui::QgsRasterHistogramWidgetBase
42 {
43  Q_OBJECT
44 
45  public:
46  QgsRasterHistogramWidget( QgsRasterLayer *lyr, QWidget *parent SIP_TRANSFERTHIS = 0 );
47 
49  bool histoSaveAsImage( const QString &filename, int width = 600, int height = 600, int quality = -1 );
50 
52  void setRendererWidget( const QString &name, QgsRasterRendererWidget *rendererWidget = nullptr );
53 
55  void setActive( bool activeFlag );
56 
58  bool computeHistogram( bool forceComputeFlag );
59 
61  void histoAction( const QString &actionName, bool actionFlag = true );
62 
64  void setSelectedBand( int index );
65 
66  public slots:
68  void refreshHistogram();
69 
70  void apply() override;
71 
72  private slots:
74  void mSaveAsImageButton_clicked();
76  void cboHistoBand_currentIndexChanged( int );
78  void applyHistoMin();
79  void applyHistoMax();
81  void btnHistoMin_toggled();
82  void btnHistoMax_toggled();
84  void histoPickerSelected( QPointF );
85 
90  void histoPickerSelectedQwt5( QwtDoublePoint ) SIP_SKIP;
92  void histoActionTriggered( QAction * );
94  void updateHistoMarkers();
96  void btnHistoCompute_clicked();
97 
98  private:
99 
100  enum HistoShowBands
101  {
102  ShowAll = 0,
103  ShowSelected = 1,
104  ShowRGB = 2
105  };
106 
108  QgsRasterLayer *mRasterLayer = nullptr;
110  QgsRasterRendererWidget *mRendererWidget = nullptr;
112  QString mRendererName;
113 
114  QwtPlotPicker *mHistoPicker = nullptr;
115  QwtPlotZoomer *mHistoZoomer = nullptr;
116  QwtPlotMarker *mHistoMarkerMin = nullptr;
117  QwtPlotMarker *mHistoMarkerMax = nullptr;
118  double mHistoMin;
119  double mHistoMax;
120  QVector<QColor> mHistoColors;
121  bool mHistoShowMarkers;
122  bool mHistoZoomToMinMax;
123  bool mHistoUpdateStyleToMinMax;
124  bool mHistoDrawLines;
125  /* bool mHistoLoadApplyAll; */
126  HistoShowBands mHistoShowBands;
128  QList< int > histoSelectedBands();
130  QList< int > rendererSelectedBands();
131  QPair< QString, QString > rendererMinMax( int bandNo );
132 };
133 #endif
A panel widget that can be shown in the map style dock.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
virtual void apply()=0
Called when changes to the layer need to be made.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QPointF QwtDoublePoint
#define SIP_SKIP
Definition: qgis_sip.h:119