/src/gdal/apps/gdalalg_vector_make_valid.h
Line | Count | Source |
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 | | |
18 | | //! @cond Doxygen_Suppress |
19 | | |
20 | | /************************************************************************/ |
21 | | /* GDALVectorMakeValidAlgorithm */ |
22 | | /************************************************************************/ |
23 | | |
24 | | class 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 | | |
55 | | class GDALVectorMakeValidAlgorithmStandalone final |
56 | | : public GDALVectorMakeValidAlgorithm |
57 | | { |
58 | | public: |
59 | | GDALVectorMakeValidAlgorithmStandalone() |
60 | 0 | : GDALVectorMakeValidAlgorithm(/* standaloneStep = */ true) |
61 | 0 | { |
62 | 0 | } |
63 | | |
64 | | ~GDALVectorMakeValidAlgorithmStandalone() override; |
65 | | }; |
66 | | |
67 | | //! @endcond |
68 | | |
69 | | #endif /* GDALALG_VECTOR_MAKE_VALID_INCLUDED */ |