OTB  6.7.0
Orfeo Toolbox
mvdColorDynamicsWidget.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef mvdColorDynamicsWidget_h
22 #define mvdColorDynamicsWidget_h
23 
24 //
25 // Configuration include.
27 #include "ConfigureMonteverdi.h"
28 
29 
30 /*****************************************************************************/
31 /* INCLUDE SECTION */
32 
33 //
34 // Qt includes (sorted by alphabetic order)
36 #include <QtWidgets>
37 
38 //
39 // System includes (sorted by alphabetic order)
40 
41 //
42 // ITK includes (sorted by alphabetic order)
43 
44 //
45 // OTB includes (sorted by alphabetic order)
46 #include "OTBMonteverdiGUIExport.h"
47 //
48 // Monteverdi includes (sorted by alphabetic order)
50 
51 
52 /*****************************************************************************/
53 /* PRE-DECLARATION SECTION */
54 
55 //
56 // External classes pre-declaration.
57 namespace
58 {
59 }
60 
61 namespace mvd
62 {
63 //
64 // Internal classes pre-declaration.
65 namespace Ui
66 {
67 class ColorDynamicsWidget;
68 };
69 
70 
71 /*****************************************************************************/
72 /* CLASS DEFINITION SECTION */
73 
79 class OTBMonteverdiGUI_EXPORT ColorDynamicsWidget :
80  public QWidget
81 {
82 
83  /*-[ QOBJECT SECTION ]-----------------------------------------------------*/
84 
85  Q_OBJECT;
86 
87  Q_PROPERTY( bool isNoDataChecked
88  READ IsNoDataChecked
89  WRITE SetNoDataChecked );
90 
91  Q_PROPERTY( double NoDataValue
92  READ GetNoDataValue
93  WRITE SetNoDataValue );
94 
95  Q_PROPERTY( int GammaCursorPosition
96  READ GetGammaCursorPosition
97  WRITE SetGammaCursorPosition );
98 
99  Q_PROPERTY( int MinGamma
100  READ GetMinGamma
101  WRITE SetMinGamma );
102 
103  Q_PROPERTY( int MaxGamma
104  READ GetMaxGamma
105  WRITE SetMaxGamma );
106 
107  Q_PROPERTY( int GammaStep
108  READ GetGammaStep
109  WRITE SetGammaStep );
110 
111  Q_PROPERTY( double Gamma
112  READ GetGamma
113  WRITE SetGamma );
114 
115  /*-[ PUBLIC SECTION ]------------------------------------------------------*/
116 
117 //
118 // Public methods.
119 public:
120 
122  ColorDynamicsWidget( QWidget* p =NULL, Qt::WindowFlags flags =0 );
123 
125  ~ColorDynamicsWidget() override;
126 
129  inline const ColorBandDynamicsWidget* GetChannel( RgbwChannel ) const;
130 
133  inline ColorBandDynamicsWidget* GetChannel( RgbwChannel );
134 
137  void SetGrayscaleActivated( bool activated );
138 
141  bool IsGrayscaleActivated() const;
142 
145  void SetNoDataChecked( bool checked );
146 
149  bool IsNoDataChecked() const;
150 
153  void SetNoDataValue( double value );
154 
157  double GetNoDataValue() const;
158 
161  void SetGamma( double value );
162 
165  double GetGamma() const;
166 
169  void SetGammaCursorPosition( int value );
170 
173  int GetGammaCursorPosition() const;
174 
177  void SetMinGamma( int value );
178 
181  int GetMinGamma() const;
182 
185  void SetMaxGamma( int value );
186 
189  int GetMaxGamma() const;
190 
193  void SetGammaStep( int value );
194 
197  int GetGammaStep() const;
198 
199 //
200 // Public slots.
201 public slots:
202 
205  void SetNoDataButtonChecked( bool checked );
206 
207  /*-[ SIGNALS SECTION ]-----------------------------------------------------*/
208 
209 //
210 // Signals.
211 signals:
214  void LowQuantileChanged( RgbwChannel, double );
215 
218  void HighQuantileChanged( RgbwChannel, double );
219 
222  void LowIntensityChanged( RgbwChannel, double );
223 
226  void HighIntensityChanged( RgbwChannel, double );
227 
230  void ResetIntensityClicked( RgbwChannel );
231 
234  void ResetQuantileClicked( RgbwChannel );
235 
238  void ApplyAllClicked( RgbwChannel, double, double );
239 
242  void LinkToggled( RgbwChannel, bool );
243 
246  void NoDataFlagToggled( bool enabled );
247 
250  void NoDataValueChanged( double value );
251 
254  void NoDataButtonPressed();
255 
258  void GammaCursorPositionChanged( int value );
259 
262  void GammaValueChanged( double value );
263 
264  /*-[ PROTECTED SECTION ]---------------------------------------------------*/
265 
266 //
267 // Protected methods.
268 protected:
269 
270 //
271 // Protected attributes.
272 protected:
273 
274  /*-[ PRIVATE SECTION ]-----------------------------------------------------*/
275 
276 //
277 // Private methods.
278 private:
286  void ConnectChild( ColorBandDynamicsWidget* child, RgbwChannel channel );
287 
288 //
289 // Private attributes.
290 private:
292  static const char* COLOR_BAND_DYNAMICS_WIDGET_NAMES[];
293 
297  Ui::ColorDynamicsWidget* m_UI;
298 
301  QDoubleValidator* m_NoDataValidator;
302 
306 
307  /*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
308 
309 //
310 // Slots.
311 private slots:
312 
315  void on_noDataLineEdit_textChanged( const QString& text );
316 
319  void on_noDataCheckBox_toggled( bool enabled );
320 
323  void on_noDataButton_toggled( bool checked );
324 
327  void on_gammaSlider_valueChanged( int gamma );
328 
329  void on_gammaResetButton_clicked();
330 };
331 
332 } // end namespace 'mvd'.
333 
334 /*****************************************************************************/
335 /* INLINE SECTION */
336 
337 namespace mvd
338 {
339 
340 /*****************************************************************************/
341 inline
342 const ColorBandDynamicsWidget*
344 ::GetChannel( RgbwChannel channel ) const
345 {
346  return findChild< const ColorBandDynamicsWidget* >(
348  );
349 }
350 
351 /*****************************************************************************/
352 inline
356 {
357  return findChild< ColorBandDynamicsWidget* >(
359  );
360 }
361 
362 /*****************************************************************************/
363 inline
364 bool
367 {
368  return m_IsGrayscaleActivated;
369 }
370 
371 /*****************************************************************************/
372 /* SLOTS */
373 
374 /*****************************************************************************/
375 
376 } // end namespace 'mvd'
377 
378 #endif // mvdColorDynamicsWidget_h
Ui::ColorDynamicsWidget * m_UI
const ColorBandDynamicsWidget * GetChannel(RgbwChannel) const
QDoubleValidator * m_NoDataValidator
RgbwChannel
Definition: mvdCore.h:80
OTBOSSIMAdapters_EXPORT char const * NoDataValue
static const char * COLOR_BAND_DYNAMICS_WIDGET_NAMES[]