| 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 | updateStatus(m_Conf,progressPercent,m_Comment.c_str()); |
|---|
| 48 | } |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | void |
|---|
| 52 | ZooWatcher |
|---|
| 53 | ::StartFilter() |
|---|
| 54 | { |
|---|
| 55 | #if OTB_VERSION_MAJOR < 6 |
|---|
| 56 | m_TimeProbe.Start(); |
|---|
| 57 | #endif |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | void |
|---|
| 61 | ZooWatcher |
|---|
| 62 | ::EndFilter() |
|---|
| 63 | { |
|---|
| 64 | #if OTB_VERSION_MAJOR < 6 |
|---|
| 65 | m_TimeProbe.Stop(); |
|---|
| 66 | std::ostringstream elapsedTime; |
|---|
| 67 | elapsedTime.precision(1); |
|---|
| 68 | elapsedTime << m_TimeProbe.GetMean(); |
|---|
| 69 | |
|---|
| 70 | std::cerr << " (OTB Execution: " |
|---|
| 71 | << elapsedTime.str() |
|---|
| 72 | << " seconds)" |
|---|
| 73 | << std::endl; |
|---|
| 74 | #endif |
|---|
| 75 | } |
|---|