GDAL
gdalalg_raster_clip.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "clip" step of "raster pipeline", or "gdal raster clip" standalone
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_CLIP_INCLUDED
14#define GDALALG_RASTER_CLIP_INCLUDED
15
16#include "gdalalg_raster_pipeline.h"
17
18#include "gdalalg_clip_common.h"
19
21
22/************************************************************************/
23/* GDALRasterClipAlgorithm */
24/************************************************************************/
25
26class GDALRasterClipAlgorithm /* non final */
27 : public GDALRasterPipelineStepAlgorithm,
28 public GDALClipCommon
29{
30 public:
31 static constexpr const char *NAME = "clip";
32 static constexpr const char *DESCRIPTION = "Clip a raster dataset.";
33 static constexpr const char *HELP_URL = "/programs/gdal_raster_clip.html";
34
35 explicit GDALRasterClipAlgorithm(bool standaloneStep = false);
36
37 private:
38 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
39
40 std::vector<int> m_window{};
41 bool m_onlyBBOX{false};
42 bool m_allowExtentOutsideSource{false};
43 bool m_addAlpha{false};
44};
45
46/************************************************************************/
47/* GDALRasterClipAlgorithmStandalone */
48/************************************************************************/
49
50class GDALRasterClipAlgorithmStandalone final : public GDALRasterClipAlgorithm
51{
52 public:
53 GDALRasterClipAlgorithmStandalone()
54 : GDALRasterClipAlgorithm(/* standaloneStep = */ true)
55 {
56 }
57
58 ~GDALRasterClipAlgorithmStandalone() override;
59};
60
62
63#endif /* GDALALG_RASTER_CLIP_INCLUDED */