QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
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
41class GUI_EXPORT QgsRasterHistogramWidget : public QgsMapLayerConfigWidget, private Ui::QgsRasterHistogramWidgetBase
42{
43 Q_OBJECT
44
45 public:
49 QgsRasterHistogramWidget( QgsRasterLayer *layer, QWidget *parent SIP_TRANSFERTHIS = nullptr );
50
52 bool histoSaveAsImage( const QString &filename, int width = 600, int height = 600, int quality = -1 );
53
55 void setRendererWidget( const QString &name, QgsRasterRendererWidget *rendererWidget = nullptr );
56
58 void setActive( bool activeFlag );
59
61 bool computeHistogram( bool forceComputeFlag );
62
64 void histoAction( const QString &actionName, bool actionFlag = true );
65
67 void setSelectedBand( int index );
68
69 public slots:
71 void refreshHistogram();
72
73 void apply() override;
74
75 private slots:
77 void mSaveAsImageButton_clicked();
79 void cboHistoBand_currentIndexChanged( int );
81 void applyHistoMin();
82 void applyHistoMax();
84 void btnHistoMin_toggled();
85 void btnHistoMax_toggled();
87 void histoPickerSelected( QPointF );
88
93 void histoPickerSelectedQwt5( QwtDoublePoint ) SIP_SKIP;
95 void histoActionTriggered( QAction * );
97 void updateHistoMarkers();
99 void btnHistoCompute_clicked();
100
101 private:
102 enum HistoShowBands
103 {
104 ShowAll = 0,
105 ShowSelected = 1,
106 ShowRGB = 2
107 };
108
110 QgsRasterLayer *mRasterLayer = nullptr;
112 QgsRasterRendererWidget *mRendererWidget = nullptr;
114 QString mRendererName;
115
116 QwtPlotPicker *mHistoPicker = nullptr;
117 QwtPlotZoomer *mHistoZoomer = nullptr;
118 QwtPlotMarker *mHistoMarkerMin = nullptr;
119 QwtPlotMarker *mHistoMarkerMax = nullptr;
120 double mHistoMin;
121 double mHistoMax;
122 QVector<QColor> mHistoColors;
123 bool mHistoShowMarkers;
124 bool mHistoZoomToMinMax;
125 bool mHistoUpdateStyleToMinMax;
126 bool mHistoDrawLines;
127 /* bool mHistoLoadApplyAll; */
128 HistoShowBands mHistoShowBands;
130 QList<int> histoSelectedBands();
132 QList<int> rendererSelectedBands();
133 QPair<QString, QString> rendererMinMax( int bandNo );
134};
135#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.
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