1 | /*========================================================================= |
---|
2 | |
---|
3 | Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. |
---|
4 | See OTBCopyright.txt for details. |
---|
5 | |
---|
6 | Some parts of this code are derived from ITK. See ITKCopyright.txt |
---|
7 | for details. |
---|
8 | |
---|
9 | |
---|
10 | This software is distributed WITHOUT ANY WARRANTY; without even |
---|
11 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
---|
12 | PURPOSE. See the above copyright notices for more information. |
---|
13 | |
---|
14 | See Ref: http://hg.orfeo-toolbox.org/OTB/ Copyright |
---|
15 | |
---|
16 | =========================================================================*/ |
---|
17 | #include "otbZooWatcher.h" |
---|
18 | #include "otbConfigure.h" |
---|
19 | #include "service_internal.h" |
---|
20 | |
---|
21 | ZooWatcher |
---|
22 | ::ZooWatcher() |
---|
23 | { |
---|
24 | } |
---|
25 | |
---|
26 | ZooWatcher |
---|
27 | ::ZooWatcher(itk::ProcessObject* process, |
---|
28 | const char *comment) |
---|
29 | : otb::FilterWatcherBase(process, comment) |
---|
30 | { |
---|
31 | } |
---|
32 | |
---|
33 | ZooWatcher |
---|
34 | ::ZooWatcher(itk::ProcessObject* process, |
---|
35 | const std::string& comment) |
---|
36 | : otb::FilterWatcherBase(process, comment.c_str()) |
---|
37 | { |
---|
38 | } |
---|
39 | |
---|
40 | void |
---|
41 | ZooWatcher |
---|
42 | ::ShowProgress() |
---|
43 | { |
---|
44 | if (m_Process) |
---|
45 | { |
---|
46 | int progressPercent = static_cast<int>(m_Process->GetProgress() * 100); |
---|
47 | if(progressPercent>iCounter){ |
---|
48 | updateStatus(m_Conf,progressPercent,m_Comment.c_str()); |
---|
49 | iCounter=progressPercent; |
---|
50 | } |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | void |
---|
55 | ZooWatcher |
---|
56 | ::StartFilter() |
---|
57 | { |
---|
58 | #if OTB_VERSION_MAJOR < 6 |
---|
59 | m_TimeProbe.Start(); |
---|
60 | #endif |
---|
61 | iCounter=-1; |
---|
62 | } |
---|
63 | |
---|
64 | void |
---|
65 | ZooWatcher |
---|
66 | ::EndFilter() |
---|
67 | { |
---|
68 | #if OTB_VERSION_MAJOR < 6 |
---|
69 | m_TimeProbe.Stop(); |
---|
70 | std::ostringstream elapsedTime; |
---|
71 | elapsedTime.precision(1); |
---|
72 | elapsedTime << m_TimeProbe.GetMean(); |
---|
73 | |
---|
74 | std::cerr << " (OTB Execution: " |
---|
75 | << elapsedTime.str() |
---|
76 | << " seconds)" |
---|
77 | << std::endl; |
---|
78 | #endif |
---|
79 | } |
---|