Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "gdal vector simplify-coverage" 5 : * Author: Daniel Baston 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2025, ISciences LLC 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef GDALALG_VECTOR_SIMPLIFY_COVERAGE_INCLUDED 14 : #define GDALALG_VECTOR_SIMPLIFY_COVERAGE_INCLUDED 15 : 16 : #include "gdalalg_vector_pipeline.h" 17 : #include "cpl_progress.h" 18 : 19 : #include <string> 20 : 21 : //! @cond Doxygen_Suppress 22 : 23 : /************************************************************************/ 24 : /* GDALVectorSimplifyCoverageAlgorithm */ 25 : /************************************************************************/ 26 : 27 : class GDALVectorSimplifyCoverageAlgorithm 28 : : public GDALVectorPipelineStepAlgorithm 29 : { 30 : public: 31 : static constexpr const char *NAME = "simplify-coverage"; 32 : static constexpr const char *DESCRIPTION = 33 : "Simplify shared boundaries of a polygonal vector dataset."; 34 : static constexpr const char *HELP_URL = 35 : "/programs/gdal_vector_simplify_coverage.html"; 36 : 37 : explicit GDALVectorSimplifyCoverageAlgorithm(bool standaloneStep = false); 38 : 39 : struct Options 40 : { 41 : double tolerance = 0; 42 : bool preserveBoundary = false; 43 : }; 44 : 45 0 : bool IsNativelyStreamingCompatible() const override 46 : { 47 0 : return false; 48 : } 49 : 50 : private: 51 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 52 : 53 : std::string m_activeLayer{}; 54 : 55 : Options m_opts{}; 56 : }; 57 : 58 : /************************************************************************/ 59 : /* GDALVectorSimplifyCoverageAlgorithmStandalone */ 60 : /************************************************************************/ 61 : 62 30 : class GDALVectorSimplifyCoverageAlgorithmStandalone final 63 : : public GDALVectorSimplifyCoverageAlgorithm 64 : { 65 : public: 66 15 : GDALVectorSimplifyCoverageAlgorithmStandalone() 67 15 : : GDALVectorSimplifyCoverageAlgorithm(/* standaloneStep = */ true) 68 : { 69 15 : } 70 : 71 : ~GDALVectorSimplifyCoverageAlgorithmStandalone() override; 72 : }; 73 : 74 : //! @endcond 75 : 76 : #endif /* GDALALG_VECTOR_SIMPLIFY_COVERAGE_INCLUDED */