QGIS API Documentation  3.21.0-Master (909859188c)
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 #include "qgsrasterpipe.h"
33 
34 class QgsPointXY;
35 class QgsMapLayer;
36 class QgsMapCanvas;
37 class QgsRasterLayer;
38 class QgsMetadataWidget;
39 class QgsRasterRenderer;
43 class QgsWebView;
49 
50 
58 class GUI_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private Ui::QgsRasterLayerPropertiesBase, private QgsExpressionContextGenerator
59 {
60  Q_OBJECT
61 
62  public:
63 
67 #ifndef SIP_RUN
68  enum StyleType
69  {
70  QML,
71  SLD
72  };
73  Q_ENUM( StyleType )
74 #endif
75 
83  QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *canvas, QWidget *parent = nullptr, Qt::WindowFlags = QgsGuiUtils::ModalDialogFlags );
84 
89  void addPropertiesPageFactory( const QgsMapLayerConfigWidgetFactory *factory );
90 
92 
93  protected slots:
95  void optionsStackedWidget_CurrentChanged( int index ) override SIP_SKIP ;
96 
97  private:
98 
99  // TODO -- consider moving these to a common raster widget base class
100 
107  void initializeDataDefinedButton( QgsPropertyOverrideButton *button, QgsRasterPipe::Property key );
108 
113  void updateDataDefinedButtons();
114 
119  void updateDataDefinedButton( QgsPropertyOverrideButton *button );
120 
122  QgsPropertyCollection mPropertyCollection;
123 
124  private slots:
125 
126  void updateProperty();
127 
129  void apply();
131  void onCancel();
133  void buttonBuildPyramids_clicked();
135  void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
136 
137  // Server properties
138  void addMetadataUrl();
139  void removeSelectedMetadataUrl();
140 
145  void updateGammaSpinBox( int value );
146 
151  void updateGammaSlider( double value );
152 
153  void mRenderTypeComboBox_currentIndexChanged( int index );
155  void loadDefaultStyle_clicked();
157  void saveDefaultStyle_clicked();
159  void loadStyle_clicked();
161  void saveStyleAs_clicked();
163  void restoreWindowModality();
164 
165 
167  void loadMetadata();
169  void saveMetadataAs();
171  void saveDefaultMetadata();
173  void loadDefaultMetadata();
174 
176  void showHelp();
177 
179  void mResetColorRenderingBtn_clicked();
180 
182  void toggleBuildPyramidsButton();
183 
185  void toggleSaturationControls( int grayscaleMode );
186 
188  void toggleColorizeControls( bool colorizeEnabled );
189 
191  void transparencyCellTextEdited( const QString &text );
192 
193  void aboutToShowStyleMenu();
194 
196  void syncToLayer();
197 
198  void urlClicked( const QUrl &url );
199 
200  private:
201  QPushButton *mBtnStyle = nullptr;
202  QPushButton *mBtnMetadata = nullptr;
203  QAction *mActionLoadMetadata = nullptr;
204  QAction *mActionSaveMetadataAs = nullptr;
205 
206  QStandardItemModel *mMetadataUrlModel = nullptr;
207 
209  QList<QgsMapLayerConfigWidget *> mLayerPropertiesPages;
210 
212  const QString TRSTRING_NOT_SET;
213 
215  QString mDefaultContrastEnhancementAlgorithm;
216 
218  double mDefaultStandardDeviation;
219 
221  int mDefaultRedBand;
222  int mDefaultGreenBand;
223  int mDefaultBlueBand;
224 
226  bool mGrayMinimumMaximumEstimated;
227 
229  bool mRGBMinimumMaximumEstimated;
230 
232  QgsRasterLayer *mRasterLayer = nullptr;
233 
234  QgsRasterRendererWidget *mRendererWidget = nullptr;
235  QgsMetadataWidget *mMetadataWidget = nullptr;
236 
237  QgsRasterTransparencyWidget *mRasterTransparencyWidget = nullptr;
238 
242  QgsRasterLayerTemporalPropertiesWidget *mTemporalWidget = nullptr;
243 
244  bool rasterIsMultiBandColor();
245 
249  void updateInformationContent();
250 
251  void setTransparencyCell( int row, int column, double value );
252  void setTransparencyCellValue( int row, int column, double value );
253  double transparencyCellValue( int row, int column );
254  void setTransparencyToEdited( int row );
255  void adjustTransparencyCellWidth( int row, int column );
256 
257  void setRendererWidget( const QString &rendererName );
258 
259  //TODO: we should move these gradient generators somewhere more generic
260  //so they can be used generically throughout the app
261  QLinearGradient greenGradient();
262  QLinearGradient redGradient();
263  QLinearGradient blueGradient();
264  QLinearGradient grayGradient();
265  QLinearGradient highlightGradient();
266  qreal mGradientHeight;
267  qreal mGradientWidth;
268 
269  QgsMapCanvas *mMapCanvas = nullptr;
270 
271  QgsRasterHistogramWidget *mHistogramWidget = nullptr;
272 
273  QVector<bool> mTransparencyToEdited;
274 
279  QgsMapLayerStyle mOldStyle;
280 
281  bool mDisableRenderTypeComboBoxCurrentIndexChanged = false;
282 
283  bool mMetadataFilled;
284 
286  void sync();
287 
288  QgsResamplingUtils mResamplingUtils;
289 
290  QgsProviderSourceWidget *mSourceWidget = nullptr;
291 
292  QgsWebView *mMetadataViewer = nullptr;
293 
294  QgsExpressionContext mContext;
295 
296  friend class QgsAppScreenShots;
297 };
298 #endif
This class represents a coordinate reference system (CRS).
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.
Definition: qgsmapcanvas.h:87
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:72
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
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.
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.
Property
Data definable properties.
Definition: qgsrasterpipe.h:58
Raster renderer pipe that applies colors to a raster.
Widget to control a layers transparency and related options.
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