GDAL
gdalalg_vector_set_geom_type.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "gdal vector set-geom-type"
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_SET_TYPE_INCLUDED
14#define GDALALG_VECTOR_SET_TYPE_INCLUDED
15
16#include "gdalalg_vector_geom.h"
17
19
20/************************************************************************/
21/* GDALVectorSetGeomTypeAlgorithm */
22/************************************************************************/
23
24class GDALVectorSetGeomTypeAlgorithm /* non final */
25 : public GDALVectorGeomAbstractAlgorithm
26{
27 public:
28 static constexpr const char *NAME = "set-geom-type";
29 static constexpr const char *DESCRIPTION =
30 "Modify the geometry type of a vector dataset.";
31 static constexpr const char *HELP_URL =
32 "/programs/gdal_vector_set_geom_type.html";
33
34 static std::vector<std::string> GetAliasesStatic()
35 {
36 // Old name of GDAL 3.11
37 return {
39 "set-type",
40 };
41 }
42
43 explicit GDALVectorSetGeomTypeAlgorithm(bool standaloneStep = false);
44
45 struct Options : public GDALVectorGeomAbstractAlgorithm::OptionsBase
46 {
47 bool m_layerOnly = false;
48 bool m_featureGeomOnly = false;
49 std::string m_type{};
50 bool m_multi = false;
51 bool m_single = false;
52 bool m_linear = false;
53 bool m_curve = false;
54 std::string m_dim{};
55 bool m_skip = false;
56
57 // Computed value from m_type
59 };
60
61 std::unique_ptr<OGRLayerWithTranslateFeature>
62 CreateAlgLayer(OGRLayer &srcLayer) override;
63
64 private:
65 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
66
67 Options m_opts{};
68};
69
70/************************************************************************/
71/* GDALVectorSetGeomTypeAlgorithmStandalone */
72/************************************************************************/
73
74class GDALVectorSetGeomTypeAlgorithmStandalone final
75 : public GDALVectorSetGeomTypeAlgorithm
76{
77 public:
78 GDALVectorSetGeomTypeAlgorithmStandalone()
79 : GDALVectorSetGeomTypeAlgorithm(/* standaloneStep = */ true)
80 {
81 }
82
83 ~GDALVectorSetGeomTypeAlgorithmStandalone() override;
84};
85
87
88#endif /* GDALALG_VECTOR_SET_TYPE_INCLUDED */
static constexpr const char * HIDDEN_ALIAS_SEPARATOR
Special value to put in m_aliases to separate public alias from hidden aliases.
Definition gdalalgorithm_cpp.h:2136
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:405
@ wkbUnknown
unknown type, non-standard
Definition ogr_core.h:406