Refactor XML parameters
Summary
Currently saving and loading application parameters to XML files is handled by two classes: OutputProcessXMLParameter
and InputProcessXMLParameter
. They are "parameters" in the sense of the application framework. They represent the "-inxml" and "-outxml" command line arguments in the CLI interface, and the load/save widgets in GUI. The actual calls to the XML reading/writing code are made inside UpdateParameters() for input, and inside ExecuteAndWriteOutput() for output.
The goal of this refactoring is double:
-
Separate XML operations from application's execution and UpdateParameters()
-
Replace the GUI widgets for XML load/save by a simple menu:
This MR does this with a significant refactoring:
- Remove
OutputProcessXMLParameter
,InputProcessXMLParameter
and their Qt wrappers - Add public Application API:
LoadParametersFromXML(filename)
andSaveParametersToXML(filename)
(in C++ and Python) - Remove support for
-inxml
without application name in ApplicationLauncherCommandLine (somewhat of a niche use case)
Backwards compatibility of the otbcli interface is maintained. If argv contains -inxml
or -outxml
, the command line launcher will call LoadParametersFromXML or SaveParametersFromXML and behave as before. So they are command line arguments but not application parameters (like -help, -progress, -testenv and -version).
Backwards breaking changes:
- In GUI and Python, it is now possible to write XML parameters without executing the application. In that case parameters with the "output" role will not be written to the xml file.
-
SetParameterString("inxml")
orSetParameterString("outxml")
will not work anymore, because parameters "inxml" and "outxml" are removed. UseLoadParametersFromXML(filename)
andSaveParametersToXML(filename)
instead.
Rationale
See above. It will also be helpful for solving #1842 (closed)
Copyright
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.
Check before merging:
- All discussions are resolved
- At least 2
👍 votes from core developers, no👎 vote. - The feature branch is (reasonably) up-to-date with the base branch
- Dashboard is green
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
- Optionally, run
git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i
on latest changes and commit