Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "gdal vector simplify" 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_SIMPLIFY_INCLUDED 14 : #define GDALALG_VECTOR_SIMPLIFY_INCLUDED 15 : 16 : #include "gdalalg_vector_geom.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALVectorSimplifyAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALVectorSimplifyAlgorithm /* non final */ 25 : : public GDALVectorGeomAbstractAlgorithm 26 : { 27 : public: 28 : static constexpr const char *NAME = "simplify"; 29 : static constexpr const char *DESCRIPTION = 30 : "Simplify geometries of a vector dataset."; 31 : static constexpr const char *HELP_URL = 32 : "/programs/gdal_vector_simplify.html"; 33 : 34 : struct Options : public GDALVectorGeomAbstractAlgorithm::OptionsBase 35 : { 36 : double m_tolerance = 0; 37 : }; 38 : 39 : std::unique_ptr<OGRLayerWithTranslateFeature> 40 : CreateAlgLayer(OGRLayer &srcLayer) override; 41 : 42 : explicit GDALVectorSimplifyAlgorithm(bool standaloneStep = false); 43 : 44 : private: 45 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 46 : 47 : Options m_opts{}; 48 : }; 49 : 50 : /************************************************************************/ 51 : /* GDALVectorSimplifyAlgorithmStandalone */ 52 : /************************************************************************/ 53 : 54 8 : class GDALVectorSimplifyAlgorithmStandalone final 55 : : public GDALVectorSimplifyAlgorithm 56 : { 57 : public: 58 4 : GDALVectorSimplifyAlgorithmStandalone() 59 4 : : GDALVectorSimplifyAlgorithm(/* standaloneStep = */ true) 60 : { 61 4 : } 62 : 63 : ~GDALVectorSimplifyAlgorithmStandalone() override; 64 : }; 65 : 66 : //! @endcond 67 : 68 : #endif /* GDALALG_VECTOR_SIMPLIFY_INCLUDED */