Orfeo Toolbox
3.16
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
OTB
Code
Wrappers
QtWidget
otbWrapperQtWidgetSimpleProgressReport.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
13
This software is distributed WITHOUT ANY WARRANTY; without even
14
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
PURPOSE. See the above copyright notices for more information.
16
17
=========================================================================*/
18
19
#include "
otbWrapperQtWidgetSimpleProgressReport.h
"
20
#include "
otbWrapperOutputImageParameter.h
"
21
#include "itksys/SystemTools.hxx"
22
23
#include "
otbWrapperAddProcessToWatchEvent.h
"
24
25
namespace
otb
26
{
27
namespace
Wrapper
28
{
29
30
QtWidgetSimpleProgressReport::QtWidgetSimpleProgressReport
(
QtWidgetModel
* model)
31
{
32
m_Model
= model;
33
connect(model, SIGNAL(SetProgressReportBegin()),
this
, SLOT(show()) );
34
connect(model, SIGNAL(SetProgressReportDone()),
this
, SLOT(close()) );
35
connect(model, SIGNAL(SetProgressReportDone()),
this
, SLOT(
Init
()) );
36
connect(
this
, SIGNAL(
AddNewProcessToReport
()),
this
, SLOT(
ReportProcess
()) );
37
38
m_Layout
=
new
QVBoxLayout;
39
this->setLayout(
m_Layout
);
40
41
m_AddProcessCommand
=
AddProcessCommandType::New
();
42
m_AddProcessCommand
->SetCallbackFunction(
this
, &
QtWidgetSimpleProgressReport::ProcessEvent
);
43
44
m_Bar
=
new
itk::QtProgressBar
(
this
);
45
m_Label
=
new
QLabel(
"No process"
);
46
connect(
m_Bar
, SIGNAL(SetValueChanged(
int
)),
m_Bar
, SLOT(setValue(
int
)) );
47
connect(
m_Model
, SIGNAL(SetProgressReportDone()),
m_Bar
, SLOT(reset()) );
48
49
m_Layout
->addWidget(
m_Label
);
50
m_Layout
->addWidget(
m_Bar
);
51
52
this->show();
53
}
54
55
QtWidgetSimpleProgressReport::~QtWidgetSimpleProgressReport
()
56
{
57
}
58
59
void
QtWidgetSimpleProgressReport::SetApplication
(
Application::Pointer
app)
60
{
61
m_Application
= app;
62
m_Application
->AddObserver(
AddProcessToWatchEvent
(),
m_AddProcessCommand
.
GetPointer
() );
63
}
64
65
void
66
QtWidgetSimpleProgressReport::ProcessEvent
(
itk::Object
* caller,
67
const
itk::EventObject
& event )
68
{
69
if
(
typeid
(
otb::Wrapper::AddProcessToWatchEvent
) ==
typeid
( event ) )
70
{
71
const
AddProcessToWatchEvent
* eventToWacth =
dynamic_cast<
const
AddProcessToWatchEvent
*
>
( &event );
72
73
m_CurrentProcess
= eventToWacth->
GetProcess
();
74
m_CurrentDescription
= eventToWacth->
GetProcessDescription
();
75
emit
AddNewProcessToReport
();
76
}
77
}
78
79
void
QtWidgetSimpleProgressReport::ReportProcess
()
80
{
81
m_Bar
->
Observe
(
m_CurrentProcess
);
82
m_Label
->setText(QString(
m_CurrentDescription
.c_str()));
83
}
84
85
86
void
QtWidgetSimpleProgressReport::Init
()
87
{
88
m_Bar
->setValue(0);
89
m_Label
->setText(
"No process yet..."
);
90
}
91
92
}
93
}
Generated at Sun Feb 3 2013 00:59:22 for
Orfeo Toolbox
with
doxygen 1.8.1.1