QGIS API Documentation 3.43.0-Master (b60ef06885e)
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
27class QgsRasterLayer;
29class QwtPlotPicker;
30class QwtPlotMarker;
31class QwtPlotZoomer;
32
33// fix for qwt5/qwt6 QwtDoublePoint vs. QPointF
34typedef QPointF QwtDoublePoint SIP_SKIP;
35
40class GUI_EXPORT QgsRasterHistogramWidget : public QgsMapLayerConfigWidget, private Ui::QgsRasterHistogramWidgetBase
41{
42 Q_OBJECT
43
44 public:
48 QgsRasterHistogramWidget( QgsRasterLayer *layer, QWidget *parent SIP_TRANSFERTHIS = nullptr );
49
51 bool histoSaveAsImage( const QString &filename, int width = 600, int height = 600, int quality = -1 );
52
54 void setRendererWidget( const QString &name, QgsRasterRendererWidget *rendererWidget = nullptr );
55
57 void setActive( bool activeFlag );
58
60 bool computeHistogram( bool forceComputeFlag );
61
63 void histoAction( const QString &actionName, bool actionFlag = true );
64
66 void setSelectedBand( int index );
67
68 public slots:
70 void refreshHistogram();
71
72 void apply() override;
73
74 private slots:
76 void mSaveAsImageButton_clicked();
78 void cboHistoBand_currentIndexChanged( int );
80 void applyHistoMin();
81 void applyHistoMax();
83 void btnHistoMin_toggled();
84 void btnHistoMax_toggled();
86 void histoPickerSelected( QPointF );
87
92 void histoPickerSelectedQwt5( QwtDoublePoint ) SIP_SKIP;
94 void histoActionTriggered( QAction * );
96 void updateHistoMarkers();
98 void btnHistoCompute_clicked();
99
100 private:
101 enum HistoShowBands
102 {
103 ShowAll = 0,
104 ShowSelected = 1,
105 ShowRGB = 2
106 };
107
109 QgsRasterLayer *mRasterLayer = nullptr;
111 QgsRasterRendererWidget *mRendererWidget = nullptr;
113 QString mRendererName;
114
115 QwtPlotPicker *mHistoPicker = nullptr;
116 QwtPlotZoomer *mHistoZoomer = nullptr;
117 QwtPlotMarker *mHistoMarkerMin = nullptr;
118 QwtPlotMarker *mHistoMarkerMax = nullptr;
119 double mHistoMin;
120 double mHistoMax;
121 QVector<QColor> mHistoColors;
122 bool mHistoShowMarkers;
123 bool mHistoZoomToMinMax;
124 bool mHistoUpdateStyleToMinMax;
125 bool mHistoDrawLines;
126 /* bool mHistoLoadApplyAll; */
127 HistoShowBands mHistoShowBands;
129 QList<int> histoSelectedBands();
131 QList<int> rendererSelectedBands();
132 QPair<QString, QString> rendererMinMax( int bandNo );
133};
134#endif
A panel widget that can be shown in the map style dock.
virtual void apply()=0
Called when changes to the layer need to be made.
A widget for display and configuring a raster layer histogram.
Represents a raster layer.
Abstract base class for widgets which configure a QgsRasterRenderer.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126
QPointF QwtDoublePoint
QPointF QwtDoublePoint