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 : private: 46 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 47 : 48 : std::string m_activeLayer{}; 49 : 50 : Options m_opts{}; 51 : }; 52 : 53 : /************************************************************************/ 54 : /* GDALVectorSimplifyCoverageAlgorithmStandalone */ 55 : /************************************************************************/ 56 : 57 22 : class GDALVectorSimplifyCoverageAlgorithmStandalone final 58 : : public GDALVectorSimplifyCoverageAlgorithm 59 : { 60 : public: 61 11 : GDALVectorSimplifyCoverageAlgorithmStandalone() 62 11 : : GDALVectorSimplifyCoverageAlgorithm(/* standaloneStep = */ true) 63 : { 64 11 : } 65 : 66 : ~GDALVectorSimplifyCoverageAlgorithmStandalone() override; 67 : }; 68 : 69 : //! @endcond 70 : 71 : #endif /* GDALALG_VECTOR_SIMPLIFY_COVERAGE_INCLUDED */