QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 = 0 );
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 = NULL );
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  public slots:
65  void refreshHistogram();
67  void on_mSaveAsImageButton_clicked();
68 
69  private slots:
71  void on_cboHistoBand_currentIndexChanged( int );
73  void applyHistoMin( );
74  void applyHistoMax( );
76  void on_btnHistoMin_toggled();
77  void on_btnHistoMax_toggled();
79  void histoPickerSelected( const QPointF & );
83  void histoPickerSelectedQwt5( const QwtDoublePoint & );
85  void histoActionTriggered( QAction* );
87  void updateHistoMarkers();
89  void on_btnHistoCompute_clicked();
90 
91  private:
92 
94  {
95  ShowAll = 0,
96  ShowSelected = 1,
97  ShowRGB = 2
98  };
99 
105  QString mRendererName;
106 
107  QwtPlotPicker* mHistoPicker;
108  QwtPlotZoomer* mHistoZoomer;
109  QwtPlotMarker* mHistoMarkerMin;
110  QwtPlotMarker* mHistoMarkerMax;
111  double mHistoMin;
112  double mHistoMax;
113  QVector<QColor> mHistoColors;
118  /* bool mHistoLoadApplyAll; */
121  QList< int > histoSelectedBands();
123  QList< int > rendererSelectedBands();
124  QPair< QString, QString > rendererMinMax( int theBandNo );
125 };
126 #endif
static unsigned index
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QString mRendererName
Name of the renderer widget (see QgsRasterRendererRegistry).
QgsRasterLayer * mRasterLayer
Pointer to the raster layer that this property dilog changes the behaviour of.
QgsRasterRendererWidget * mRendererWidget
Pointer to the renderer widget, to get/set min/max.