LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_polygonize.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 10 10 100.0 %
Date: 2025-06-19 12:30:01 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "raster polygonize" subcommand
       5             :  * Author:   Even Rouault <even dot rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_RASTER_POLYGONIZE_INCLUDED
      14             : #define GDALALG_RASTER_POLYGONIZE_INCLUDED
      15             : 
      16             : #include "gdalalg_abstract_pipeline.h"
      17             : 
      18             : //! @cond Doxygen_Suppress
      19             : 
      20             : /************************************************************************/
      21             : /*                     GDALRasterPolygonizeAlgorithm                    */
      22             : /************************************************************************/
      23             : 
      24             : class GDALRasterPolygonizeAlgorithm /* non final */
      25             :     : public GDALPipelineStepAlgorithm
      26             : {
      27             :   public:
      28             :     static constexpr const char *NAME = "polygonize";
      29             :     static constexpr const char *DESCRIPTION =
      30             :         "Create a polygon feature dataset from a raster band.";
      31             :     static constexpr const char *HELP_URL =
      32             :         "/programs/gdal_raster_polygonize.html";
      33             : 
      34             :     explicit GDALRasterPolygonizeAlgorithm(bool standaloneStep = false);
      35             : 
      36           1 :     bool IsNativelyStreamingCompatible() const override
      37             :     {
      38           1 :         return false;
      39             :     }
      40             : 
      41           1 :     int GetInputType() const override
      42             :     {
      43           1 :         return GDAL_OF_RASTER;
      44             :     }
      45             : 
      46           1 :     int GetOutputType() const override
      47             :     {
      48           1 :         return GDAL_OF_VECTOR;
      49             :     }
      50             : 
      51             :   private:
      52             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      53             :     bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
      54             : 
      55             :     // polygonize specific arguments
      56             :     int m_band = 1;
      57             :     std::string m_attributeName = "DN";
      58             :     bool m_connectDiagonalPixels = false;
      59             : };
      60             : 
      61             : /************************************************************************/
      62             : /*                 GDALRasterPolygonizeAlgorithmStandalone              */
      63             : /************************************************************************/
      64             : 
      65          40 : class GDALRasterPolygonizeAlgorithmStandalone final
      66             :     : public GDALRasterPolygonizeAlgorithm
      67             : {
      68             :   public:
      69          20 :     GDALRasterPolygonizeAlgorithmStandalone()
      70          20 :         : GDALRasterPolygonizeAlgorithm(/* standaloneStep = */ true)
      71             :     {
      72          20 :     }
      73             : 
      74             :     ~GDALRasterPolygonizeAlgorithmStandalone() override;
      75             : };
      76             : 
      77             : //! @endcond
      78             : 
      79             : #endif

Generated by: LCOV version 1.14