Skip to content

Refactor XML parameters

Victor Poughon requested to merge refactor-xml into develop

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:

  1. Separate XML operations from application's execution and UpdateParameters()

  2. Replace the GUI widgets for XML load/save by a simple menu:

Screenshot_from_2019-04-30_17-38-35

This MR does this with a significant refactoring:

  • Remove OutputProcessXMLParameter, InputProcessXMLParameter and their Qt wrappers
  • Add public Application API: LoadParametersFromXML(filename) and SaveParametersToXML(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") or SetParameterString("outxml") will not work anymore, because parameters "inxml" and "outxml" are removed. Use LoadParametersFromXML(filename) and SaveParametersToXML(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
Edited by Victor Poughon

Merge request reports

Loading