OTB  6.7.0
Orfeo Toolbox
mvdImageSettings.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 mvdImageSettings_h
22 #define mvdImageSettings_h
23 
24 //
25 // Configuration include.
27 #include "ConfigureMonteverdi.h"
28 
29 #include "OTBMonteverdiCoreExport.h"
30 
31 /*****************************************************************************/
32 /* INCLUDE SECTION */
33 
34 //
35 // Qt includes (sorted by alphabetic order)
37 #include <QtCore>
38 
39 //
40 // System includes (sorted by alphabetic order)
41 
42 //
43 // ITK includes (sorted by alphabetic order)
44 
45 //
46 // OTB includes (sorted by alphabetic order)
47 
48 //
49 // Monteverdi includes (sorted by alphabetic order)
50 #include "mvdCore.h"
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 
66 
67 /*****************************************************************************/
68 /* CLASS DEFINITION SECTION */
69 
77 class OTBMonteverdiCore_EXPORT ImageSettings
78 {
79 
80  /*-[ PUBLIC SECTION ]------------------------------------------------------*/
81 
82 //
83 // Public types & constants.
84 public:
85 
87  typedef unsigned int SizeType;
88 
90  typedef double ValueType;
91 
92 //
93 // Public methods.
94 public:
95 
97  ImageSettings();
98 
100  virtual ~ImageSettings();
101 
104  inline bool IsApplied() const;
105 
108  inline bool IsModified() const;
109 
112  inline void ClearModified();
113 
116  inline void SetApplied();
117 
120  inline void SetEffect( Effect );
121 
124  inline Effect GetEffect() const;
125 
128  const char * GetEffectName() const;
129 
132  inline bool HasSize() const;
133 
136  inline bool HasValue() const;
137 
140  inline void SetSize( unsigned int );
141 
144  inline unsigned int GetSize() const;
145 
148  void SetValue( double );
149 
152  double GetValue() const;
153 
156  inline const char * GetValueName() const;
157 
160  inline void SetAlpha( double );
161 
164  inline double GetAlpha() const;
165 
166  /*-[ PROTECTED SECTION ]---------------------------------------------------*/
167 
168 //
169 // Protected methods.
170 protected:
171 
174  inline void SetModified();
175 
176 //
177 // Protected attributes.
178 protected:
179 
180  /*-[ PRIVATE SECTION ]-----------------------------------------------------*/
181 
182 //
183 // Private methods.
184 private:
185 
186 
187 //
188 // Private attributes.
189 private:
190 
193  static char const * const EFFECT_VALUE_NAME[ EFFECT_COUNT ];
194 
199  // TODO: Optimize using C++ bitset bool foo:1;
200  bool m_IsModified: 1;
201 
206  // TODO: Optimize using C++ bitset bool foo:1;
207  bool m_IsApplied: 1;
208 
212 
215  unsigned int m_Size;
216 
219  double m_Range;
220  double m_Angle;
221 
224  double m_Alpha;
225 };
226 
227 } // end namespace 'mvd'.
228 
229 /*****************************************************************************/
230 /* INLINE SECTION */
231 
232 //
233 // Qt includes (sorted by alphabetic order)
235 
236 //
237 // System includes (sorted by alphabetic order)
238 
239 //
240 // ITK includes (sorted by alphabetic order)
241 
242 //
243 // OTB includes (sorted by alphabetic order)
244 
245 //
246 // Monteverdi includes (sorted by alphabetic order)
247 
248 namespace mvd
249 {
250 
251 /*****************************************************************************/
252 inline
253 bool
255 ::IsApplied() const
256 {
257  return m_IsApplied;
258 }
259 
260 /*****************************************************************************/
261 inline
262 bool
265 {
266  return m_IsModified;
267 }
268 
269 /*****************************************************************************/
270 inline
271 void
274 {
275  // qDebug() << this << "::SetModified()";
276 
277  m_IsModified = true;
278  m_IsApplied = false;
279 }
280 
281 /*****************************************************************************/
282 inline
283 void
286 {
287  // qDebug() << this << "::ClearModified()";
288 
289  m_IsModified = false;
290 }
291 
292 /*****************************************************************************/
293 inline
294 void
297 {
298  // qDebug() << this << "::SetApplied()";
299 
300  m_IsApplied = true;
301 }
302 
303 /*****************************************************************************/
304 inline
305 void
308 {
309  m_Effect = effect;
310 
311  SetModified();
312 }
313 
314 /*****************************************************************************/
315 inline
316 Effect
318 ::GetEffect() const
319 {
320  return m_Effect;
321 }
322 
323 /*****************************************************************************/
324 inline
325 const char *
328 {
329  assert( qApp!=NULL );
330 
331  return
332  qApp->translate(
333  "mvd::ImageSettings",
335  )
336  .toLocal8Bit().constData();
337 }
338 
339 /*****************************************************************************/
340 inline
341 bool
343 ::HasSize() const
344 {
345  return
346  m_Effect==EFFECT_CHESSBOARD ||
347  m_Effect==EFFECT_GRADIENT ||
348  m_Effect==EFFECT_LOCAL_CONTRAST ||
349  m_Effect==EFFECT_LOCAL_TRANSLUCENCY ||
350  m_Effect==EFFECT_SPECTRAL_ANGLE ||
351  m_Effect==EFFECT_LUT_LOCAL_JET ||
352  m_Effect==EFFECT_LUT_LOCAL_HOT ||
353  m_Effect==EFFECT_LUT_LOCAL_WINTER ||
354  m_Effect==EFFECT_LUT_LOCAL_SUMMER ||
355  m_Effect==EFFECT_LUT_LOCAL_COOL;
356 }
357 
358 /*****************************************************************************/
359 inline
360 bool
362 ::HasValue() const
363 {
364  return
365  m_Effect==EFFECT_LOCAL_CONTRAST ||
366  m_Effect==EFFECT_SPECTRAL_ANGLE ||
367  m_Effect==EFFECT_LUT_LOCAL_JET ||
368  m_Effect==EFFECT_LUT_LOCAL_HOT ||
369  m_Effect==EFFECT_LUT_LOCAL_WINTER ||
370  m_Effect==EFFECT_LUT_LOCAL_SUMMER ||
371  m_Effect==EFFECT_LUT_LOCAL_COOL;
372 }
373 
374 /*****************************************************************************/
375 inline
376 void
378 ::SetSize( unsigned int size )
379 {
380  m_Size = size;
381 
382  SetModified();
383 }
384 
385 /*****************************************************************************/
386 inline
387 unsigned int
389 ::GetSize() const
390 {
391  return m_Size;
392 }
393 
394 /*****************************************************************************/
395 inline
396 void
398 ::SetAlpha( double alpha )
399 {
400  m_Alpha = alpha;
401 
402  if( m_Alpha>1.0 )
403  m_Alpha = 1.0;
404 
405  if( m_Alpha<0.0 )
406  m_Alpha = 0.0;
407 
408  SetModified();
409 }
410 
411 /*****************************************************************************/
412 inline
413 double
415 ::GetAlpha() const
416 {
417  return m_Alpha;
418 }
419 
420 } // end namespace 'mvd'
421 
422 #endif // mvdImageSettings_h
Effect
Definition: mvdCore.h:122
unsigned int GetSize() const
void SetEffect(Effect)
bool HasValue() const
bool IsApplied() const
bool HasSize() const
double GetAlpha() const
bool IsModified() const
static char const *const EFFECT_VALUE_NAME[EFFECT_COUNT]
Effect GetEffect() const
const char * GetValueName() const
void SetSize(unsigned int)
unsigned int SizeType