LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_clean_coverage.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2025-08-01 10:10:57 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             : *
       3             :  * Project:  GDAL
       4             :  * Purpose:  "gdal vector clean-coverage"
       5             :  * Author:   Daniel Baston
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2025, ISciences LLC
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_VECTOR_CLEAN_COVERAGE_INCLUDED
      14             : #define GDALALG_VECTOR_CLEAN_COVERAGE_INCLUDED
      15             : 
      16             : #include "gdalalg_vector_pipeline.h"
      17             : #include "cpl_progress.h"
      18             : 
      19             : #include <string>
      20             : 
      21             : //! @cond Doxygen_Suppress
      22             : 
      23             : /************************************************************************/
      24             : /*                     GDALVectorCleanCoverageAlgorithm                 */
      25             : /************************************************************************/
      26             : 
      27             : class GDALVectorCleanCoverageAlgorithm : public GDALVectorPipelineStepAlgorithm
      28             : {
      29             :   public:
      30             :     static constexpr const char *NAME = "clean-coverage";
      31             :     static constexpr const char *DESCRIPTION =
      32             :         "Alter polygon boundaries to make shared edges identical, removing "
      33             :         "gaps and overlaps";
      34             :     static constexpr const char *HELP_URL =
      35             :         "/programs/gdal_vector_clean_coverage.html";
      36             : 
      37             :     explicit GDALVectorCleanCoverageAlgorithm(bool standaloneStep = false);
      38             : 
      39             :     struct Options
      40             :     {
      41             :         double snappingTolerance = -1;
      42             :         double maximumGapWidth = 0;
      43             :         std::string mergeStrategy = "longest-border";
      44             :     };
      45             : 
      46             :   private:
      47             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      48             : 
      49             :     std::string m_activeLayer{};
      50             : 
      51             :     Options m_opts{};
      52             : };
      53             : 
      54             : /************************************************************************/
      55             : /*                 GDALVectorCleanCoverageAlgorithmStandalone           */
      56             : /************************************************************************/
      57             : 
      58          36 : class GDALVectorCleanCoverageAlgorithmStandalone final
      59             :     : public GDALVectorCleanCoverageAlgorithm
      60             : {
      61             :   public:
      62          18 :     GDALVectorCleanCoverageAlgorithmStandalone()
      63          18 :         : GDALVectorCleanCoverageAlgorithm(/* standaloneStep = */ true)
      64             :     {
      65          18 :     }
      66             : 
      67             :     ~GDALVectorCleanCoverageAlgorithmStandalone() override;
      68             : };
      69             : 
      70             : //! @endcond
      71             : 
      72             : #endif /* GDALALG_VECTOR_CLEAN_COVERAGE_INCLUDED */

Generated by: LCOV version 1.14