QGIS API Documentation  2.15.0-Master (5773d0d)
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 
22 class QgsRasterLayer;
24 class QwtPlotPicker;
25 class QwtPlotMarker;
26 class QwtPlotZoomer;
27 
28 // fix for qwt5/qwt6 QwtDoublePoint vs. QPointF
29 #if defined(QWT_VERSION) && QWT_VERSION>=0x060000
30 typedef QPointF QwtDoublePoint;
31 #endif
32 
37 class GUI_EXPORT QgsRasterHistogramWidget : public QWidget, private Ui::QgsRasterHistogramWidgetBase
38 {
39  Q_OBJECT
40 
41  public:
42  QgsRasterHistogramWidget( QgsRasterLayer *lyr, QWidget *parent = nullptr );
44 
46  bool histoSaveAsImage( const QString& theFilename, int width = 600, int height = 600, int quality = -1 );
47 
49  void setRendererWidget( const QString& name, QgsRasterRendererWidget* rendererWidget = nullptr );
50 
52  void setActive( bool theActiveFlag );
53 
55  bool computeHistogram( bool forceComputeFlag );
56 
58  void histoAction( const QString &actionName, bool actionFlag = true );
59 
61  void setSelectedBand( int index );
62 
63  signals:
68  void widgetChanged();
69 
70  public slots:
72  void refreshHistogram();
74  void on_mSaveAsImageButton_clicked();
75 
76  private slots:
78  void on_cboHistoBand_currentIndexChanged( int );
80  void applyHistoMin();
81  void applyHistoMax();
83  void on_btnHistoMin_toggled();
84  void on_btnHistoMax_toggled();
86  void histoPickerSelected( QPointF );
90  void histoPickerSelectedQwt5( QwtDoublePoint );
92  void histoActionTriggered( QAction* );
94  void updateHistoMarkers();
96  void on_btnHistoCompute_clicked();
97 
98  private:
99 
100  enum HistoShowBands
101  {
102  ShowAll = 0,
103  ShowSelected = 1,
104  ShowRGB = 2
105  };
106 
108  QgsRasterLayer * mRasterLayer;
110  QgsRasterRendererWidget* mRendererWidget;
112  QString mRendererName;
113 
114  QwtPlotPicker* mHistoPicker;
115  QwtPlotZoomer* mHistoZoomer;
116  QwtPlotMarker* mHistoMarkerMin;
117  QwtPlotMarker* mHistoMarkerMax;
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 theBandNo );
132 };
133 #endif
static unsigned index
This class provides qgis with the ability to render raster datasets onto the mapcanvas.