Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "gdal vector clean-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_CLEAN_COVERAGE_INCLUDED 14 : #define GDALALG_VECTOR_CLEAN_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 : /* GDALVectorCleanCoverageAlgorithm */ 25 : /************************************************************************/ 26 : 27 : class GDALVectorCleanCoverageAlgorithm : public GDALVectorPipelineStepAlgorithm 28 : { 29 : public: 30 : static constexpr const char *NAME = "clean-coverage"; 31 : static constexpr const char *DESCRIPTION = 32 : "Alter polygon boundaries to make shared edges identical, removing " 33 : "gaps and overlaps"; 34 : static constexpr const char *HELP_URL = 35 : "/programs/gdal_vector_clean_coverage.html"; 36 : 37 : explicit GDALVectorCleanCoverageAlgorithm(bool standaloneStep = false); 38 : 39 0 : bool IsNativelyStreamingCompatible() const override 40 : { 41 0 : return false; 42 : } 43 : 44 : struct Options 45 : { 46 : double snappingTolerance = -1; 47 : double maximumGapWidth = 0; 48 : std::string mergeStrategy = "longest-border"; 49 : }; 50 : 51 : private: 52 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 53 : 54 : std::string m_activeLayer{}; 55 : 56 : Options m_opts{}; 57 : }; 58 : 59 : /************************************************************************/ 60 : /* GDALVectorCleanCoverageAlgorithmStandalone */ 61 : /************************************************************************/ 62 : 63 44 : class GDALVectorCleanCoverageAlgorithmStandalone final 64 : : public GDALVectorCleanCoverageAlgorithm 65 : { 66 : public: 67 22 : GDALVectorCleanCoverageAlgorithmStandalone() 68 22 : : GDALVectorCleanCoverageAlgorithm(/* standaloneStep = */ true) 69 : { 70 22 : } 71 : 72 : ~GDALVectorCleanCoverageAlgorithmStandalone() override; 73 : }; 74 : 75 : //! @endcond 76 : 77 : #endif /* GDALALG_VECTOR_CLEAN_COVERAGE_INCLUDED */