LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_pixel_info.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 10 10 100.0 %
Date: 2026-02-21 16:21:44 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "raster pixelinfo" subcommand
       5             :  * Author:   Even Rouault <even dot rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_RASTER_PIXEL_INFO_INCLUDED
      14             : #define GDALALG_RASTER_PIXEL_INFO_INCLUDED
      15             : 
      16             : #include "gdalalg_abstract_pipeline.h"
      17             : 
      18             : #include "cpl_vsi_virtual.h"
      19             : 
      20             : //! @cond Doxygen_Suppress
      21             : 
      22             : /************************************************************************/
      23             : /*                     GDALRasterPixelInfoAlgorithm                     */
      24             : /************************************************************************/
      25             : 
      26             : class GDALRasterPixelInfoAlgorithm /* non final */
      27             :     : public GDALPipelineStepAlgorithm
      28             : {
      29             :   public:
      30             :     static constexpr const char *NAME = "pixel-info";
      31             :     static constexpr const char *DESCRIPTION =
      32             :         "Return information on a pixel of a raster dataset.";
      33             :     static constexpr const char *HELP_URL =
      34             :         "/programs/gdal_raster_pixel_info.html";
      35             : 
      36             :     explicit GDALRasterPixelInfoAlgorithm(bool standaloneStep = false);
      37             :     ~GDALRasterPixelInfoAlgorithm() override;
      38             : 
      39          10 :     bool IsNativelyStreamingCompatible() const override
      40             :     {
      41             :         // It could potentially be made fully streamable in pipeline mode since
      42             :         // we read coordinates from an input vector dataset. "Just" needs some
      43             :         // code reorganization.
      44          10 :         return false;
      45             :     }
      46             : 
      47           9 :     int GetInputType() const override
      48             :     {
      49           9 :         return GDAL_OF_RASTER;
      50             :     }
      51             : 
      52           5 :     int GetOutputType() const override
      53             :     {
      54           5 :         return GDAL_OF_VECTOR;
      55             :     }
      56             : 
      57             :   private:
      58             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      59             :     bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
      60             : 
      61             :     GDALArgDatasetValue m_vectorDataset{};
      62             :     std::vector<std::string> m_includeFields{"ALL"};
      63             : 
      64             :     std::vector<int> m_band{};
      65             :     int m_overview = -1;
      66             :     std::vector<double> m_pos{};
      67             :     std::string m_posCrs{};
      68             :     std::string m_resampling = "nearest";
      69             :     bool m_promotePixelValueToZ = false;
      70             : 
      71             :     VSIVirtualHandleUniquePtr m_outputFile{};
      72             :     std::string m_osTmpFilename{};
      73             : };
      74             : 
      75             : /************************************************************************/
      76             : /*                GDALRasterPixelInfoAlgorithmStandalone                */
      77             : /************************************************************************/
      78             : 
      79         106 : class GDALRasterPixelInfoAlgorithmStandalone final
      80             :     : public GDALRasterPixelInfoAlgorithm
      81             : {
      82             :   public:
      83          53 :     GDALRasterPixelInfoAlgorithmStandalone()
      84          53 :         : GDALRasterPixelInfoAlgorithm(/* standaloneStep = */ true)
      85             :     {
      86          53 :     }
      87             : 
      88             :     ~GDALRasterPixelInfoAlgorithmStandalone() override;
      89             : };
      90             : 
      91             : //! @endcond
      92             : 
      93             : #endif

Generated by: LCOV version 1.14