LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_sort.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 6 6 100.0 %
Date: 2026-02-01 11:59:10 Functions: 4 4 100.0 %

          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           8 :     bool IsNativelyStreamingCompatible() const override
      38             :     {
      39           8 :         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             :     bool m_useTempfile{false};
      48             : };
      49             : 
      50             : /************************************************************************/
      51             : /*                  GDALVectorSortAlgorithmStandalone                   */
      52             : /************************************************************************/
      53             : 
      54          52 : class GDALVectorSortAlgorithmStandalone final : public GDALVectorSortAlgorithm
      55             : {
      56             :   public:
      57          26 :     GDALVectorSortAlgorithmStandalone()
      58          26 :         : GDALVectorSortAlgorithm(/* standaloneStep = */ true)
      59             :     {
      60          26 :     }
      61             : 
      62             :     ~GDALVectorSortAlgorithmStandalone() override;
      63             : };
      64             : 
      65             : //! @endcond
      66             : 
      67             : #endif /* GDALALG_VECTOR_SORT_INCLUDED */

Generated by: LCOV version 1.14