Line data Source code
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 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALVectorSegmentizeAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class 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 : 52 6 : class GDALVectorSegmentizeAlgorithmStandalone final 53 : : public GDALVectorSegmentizeAlgorithm 54 : { 55 : public: 56 3 : GDALVectorSegmentizeAlgorithmStandalone() 57 3 : : GDALVectorSegmentizeAlgorithm(/* standaloneStep = */ true) 58 : { 59 3 : } 60 : 61 : ~GDALVectorSegmentizeAlgorithmStandalone() override; 62 : }; 63 : 64 : //! @endcond 65 : 66 : #endif /* GDALALG_VECTOR_SEGMENTIZE_INCLUDED */