Orfeo Toolbox  3.16
otbFltkFilterWatcher.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12  Some parts of this code are derived from ITK. See ITKCopyright.txt
13  for details.
14 
15 
16  This software is distributed WITHOUT ANY WARRANTY; without even
17  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  PURPOSE. See the above copyright notices for more information.
19 
20 =========================================================================*/
21 #include "otbFltkFilterWatcher.h"
22 
23 namespace otb
24 {
25 
28  int x, int y, int w, int h,
29  const char *comment)
30  : FilterWatcherBase(process, comment),
31  m_CurrentProgress(0)
32 {
33  m_Window = new Fl_Window(x, y, w + 10, h + 10);
34  m_Window->label(m_Comment.c_str());
35  m_Window->begin();
36  m_Progress = new Fl_Progress(5, 5, w, h);
37  m_Progress->selection_color(FL_DARK_BLUE);
38  m_Progress->minimum(0);
39  m_Progress->maximum(1);
40  m_Window->end();
41 }
42 
45 {
46  delete m_Progress;
47  delete m_Window;
48 }
49 
50 void
53 {
54  m_Window->show();
55  m_Progress->value(0);
56  m_Progress->show();
57  Fl::check();
58 }
59 
60 void
63 {
64  if (m_Process)
65  {
66  double progress = m_Process->GetProgress();
67 
68  // Update only at each 0.5 percent
69  if (progress - m_CurrentProgress > 0.005)
70  {
71  m_Progress->value(progress);
72  m_CurrentProgress = progress;
73  Fl::check();
74  }
75  }
76 }
77 
78 void
81 {
82  m_Window->hide();
83 }
84 
85 } // end namespace otb

Generated at Sun Feb 3 2013 00:22:52 for Orfeo Toolbox with doxygen 1.8.1.1