diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx index 93f7bdebdab6da36c541f9a0f081e1b6b1438d85..016c2370913b19ada2bc66f201cf78ec7f7de8b9 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx @@ -191,35 +191,21 @@ QWidget* QtWidgetView::CreateDoc() void QtWidgetView::SetDocParameters( std::string & val ) { const std::vector<std::string> appKeyList = m_Application->GetParametersKeys( false ); - //const unsigned int nbOfParam = appKeyList.size(); itk::OStringStream oss; - // Mandatory parameters - oss << "<h3>Mandatory parameters</h3>"; + oss << "<h3>Parameters</h3>"; oss<<"<ul>"; std::string paramDocs(""); - this->GetDocParameters( paramDocs, true ); + this->GetDocParameters( paramDocs ); oss<<paramDocs; oss<<"</ul>"; - paramDocs =""; - - // Optional parameters - oss << "<h3>Optional parameters</h3>"; - oss << "<ul>"; - - this->GetDocParameters( paramDocs, false ); - - oss<<paramDocs; - - oss<<"</ul>"; - val.append(oss.str()); } -void QtWidgetView::GetDocParameters( std::string & val, bool mandatory) +void QtWidgetView::GetDocParameters( std::string & val ) { itk::OStringStream oss; const std::vector<std::string> appKeyList = m_Application->GetParametersKeys( false ); @@ -230,37 +216,34 @@ void QtWidgetView::GetDocParameters( std::string & val, bool mandatory) { const std::string key(appKeyList[i]); Parameter::Pointer param = m_Application->GetParameterByKey( key ); - if( param->GetMandatory() == mandatory ) + if( m_Application->GetParameterType(key) == ParameterType_Group) { - if( m_Application->GetParameterType(key) == ParameterType_Group) + oss << "<li><b>[group] "<<param->GetName()<<": </b>"; + if(std::string(param->GetDescription()).size()!=0) { - oss << "<li><b>[group] "<<param->GetName()<<": </b>"; - if(std::string(param->GetDescription()).size()!=0) - { - oss<<param->GetDescription(); - } - std::string grDoc; - GetDocParameterGroup( grDoc, key, 1); - oss<<grDoc; - oss<<"</li><br />"; + oss<<param->GetDescription(); } - else if( m_Application->GetParameterType(key) == ParameterType_Choice ) - { - oss << "<li><b> [choice] "<<param->GetName()<<": </b>"; - if(std::string(param->GetDescription()).size()!=0) - { - oss<<param->GetDescription(); - } - std::string grDoc; - GetDocParameterChoice(grDoc, key, 1); - oss<<grDoc; - oss<<"</li><br />"; - } - else + std::string grDoc; + GetDocParameterGroup( grDoc, key ); + oss<<grDoc; + oss<<"</li><br />"; + } + else if( m_Application->GetParameterType(key) == ParameterType_Choice ) + { + oss << "<li><b> [choice] "<<param->GetName()<<": </b>"; + if(std::string(param->GetDescription()).size()!=0) { - oss << "<li><b><code>[param] " << param->GetName() << ": </code></b>"; - oss << param->GetDescription()<< "</li>"; + oss<<param->GetDescription(); } + std::string grDoc; + GetDocParameterChoice(grDoc, key); + oss<<grDoc; + oss<<"</li><br />"; + } + else + { + oss << "<li><b><code>[param] " << param->GetName() << ": </code></b>"; + oss << param->GetDescription()<< "</li>"; } } @@ -271,7 +254,7 @@ void QtWidgetView::GetDocParameters( std::string & val, bool mandatory) } -void QtWidgetView::GetDocParameterGroup( std::string & val, const std::string & key, int level ) +void QtWidgetView::GetDocParameterGroup( std::string & val, const std::string & key ) { Parameter * paramGr = m_Application->GetParameterByKey( key ); if( !dynamic_cast<ParameterGroup *>(paramGr)) @@ -295,7 +278,7 @@ void QtWidgetView::GetDocParameterGroup( std::string & val, const std::string & oss<<param->GetDescription(); } std::string grDoc; - GetDocParameterGroup( grDoc, fullKey, level+1); + GetDocParameterGroup( grDoc, fullKey ); oss<<grDoc; oss<<"</li>"; } @@ -307,7 +290,7 @@ void QtWidgetView::GetDocParameterGroup( std::string & val, const std::string & oss<<param->GetDescription(); } std::string grDoc; - GetDocParameterChoice(grDoc, fullKey, level+1); + GetDocParameterChoice(grDoc, fullKey ); oss<<grDoc; oss<<"</li>"; } @@ -322,7 +305,7 @@ void QtWidgetView::GetDocParameterGroup( std::string & val, const std::string & } -void QtWidgetView::GetDocParameterChoice( std::string & val, const std::string & key, int level ) +void QtWidgetView::GetDocParameterChoice( std::string & val, const std::string & key ) { Parameter * paramCh = m_Application->GetParameterByKey( key ); if( !dynamic_cast<ChoiceParameter *>(paramCh)) @@ -346,7 +329,7 @@ void QtWidgetView::GetDocParameterChoice( std::string & val, const std::string & oss<<group->GetDescription(); } - GetDocParameterGroup( grDoc, fullKey, level+1); + GetDocParameterGroup( grDoc, fullKey ); oss<<grDoc; oss<<"</li>"; } diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h b/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h index 9729b43a7978331968867bd1e6a057027f6ef76f..c96fc7895677d57660d07a08f691f6d70573cf6a 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h @@ -70,13 +70,13 @@ private: void SetDocParameters( std::string & val ); /** Get the parameter description of one parameter. */ - void GetDocParameters( std::string & val, bool mandatory ); + void GetDocParameters( std::string & val ); /** generate the documentation associated to a group.*/ - void GetDocParameterGroup( std::string & val, const std::string & key, int level); + void GetDocParameterGroup( std::string & val, const std::string & key ); /** generate the documentation associated to a choice.*/ - void GetDocParameterChoice( std::string & val, const std::string & key, int level); + void GetDocParameterChoice( std::string & val, const std::string & key ); Application::Pointer m_Application;