GDAL

gdalalg_vector_buffer.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "gdal vector buffer"
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_BUFFER_INCLUDED
14#define GDALALG_VECTOR_BUFFER_INCLUDED
15
16#include "gdalalg_vector_geom.h"
17
19
20/************************************************************************/
21/* GDALVectorBufferAlgorithm */
22/************************************************************************/
23
24 class GDALVectorBufferAlgorithm /* non final */
25 : public GDALVectorGeomAbstractAlgorithm
26{
27 public:
28 static constexpr const char *NAME = "buffer";
29 static constexpr const char *DESCRIPTION =
30 "Compute a buffer around geometries of a vector dataset.";
31 static constexpr const char *HELP_URL = "/programs/gdal_vector_buffer.html";
32
33 struct Options : public GDALVectorGeomAbstractAlgorithm::OptionsBase
34 {
35 double m_distance = 0;
36 std::string m_endCapStyle = "round";
37 std::string m_joinStyle = "round";
38 double m_mitreLimit = 5;
39 int m_quadrantSegments = 8;
40 std::string m_side = "both";
41 };
42
43 std::unique_ptr<OGRLayerWithTranslateFeature>
44 CreateAlgLayer(OGRLayer &srcLayer) override;
45
46 explicit GDALVectorBufferAlgorithm(bool standaloneStep = false);
47
48 private:
49 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
50
51 Options m_opts{};
52};
53
54/************************************************************************/
55/* GDALVectorBufferAlgorithmStandalone */
56/************************************************************************/
57
58 class GDALVectorBufferAlgorithmStandalone final
59 : public GDALVectorBufferAlgorithm
60{
61 public:
62 GDALVectorBufferAlgorithmStandalone()
63 : GDALVectorBufferAlgorithm(/* standaloneStep = */ true)
64 {
65 }
66
67 ~GDALVectorBufferAlgorithmStandalone() override;
68};
69
71
72#endif /* GDALALG_VECTOR_BUFFER_INCLUDED */
OGRLayer
This class represents a layer of simple features, with access methods.
Definition ogrsf_frmts.h:61