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