QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
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 "qgsrasterpipe.h"
25
26#include "qgis_gui.h"
27
28class QgsRasterLayer;
30class QgsMapCanvas;
32class QgsPointXY;
33
38class GUI_EXPORT QgsRasterTransparencyWidget : public QgsMapLayerConfigWidget, private QgsExpressionContextGenerator, public Ui::QgsRasterTransparencyWidget
39{
40 Q_OBJECT
41 public:
42
46 QgsRasterTransparencyWidget( QgsRasterLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );
47
52 void setContext( const QgsSymbolWidgetContext &context );
53
55
60 QgsMapToolEmitPoint *pixelSelectorTool() const;
61
62 public slots:
63
64#ifdef __clang__
65#pragma clang diagnostic push
66#pragma clang diagnostic ignored "-Woverloaded-virtual"
67#endif
68
72 void syncToLayer();
73#ifdef __clang__
74#pragma clang diagnostic pop
75#endif
76
80 void apply() override;
81
82 protected:
83
84#ifndef SIP_RUN
85
86 // TODO -- consider moving these to a common raster widget base class
87
95 void initializeDataDefinedButton( QgsPropertyOverrideButton *button, QgsRasterPipe::Property key );
96
102 void updateDataDefinedButtons();
103
109 void updateDataDefinedButton( QgsPropertyOverrideButton *button );
110
113
114#endif
115
116 private slots:
117
118 void updateProperty();
119
120 void pixelSelected( const QgsPointXY &canvasPoint );
121
123 void transparencyCellTextEdited( const QString &text );
124
126 void pbnAddValuesFromDisplay_clicked();
127
129 void pbnAddValuesManually_clicked();
130
132 void pbnDefaultValues_clicked();
133
135 void pbnExportTransparentPixelValues_clicked();
136
138 void pbnImportTransparentPixelValues_clicked();
140 void pbnRemoveSelectedRow_clicked();
141
142 private:
144 const QString TRSTRING_NOT_SET;
145
146 bool rasterIsMultiBandColor();
147
149 void populateTransparencyTable( QgsRasterRenderer *renderer );
150
151 void setupTransparencyTable( int nBands );
152
153 void setTransparencyCell( int row, int column, double value );
154
155 void adjustTransparencyCellWidth( int row, int column );
156
157 void setTransparencyToEdited( int row );
158
159 double transparencyCellValue( int row, int column );
160
161 QgsRasterLayer *mRasterLayer = nullptr;
162
163 QgsMapCanvas *mMapCanvas = nullptr;
164
165 QgsMapToolEmitPoint *mPixelSelectorTool = nullptr;
166
167 QVector<bool> mTransparencyToEdited;
168
170 QgsSymbolWidgetContext mContext;
171};
172#endif // QGSRASTERTRANSPARENCYWIDGET_H
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Map canvas is a class for displaying all GIS data types on a canvas.
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.
virtual void syncToLayer(QgsMapLayer *layer)
Reset to original (vector layer) values.
A map tool that simply emits a point when clicking on the map.
A class to represent a 2D point.
Definition qgspointxy.h:60
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
A button for controlling property overrides which may apply to a widget.
Represents a raster layer.
Property
Data definable properties.
Raster renderer pipe that applies colors to a raster.
Widget to control a layers transparency and related options.
QgsPropertyCollection mPropertyCollection
Temporary property collection.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...