QGIS API Documentation  3.12.1-București (121cc00ff0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 : tim@linfiniti.com
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 
32 class QgsPointXY;
33 class QgsMapLayer;
34 class QgsMapCanvas;
35 class QgsRasterLayer;
36 class QgsMetadataWidget;
37 class QgsRasterRenderer;
40 class QgsWebView;
41 
42 
50 class GUI_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private Ui::QgsRasterLayerPropertiesBase
51 {
52  Q_OBJECT
53 
54  public:
55 
59 #ifndef SIP_RUN
60  enum StyleType
61  {
62  QML,
63  SLD
64  };
65  Q_ENUM( StyleType )
66 #endif
67 
75  QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *canvas, QWidget *parent = nullptr, Qt::WindowFlags = QgsGuiUtils::ModalDialogFlags );
76 
77  protected slots:
79  void optionsStackedWidget_CurrentChanged( int index ) override SIP_SKIP ;
80 
81  private slots:
82 
84  void apply();
86  void onCancel();
88  void mLayerOrigNameLineEd_textEdited( const QString &text );
90  void buttonBuildPyramids_clicked();
92  void pbnAddValuesFromDisplay_clicked();
94  void pbnAddValuesManually_clicked();
96  void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
98  void pbnDefaultValues_clicked();
100  void pbnExportTransparentPixelValues_clicked();
102  void pbnImportTransparentPixelValues_clicked();
104  void pbnRemoveSelectedRow_clicked();
105 
110  //void on_btnResetNull_clicked();
111 
112  void pixelSelected( const QgsPointXY &, const Qt::MouseButton & );
113 
114 
115 
116  void mRenderTypeComboBox_currentIndexChanged( int index );
118  void loadDefaultStyle_clicked();
120  void saveDefaultStyle_clicked();
122  void loadStyle_clicked();
124  void saveStyleAs_clicked();
126  void restoreWindowModality();
127 
128 
130  void loadMetadata();
132  void saveMetadataAs();
134  void saveDefaultMetadata();
136  void loadDefaultMetadata();
137 
139  void showHelp();
140 
142  void mResetColorRenderingBtn_clicked();
143 
145  void toggleBuildPyramidsButton();
146 
148  void toggleSaturationControls( int grayscaleMode );
149 
151  void toggleColorizeControls( bool colorizeEnabled );
152 
154  void transparencyCellTextEdited( const QString &text );
155 
156  void aboutToShowStyleMenu();
157 
159  void syncToLayer();
160 
161  void urlClicked( const QUrl &url );
162 
163  private:
164  QPushButton *mBtnStyle = nullptr;
165  QPushButton *mBtnMetadata = nullptr;
166  QAction *mActionLoadMetadata = nullptr;
167  QAction *mActionSaveMetadataAs = nullptr;
168 
170  const QString TRSTRING_NOT_SET;
171 
173  QString mDefaultContrastEnhancementAlgorithm;
174 
176  double mDefaultStandardDeviation;
177 
179  int mDefaultRedBand;
180  int mDefaultGreenBand;
181  int mDefaultBlueBand;
182 
184  bool mGrayMinimumMaximumEstimated;
185 
187  bool mRGBMinimumMaximumEstimated;
188 
190  QgsRasterLayer *mRasterLayer = nullptr;
191 
198  //bool mRasterLayerIsInternal;
199 
200  QgsRasterRendererWidget *mRendererWidget = nullptr;
201  QgsMetadataWidget *mMetadataWidget = nullptr;
202 
203  bool rasterIsMultiBandColor();
204 
208  void updateInformationContent();
209 
210  void setupTransparencyTable( int nBands );
211 
213  void populateTransparencyTable( QgsRasterRenderer *renderer );
214 
215  void setTransparencyCell( int row, int column, double value );
216  void setTransparencyCellValue( int row, int column, double value );
217  double transparencyCellValue( int row, int column );
218  void setTransparencyToEdited( int row );
219  void adjustTransparencyCellWidth( int row, int column );
220 
221  void setRendererWidget( const QString &rendererName );
222 
223  //TODO: we should move these gradient generators somewhere more generic
224  //so they can be used generically throughout the app
225  QLinearGradient greenGradient();
226  QLinearGradient redGradient();
227  QLinearGradient blueGradient();
228  QLinearGradient grayGradient();
229  QLinearGradient highlightGradient();
230  qreal mGradientHeight;
231  qreal mGradientWidth;
232 
233  QgsMapCanvas *mMapCanvas = nullptr;
234  std::unique_ptr<QgsMapToolEmitPoint> mPixelSelectorTool;
235 
236  QgsRasterHistogramWidget *mHistogramWidget = nullptr;
237 
238  QVector<bool> mTransparencyToEdited;
239 
243  QgsMapLayerStyle mOldStyle;
244 
245  bool mDisableRenderTypeComboBoxCurrentIndexChanged = false;
246 
247  bool mMetadataFilled;
248 
250  void sync();
251 
252  friend class QgsAppScreenShots;
253 };
254 #endif
Base class for all map layer types.
Definition: qgsmaplayer.h:79
Represents a raster layer.
A class to represent a 2D point.
Definition: qgspointxy.h:43
StyleType
enumeration for the different types of style
const QgsCoordinateReferenceSystem & crs
A wizard to edit metadata on a map layer.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:75
Stores style information (renderer, opacity, labeling, diagrams etc.) applicable to a map layer...
#define SIP_SKIP
Definition: qgis_sip.h:126
A base dialog for options and properties dialogs that offers vertical tabs.
The QgsWebView class is a collection of stubs to mimic the API of QWebView on systems where the real ...
Definition: qgswebview.h:65
This class represents a coordinate reference system (CRS).
Property sheet for a raster map layer.
virtual void optionsStackedWidget_CurrentChanged(int index)
Select relevant tab on current page change.
Raster renderer pipe that applies colors to a raster.