1 /***************************************************************************
2                          qgspointcloudrgbrendererwidget.h
3     ---------------------
4     begin                : November 2020
5     copyright            : (C) 2020 by Nyall Dawson
6     email                : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef QGSPOINTCLOUDRGBRENDERERWIDGET_H
19 #define QGSPOINTCLOUDRGBRENDERERWIDGET_H
20 
21 #include "qgspointcloudrendererwidget.h"
22 #include "ui_qgspointcloudrgbrendererwidgetbase.h"
23 #include "qgis_gui.h"
24 
25 class QgsContrastEnhancement;
26 class QgsPointCloudLayer;
27 class QgsStyle;
28 class QLineEdit;
29 class QgsPointCloudRgbRenderer;
30 
31 #define SIP_NO_FILE
32 
33 ///@cond PRIVATE
34 
35 class GUI_EXPORT QgsPointCloudRgbRendererWidget: public QgsPointCloudRendererWidget, private Ui::QgsPointCloudRgbRendererWidgetBase
36 {
37     Q_OBJECT
38 
39   public:
40     QgsPointCloudRgbRendererWidget( QgsPointCloudLayer *layer, QgsStyle *style );
41     static QgsPointCloudRendererWidget *create( QgsPointCloudLayer *layer, QgsStyle *style, QgsPointCloudRenderer * );
42 
43     QgsPointCloudRenderer *renderer() override;
44   private slots:
45 
46     void mRedMinLineEdit_textChanged( const QString & );
47     void mRedMaxLineEdit_textChanged( const QString & );
48     void mGreenMinLineEdit_textChanged( const QString & );
49     void mGreenMaxLineEdit_textChanged( const QString & );
50     void mBlueMinLineEdit_textChanged( const QString & );
51     void mBlueMaxLineEdit_textChanged( const QString & );
52 
53     void emitWidgetChanged();
54 
55     void redAttributeChanged();
56     void greenAttributeChanged();
57     void blueAttributeChanged();
58 
59   private:
60     void setFromRenderer( const QgsPointCloudRenderer *r );
61 
62     void createValidators();
63     void setCustomMinMaxValues( QgsPointCloudRgbRenderer *r );
64     //! Reads min/max values from contrast enhancement and fills values into the min/max line edits
65     void setMinMaxValue( const QgsContrastEnhancement *ce, QLineEdit *minEdit, QLineEdit *maxEdit );
66 
67     void minMaxModified();
68 
69     bool mBlockChangedSignal = false;
70     int mDisableMinMaxWidgetRefresh = 0;
71 
72 };
73 
74 ///@endcond
75 
76 #endif // QGSPOINTCLOUDRGBRENDERERWIDGET_H
77