LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_as_features.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 5 11 45.5 %
Date: 2025-09-10 17:48:50 Functions: 4 8 50.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             : *
       3             :  * Project:  GDAL
       4             :  * Purpose:  "as-features" step of "gdal pipeline"
       5             :  * Author:   Daniel Baston
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2025, ISciences, LLC
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_RASTER_AS_FEATURES_INCLUDED
      14             : #define GDALALG_RASTER_AS_FEATURES_INCLUDED
      15             : 
      16             : #include "gdalalg_abstract_pipeline.h"
      17             : 
      18             : //! @cond Doxygen_Suppress
      19             : 
      20             : /************************************************************************/
      21             : /*                   GDALRasterAsFeaturesAlgorithm                      */
      22             : /************************************************************************/
      23             : 
      24          18 : class GDALRasterAsFeaturesAlgorithm /* non final */
      25             :     : public GDALPipelineStepAlgorithm
      26             : {
      27             :   public:
      28             :     static constexpr const char *NAME = "as-features";
      29             :     static constexpr const char *DESCRIPTION =
      30             :         "Create features from pixels of a raster dataset";
      31             :     static constexpr const char *HELP_URL =
      32             :         "/programs/gdal_raster_as_features.html";
      33             : 
      34             :     explicit GDALRasterAsFeaturesAlgorithm(bool standaloneStep = false);
      35             : 
      36             :     ~GDALRasterAsFeaturesAlgorithm() override;
      37             : 
      38           0 :     bool IsNativelyStreamingCompatible() const override
      39             :     {
      40           0 :         return true;
      41             :     }
      42             : 
      43           0 :     int GetInputType() const override
      44             :     {
      45           0 :         return GDAL_OF_RASTER;
      46             :     }
      47             : 
      48           0 :     int GetOutputType() const override
      49             :     {
      50           0 :         return GDAL_OF_VECTOR;
      51             :     }
      52             : 
      53             :   private:
      54             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      55             :     bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
      56             : 
      57             :     std::vector<int> m_bands;
      58             :     std::string m_geomTypeName;
      59             :     bool m_skipNoData;
      60             :     bool m_includeXY;
      61             :     bool m_includeRowCol;
      62             : };
      63             : 
      64             : /************************************************************************/
      65             : /*                 GDALRasterAsFeaturesAlgorithmStandalone              */
      66             : /************************************************************************/
      67             : 
      68          36 : class GDALRasterAsFeaturesAlgorithmStandalone final
      69             :     : public GDALRasterAsFeaturesAlgorithm
      70             : {
      71             :   public:
      72          18 :     GDALRasterAsFeaturesAlgorithmStandalone()
      73          18 :         : GDALRasterAsFeaturesAlgorithm(/* standaloneStep = */ true)
      74             :     {
      75          18 :     }
      76             : 
      77             :     ~GDALRasterAsFeaturesAlgorithmStandalone() override;
      78             : };
      79             : 
      80             : //! @endcond
      81             : 
      82             : #endif

Generated by: LCOV version 1.14