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

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             : * Purpose:  gdal "vector grid minimum/maximum/range/count/average-distance/average-distance-pts" 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_data_metrics.h"
      14             : 
      15             : #include <limits>
      16             : 
      17             : //! @cond Doxygen_Suppress
      18             : 
      19             : /************************************************************************/
      20             : /*            GDALVectorGridDataMetricsAbstractAlgorithm()              */
      21             : /************************************************************************/
      22             : 
      23          36 : GDALVectorGridDataMetricsAbstractAlgorithm::
      24             :     GDALVectorGridDataMetricsAbstractAlgorithm(const std::string &name,
      25             :                                                const std::string &description,
      26             :                                                const std::string &helpURL,
      27             :                                                const std::string &method,
      28          36 :                                                bool standalone)
      29             :     : GDALVectorGridAbstractAlgorithm(name, description, helpURL, standalone),
      30          36 :       m_method(method)
      31             : {
      32          36 :     AddRadiusArg();
      33          36 :     AddRadius1AndRadius2Arg();
      34          36 :     AddAngleArg();
      35          36 :     AddMinPointsArg();
      36          36 :     AddMinMaxPointsPerQuadrantArg();
      37          36 :     AddNodataArg();
      38          36 : }
      39             : 
      40             : /************************************************************************/
      41             : /*         GDALVectorGridDataMetricsAbstractAlgorithm::RunImpl()        */
      42             : /************************************************************************/
      43             : 
      44          12 : std::string GDALVectorGridDataMetricsAbstractAlgorithm::GetGridAlgorithm() const
      45             : {
      46             :     std::string ret = CPLSPrintf("%s:angle=%.17g:nodata=%.17g",
      47          12 :                                  m_method.c_str(), m_angle, m_nodata);
      48          12 :     if (m_radius > 0)
      49             :     {
      50           6 :         ret += CPLSPrintf(":radius=%.17g", m_radius);
      51             :     }
      52             :     else
      53             :     {
      54           6 :         if (m_radius1 > 0)
      55           1 :             ret += CPLSPrintf(":radius1=%.17g", m_radius1);
      56           6 :         if (m_radius2 > 0)
      57           1 :             ret += CPLSPrintf(":radius2=%.17g", m_radius2);
      58             :     }
      59          12 :     if (m_minPoints > 0)
      60           1 :         ret += CPLSPrintf(":min_points=%d", m_minPoints);
      61          12 :     if (m_minPointsPerQuadrant > 0)
      62             :         ret +=
      63           1 :             CPLSPrintf(":min_points_per_quadrant=%d", m_minPointsPerQuadrant);
      64          12 :     if (m_maxPointsPerQuadrant < std::numeric_limits<int>::max())
      65             :         ret +=
      66           1 :             CPLSPrintf(":max_points_per_quadrant=%d", m_maxPointsPerQuadrant);
      67          12 :     return ret;
      68             : }
      69             : 
      70             : GDALVectorGridDataMetricsAbstractAlgorithm::
      71             :     ~GDALVectorGridDataMetricsAbstractAlgorithm() = default;
      72             : GDALVectorGridMinimumAlgorithm::~GDALVectorGridMinimumAlgorithm() = default;
      73             : GDALVectorGridMaximumAlgorithm::~GDALVectorGridMaximumAlgorithm() = default;
      74             : GDALVectorGridRangeAlgorithm::~GDALVectorGridRangeAlgorithm() = default;
      75             : GDALVectorGridCountAlgorithm::~GDALVectorGridCountAlgorithm() = default;
      76             : GDALVectorGridAverageDistanceAlgorithm::
      77             :     ~GDALVectorGridAverageDistanceAlgorithm() = default;
      78             : GDALVectorGridAverageDistancePointsAlgorithm::
      79             :     ~GDALVectorGridAverageDistancePointsAlgorithm() = default;
      80             : 
      81             : GDALVectorGridMinimumAlgorithmStandalone::
      82             :     ~GDALVectorGridMinimumAlgorithmStandalone() = default;
      83             : GDALVectorGridMaximumAlgorithmStandalone::
      84             :     ~GDALVectorGridMaximumAlgorithmStandalone() = default;
      85             : GDALVectorGridRangeAlgorithmStandalone::
      86             :     ~GDALVectorGridRangeAlgorithmStandalone() = default;
      87             : GDALVectorGridCountAlgorithmStandalone::
      88             :     ~GDALVectorGridCountAlgorithmStandalone() = default;
      89             : GDALVectorGridAverageDistanceAlgorithmStandalone::
      90             :     ~GDALVectorGridAverageDistanceAlgorithmStandalone() = default;
      91             : GDALVectorGridAverageDistancePointsAlgorithmStandalone::
      92             :     ~GDALVectorGridAverageDistancePointsAlgorithmStandalone() = default;
      93             : 
      94             : //! @endcond

Generated by: LCOV version 1.14