QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsrastertransparencywidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrastertransparencywidget.h
3  ---------------------
4  begin : May 2016
5  copyright : (C) 2016 by Nathan Woodrow
6  email : woodrow dot nathan at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSRASTERTRANSPARENCYWIDGET_H
16 #define QGSRASTERTRANSPARENCYWIDGET_H
17 
18 #include <QWidget>
19 
20 #include "ui_qgsrastertransparencywidget.h"
21 
23 
24 class QgsRasterLayer;
25 class QgsRasterRenderer;
26 class QgsMapCanvas;
28 class QgsPoint;
29 
30 
34 class GUI_EXPORT QgsRasterTransparencyWidget : public QgsMapLayerConfigWidget, private Ui::QgsRasterTransparencyWidget
35 {
36  Q_OBJECT
37  public:
41  QgsRasterTransparencyWidget( QgsRasterLayer* layer, QgsMapCanvas *canvas, QWidget *parent = 0 );
43 
44  public slots:
48  void syncToLayer();
49 
53  void apply();
54 
55  private slots:
56 
57  void pixelSelected( const QgsPoint& canvasPoint );
58 
60  void transparencyCellTextEdited( const QString & text );
61 
63  void sliderTransparency_valueChanged( int theValue );
64 
66  void on_pbnAddValuesFromDisplay_clicked();
67 
69  void on_pbnAddValuesManually_clicked();
70 
72  void on_pbnDefaultValues_clicked();
73 
75  void on_pbnExportTransparentPixelValues_clicked();
76 
78  void on_pbnImportTransparentPixelValues_clicked();
80  void on_pbnRemoveSelectedRow_clicked();
81 
82  private:
84  const QString TRSTRING_NOT_SET;
85 
86  bool rasterIsMultiBandColor();
87 
89  void populateTransparencyTable( QgsRasterRenderer* renderer );
90 
91  void setupTransparencyTable( int nBands );
92 
93  void setTransparencyCell( int row, int column, double value );
94 
95  void adjustTransparencyCellWidth( int row, int column );
96 
97  void setTransparencyToEdited( int row );
98 
99  double transparencyCellValue( int row, int column );
100 
101  QgsRasterLayer* mRasterLayer;
102 
104 
105  QgsMapToolEmitPoint* mPixelSelectorTool;
106 
107  QVector<bool> mTransparencyToEdited;
108 };
109 #endif // QGSRASTERTRANSPARENCYWIDGET_H
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.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:109
A class to represent a point.
Definition: qgspoint.h:117
Widget to control a layers transparency and related options.
A map tool that simply emits a point when clicking on the map.
Raster renderer pipe that applies colors to a raster.