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 4 : bool IsNativelyStreamingCompatible() const override 38 : { 39 4 : return false; 40 : } 41 : 42 : private: 43 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 44 : 45 : std::string m_geomField{}; 46 : std::string m_sortMethod{"hilbert"}; 47 : }; 48 : 49 : /************************************************************************/ 50 : /* GDALVectorSortAlgorithmStandalone */ 51 : /************************************************************************/ 52 : 53 34 : class GDALVectorSortAlgorithmStandalone final : public GDALVectorSortAlgorithm 54 : { 55 : public: 56 17 : GDALVectorSortAlgorithmStandalone() 57 17 : : GDALVectorSortAlgorithm(/* standaloneStep = */ true) 58 : { 59 17 : } 60 : 61 : ~GDALVectorSortAlgorithmStandalone() override; 62 : }; 63 : 64 : //! @endcond 65 : 66 : #endif /* GDALALG_VECTOR_SORT_INCLUDED */