LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_grid_nearest.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 17 17 100.0 %
Date: 2025-07-09 17:50:03 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "vector grid nearest" 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             : #include "gdalalg_vector_grid_nearest.h"
      14             : 
      15             : #include <limits>
      16             : 
      17             : //! @cond Doxygen_Suppress
      18             : 
      19             : /************************************************************************/
      20             : /*    GDALVectorGridNearestAlgorithm::GDALVectorGridNearestAlgorithm()  */
      21             : /************************************************************************/
      22             : 
      23           9 : GDALVectorGridNearestAlgorithm::GDALVectorGridNearestAlgorithm(
      24           9 :     bool standaloneStep)
      25             :     : GDALVectorGridAbstractAlgorithm(NAME, DESCRIPTION, HELP_URL,
      26           9 :                                       standaloneStep)
      27             : {
      28           9 :     AddRadiusArg();
      29           9 :     AddRadius1AndRadius2Arg();
      30           9 :     AddAngleArg();
      31           9 :     AddNodataArg();
      32           9 : }
      33             : 
      34             : /************************************************************************/
      35             : /*               GDALVectorGridNearestAlgorithm::RunImpl()              */
      36             : /************************************************************************/
      37             : 
      38           5 : std::string GDALVectorGridNearestAlgorithm::GetGridAlgorithm() const
      39             : {
      40             :     std::string ret =
      41           5 :         CPLSPrintf("nearest:angle=%.17g:nodata=%.17g", m_angle, m_nodata);
      42           5 :     if (m_radius > 0)
      43             :     {
      44           2 :         ret += CPLSPrintf(":radius=%.17g", m_radius);
      45             :     }
      46             :     else
      47             :     {
      48           3 :         if (m_radius1 > 0)
      49           2 :             ret += CPLSPrintf(":radius1=%.17g", m_radius1);
      50           3 :         if (m_radius2 > 0)
      51           2 :             ret += CPLSPrintf(":radius2=%.17g", m_radius2);
      52             :     }
      53           5 :     return ret;
      54             : }
      55             : 
      56             : GDALVectorGridNearestAlgorithmStandalone::
      57             :     ~GDALVectorGridNearestAlgorithmStandalone() = default;
      58             : 
      59             : //! @endcond

Generated by: LCOV version 1.14