QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsrasterlayerproperties.h
Go to the documentation of this file.
1 
5 /* **************************************************************************
6  qgsrasterlayerproperties.h - description
7  -------------------
8  begin : Sun Aug 11 2002
9  copyright : (C) 2002 by Tim Sutton
10  email : [email protected]
11  ***************************************************************************/
12 
13 /***************************************************************************
14  * *
15  * This program is free software; you can redistribute it and/or modify *
16  * it under the terms of the GNU General Public License as published by *
17  * the Free Software Foundation; either version 2 of the License, or *
18  * (at your option) any later version. *
19  * *
20  ***************************************************************************/
21 #ifndef QGSRASTERLAYERPROPERTIES_H
22 #define QGSRASTERLAYERPROPERTIES_H
23 
24 #include "qgsoptionsdialogbase.h"
25 #include "ui_qgsrasterlayerpropertiesbase.h"
26 #include "qgsguiutils.h"
27 #include "qgshelp.h"
29 #include "qgsmaptoolemitpoint.h"
30 #include "qgis_gui.h"
31 #include "qgsresamplingutils.h"
32 
33 class QgsPointXY;
34 class QgsMapLayer;
35 class QgsMapCanvas;
36 class QgsRasterLayer;
37 class QgsMetadataWidget;
38 class QgsRasterRenderer;
42 class QgsWebView;
46 
47 
55 class GUI_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private Ui::QgsRasterLayerPropertiesBase
56 {
57  Q_OBJECT
58 
59  public:
60 
64 #ifndef SIP_RUN
65  enum StyleType
66  {
67  QML,
68  SLD
69  };
70  Q_ENUM( StyleType )
71 #endif
72 
80  QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *canvas, QWidget *parent = nullptr, Qt::WindowFlags = QgsGuiUtils::ModalDialogFlags );
81 
86  void addPropertiesPageFactory( const QgsMapLayerConfigWidgetFactory *factory );
87 
88  protected slots:
90  void optionsStackedWidget_CurrentChanged( int index ) override SIP_SKIP ;
91 
92  private slots:
93 
95  void apply();
97  void onCancel();
99  void mLayerOrigNameLineEd_textEdited( const QString &text );
101  void buttonBuildPyramids_clicked();
103  void pbnAddValuesFromDisplay_clicked();
105  void pbnAddValuesManually_clicked();
107  void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
109  void pbnDefaultValues_clicked();
111  void pbnExportTransparentPixelValues_clicked();
113  void pbnImportTransparentPixelValues_clicked();
115  void pbnRemoveSelectedRow_clicked();
116 
121  //void on_btnResetNull_clicked();
122 
123  void pixelSelected( const QgsPointXY &, const Qt::MouseButton & );
124 
129  void updateGammaSpinBox( int value );
130 
135  void updateGammaSlider( double value );
136 
137  void mRenderTypeComboBox_currentIndexChanged( int index );
139  void loadDefaultStyle_clicked();
141  void saveDefaultStyle_clicked();
143  void loadStyle_clicked();
145  void saveStyleAs_clicked();
147  void restoreWindowModality();
148 
149 
151  void loadMetadata();
153  void saveMetadataAs();
155  void saveDefaultMetadata();
157  void loadDefaultMetadata();
158 
160  void showHelp();
161 
163  void mResetColorRenderingBtn_clicked();
164 
166  void toggleBuildPyramidsButton();
167 
169  void toggleSaturationControls( int grayscaleMode );
170 
172  void toggleColorizeControls( bool colorizeEnabled );
173 
175  void transparencyCellTextEdited( const QString &text );
176 
177  void aboutToShowStyleMenu();
178 
180  void syncToLayer();
181 
182  void urlClicked( const QUrl &url );
183 
184  private:
185  QPushButton *mBtnStyle = nullptr;
186  QPushButton *mBtnMetadata = nullptr;
187  QAction *mActionLoadMetadata = nullptr;
188  QAction *mActionSaveMetadataAs = nullptr;
189 
191  QList<QgsMapLayerConfigWidget *> mLayerPropertiesPages;
192 
194  const QString TRSTRING_NOT_SET;
195 
197  QString mDefaultContrastEnhancementAlgorithm;
198 
200  double mDefaultStandardDeviation;
201 
203  int mDefaultRedBand;
204  int mDefaultGreenBand;
205  int mDefaultBlueBand;
206 
208  bool mGrayMinimumMaximumEstimated;
209 
211  bool mRGBMinimumMaximumEstimated;
212 
214  QgsRasterLayer *mRasterLayer = nullptr;
215 
216  QgsRasterRendererWidget *mRendererWidget = nullptr;
217  QgsMetadataWidget *mMetadataWidget = nullptr;
218 
222  QgsRasterLayerTemporalPropertiesWidget *mTemporalWidget = nullptr;
223 
224  bool rasterIsMultiBandColor();
225 
229  void updateInformationContent();
230 
231  void setupTransparencyTable( int nBands );
232 
234  void populateTransparencyTable( QgsRasterRenderer *renderer );
235 
236  void setTransparencyCell( int row, int column, double value );
237  void setTransparencyCellValue( int row, int column, double value );
238  double transparencyCellValue( int row, int column );
239  void setTransparencyToEdited( int row );
240  void adjustTransparencyCellWidth( int row, int column );
241 
242  void setRendererWidget( const QString &rendererName );
243 
244  //TODO: we should move these gradient generators somewhere more generic
245  //so they can be used generically throughout the app
246  QLinearGradient greenGradient();
247  QLinearGradient redGradient();
248  QLinearGradient blueGradient();
249  QLinearGradient grayGradient();
250  QLinearGradient highlightGradient();
251  qreal mGradientHeight;
252  qreal mGradientWidth;
253 
254  QgsMapCanvas *mMapCanvas = nullptr;
255  std::unique_ptr<QgsMapToolEmitPoint> mPixelSelectorTool;
256 
257  QgsRasterHistogramWidget *mHistogramWidget = nullptr;
258 
259  QVector<bool> mTransparencyToEdited;
260 
265  QgsMapLayerStyle mOldStyle;
266 
267  bool mDisableRenderTypeComboBoxCurrentIndexChanged = false;
268 
269  bool mMetadataFilled;
270 
272  void sync();
273 
274  QgsResamplingUtils mResamplingUtils;
275 
276  QgsProviderSourceWidget *mSourceWidget = nullptr;
277 
278  friend class QgsAppScreenShots;
279 };
280 #endif
This class represents a coordinate reference system (CRS).
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:86
Factory class for creating custom map layer property pages.
A panel widget that can be shown in the map style dock.
Stores style information (renderer, opacity, labeling, diagrams etc.) applicable to a map layer.
Base class for all map layer types.
Definition: qgsmaplayer.h:70
A wizard to edit metadata on a map layer.
A base dialog for options and properties dialogs that offers vertical tabs.
virtual void optionsStackedWidget_CurrentChanged(int index)
Select relevant tab on current page change.
A class to represent a 2D point.
Definition: qgspointxy.h:59
Base class for widgets which allow customization of a provider's source URI.
Property sheet for a raster map layer.
StyleType
enumeration for the different types of style
A widget for configuring the temporal properties for a raster layer.
Represents a raster layer.
Raster renderer pipe that applies colors to a raster.
The QgsWebView class is a collection of stubs to mimic the API of QWebView on systems where the real ...
Definition: qgswebview.h:66
#define SIP_SKIP
Definition: qgis_sip.h:126
const QgsCoordinateReferenceSystem & crs