Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "gdal vector sort" 5 : * Author: Daniel Baston 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2025, ISciences LLC 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef GDALALG_VECTOR_SORT_INCLUDED 14 : #define GDALALG_VECTOR_SORT_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 : /* GDALVectorSortAlgorithm */ 25 : /************************************************************************/ 26 : 27 : class GDALVectorSortAlgorithm : public GDALVectorPipelineStepAlgorithm 28 : { 29 : public: 30 : static constexpr const char *NAME = "sort"; 31 : static constexpr const char *DESCRIPTION = 32 : "Spatially order the features in a layer"; 33 : static constexpr const char *HELP_URL = "/programs/gdal_vector_sort.html"; 34 : 35 : explicit GDALVectorSortAlgorithm(bool standaloneStep = false); 36 : 37 : private: 38 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 39 : 40 : std::string m_geomField{}; 41 : std::string m_sortMethod{"hilbert"}; 42 : }; 43 : 44 : /************************************************************************/ 45 : /* GDALVectorSortAlgorithmStandalone */ 46 : /************************************************************************/ 47 : 48 32 : class GDALVectorSortAlgorithmStandalone final : public GDALVectorSortAlgorithm 49 : { 50 : public: 51 16 : GDALVectorSortAlgorithmStandalone() 52 16 : : GDALVectorSortAlgorithm(/* standaloneStep = */ true) 53 : { 54 16 : } 55 : 56 : ~GDALVectorSortAlgorithmStandalone() override; 57 : }; 58 : 59 : //! @endcond 60 : 61 : #endif /* GDALALG_VECTOR_SORT_INCLUDED */