diff --git a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py index 7bb739bed0feff46340b2ba82c01a19525465858..c9192c36d8d066c09a8a2f6a81ed5cb6849bf4f1 100755 --- a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py +++ b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py @@ -115,8 +115,7 @@ def GenerateChoice(app,param,paramlist, count = 0): return output def GenerateParameterType(app,param): - if app.GetParameterType(param) == otbApplication.ParameterType_Empty \ - or app.GetParameterType(param) == otbApplication.ParameterType_Bool: + if app.GetParameterType(param) == otbApplication.ParameterType_Bool: return "Boolean" if app.GetParameterType(param) == otbApplication.ParameterType_Int \ or app.GetParameterType(param) == otbApplication.ParameterType_Radius \ @@ -367,9 +366,6 @@ def GetApplicationExamplePythonSnippet(app,idx,expand = False, inputpath="",outp if paramtype == otbApplication.ParameterType_Choice: #app.SetParameterString(param,value) output+= "\t" + appname + ".SetParameterString(" + EncloseString(param) + "," + EncloseString(value) + ")" + linesep - if paramtype == otbApplication.ParameterType_Empty: - app.EnableParameter(param) - output+= "\t" + appname + ".EnableParameter("+EncloseString(param)+")" + linesep if paramtype == otbApplication.ParameterType_Bool: output+= "\t" + appname + ".SetParameterString("+EncloseString(param)+","+EncloseString(value)+")" + linesep if paramtype == otbApplication.ParameterType_Int \ diff --git a/Documentation/Cookbook/rst/recipes/python.rst b/Documentation/Cookbook/rst/recipes/python.rst index b03145be78c074b5c761bc2233162a98a553f4cb..7813b897cda68c188a431261a3154f77d60fb691 100644 --- a/Documentation/Cookbook/rst/recipes/python.rst +++ b/Documentation/Cookbook/rst/recipes/python.rst @@ -375,41 +375,3 @@ that relate to geometry, projections, and also calibration. Future developments will probably offer a more adapted structure to import and export images between OTB and the Python world. -Setting of EmptyParameter -^^^^^^^^^^^^^^^^^^^^^^^^^ - -Most of the parameters are set using functions ``SetParameterXXX()``, except for -one type of parameter: the ``EmptyParameter``. This class was the first -implementation of a boolean. It is now **deprecated**, you should use ``BoolParameter`` -instead. - -Let's take an example with the application ``ReadImageInfo`` when it was still -using an ``EmptyParameter`` for parameter ``keywordlist``: - -.. code-block:: python - - import otbApplication as otb - app = otb.Registry.CreateApplication("ReadImageInfo") - -If you want the get the state of parameter ``keywordlist``, a boolean, use: - -.. code-block:: python - - app.IsParameterEnabled("keywordlist") - -To set this parameter ON/OFF, use the functions: - -.. code-block:: python - - app.EnableParameter("keywordlist") - app.DisableParameter("keywordlist") - -Don't try to use other functions to set the state of a boolean. For instance, -try the following commands: - -.. code-block:: python - - app.SetParameterInt("keywordlist", 0) - app.IsParameterEnabled("keywordlist") - -You will get a state ``True`` even if you asked the opposite. diff --git a/Examples/Application/ApplicationExample.cxx b/Examples/Application/ApplicationExample.cxx index 946ca706697a8313a73b46efe2718b7e41b9df0e..f606036a9fc14edd629bc4dc4a71ba5d503bfe6f 100644 --- a/Examples/Application/ApplicationExample.cxx +++ b/Examples/Application/ApplicationExample.cxx @@ -153,7 +153,7 @@ private: AddParameter(ParameterType_OutputImage, "out", "Output Image"); - AddParameter(ParameterType_Empty, "param1", "Example of boolean parameter"); + AddParameter(ParameterType_Bool, "param1", "Example of boolean parameter"); MandatoryOff("param1"); AddParameter(ParameterType_Int, "param2", "Example of integer parameter"); diff --git a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.hxx b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.hxx index 324bc7dd1d8dceabab88635e39d853f1b7c0c2e2..b569b335ccd025d7610bb28693c8b4850c5ace10 100644 --- a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.hxx +++ b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.hxx @@ -65,7 +65,6 @@ LearningApplicationBase<TInputValue,TOutputValue> "regression accuracy parameter, then the node will not be split further."); //UseSurrogates : don't need to be exposed ! - //AddParameter(ParameterType_Empty, "classifier.dt.sur", "Surrogate splits will be built"); //SetParameterDescription("classifier.dt.sur","These splits allow working with missing data and compute variable importance correctly."); //MaxCategories diff --git a/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.hxx b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.hxx index 719bf8b06e8f4ba74002c635570afb0da5b9babb..74a3ce3d7cd89d6a2e9035d572758042ec2dbfd0 100644 --- a/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.hxx +++ b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.hxx @@ -79,9 +79,6 @@ LearningApplicationBase<TInputValue,TOutputValue> "possible depth of the tree. The actual depth may be smaller if the other termination criteria are met, and/or " "if the tree is pruned."); - //UseSurrogates : don't need to be exposed ! - //AddParameter(ParameterType_Empty, "classifier.gbt.sur", "Surrogate splits will be built"); - //SetParameterDescription("classifier.gbt.sur","These splits allow working with missing data and compute variable importance correctly."); #endif } diff --git a/Modules/Applications/AppClassification/include/otbTrainRandomForests.hxx b/Modules/Applications/AppClassification/include/otbTrainRandomForests.hxx index 1751f927026bf15c6e0e940df7993c63798e93bd..46b87fe86512d1bccf944e64611bc958414bc08c 100644 --- a/Modules/Applications/AppClassification/include/otbTrainRandomForests.hxx +++ b/Modules/Applications/AppClassification/include/otbTrainRandomForests.hxx @@ -59,10 +59,6 @@ LearningApplicationBase<TInputValue,TOutputValue> "and the values of the train samples in this node are smaller than this regression accuracy parameter, " "then the node will not be split."); - //UseSurrogates : don't need to be exposed ! - //AddParameter(ParameterType_Empty, "classifier.rf.sur", "Surrogate splits will be built"); - //SetParameterDescription("classifier.rf.sur","These splits allow working with missing data and compute variable importance correctly."); - //MaxNumberOfCategories AddParameter(ParameterType_Int, "classifier.rf.cat", "Cluster possible values of a categorical variable into K <= cat clusters to find a suboptimal split"); diff --git a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx index 0103fee6b29d5602b478ff2d448231d09c2bd048..9c245c79bf047e60d1f5b561e219edabc65de660 100644 --- a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx @@ -189,10 +189,6 @@ private: SetParameterDescription("filter.meanshift.minsize", "Minimum size of a region (in pixel unit) in segmentation. Smaller clusters will be merged to the neighboring cluster with the closest radiometry." " If set to 0 no pruning is done."); - //AddParameter(ParameterType_Empty, "filter.meanshift.useoptim", "use optimization"); - //SetParameterDescription("filter.meanshift.useoptim", "Use mode optimization."); - //MandatoryOff("filter.meanshift.useoptim"); - SetDefaultParameterInt("filter.meanshift.spatialr", 5); SetDefaultParameterFloat("filter.meanshift.ranger", 15.0); SetDefaultParameterFloat("filter.meanshift.thres", 0.1); diff --git a/Modules/Applications/AppTest/app/otbTestApplication.cxx b/Modules/Applications/AppTest/app/otbTestApplication.cxx index 42f11fb32742a8f606a53f762b72516e3acde470..0aed3c6682ca765e35db0d7ddee1cafbc6241eda 100644 --- a/Modules/Applications/AppTest/app/otbTestApplication.cxx +++ b/Modules/Applications/AppTest/app/otbTestApplication.cxx @@ -56,7 +56,6 @@ private: AddDocTag("Test"); //std::cout << "TestApplication::DoInit" << std::endl; - AddParameter(ParameterType_Empty, "empty", "Boolean (old impl.)"); AddParameter(ParameterType_Bool, "boolean", "Boolean"); AddParameter(ParameterType_Int, "int", "Integer"); MandatoryOff("int"); diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index bd98acca2ae69a9a2ff521656977793fe8d87043..debf5cf508d4efff369affcc9efddc5741d64812 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -190,10 +190,6 @@ public: * or a value set externally by user */ bool HasValue(std::string paramKey) const; - /* Get active flag of parameter with key paramKey - */ - bool GetParameterEmpty(std::string paramKey); - /** Set HasUserValue flag of parameter with key paramKey * Note that when this function is called from DoInit, DoUpdateParameters * or DoExecute, it will always set this flag to false, because this is @@ -226,6 +222,7 @@ public: * * Can be called for types : * \li ParameterType_Int + * \li ParameterType_Bool * \li ParameterType_Float * \li ParameterType_Radius * \li ParameterType_Choice @@ -271,8 +268,6 @@ public: */ void SetParameterStringList(std::string parameter, std::vector<std::string> values, bool hasUserValueFlag = true); - void SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag = true); - /** Checks if the application is ready to be executed. It checks that there * is no missing parameter */ @@ -434,6 +429,7 @@ public: * * Can be called for types : * \li ParameterType_Int + * \li ParameterType_Bool * \li ParameterType_Float * \li ParameterType_Radius * \li ParameterType_Choice diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperBoolParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperBoolParameter.h index 28ac6bf66862edada93834697d0895ee79da7529..dae2fb7edaa348830367a0cfc2b931203099e190 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperBoolParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperBoolParameter.h @@ -33,8 +33,6 @@ namespace Wrapper /** \class BoolParameter * \brief This class represent a boolean parameter for the wrapper framework * - * It is intended to replace the deprecated EmptyParameter - * * \ingroup OTBApplicationEngine */ class OTBApplicationEngine_EXPORT BoolParameter diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h deleted file mode 100644 index a71cad06ba3c2bc0ba1fcd45294a48a6f4340bd0..0000000000000000000000000000000000000000 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbWrapperEmptyParameter_h -#define otbWrapperEmptyParameter_h - -#include "otbWrapperParameter.h" - -namespace otb -{ -namespace Wrapper -{ - -/** \class EmptyParameter - * \brief This class represent an empty parameter for the wrapper framework (boolean value) - * - * \deprecated in OTB 6.6, use BoolParameter instead - * - * \ingroup OTBApplicationEngine - */ -class OTBApplicationEngine_EXPORT EmptyParameter - : public Parameter -{ -public: - /** Standard class typedef */ - typedef EmptyParameter Self; - typedef Parameter Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Defining ::New() static method */ - itkNewMacro(Self); - - /** RTTI support */ - itkTypeMacro(EmptyParameter, Parameter); - - /** HasValue */ - bool HasValue() const override - { - return false; - } - - bool HasUserValue() const override - { - return this->m_UserValue; - } - -protected: - /** Constructor */ - EmptyParameter() - { - // It does not make sense for an empty parameter to be mandatory - this->MandatoryOff(); - } - - /** Destructor */ - ~EmptyParameter() override - {} - -private: - EmptyParameter(const EmptyParameter &) = delete; - void operator =(const EmptyParameter&) = delete; - -}; // End class Parameter - -} // End namespace Wrapper -} // End namespace otb - -#endif diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h index bf51898aa92afed9ebad8929ba74ae403655e929..6f99abe774bdb5f86f4de1f0fa0fa5cd4e15d088 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h @@ -35,7 +35,6 @@ namespace Wrapper typedef enum { - ParameterType_Empty, ParameterType_Int, ParameterType_Float, ParameterType_String, diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index 9f820a3e8f6382dc267c72f1d1b52e85ab911e9c..49506d3dd1f0bb7efea7e7d7559413a1555f3d84 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -22,7 +22,6 @@ #include "otbWrapperChoiceParameter.h" #include "otbWrapperListViewParameter.h" #include "otbWrapperDirectoryParameter.h" -#include "otbWrapperEmptyParameter.h" #include "otbWrapperInputFilenameParameter.h" #include "otbWrapperInputFilenameListParameter.h" #include "otbWrapperOutputFilenameParameter.h" @@ -380,6 +379,10 @@ void Application::SetParameterInt(std::string parameter, int value, bool hasUser BoolParameter* paramBool = dynamic_cast<BoolParameter*>(param); paramBool->SetValue(static_cast<bool>(value)); } + else + { + otbAppLogWARNING(<< "SetParameterInt on parameter " + parameter); + } this->SetParameterUserValue(parameter, hasUserValueFlag); } @@ -538,12 +541,6 @@ void Application::SetParameterStringList(std::string parameter, std::vector<std: this->SetParameterUserValue(parameter, hasUserValueFlag); } -void Application::SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag) -{ - this->SetParameterUserValue(parameter, hasUserValueFlag); - GetParameterByKey(parameter)->SetActive(value); -} - void Application::SetParameterUserValue(std::string paramKey, bool value) { /** UserValue is set/unset parameter must be active. @@ -1086,11 +1083,6 @@ Role Application::GetParameterRole(std::string paramKey) const return GetParameterByKey(paramKey)->GetRole(); } -bool Application::GetParameterEmpty(std::string paramKey) -{ - return GetParameterByKey(paramKey)->GetActive(); -} - /* Return the role (input/output) of a parameter */ void Application::SetParameterRole(std::string paramKey, Role role) { @@ -1116,10 +1108,6 @@ ParameterType Application::GetParameterType(std::string paramKey) const { type = ParameterType_Radius; } - else if (dynamic_cast<const EmptyParameter*>(param)) - { - type = ParameterType_Empty; - } else if (dynamic_cast<const IntParameter*>(param)) { type = ParameterType_Int; @@ -1550,11 +1538,6 @@ int Application::GetParameterInt(std::string parameter) BoolParameter* paramBool = dynamic_cast<BoolParameter*>(param); ret = static_cast<int>(paramBool->GetValue()); } - else if (dynamic_cast<EmptyParameter*>(param)) - { - // This case is here for compatibility purpose with deprecated EmptyParameter - ret = static_cast<int>(this->IsParameterEnabled(parameter)); - } else { itkExceptionMacro(<<parameter << " parameter can't be casted to int"); diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx index 11f0e6b482a69896a0d132edb64bcc808c49576f..d0cff8814ddcdacd6c3c1ec285d1e34b518ee5ea 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx @@ -23,7 +23,6 @@ #include "otbWrapperChoiceParameter.h" #include "otbWrapperListViewParameter.h" #include "otbWrapperDirectoryParameter.h" -#include "otbWrapperEmptyParameter.h" #include "otbWrapperInputFilenameParameter.h" #include "otbWrapperInputFilenameListParameter.h" #include "otbWrapperOutputFilenameParameter.h" @@ -419,15 +418,6 @@ InputProcessXMLParameter::Read(Application::Pointer this_) std::stringstream(value) >> floatValue; this_->SetParameterFloat(key, floatValue); } - else if (type == ParameterType_Empty) - { - bool emptyValue = false; - if( value == "true") - { - emptyValue = true; - } - this_->SetParameterEmpty(key, emptyValue); - } else if (type == ParameterType_StringList || type == ParameterType_ListView) { if(values.empty()) diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx index 22791595c01061f957b2d64d9f7d17c52a7e58a2..e1b92a118d8fc241380963aa7edc627ed04d4606 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx @@ -23,7 +23,6 @@ #include "otbWrapperChoiceParameter.h" #include "otbWrapperListViewParameter.h" #include "otbWrapperDirectoryParameter.h" -#include "otbWrapperEmptyParameter.h" #include "otbWrapperInputFilenameParameter.h" #include "otbWrapperInputFilenameListParameter.h" #include "otbWrapperOutputFilenameParameter.h" @@ -243,26 +242,6 @@ OutputProcessXMLParameter::ParseGroup(const std::string& group) paramExists = false; } - std::string emptyValue; - if (type == ParameterType_Empty) - { - EmptyParameter* eParam = dynamic_cast<EmptyParameter *> (param); - - if(eParam!=nullptr) - { - //Don't use m_Appli->HasUserValue which returns false always because of - //EmptyParameter::HasValue() is false for EmptyParameter - if(eParam->HasUserValue()) - { - paramExists = true; - emptyValue = "false"; - if( eParam->GetActive() ) - { - emptyValue = "true"; - } - } - } - } if(type == ParameterType_RAM) { paramExists = true; @@ -317,11 +296,6 @@ OutputProcessXMLParameter::ParseGroup(const std::string& group) strm << m_Appli->GetParameterInt("rand"); value = strm.str(); } - else if (typeAsString == "Empty") - { - //Nothing to do. copy emptyValue - value = emptyValue; - } else if (type == ParameterType_InputProcessXML) { continue; diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx index 55095184e530bdf6d69d63f5c3f414f5e5b962bb..160c92b2d3e26f34d4e41510d8572a0943bf5682 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx @@ -21,7 +21,6 @@ #include "otbWrapperChoiceParameter.h" #include "otbWrapperListViewParameter.h" #include "otbWrapperDirectoryParameter.h" -#include "otbWrapperEmptyParameter.h" #include "otbWrapperInputFilenameParameter.h" #include "otbWrapperInputFilenameListParameter.h" #include "otbWrapperOutputFilenameParameter.h" @@ -249,10 +248,6 @@ ParameterGroup::GetSelectedItems(std::string paramKey) { return ParameterType_Radius; } - else if (type == "Empty") - { - return ParameterType_Empty; - } else if (type == "Int") { return ParameterType_Int; @@ -339,8 +334,8 @@ ParameterGroup::GetSelectedItems(std::string paramKey) } else { - std::cerr << "Cannot find parameter type code for type: " << type << std::endl; - return ParameterType_Empty; + otbLogMacro(Error, << "Cannot find parameter type code for type: " << type); + throw std::invalid_argument("Cannot find parameter type code for type: " + type); } } @@ -351,11 +346,6 @@ std::string ParameterGroup::GetParameterTypeAsString(ParameterType type) switch (type) { - case ParameterType_Empty: - { - paramType = "Empty"; - } - break; case ParameterType_Int: { paramType = "Int"; @@ -515,11 +505,6 @@ ParameterGroup::AddParameter(ParameterType type, std::string paramKey, std::stri Parameter::Pointer newParam; switch (type) { - case ParameterType_Empty: - { - newParam = EmptyParameter::New(); - } - break; case ParameterType_Int: { newParam = IntParameter::New(); diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx index f3c7c4d5deaf754f2b734b0d625198a5dfcc7bbb..08a53d004f1d1e6f2f238fd16dc15d1ad1dcc57f 100644 --- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx +++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx @@ -23,7 +23,6 @@ // Single value parameter #include "otbWrapperChoiceParameter.h" #include "otbWrapperDirectoryParameter.h" -#include "otbWrapperEmptyParameter.h" #include "otbWrapperInputFilenameParameter.h" #include "otbWrapperOutputFilenameParameter.h" #include "otbWrapperInputImageParameter.h" @@ -496,26 +495,6 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() } } } - else if (type == ParameterType_Empty) - { - // Set UserValue flag specific for EmptyParameter, beware that it - // should be done before Enable/Disable because SetParameterUserValue() - // may enable it by default - m_Application->SetParameterUserValue(paramKey,true); - if (values[0] == "1" || values[0] == "true") - { - m_Application->EnableParameter(paramKey); - } - else if (values[0] == "0" || values[0] == "false") - { - m_Application->DisableParameter(paramKey); - } - else - { - std::cerr << "ERROR: Wrong value for parameter -" << paramKey << "." << std::endl; - return WRONGPARAMETERVALUE; - } - } // Call the DoUpdateParameter to update dependent params m_Application->UpdateParameters(); } @@ -755,7 +734,7 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & { oss << "<int32> "; } - else if (type == ParameterType_Empty || type == ParameterType_Bool) + else if (type == ParameterType_Bool) { oss << "<boolean> "; } diff --git a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx index 40c6906ebd573869bff5b03878d9c96c3d2a934f..84d226b382b8990fc5575f8022c6fcccf45683ff 100644 --- a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx +++ b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx @@ -54,7 +54,6 @@ int main(int argc, char* argv[]) assert(!group.empty()); std::map<ParameterType, std::string> parameterTypeToString; - parameterTypeToString[ParameterType_Empty] = "QgsProcessingParameterBoolean"; parameterTypeToString[ParameterType_Bool] = "QgsProcessingParameterBoolean"; parameterTypeToString[ParameterType_Int] = "QgsProcessingParameterNumber"; parameterTypeToString[ParameterType_Float] = "QgsProcessingParameterNumber"; @@ -272,10 +271,6 @@ int main(int argc, char* argv[]) { default_value = appli->GetParameterAsString(name); } - else if(type == ParameterType_Empty) - { - default_value = appli->IsParameterEnabled(name)?"true":"false"; - } else if(type == ParameterType_Choice) { std::vector<std::string> key_list = appli->GetChoiceKeys(name); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h deleted file mode 100644 index 283caa397e60a11cd6827eb5201e59eae7425c2b..0000000000000000000000000000000000000000 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbWrapperQtWidgetEmptyParameter_h -#define otbWrapperQtWidgetEmptyParameter_h - -#include <QtWidgets> -#include "otbWrapperEmptyParameter.h" -#include "otbWrapperQtWidgetParameterBase.h" - -namespace otb -{ -namespace Wrapper -{ - -/** \class QtWidgetEmptyParameter - * \brief - * - * \ingroup OTBQtWidget - */ -class OTBQtWidget_EXPORT QtWidgetEmptyParameter : public QtWidgetParameterBase -{ - Q_OBJECT - -public: - QtWidgetEmptyParameter(EmptyParameter*, QtWidgetModel*, QWidget*); - ~QtWidgetEmptyParameter() override; - -private: - QtWidgetEmptyParameter(const QtWidgetEmptyParameter&) = delete; - void operator=(const QtWidgetEmptyParameter&) = delete; - - void DoCreateWidget() override; - - void DoUpdateGUI() override; -}; - - -} -} - -#endif diff --git a/Modules/Wrappers/QtWidget/src/CMakeLists.txt b/Modules/Wrappers/QtWidget/src/CMakeLists.txt index ac5497170b64200fa3034a00b6456cfe695f39a0..e8bab3c0869e2764e5318c32e4fb93091ee56c7a 100644 --- a/Modules/Wrappers/QtWidget/src/CMakeLists.txt +++ b/Modules/Wrappers/QtWidget/src/CMakeLists.txt @@ -50,7 +50,6 @@ set(OTBQtWidget_SRC otbWrapperQtWidgetParameterBase.cxx otbWrapperQtWidgetInputImageParameter.cxx otbWrapperQtWidgetStringListParameter.cxx - otbWrapperQtWidgetEmptyParameter.cxx otbWrapperQtWidgetOutputVectorDataParameter.cxx otbWrapperQtWidgetInputFilenameParameter.cxx otbWrapperQtWidgetInputImageListParameter.cxx @@ -62,7 +61,6 @@ set(OTBQtWidget_SRC ) set(OTBQtWidget_MOC_HDR - ../include/otbWrapperQtWidgetEmptyParameter.h ../include/otbWrapperQtWidgetFloatParameter.h ../include/otbWrapperQtWidgetIntParameter.h ../include/otbWrapperQtWidgetStringParameter.h diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetEmptyParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetEmptyParameter.cxx deleted file mode 100644 index fc64f91581e550efc1ac1d7ce6a94a2bac1f736b..0000000000000000000000000000000000000000 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetEmptyParameter.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "otbWrapperQtWidgetEmptyParameter.h" - -namespace otb -{ -namespace Wrapper -{ - -QtWidgetEmptyParameter::QtWidgetEmptyParameter(EmptyParameter* emptyParam, QtWidgetModel* m, QWidget * parent) - : QtWidgetParameterBase(emptyParam, m, parent) -{ -} - -QtWidgetEmptyParameter::~QtWidgetEmptyParameter() -{ -} - -void QtWidgetEmptyParameter::DoUpdateGUI() -{ - -} - -void QtWidgetEmptyParameter::DoCreateWidget() -{ - // Set up input text edit - QHBoxLayout *hLayout = new QHBoxLayout; - hLayout->setSpacing(0); - hLayout->setContentsMargins(0, 0, 0, 0); - - //QCheckBox* checkbox = new QCheckBox(this); - //checkbox->setToolTip(emptyParam->GetDescription()); - - //QString optionID(emptyParam->GetName()); - //hLayout->addWidget(checkbox); - hLayout->addStretch(); - - this->setLayout(hLayout); -} - -} -} diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterBase.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterBase.cxx index 4454532169996dc23e68da7389847107e5fbc2ac..2d16d8e249c06605cd6a6ba14cd6d6ed4b480cf9 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterBase.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterBase.cxx @@ -83,18 +83,9 @@ QtWidgetModel* QtWidgetParameterBase::GetModel() // current widget void QtWidgetParameterBase::SetActivationState( bool value ) { - //filter out EmptyParameter - if(strcmp(m_Param->GetNameOfClass(), "EmptyParameter") == 0) - { - //only set user value if there is a change - if(value != m_Param->GetActive()) - m_Param->SetUserValue(true); - } - this->setEnabled(value); this->SetChecked(value); m_Param->SetActive(value); - } const Parameter * diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx index ea8f07d950305d34f3747f9fcceb3b25f4a5e3bd..a19a6cfa2341f8fd2c1de5565c6d5b3659c8621f 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx @@ -29,7 +29,6 @@ #include "otbWrapperQtWidgetComplexInputImageParameter.h" #include "otbWrapperQtWidgetComplexOutputImageParameter.h" #include "otbWrapperQtWidgetDirectoryParameter.h" -#include "otbWrapperQtWidgetEmptyParameter.h" #include "otbWrapperQtWidgetFloatParameter.h" #include "otbWrapperQtWidgetIntParameter.h" #include "otbWrapperQtWidgetInputFilenameParameter.h" @@ -105,7 +104,6 @@ QtWidgetParameterFactory::CreateQtWidget( Parameter* param, QtWidgetModel* model } if (0) {} - CREATEWIDGET(EmptyParameter, QtWidgetEmptyParameter) CREATEWIDGET(IntParameter, QtWidgetIntParameter) CREATEWIDGET(FloatParameter, QtWidgetFloatParameter) CREATEWIDGET(InputFilenameParameter, QtWidgetInputFilenameParameter) diff --git a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx index 98ba334c35844289666556ef439575eaa8b72137..1394cf5c0d304bb9a05dc720cd6c09576e76a5b2 100644 --- a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx +++ b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx @@ -24,7 +24,6 @@ #include "otbWrapperQtWidgetParameterFactory.h" #include "otbWrapperStringParameter.h" -#include "otbWrapperEmptyParameter.h" #include "otbWrapperChoiceParameter.h" #include "otbWrapperQtWidgetModel.h" @@ -84,7 +83,6 @@ int otbWrapperQtWidgetParameterFactory(int argc, char* argv[]) otb::Wrapper::IntParameter::Pointer intParam = otb::Wrapper::IntParameter::New(); otb::Wrapper::FloatParameter::Pointer floatParam = otb::Wrapper::FloatParameter::New(); - otb::Wrapper::EmptyParameter::Pointer emptyParam = otb::Wrapper::EmptyParameter::New(); otb::Wrapper::ChoiceParameter::Pointer choiceParam = otb::Wrapper::ChoiceParameter::New(); intParam->SetName("Int parameter"); @@ -103,10 +101,6 @@ int otbWrapperQtWidgetParameterFactory(int argc, char* argv[]) floatParam->SetMinimumValue(-3.75); floatParam->SetMaximumValue(4.97); - emptyParam->SetName("Empty parameter"); - emptyParam->SetDescription("This is an empty parameter"); - emptyParam->SetKey("empty"); - choiceParam->SetName("Choice parameter"); choiceParam->SetDescription("This is a choice parameter"); choiceParam->SetKey("choice"); @@ -116,14 +110,12 @@ int otbWrapperQtWidgetParameterFactory(int argc, char* argv[]) QWidget * intWidget = factory->CreateQtWidget(intParam, model, nullptr); QWidget * floatWidget = factory->CreateQtWidget(floatParam, model, nullptr); - QWidget * emptyWidget = factory->CreateQtWidget(emptyParam, model, nullptr); QWidget * choiceWidget = factory->CreateQtWidget(choiceParam, model, nullptr); if(intWidget) { intWidget->show(); floatWidget->show(); - emptyWidget->show(); choiceWidget->show(); //return app.exec(); @@ -146,7 +138,6 @@ int otbWrapperQtWidgetParameterGroup(int argc, char* argv[]) otb::Wrapper::IntParameter::Pointer intParam = otb::Wrapper::IntParameter::New(); otb::Wrapper::FloatParameter::Pointer floatParam = otb::Wrapper::FloatParameter::New(); - otb::Wrapper::EmptyParameter::Pointer emptyParam = otb::Wrapper::EmptyParameter::New(); otb::Wrapper::ChoiceParameter::Pointer choiceParam = otb::Wrapper::ChoiceParameter::New(); otb::Wrapper::StringParameter::Pointer stringParam = otb::Wrapper::StringParameter::New(); @@ -166,10 +157,6 @@ int otbWrapperQtWidgetParameterGroup(int argc, char* argv[]) floatParam->SetMinimumValue(-3.75); floatParam->SetMaximumValue(4.97); - emptyParam->SetName("Empty parameter"); - emptyParam->SetDescription("This is an empty parameter"); - emptyParam->SetKey("empty"); - choiceParam->SetName("Choice parameter"); choiceParam->SetDescription("This is an choice parameter"); choiceParam->SetKey("choice"); @@ -185,13 +172,11 @@ int otbWrapperQtWidgetParameterGroup(int argc, char* argv[]) otb::Wrapper::ParameterGroup::Pointer list = otb::Wrapper::ParameterGroup::New(); list->AddParameter(otb::Wrapper::Parameter::Pointer(intParam.GetPointer())); list->AddParameter(otb::Wrapper::Parameter::Pointer(floatParam.GetPointer())); - list->AddParameter(otb::Wrapper::Parameter::Pointer(emptyParam.GetPointer())); list->AddParameter(otb::Wrapper::Parameter::Pointer(choiceParam.GetPointer())); list->AddParameter(otb::Wrapper::Parameter::Pointer(stringParam.GetPointer())); otb::Wrapper::IntParameter::Pointer intParam2 = otb::Wrapper::IntParameter::New(); otb::Wrapper::FloatParameter::Pointer floatParam2 = otb::Wrapper::FloatParameter::New(); - otb::Wrapper::EmptyParameter::Pointer emptyParam2 = otb::Wrapper::EmptyParameter::New(); otb::Wrapper::ChoiceParameter::Pointer choiceParam2 = otb::Wrapper::ChoiceParameter::New(); otb::Wrapper::StringParameter::Pointer stringParam2 = otb::Wrapper::StringParameter::New(); intParam2->SetName("Int parameter"); @@ -210,10 +195,6 @@ int otbWrapperQtWidgetParameterGroup(int argc, char* argv[]) floatParam2->SetMinimumValue(-3.75); floatParam2->SetMaximumValue(4.97); - emptyParam2->SetName("Empty parameter"); - emptyParam2->SetDescription("This is an empty parameter"); - emptyParam2->SetKey("empty2"); - choiceParam2->SetName("Choice parameter"); choiceParam2->SetDescription("This is an choice parameter"); choiceParam2->SetKey("choice2"); @@ -233,7 +214,6 @@ int otbWrapperQtWidgetParameterGroup(int argc, char* argv[]) group2->AddParameter(otb::Wrapper::Parameter::Pointer(intParam2.GetPointer())); group2->AddParameter(otb::Wrapper::Parameter::Pointer(floatParam2.GetPointer())); - group2->AddParameter(otb::Wrapper::Parameter::Pointer(emptyParam2.GetPointer())); group2->AddParameter(otb::Wrapper::Parameter::Pointer(choiceParam2.GetPointer())); group2->AddParameter(otb::Wrapper::Parameter::Pointer(stringParam2.GetPointer())); group2->AddParameter(otb::Wrapper::Parameter::Pointer(list.GetPointer())); diff --git a/Modules/Wrappers/SWIG/src/otbApplication.i b/Modules/Wrappers/SWIG/src/otbApplication.i index 50ab3e24aced3994827c4a508abe1065eaf0d1e2..2901fd8ed6f8f90b77d8b75a87efaeaa9175da2b 100644 --- a/Modules/Wrappers/SWIG/src/otbApplication.i +++ b/Modules/Wrappers/SWIG/src/otbApplication.i @@ -79,7 +79,6 @@ namespace Wrapper typedef enum { - ParameterType_Empty, ParameterType_Int, ParameterType_Float, ParameterType_String, @@ -247,7 +246,6 @@ public: void SetParameterFloat(std::string parameter, float value, bool hasUserValueFlag = true); void SetParameterString(std::string parameter, std::string value, bool hasUserValueFlag = true); void SetParameterStringList(std::string parameter, std::vector<std::string> values, bool hasUserValueFlag = true); - void SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag = true); void SetParameterOutputImagePixelType(std::string parameter, otb::Wrapper::ImagePixelType pixelType); void SetParameterComplexOutputImagePixelType(std::string parameter, otb::Wrapper::ComplexImagePixelType cpixelType); @@ -581,7 +579,6 @@ class ApplicationProxy(object): ParameterType_Radius : 'ParameterType_Radius', ParameterType_RAM : 'ParameterType_RAM', ParameterType_Float : 'ParameterType_Float', - ParameterType_Empty : 'ParameterType_Empty', ParameterType_Choice : 'ParameterType_Choice', ParameterType_Group : 'ParameterType_Group', ParameterType_Bool : 'ParameterType_Bool' @@ -614,8 +611,6 @@ class ApplicationProxy(object): return self.SetParameterInt(paramKey, value) elif paramType in [ParameterType_Float]: return self.SetParameterFloat(paramKey, value) - elif paramType in [ParameterType_Empty]: - return self.EnableParameter(paramKey) elif paramType in [ParameterType_Bool]: return self.SetParameterString(paramKey, str(value) ) elif paramType in [ParameterType_Group]: @@ -650,8 +645,6 @@ class ApplicationProxy(object): return self.GetParameterInt(paramKey) elif paramType in [ParameterType_Float]: return self.GetParameterFloat(paramKey) - elif paramType in [ParameterType_Empty]: - return self.IsParameterEnabled(paramKey) elif paramType in [ParameterType_Bool]: return bool(self.GetParameterInt(paramKey)) elif paramType in [ParameterType_Group, ParameterType_Choice]: diff --git a/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py b/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py index c6cb4f3c4bad06845c8a3e9449f83174cbe35aca..3bf5def520515a7b64b6ab565ad1b6e89ef6eaa5 100644 --- a/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py +++ b/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py @@ -31,7 +31,6 @@ def test(otb, argv): # test GetParameterTypeAsString() method in python. print( app.GetParameterTypeAsString(otb.ParameterType_InputImage) ) print( app.GetParameterTypeAsString(otb.ParameterType_String) ) - print( app.GetParameterTypeAsString(otb.ParameterType_Empty) ) # one test for each parameter type (string, float, int, ...)