QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 #include "qgis_gui.h"
24 
25 class QgsRasterLayer;
26 class QgsRasterRenderer;
27 class QgsMapCanvas;
29 class QgsPointXY;
30 
31 
36 class GUI_EXPORT QgsRasterTransparencyWidget : public QgsMapLayerConfigWidget, private Ui::QgsRasterTransparencyWidget
37 {
38  Q_OBJECT
39  public:
40 
44  QgsRasterTransparencyWidget( QgsRasterLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );
45 
46  public slots:
47 
51  void syncToLayer();
52 
56  void apply() override;
57 
58  private slots:
59 
60  void pixelSelected( const QgsPointXY &canvasPoint );
61 
63  void transparencyCellTextEdited( const QString &text );
64 
66  void pbnAddValuesFromDisplay_clicked();
67 
69  void pbnAddValuesManually_clicked();
70 
72  void pbnDefaultValues_clicked();
73 
75  void pbnExportTransparentPixelValues_clicked();
76 
78  void pbnImportTransparentPixelValues_clicked();
80  void 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 = nullptr;
102 
103  QgsMapCanvas *mMapCanvas = nullptr;
104 
105  QgsMapToolEmitPoint *mPixelSelectorTool = nullptr;
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.
A class to represent a 2D point.
Definition: qgspointxy.h:43
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:74
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.