LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_viewshed.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2025-06-19 12:30:01 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "raster viewshed" 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_VIEWSHED_INCLUDED
      14             : #define GDALALG_RASTER_VIEWSHED_INCLUDED
      15             : 
      16             : #include "gdalalg_raster_pipeline.h"
      17             : #include "viewshed/viewshed_types.h"
      18             : 
      19             : //! @cond Doxygen_Suppress
      20             : 
      21             : /************************************************************************/
      22             : /*                   GDALRasterViewshedAlgorithm                       */
      23             : /************************************************************************/
      24             : 
      25             : class GDALRasterViewshedAlgorithm /* non final */
      26             :     : public GDALRasterPipelineNonNativelyStreamingAlgorithm
      27             : {
      28             :   public:
      29             :     static constexpr const char *NAME = "viewshed";
      30             :     static constexpr const char *DESCRIPTION =
      31             :         "Compute the viewshed of a raster dataset.";
      32             :     static constexpr const char *HELP_URL =
      33             :         "/programs/gdal_raster_viewshed.html";
      34             : 
      35             :     explicit GDALRasterViewshedAlgorithm(bool standaloneStep = false);
      36             : 
      37             :   private:
      38             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      39             : 
      40             :     std::vector<double> m_observerPos{};
      41             :     gdal::viewshed::Options m_opts{};
      42             : 
      43             :     std::string m_outputMode = "normal";
      44             :     int m_band = 1;
      45             :     int m_numThreads = 3;
      46             : 
      47             :     // Work variables
      48             :     std::string m_numThreadsStr{};
      49             : };
      50             : 
      51             : /************************************************************************/
      52             : /*                GDALRasterViewshedAlgorithmStandalone                 */
      53             : /************************************************************************/
      54             : 
      55          40 : class GDALRasterViewshedAlgorithmStandalone final
      56             :     : public GDALRasterViewshedAlgorithm
      57             : {
      58             :   public:
      59          20 :     GDALRasterViewshedAlgorithmStandalone()
      60          20 :         : GDALRasterViewshedAlgorithm(/* standaloneStep = */ true)
      61             :     {
      62          20 :     }
      63             : 
      64             :     ~GDALRasterViewshedAlgorithmStandalone() override;
      65             : };
      66             : 
      67             : //! @endcond
      68             : 
      69             : #endif

Generated by: LCOV version 1.14