Fix OutputVectorDataParameter inside a choice
Summary
This MR is a fix for this bug reported on the forum.
Rationale
This is a bug in the application engine, it affects the ZonalStatistics
application, and maybe others.
if a vector data parameteris the child of a choice parameter, and if the choice is non actives (i.e. non chosen) while the vector data is, the Application class will try to create the output vector data, leading to a crash. It can be reproduced with the command:
otbcli_ZonalStatistics -in S2A_ROI.tif -inzone.vector.in ImageClassifier/input/classif_train.shp -out raster -out.vector.filename /tmp/out.shp -out.raster.filename /tmp/out.tif
It happens on Monteverdi because a default value is attributed to vector data parameters, activating them.
The fix simply use the recurse
functionality of the IsEnabled(string paramKey)
of the Application engine to check if the choice is active before attempting to create the output data.
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