DOI-USGS / ISIS3

Integrated Software for Imagers and Spectrometers v3. ISIS3 is a digital image processing software package to manipulate imagery collected by current and past NASA and International planetary missions.
https://isis.astrogeology.usgs.gov
Other
197 stars 166 forks source link

Bug fixed in isisminer to properly handle self-intersecting polygon geometries. #5620

Open kledmundson opened 4 days ago

kledmundson commented 4 days ago

Description

The isisminer application detects bad polygons, reports them, and terminates instead of attempting to repair them. Often (though not always), self-intersecting polygons can be repaired by creating a buffer of size 0 around the polygon.

Here, the Strategy and GisGeometry classes have been updated to better manage geometries. The buffer(0) method was added to GisGeometry to repair self-intersecting polygons. The RepairInvalidGeometry and InvalidGeometryAction keywords have been added to the Strategy class providing improved user control over invalid geometries.

The RepairInvalidGeometry keyword defaults to true so that invalid geometries will be repaired. Options for the InvalidGeometryAction keyword are continue, disable or error. For InvalidGeometryAction = continue, the state of the invalid geometry is retained in the Resource (some GIS operations still function) and it is not disabled and no error occurs - the issue is ignored. If InvalidGeometryAction = disable, then the geometry is retained in the Resource but the status is set to "discard". It can be re-enabled by using the ResourceManager strategy. If InvalidGeometryAction = error, then an error is thrown and isisminer terminates. The default value is disable.

Related Issue

https://github.com/DOI-USGS/ISIS3/issues/5612 ## How Has This Been Validated?

The GisGeometry unit test has been modified to test the validity and repair of a self-intersecting polygon. The Strategy unit test has been updated to test the behavior of the two new keywords RepairInvalidGeometry and InvalidGeometryAction.

GisGeometry unit test result

ctest -R GisGeometry --output-on-failure Start 108: isis_unit_test_GisGeometry 1/1 Test #108: isis_unit_test_GisGeometry ....... Passed 2.01 sec

Strategy unit test result

ctest -R isis_unit_test_Strategy --output-on-failure Start 299: isis_unit_test_Strategy 1/1 Test #299: isis_unit_test_Strategy .......... Passed 0.56 sec

Additionally, all isisminer app tests continue to pass.

Types of changes

Checklist:

Licensing

This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words:

This work is free and unencumbered software released into the public domain. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain.

github-actions[bot] commented 4 days ago

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_5620".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.