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 6 66.7 %
Date: 2026-06-03 12:46:18 Functions: 3 4 75.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 "gdalvectorpipelinestepalgorithm.h"
      17             : 
      18             : #include "cpl_progress.h"
      19             : 
      20             : #include <string>
      21             : 
      22             : //! @cond Doxygen_Suppress
      23             : 
      24             : /************************************************************************/
      25             : /*                   GDALVectorCleanCoverageAlgorithm                   */
      26             : /************************************************************************/
      27             : 
      28             : class GDALVectorCleanCoverageAlgorithm : public GDALVectorPipelineStepAlgorithm
      29             : {
      30             :   public:
      31             :     static constexpr const char *NAME = "clean-coverage";
      32             :     static constexpr const char *DESCRIPTION =
      33             :         "Alter polygon boundaries to make shared edges identical, removing "
      34             :         "gaps and overlaps";
      35             :     static constexpr const char *HELP_URL =
      36             :         "/programs/gdal_vector_clean_coverage.html";
      37             : 
      38             :     explicit GDALVectorCleanCoverageAlgorithm(bool standaloneStep = false);
      39             : 
      40           0 :     bool IsNativelyStreamingCompatible() const override
      41             :     {
      42           0 :         return false;
      43             :     }
      44             : 
      45             :     struct Options
      46             :     {
      47             :         double snappingTolerance = -1;
      48             :         double maximumGapWidth = 0;
      49             :         std::string mergeStrategy = "longest-border";
      50             :     };
      51             : 
      52             :   private:
      53             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      54             : 
      55             :     std::string m_activeLayer{};
      56             : 
      57             :     Options m_opts{};
      58             : };
      59             : 
      60             : /************************************************************************/
      61             : /*              GDALVectorCleanCoverageAlgorithmStandalone              */
      62             : /************************************************************************/
      63             : 
      64         122 : class GDALVectorCleanCoverageAlgorithmStandalone final
      65             :     : public GDALVectorCleanCoverageAlgorithm
      66             : {
      67             :   public:
      68          61 :     GDALVectorCleanCoverageAlgorithmStandalone()
      69          61 :         : GDALVectorCleanCoverageAlgorithm(/* standaloneStep = */ true)
      70             :     {
      71          61 :     }
      72             : 
      73             :     ~GDALVectorCleanCoverageAlgorithmStandalone() override;
      74             : };
      75             : 
      76             : //! @endcond
      77             : 
      78             : #endif /* GDALALG_VECTOR_CLEAN_COVERAGE_INCLUDED */

Generated by: LCOV version 1.14