Coverage Report

Created: 2026-02-14 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/apps/gdalalg_vector_rasterize.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  gdal "vector rasterize" subcommand
5
 * Author:   Alessandro Pasotti <elpaso at itopen dot it>
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2025, Alessandro Pasotti <elpaso at itopen dot it>
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef GDALALG_VECTOR_RASTERIZE_INCLUDED
14
#define GDALALG_VECTOR_RASTERIZE_INCLUDED
15
16
#include <algorithm>
17
#include <limits>
18
19
#include "gdalalg_abstract_pipeline.h"
20
21
//! @cond Doxygen_Suppress
22
23
/************************************************************************/
24
/*                     GDALVectorRasterizeAlgorithm                     */
25
/************************************************************************/
26
27
class GDALVectorRasterizeAlgorithm /* non final */
28
    : public GDALPipelineStepAlgorithm
29
{
30
  public:
31
    static constexpr const char *NAME = "rasterize";
32
    static constexpr const char *DESCRIPTION =
33
        "Burns vector geometries into a raster.";
34
    static constexpr const char *HELP_URL =
35
        "/programs/gdal_vector_rasterize.html";
36
37
    explicit GDALVectorRasterizeAlgorithm(bool standaloneStep = false);
38
39
    bool IsNativelyStreamingCompatible() const override
40
0
    {
41
0
        return false;
42
0
    }
43
44
  private:
45
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
46
    bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
47
48
    int GetInputType() const override
49
0
    {
50
0
        return GDAL_OF_VECTOR;
51
0
    }
52
53
    int GetOutputType() const override
54
0
    {
55
0
        return GDAL_OF_RASTER;
56
0
    }
57
58
    std::vector<int> m_bands{};
59
    bool m_invert = false;
60
    bool m_allTouched = false;
61
    std::vector<double> m_burnValues{};
62
    std::string m_attributeName{};
63
    bool m_3d = false;
64
    bool m_add = false;
65
    std::string m_layerName{};  // mutually exclusive with m_sql
66
    std::string m_where{};
67
    std::string m_sql{};  // mutually exclusive with m_layerName
68
    std::string m_dialect{};
69
    double m_nodata = std::numeric_limits<double>::quiet_NaN();
70
    std::vector<double> m_initValues{};
71
    std::string m_srs{};
72
    std::vector<std::string> m_transformerOption{};
73
    std::vector<double> m_targetExtent{};
74
    std::vector<double>
75
        m_targetResolution{};  // Mutually exclusive with targetSize
76
    bool m_tap = false;
77
    std::vector<int>
78
        m_targetSize{};  // Mutually exclusive with targetResolution
79
    std::string m_outputType{};
80
    std::string m_optimization{};  // {AUTO|VECTOR|RASTER}
81
};
82
83
/************************************************************************/
84
/*                GDALVectorRasterizeAlgorithmStandalone                */
85
/************************************************************************/
86
87
class GDALVectorRasterizeAlgorithmStandalone final
88
    : public GDALVectorRasterizeAlgorithm
89
{
90
  public:
91
    GDALVectorRasterizeAlgorithmStandalone()
92
0
        : GDALVectorRasterizeAlgorithm(/* standaloneStep = */ true)
93
0
    {
94
0
    }
95
96
    ~GDALVectorRasterizeAlgorithmStandalone() override;
97
};
98
99
//! @endcond
100
101
#endif