Commit 0dd5c2a0 authored by Julien Cabieces's avatar Julien Cabieces

Add band and field parameters in help/python bindings/documentation

parent ff02e3e0
......@@ -25,7 +25,7 @@ import argparse
import re
import otbApplication
from otbApplication import ParameterType_Bool, ParameterType_Int, ParameterType_Radius, ParameterType_RAM, ParameterType_Float, ParameterType_String, ParameterType_StringList, ParameterType_InputFilename, ParameterType_OutputFilename, ParameterType_InputImage, ParameterType_OutputImage, ParameterType_InputVectorData, ParameterType_OutputVectorData, ParameterType_Directory, ParameterType_Choice, ParameterType_InputImageList, ParameterType_InputVectorDataList, ParameterType_InputFilenameList, ParameterType_ListView, ParameterType_Group
from otbApplication import ParameterType_Bool, ParameterType_Int, ParameterType_Radius, ParameterType_RAM, ParameterType_Float, ParameterType_String, ParameterType_StringList, ParameterType_InputFilename, ParameterType_OutputFilename, ParameterType_InputImage, ParameterType_OutputImage, ParameterType_InputVectorData, ParameterType_OutputVectorData, ParameterType_Directory, ParameterType_Choice, ParameterType_InputImageList, ParameterType_InputVectorDataList, ParameterType_InputFilenameList, ParameterType_ListView, ParameterType_Band, ParameterType_Field, ParameterType_Group
from otb_warnings import application_documentation_warnings
......@@ -82,7 +82,7 @@ def GetApplicationExamplePythonSnippet(app,idx,expand = False, inputpath="",outp
value = app.GetExampleParameterValue(idx,i)
paramtype = app.GetParameterType(param)
paramrole = app.GetParameterRole(param)
if paramtype == ParameterType_ListView:
if paramtype == ParameterType_ListView or paramtype == ParameterType_Band or paramtype == ParameterType_Field:
if app.GetListViewSingleSelectionMode(param):
output += "\t" + appname + ".SetParameterString("+EncloseString(param)+", "+EncloseString(value)+")"
else:
......@@ -182,8 +182,8 @@ def rst_parameter_value(app, key):
type = app.GetParameterType(key)
# ListView is a special case depending on its mode
if type == ParameterType_ListView:
# ListView/Band/Field is a special case depending on its mode
if type == ParameterType_ListView or type == ParameterType_Band or type == ParameterType_Field:
if app.GetListViewSingleSelectionMode(key):
return "string"
else:
......
......@@ -169,6 +169,12 @@ parameters:
- ``ParameterType_RAM`` : parameter storing the maximum amount of RAM
to be used.
- ``ParameterType_Field`` : parameter storing a list of field from a given
vector data (support multi-choice and single-choice).
- ``ParameterType_Band`` : parameter storing a list of band from a given
raster data (support multi-choice and single-choice).
Parameters description
~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -250,6 +250,8 @@ public:
* \li ParameterType_InputFilenameListParameter
* \li ParameterType_StringList
* \li ParameterType_ListView
* \li ParameterType_Band
* \li ParameterType_Field
*/
void SetParameterString(std::string const& parameter, std::string value, bool hasUserValueFlag = true);
......@@ -259,6 +261,8 @@ public:
* \li ParameterType_String
* \li ParameterType_StringList
* \li ParameterType_ListView
* \li ParameterType_Band
* \li ParameterType_Field
* \li ParameterType_InputFilename
* \li ParameterType_OutputFilename
* \li ParameterType_Directory
......@@ -427,6 +431,8 @@ public:
*
* Can be called for types:
* \li ParameterType_ListView
* \li ParameterType_Band
* \li ParameterType_Field
*/
void SetListViewSingleSelectionMode(std::string const& parameter, bool status);
......@@ -435,6 +441,8 @@ public:
*
* Can be called for types:
* \li ParameterType_ListView
* \li ParameterType_Band
* \li ParameterType_Field
*/
bool GetListViewSingleSelectionMode(const std::string& parameter);
......
......@@ -234,7 +234,7 @@ void ParseGroup(Application::Pointer app, TiXmlElement* n_App, const std::string
}
}
else if (type == ParameterType_InputImageList || type == ParameterType_InputFilenameList || type == ParameterType_InputVectorDataList ||
type == ParameterType_StringList || type == ParameterType_ListView)
type == ParameterType_StringList || type == ParameterType_ListView || type == ParameterType_Field || type == ParameterType_Band)
{
values = app->GetParameterStringList(key);
hasValueList = true;
......
......@@ -673,9 +673,9 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer&
bool singleSelectionForListView = false;
if (type == ParameterType_ListView)
ListViewParameter* tmp = dynamic_cast<ListViewParameter*>(param.GetPointer());
if (tmp)
{
ListViewParameter* tmp = static_cast<ListViewParameter*>(param.GetPointer());
singleSelectionForListView = tmp->GetSingleSelection();
}
......@@ -714,7 +714,7 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer&
}
else if (type == ParameterType_InputFilename || type == ParameterType_OutputFilename || type == ParameterType_Directory || type == ParameterType_InputImage ||
type == ParameterType_InputVectorData || type == ParameterType_OutputVectorData || type == ParameterType_String || type == ParameterType_Choice ||
(type == ParameterType_ListView && singleSelectionForListView))
((type == ParameterType_ListView || type == ParameterType_Band || type == ParameterType_Field) && singleSelectionForListView))
{
oss << "<string> ";
}
......@@ -722,7 +722,8 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer&
{
oss << "<string> [pixel]";
}
else if (type == ParameterType_Choice || (type == ParameterType_ListView && !singleSelectionForListView) || type == ParameterType_InputImageList ||
else if (type == ParameterType_Choice
|| ((type == ParameterType_ListView || type == ParameterType_Band || type == ParameterType_Field) && !singleSelectionForListView) || type == ParameterType_InputImageList ||
type == ParameterType_InputVectorDataList || type == ParameterType_InputFilenameList || type == ParameterType_StringList)
{
oss << "<string list> ";
......
......@@ -637,7 +637,9 @@ class ApplicationProxy(object):
ParameterType_Float : 'ParameterType_Float',
ParameterType_Choice : 'ParameterType_Choice',
ParameterType_Group : 'ParameterType_Group',
ParameterType_Bool : 'ParameterType_Bool'
ParameterType_Bool : 'ParameterType_Bool',
ParameterType_Field : 'ParameterType_Field'
ParameterType_Band : 'ParameterType_Band'
}.get(parameter_type, 'ParameterType_UNKNOWN')
def __str__(self):
......
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