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