LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_grid_nearest.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 16 16 100.0 %
Date: 2025-04-16 00:42:22 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           6 : GDALVectorGridNearestAlgorithm::GDALVectorGridNearestAlgorithm()
      24           6 :     : GDALVectorGridAbstractAlgorithm(NAME, DESCRIPTION, HELP_URL)
      25             : {
      26           6 :     AddRadiusArg();
      27           6 :     AddRadius1AndRadius2Arg();
      28           6 :     AddAngleArg();
      29           6 :     AddNodataArg();
      30           6 : }
      31             : 
      32             : /************************************************************************/
      33             : /*               GDALVectorGridNearestAlgorithm::RunImpl()              */
      34             : /************************************************************************/
      35             : 
      36           5 : std::string GDALVectorGridNearestAlgorithm::GetGridAlgorithm() const
      37             : {
      38             :     std::string ret =
      39           5 :         CPLSPrintf("nearest:angle=%.17g:nodata=%.17g", m_angle, m_nodata);
      40           5 :     if (m_radius > 0)
      41             :     {
      42           2 :         ret += CPLSPrintf(":radius=%.17g", m_radius);
      43             :     }
      44             :     else
      45             :     {
      46           3 :         if (m_radius1 > 0)
      47           2 :             ret += CPLSPrintf(":radius1=%.17g", m_radius1);
      48           3 :         if (m_radius2 > 0)
      49           2 :             ret += CPLSPrintf(":radius2=%.17g", m_radius2);
      50             :     }
      51           5 :     return ret;
      52             : }
      53             : 
      54             : //! @endcond

Generated by: LCOV version 1.14