LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_filter.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 6 6 100.0 %
Date: 2025-12-17 01:24:48 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  "filter" step of "vector pipeline"
       5             :  * Author:   Even Rouault <even dot rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2024, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_VECTOR_FILTER_INCLUDED
      14             : #define GDALALG_VECTOR_FILTER_INCLUDED
      15             : 
      16             : #include "gdalalg_vector_pipeline.h"
      17             : 
      18             : //! @cond Doxygen_Suppress
      19             : 
      20             : /************************************************************************/
      21             : /*                    GDALVectorFilterAlgorithm                         */
      22             : /************************************************************************/
      23             : 
      24             : class GDALVectorFilterAlgorithm /* non final */
      25             :     : public GDALVectorPipelineStepAlgorithm
      26             : {
      27             :   public:
      28             :     static constexpr const char *NAME = "filter";
      29             :     static constexpr const char *DESCRIPTION = "Filter a vector dataset.";
      30             :     static constexpr const char *HELP_URL = "/programs/gdal_vector_filter.html";
      31             : 
      32             :     explicit GDALVectorFilterAlgorithm(bool standaloneStep = false);
      33             : 
      34          10 :     bool IsNativelyStreamingCompatible() const override
      35             :     {
      36          10 :         return !m_updateExtent;
      37             :     }
      38             : 
      39             :   private:
      40             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      41             : 
      42             :     std::string m_activeLayer{};
      43             :     std::vector<double> m_bbox{};
      44             :     std::string m_where{};
      45             :     bool m_updateExtent = false;
      46             : };
      47             : 
      48             : /************************************************************************/
      49             : /*                 GDALVectorFilterAlgorithmStandalone                  */
      50             : /************************************************************************/
      51             : 
      52          26 : class GDALVectorFilterAlgorithmStandalone final
      53             :     : public GDALVectorFilterAlgorithm
      54             : {
      55             :   public:
      56          13 :     GDALVectorFilterAlgorithmStandalone()
      57          13 :         : GDALVectorFilterAlgorithm(/* standaloneStep = */ true)
      58             :     {
      59          13 :     }
      60             : 
      61             :     ~GDALVectorFilterAlgorithmStandalone() override;
      62             : };
      63             : 
      64             : //! @endcond
      65             : 
      66             : #endif /* GDALALG_VECTOR_FILTER_INCLUDED */

Generated by: LCOV version 1.14