This merge request adds checks on the field type before using GetValue() and SetValue.
There is an assertion that checks that the field type is the same as the requested type in the
SetValue<T>() method of the
Field class. However this assertion is not respected in classification applications. This merge request adds field type verification and appropriate cast when calling these methods.
One notable change is that
std::stod is used to convert string field to numeric types instead of the
atoi used in GDAL's GetValueAsXXX() for string fields.
stod throw an exception if the field cannot be converted ("1" is ok, "Vegetation" is not). This change highlighted a bug in the
TrainVectorApplication working in unsupervised mode, the app is not supposed to fetch the class field in this case, but it does, using the first field of the features as the class field, and trying to convert it to a numerical value.
See associated issue
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 -ion latest changes and commit