Coverage Report

Created: 2026-02-14 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/apps/gdalalg_raster_polygonize.h
Line
Count
Source
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
    bool IsNativelyStreamingCompatible() const override
37
0
    {
38
0
        return false;
39
0
    }
40
41
    int GetInputType() const override
42
0
    {
43
0
        return GDAL_OF_RASTER;
44
0
    }
45
46
    int GetOutputType() const override
47
0
    {
48
0
        return GDAL_OF_VECTOR;
49
0
    }
50
51
    bool
52
    CanHandleNextStep(GDALPipelineStepAlgorithm *poNextStep) const override;
53
54
  private:
55
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
56
    bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
57
58
    // polygonize specific arguments
59
    int m_band = 1;
60
    std::string m_attributeName = "DN";
61
    bool m_connectDiagonalPixels = false;
62
63
    // hidden
64
    int m_commitInterval = 0;
65
};
66
67
/************************************************************************/
68
/*               GDALRasterPolygonizeAlgorithmStandalone                */
69
/************************************************************************/
70
71
class GDALRasterPolygonizeAlgorithmStandalone final
72
    : public GDALRasterPolygonizeAlgorithm
73
{
74
  public:
75
    GDALRasterPolygonizeAlgorithmStandalone()
76
0
        : GDALRasterPolygonizeAlgorithm(/* standaloneStep = */ true)
77
0
    {
78
0
    }
79
80
    ~GDALRasterPolygonizeAlgorithmStandalone() override;
81
};
82
83
//! @endcond
84
85
#endif