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 "gdalvectorpipelinestepalgorithm.h" 17 : 18 : #include "cpl_progress.h" 19 : 20 : #include <string> 21 : 22 : //! @cond Doxygen_Suppress 23 : 24 : /************************************************************************/ 25 : /* GDALVectorSortAlgorithm */ 26 : /************************************************************************/ 27 : 28 : class GDALVectorSortAlgorithm : public GDALVectorPipelineStepAlgorithm 29 : { 30 : public: 31 : static constexpr const char *NAME = "sort"; 32 : static constexpr const char *DESCRIPTION = 33 : "Spatially order the features in a layer"; 34 : static constexpr const char *HELP_URL = "/programs/gdal_vector_sort.html"; 35 : 36 : explicit GDALVectorSortAlgorithm(bool standaloneStep = false); 37 : 38 16 : bool IsNativelyStreamingCompatible() const override 39 : { 40 16 : return false; 41 : } 42 : 43 : private: 44 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 45 : 46 : std::string m_geomField{}; 47 : std::string m_sortMethod{"hilbert"}; 48 : bool m_useTempfile{false}; 49 : }; 50 : 51 : /************************************************************************/ 52 : /* GDALVectorSortAlgorithmStandalone */ 53 : /************************************************************************/ 54 : 55 128 : class GDALVectorSortAlgorithmStandalone final : public GDALVectorSortAlgorithm 56 : { 57 : public: 58 64 : GDALVectorSortAlgorithmStandalone() 59 64 : : GDALVectorSortAlgorithm(/* standaloneStep = */ true) 60 : { 61 64 : } 62 : 63 : ~GDALVectorSortAlgorithmStandalone() override; 64 : }; 65 : 66 : //! @endcond 67 : 68 : #endif /* GDALALG_VECTOR_SORT_INCLUDED */