Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Belvire
otb
Commits
854f4893
Commit
854f4893
authored
18 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
Oubli.
parent
c512d102
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Gui/otbFltkFilterWatcher.cxx
+87
-0
87 additions, 0 deletions
Code/Gui/otbFltkFilterWatcher.cxx
Code/Gui/otbFltkFilterWatcher.h
+96
-0
96 additions, 0 deletions
Code/Gui/otbFltkFilterWatcher.h
with
183 additions
and
0 deletions
Code/Gui/otbFltkFilterWatcher.cxx
0 → 100644
+
87
−
0
View file @
854f4893
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
Some parts of this code are derived from ITK. See ITKCopyright.txt
for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include
"otbFltkFilterWatcher.h"
namespace
otb
{
FltkFilterWatcher
::
FltkFilterWatcher
(
itk
::
ProcessObject
*
o
,
int
x
,
int
y
,
int
w
,
int
h
,
const
char
*
comment
)
{
// Initialize state
m_Process
=
o
;
m_Comment
=
comment
;
// Create a series of commands
m_StartFilterCommand
=
CommandType
::
New
();
m_EndFilterCommand
=
CommandType
::
New
();
m_ProgressFilterCommand
=
CommandType
::
New
();
// Assign the callbacks
m_StartFilterCommand
->
SetCallbackFunction
(
this
,
&
FltkFilterWatcher
::
StartFilter
);
m_EndFilterCommand
->
SetCallbackFunction
(
this
,
&
FltkFilterWatcher
::
EndFilter
);
m_ProgressFilterCommand
->
SetCallbackFunction
(
this
,
&
FltkFilterWatcher
::
ShowProgress
);
// Add the commands as observers
m_StartTag
=
m_Process
->
AddObserver
(
itk
::
StartEvent
(),
m_StartFilterCommand
);
m_EndTag
=
m_Process
->
AddObserver
(
itk
::
EndEvent
(),
m_EndFilterCommand
);
m_ProgressTag
=
m_Process
->
AddObserver
(
itk
::
ProgressEvent
(),
m_ProgressFilterCommand
);
m_Window
=
new
Fl_Window
(
x
,
y
,
w
+
10
,
h
+
10
);
m_Window
->
label
(
m_Comment
.
c_str
());
m_Window
->
begin
();
m_Progress
=
new
Fl_Progress
(
5
,
5
,
w
,
h
);
m_Progress
->
selection_color
(
FL_DARK_BLUE
);
m_Progress
->
minimum
(
0
);
m_Progress
->
maximum
(
1
);
m_Window
->
end
();
}
FltkFilterWatcher
::~
FltkFilterWatcher
()
{
// Remove any observers we have on the old process object
if
(
m_Process
)
{
if
(
m_StartFilterCommand
)
{
m_Process
->
RemoveObserver
(
m_StartTag
);
}
if
(
m_EndFilterCommand
)
{
m_Process
->
RemoveObserver
(
m_EndTag
);
}
if
(
m_ProgressFilterCommand
)
{
m_Process
->
RemoveObserver
(
m_ProgressTag
);
}
}
delete
m_Progress
;
delete
m_Window
;
}
}
// end namespace otb
This diff is collapsed.
Click to expand it.
Code/Gui/otbFltkFilterWatcher.h
0 → 100644
+
96
−
0
View file @
854f4893
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
Some parts of this code are derived from ITK. See ITKCopyright.txt
for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbFltkFilterWatcher_h
#define __otbFltkFilterWatcher_h
#include
"itkCommand.h"
#include
"itkProcessObject.h"
#include
"itkTimeProbe.h"
#include
<FL/Fl.H>
#include
<FL/Fl_Window.H>
#include
<FL/Fl_Progress.H>
namespace
otb
{
/** \class FltkFilterWatcher
*/
class
ITK_EXPORT
FltkFilterWatcher
{
public:
/** Classes that need access to filter's private data */
friend
class
XMLFilterWatcher
;
/** Constructor. Takes a ProcessObject to monitor and an optional
* comment string that is prepended to each event message. */
FltkFilterWatcher
(
itk
::
ProcessObject
*
o
,
int
x
,
int
y
,
int
w
,
int
h
,
const
char
*
comment
=
""
);
/** Destructor. */
virtual
~
FltkFilterWatcher
();
protected:
/** Callback method to show the ProgressEvent */
virtual
void
ShowProgress
()
{
if
(
m_Process
)
{
m_Progress
->
value
(
m_Process
->
GetProgress
());
Fl
::
check
();
}
}
/** Callback method to show the StartEvent */
virtual
void
StartFilter
()
{
m_Window
->
show
();
m_Progress
->
show
();
}
/** Callback method to show the EndEvent */
virtual
void
EndFilter
()
{
m_Window
->
hide
();
}
private
:
itk
::
TimeProbe
m_TimeProbe
;
std
::
string
m_Comment
;
itk
::
ProcessObject
::
Pointer
m_Process
;
typedef
itk
::
SimpleMemberCommand
<
FltkFilterWatcher
>
CommandType
;
CommandType
::
Pointer
m_StartFilterCommand
;
CommandType
::
Pointer
m_EndFilterCommand
;
CommandType
::
Pointer
m_ProgressFilterCommand
;
unsigned
long
m_StartTag
;
unsigned
long
m_EndTag
;
unsigned
long
m_ProgressTag
;
Fl_Window
*
m_Window
;
Fl_Progress
*
m_Progress
;
};
}
// end namespace otb
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment