Commit b3cb60bd authored by Victor Poughon's avatar Victor Poughon

Merge branch '1686-clarify-list-param' into 'develop'

Resolve "Possible confusion when using single-value-mode parameter-lists in CLI"

Closes #1686

See merge request !200
parents 454694c5 921bcda4
......@@ -133,7 +133,10 @@ def GenerateParameterType(app,param):
if app.GetParameterType(param) == otbApplication.ParameterType_InputFilenameList :
return "Input File name list"
if app.GetParameterType(param) == otbApplication.ParameterType_ListView:
return "List"
if app.GetListViewSingleSelectionMode(param):
return "String"
else:
return "String List"
if app.GetParameterType(param) == otbApplication.ParameterType_Group:
return "Group"
if app.GetParameterType(param) == otbApplication.ParameterType_InputProcessXML:
......
......@@ -121,7 +121,7 @@ private:
// Doc example parameter settings
SetDocExampleParameterValue("in", "support_image.tif");
SetDocExampleParameterValue("vec", "variousVectors.sqlite");
SetDocExampleParameterValue("field", "label");
SetDocExampleParameterValue("field", "CLASS");
SetDocExampleParameterValue("out","polygonStat.xml");
SetOfficialDocLink();
......
......@@ -384,6 +384,14 @@ public:
*/
void SetListViewSingleSelectionMode(std::string parameter, bool status);
/**
* True if the parameter is a list view and is in single selection mode
*
* Can be called for types:
* \li ParameterType_ListView
*/
bool GetListViewSingleSelectionMode(const std::string& parameter);
/* Set an output image value
*
* Can be called for types :
......
......@@ -1422,6 +1422,21 @@ void Application::SetListViewSingleSelectionMode(std::string parameter, bool sta
}
bool Application::GetListViewSingleSelectionMode(const std::string& parameter)
{
Parameter* param = GetParameterByKey(parameter);
ListViewParameter* paramListView = dynamic_cast<ListViewParameter*>(param);
if (paramListView)
{
return paramListView->GetSingleSelection();
}
else
{
itkExceptionMacro(<<parameter << " parameter can't be casted to ListView");
}
}
void Application::SetParameterOutputImage(std::string parameter, FloatVectorImageType* value)
{
......
......@@ -261,6 +261,8 @@ public:
std::vector<std::string> GetParameterStringList(std::string parameter);
std::string GetParameterAsString(std::string paramKey);
bool GetListViewSingleSelectionMode(const std::string& paramKey);
ImageBaseType * GetParameterOutputImage(std::string parameter);
void SetParameterInputImage(std::string parameter, ImageBaseType * inputImage);
ImageBaseType * GetParameterComplexOutputImage(std::string parameter);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment