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_create.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  gdal "raster create" 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_CREATE_INCLUDED
14
#define GDALALG_RASTER_CREATE_INCLUDED
15
16
#include "gdalalg_raster_pipeline.h"
17
18
//! @cond Doxygen_Suppress
19
20
/************************************************************************/
21
/*                      GDALRasterCreateAlgorithm                       */
22
/************************************************************************/
23
24
class GDALRasterCreateAlgorithm : public GDALRasterPipelineStepAlgorithm
25
{
26
  public:
27
    static constexpr const char *NAME = "create";
28
    static constexpr const char *DESCRIPTION = "Create a new raster dataset.";
29
    static constexpr const char *HELP_URL = "/programs/gdal_raster_create.html";
30
31
    explicit GDALRasterCreateAlgorithm(bool standaloneStep = false) noexcept;
32
33
    bool CanBeMiddleStep() const override
34
0
    {
35
0
        return true;
36
0
    }
37
38
    bool CanBeFirstStep() const override
39
0
    {
40
0
        return true;
41
0
    }
42
43
  private:
44
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
45
    bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
46
47
    std::vector<int> m_size{};
48
    int m_bandCount = 1;
49
    std::string m_type = "Byte";
50
    std::string m_crs{};
51
    std::vector<double> m_bbox{};
52
    std::vector<std::string> m_metadata{};
53
    std::string m_nodata{};
54
    std::vector<double> m_burnValues{};
55
    bool m_copyOverviews = false;
56
    bool m_copyMetadata = false;
57
};
58
59
/************************************************************************/
60
/*                 GDALRasterCreateAlgorithmStandalone                  */
61
/************************************************************************/
62
63
class GDALRasterCreateAlgorithmStandalone final
64
    : public GDALRasterCreateAlgorithm
65
{
66
  public:
67
    GDALRasterCreateAlgorithmStandalone()
68
0
        : GDALRasterCreateAlgorithm(/* standaloneStep = */ true)
69
0
    {
70
0
    }
71
72
    ~GDALRasterCreateAlgorithmStandalone() override;
73
};
74
75
//! @endcond
76
77
#endif