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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
David Youssefi
otb
Commits
825c4432
Commit
825c4432
authored
13 years ago
by
Otmane Lahlou
Browse files
Options
Downloads
Patches
Plain Diff
ENH : Add ListWidget class
parent
21011b71
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/ApplicationEngine/otbWrapperListViewParameter.cxx
+159
-0
159 additions, 0 deletions
Code/ApplicationEngine/otbWrapperListViewParameter.cxx
Code/ApplicationEngine/otbWrapperListViewParameter.h
+134
-0
134 additions, 0 deletions
Code/ApplicationEngine/otbWrapperListViewParameter.h
with
293 additions
and
0 deletions
Code/ApplicationEngine/otbWrapperListViewParameter.cxx
0 → 100644
+
159
−
0
View file @
825c4432
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.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
"otbWrapperListViewParameter.h"
namespace
otb
{
namespace
Wrapper
{
ListViewParameter
::
ListViewParameter
()
:
m_CurrentChoice
(
0
)
{
}
ListViewParameter
::~
ListViewParameter
()
{
}
void
ListViewParameter
::
AddChoice
(
std
::
string
choicekey
,
std
::
string
choiceName
)
{
ListViewChoice
choice
;
choice
.
m_Key
=
choicekey
;
choice
.
m_Name
=
choiceName
;
m_ChoiceList
.
push_back
(
choice
);
}
std
::
string
ListViewParameter
::
GetChoiceKey
(
int
i
)
{
return
m_ChoiceList
[
i
].
m_Key
;
}
std
::
vector
<
std
::
string
>
ListViewParameter
::
GetChoiceKeys
(
)
{
std
::
vector
<
std
::
string
>
ret
;
ChoiceList
::
iterator
it
=
m_ChoiceList
.
begin
();
for
(
it
=
m_ChoiceList
.
begin
();
it
!=
m_ChoiceList
.
end
();
++
it
)
{
ret
.
push_back
(
it
->
m_Key
);
}
return
ret
;
}
std
::
string
ListViewParameter
::
GetChoiceName
(
int
i
)
{
return
m_ChoiceList
[
i
].
m_Name
;
}
std
::
vector
<
std
::
string
>
ListViewParameter
::
GetChoiceNames
(
)
{
std
::
vector
<
std
::
string
>
ret
;
ChoiceList
::
iterator
it
=
m_ChoiceList
.
begin
();
for
(
it
=
m_ChoiceList
.
begin
();
it
!=
m_ChoiceList
.
end
();
++
it
)
{
ret
.
push_back
(
it
->
m_Name
);
}
return
ret
;
}
unsigned
int
ListViewParameter
::
GetNbChoices
(
void
)
{
return
m_ChoiceList
.
size
();
}
void
ListViewParameter
::
SetValue
(
unsigned
int
v
)
{
m_CurrentChoice
=
v
;
SetActive
(
true
);
// Call Modified();
this
->
Modified
();
}
void
ListViewParameter
::
SetValue
(
std
::
string
choiceKey
)
{
ChoiceList
::
iterator
it
=
m_ChoiceList
.
begin
();
unsigned
int
i
=
0
;
for
(
it
=
m_ChoiceList
.
begin
();
it
!=
m_ChoiceList
.
end
();
++
it
)
{
if
(
it
->
m_Key
==
choiceKey
)
{
SetValue
(
i
);
return
;
}
++
i
;
}
itkExceptionMacro
(
<<
"Cannot find "
<<
choiceKey
);
}
unsigned
int
ListViewParameter
::
GetValue
()
{
return
m_CurrentChoice
;
}
// TODO : not implemented yet
std
::
vector
<
std
::
string
>
ListViewParameter
::
GetParametersKeys
()
{
std
::
vector
<
std
::
string
>
parameters
;
ChoiceList
::
iterator
cit
=
m_ChoiceList
.
begin
();
// for (cit = m_ChoiceList.begin(); cit != m_ChoiceList.end(); ++cit)
// {
// if (cit->m_AssociatedParameter)
// {
// std::vector<std::string> subparams = cit->m_AssociatedParameter->GetParametersKeys();
// for (std::vector<std::string>::const_iterator it = subparams.begin();
// it != subparams.end(); ++it)
// {
// parameters.push_back( cit->m_Key + "." + *it );
// }
// }
// }
return
parameters
;
}
/** Clear choices */
void
ListViewParameter
::
ClearChoices
()
{
m_ChoiceList
.
clear
();
}
}
}
This diff is collapsed.
Click to expand it.
Code/ApplicationEngine/otbWrapperListViewParameter.h
0 → 100644
+
134
−
0
View file @
825c4432
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.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 __otbWrapperListViewParameter_h
#define __otbWrapperListViewParameter_h
#include
"otbWrapperParameter.h"
#include
"otbWrapperParameterGroup.h"
namespace
otb
{
namespace
Wrapper
{
/** \class ListViewParameter
* \brief This class represent a ListWidget parameter for the wrapper framework
*
* The row selected in the ListWidget are stored in a std::vector. The
* method GetSelectedItems() allow the user to access to this method.
*
*/
class
ListViewParameter
:
public
Parameter
{
public:
/** Standard class typedef */
typedef
ListViewParameter
Self
;
typedef
Parameter
Superclass
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
itk
::
SmartPointer
<
const
Self
>
ConstPointer
;
/** Defining ::New() static method */
itkNewMacro
(
Self
);
/** RTTI support */
itkTypeMacro
(
ListViewParameter
,
Parameter
);
/** Add a value to the choice */
void
AddChoice
(
std
::
string
choicekey
,
std
::
string
choiceName
);
/** Get the key of a specific choice value */
std
::
string
GetChoiceKey
(
int
i
);
/** Get the list of the different choice keys */
std
::
vector
<
std
::
string
>
GetChoiceKeys
();
/** Get the long name of a specific choice value */
std
::
string
GetChoiceName
(
int
i
);
/** Get the list of the different choice keys */
std
::
vector
<
std
::
string
>
GetChoiceNames
();
/** Get all parameters that are child of this choice parameter */
std
::
vector
<
std
::
string
>
GetParametersKeys
();
/** Get the number of available choice */
unsigned
int
GetNbChoices
(
void
);
/** Set choice value */
virtual
void
SetValue
(
unsigned
int
v
);
/** Set choice value by its key */
virtual
void
SetValue
(
std
::
string
choiceKey
);
/** Return any value */
virtual
unsigned
int
GetValue
();
bool
HasValue
()
const
{
// a choice parameter always has a value
return
true
;
}
void
ClearValue
()
{
// nothing to do : a choice parameter always has a value
}
void
ClearChoices
();
std
::
vector
<
int
>
GetSelectedItems
()
{
return
m_SelectedItems
;
}
void
SetSelectedItems
(
std
::
vector
<
int
>
selectedItems
)
{
m_SelectedItems
=
selectedItems
;
}
protected
:
/** Constructor */
ListViewParameter
();
/** Destructor */
virtual
~
ListViewParameter
();
struct
ListViewChoice
{
ListViewChoice
()
{}
std
::
string
m_Key
;
std
::
string
m_Name
;
};
typedef
std
::
vector
<
ListViewChoice
>
ChoiceList
;
ChoiceList
m_ChoiceList
;
unsigned
int
m_CurrentChoice
;
std
::
vector
<
int
>
m_SelectedItems
;
private
:
ListViewParameter
(
const
ListViewParameter
&
);
//purposely not implemented
void
operator
=
(
const
ListViewParameter
&
);
//purposely not implemented
};
// End class Parameter
}
// End namespace Wrapper
}
// 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