OTB  6.7.0
Orfeo Toolbox
mvdHistogramPlotPicker.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 mvdHistogramPlotPicker_h
22 #define mvdHistogramPlotPicker_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 
37 //
38 //
39 #include <qwt_plot_picker.h>
40 
41 //
42 // System includes (sorted by alphabetic order)
43 
44 //
45 // ITK includes (sorted by alphabetic order)
46 
47 //
48 // OTB includes (sorted by alphabetic order)
49 #include "OTBMonteverdiGUIExport.h"
50 //
51 // Monteverdi includes (sorted by alphabetic order)
52 #include "mvdCore.h"
53 #include "mvdTypes.h"
54 
55 
56 /*****************************************************************************/
57 /* PRE-DECLARATION SECTION */
58 
59 //
60 // External classes pre-declaration.
61 namespace
62 {
63 }
64 
65 class QwtPlotCanvas;
66 class QwtPlotCurve;
67 
68 namespace mvd
69 {
70 
71 //
72 // Internal classes pre-declaration.
73 
74 
75 /*****************************************************************************/
76 /* CLASS DEFINITION SECTION */
77 
86 class OTBMonteverdiGUI_EXPORT HistogramPlotPicker :
87  public QwtPlotPicker
88 {
89 
90  /*-[ QOBJECT SECTION ]-----------------------------------------------------*/
91 
92  Q_OBJECT;
93 
94  /*-[ PUBLIC SECTION ]------------------------------------------------------*/
95 
96 //
97 // Public types and constants.
98 public:
99 
103  typedef std::vector< QwtPlotCurve* > PlotCurveVector;
104 
105 //
106 // Public methods.
107 public:
108 
110  HistogramPlotPicker( const PlotCurveVector& curves, QwtPlotCanvas* canvas );
111 
113  HistogramPlotPicker( const PlotCurveVector& curves,
114  int xAxis,
115  int yAxis,
116  QwtPlotCanvas* canvas );
117 
119  HistogramPlotPicker( const PlotCurveVector& curves,
120  int xAxis,
121  int yAxis,
122  DisplayMode trackerMode,
123  QwtPlotCanvas* canvas );
124 
126  ~HistogramPlotPicker() override;
127 
130  void SetRubberBandPen( RgbwChannel channel, const QPen& pen );
131 
134  void SetGrayscaleActivated( bool isGrayscale );
135 
136  //
137  // QwtPlotPicker methods.
138 
139  void drawRubberBand( QPainter* painter ) const override;
140 
141  /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
142 
143 //
144 // Public SLOTS.
145 public slots:
146 
147  /*-[ SIGNALS SECTION ]-----------------------------------------------------*/
148 
149 //
150 // Signals.
151 signals:
152 
153  /*-[ PROTECTED SECTION ]---------------------------------------------------*/
154 
155 //
156 // Protected methods.
157 protected:
158 
159  //
160  // QwtPlotPicker methods.
161 
162  using QwtPlotPicker::trackerText;
163 
164  QwtText trackerTextF( const QPointF & ) const override;
165 
166 //
167 // Protected attributes.
168 protected:
169 
170  /*-[ PRIVATE SECTION ]-----------------------------------------------------*/
171 
172 //
173 // Private methods.
174 private:
175 
178  double Find( const QwtPlotCurve* curve, double x ) const;
179 
182  CountType Find( const QwtPlotCurve* curve,
183  double x,
184  double& xmin,
185  double& xmax,
186  double& y ) const;
187 
188 //
189 // Private attributes.
190 private:
194  static const CountType CURVE_COUNT = 4;
195 
200 
203  QPen m_RubberBandPens[ CURVE_COUNT ];
204 
207  bool m_IsGrayscaleActivated : 1;
208 
209  /*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
210 
211 //
212 // Slots.
213 private slots:
214 };
215 
216 } // end namespace 'mvd'
217 
218 /*****************************************************************************/
219 /* INLINE SECTION */
220 
221 namespace mvd
222 {
223 
224 } // end namespace 'mvd'
225 
226 #endif // mvdHistogramPlotPicker_h
RgbwChannel
Definition: mvdCore.h:80
unsigned int CountType
Definition: mvdTypes.h:80
Widget template skeleton to copy-paste when adding a new widget class.
std::vector< QwtPlotCurve * > PlotCurveVector