GDAL
gdalalg_vector_simplify.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "gdal vector simplify"
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_VECTOR_SIMPLIFY_INCLUDED
14#define GDALALG_VECTOR_SIMPLIFY_INCLUDED
15
16#include "gdalalg_vector_geom.h"
17
19
20/************************************************************************/
21/* GDALVectorSimplifyAlgorithm */
22/************************************************************************/
23
24class GDALVectorSimplifyAlgorithm /* non final */
25 : public GDALVectorGeomAbstractAlgorithm
26{
27 public:
28 static constexpr const char *NAME = "simplify";
29 static constexpr const char *DESCRIPTION =
30 "Simplify geometries of a vector dataset.";
31 static constexpr const char *HELP_URL =
32 "/programs/gdal_vector_simplify.html";
33
34 struct Options : public GDALVectorGeomAbstractAlgorithm::OptionsBase
35 {
36 double m_tolerance = 0;
37 };
38
39 std::unique_ptr<OGRLayerWithTranslateFeature>
40 CreateAlgLayer(OGRLayer &srcLayer) override;
41
42 explicit GDALVectorSimplifyAlgorithm(bool standaloneStep = false);
43
44 private:
45 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
46
47 Options m_opts{};
48};
49
50/************************************************************************/
51/* GDALVectorSimplifyAlgorithmStandalone */
52/************************************************************************/
53
54class GDALVectorSimplifyAlgorithmStandalone final
55 : public GDALVectorSimplifyAlgorithm
56{
57 public:
58 GDALVectorSimplifyAlgorithmStandalone()
59 : GDALVectorSimplifyAlgorithm(/* standaloneStep = */ true)
60 {
61 }
62
63 ~GDALVectorSimplifyAlgorithmStandalone() override;
64};
65
67
68#endif /* GDALALG_VECTOR_SIMPLIFY_INCLUDED */