LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_grid_data_metrics.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 24 24 100.0 %
Date: 2025-04-16 00:42:22 Functions: 6 6 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             : #ifndef GDALALG_VECTOR_GRID_DATA_METRICS_INCLUDED
      14             : #define GDALALG_VECTOR_GRID_DATA_METRICS_INCLUDED
      15             : 
      16             : #include "gdalalg_vector_grid.h"
      17             : 
      18             : //! @cond Doxygen_Suppress
      19             : 
      20             : /************************************************************************/
      21             : /*                 GDALVectorGridDataMetricsAbstractAlgorithm           */
      22             : /************************************************************************/
      23             : 
      24             : class GDALVectorGridDataMetricsAbstractAlgorithm /* non final */
      25             :     : public GDALVectorGridAbstractAlgorithm
      26             : {
      27             :   public:
      28             :     static constexpr const char *HELP_URL = "/programs/gdal_vector_grid.html";
      29             : 
      30             :   protected:
      31             :     GDALVectorGridDataMetricsAbstractAlgorithm(const std::string &name,
      32             :                                                const std::string &description,
      33             :                                                const std::string &helpURL,
      34             :                                                const std::string &method);
      35             : 
      36             :     std::string GetGridAlgorithm() const override;
      37             : 
      38             :   private:
      39             :     std::string m_method{};
      40             : };
      41             : 
      42             : /************************************************************************/
      43             : /*                      GDALVectorGridMinimumAlgorithm                  */
      44             : /************************************************************************/
      45             : 
      46             : class GDALVectorGridMinimumAlgorithm final
      47             :     : public GDALVectorGridDataMetricsAbstractAlgorithm
      48             : {
      49             :   public:
      50             :     static constexpr const char *NAME = "minimum";
      51             :     static constexpr const char *DESCRIPTION =
      52             :         "Create a regular grid from scattered points using the minimum value "
      53             :         "in the search ellipse.";
      54             : 
      55           8 :     GDALVectorGridMinimumAlgorithm()
      56           8 :         : GDALVectorGridDataMetricsAbstractAlgorithm(NAME, DESCRIPTION,
      57           8 :                                                      HELP_URL, "minimum")
      58             :     {
      59           8 :     }
      60             : };
      61             : 
      62             : /************************************************************************/
      63             : /*                      GDALVectorGridMaximumAlgorithm                  */
      64             : /************************************************************************/
      65             : 
      66             : class GDALVectorGridMaximumAlgorithm final
      67             :     : public GDALVectorGridDataMetricsAbstractAlgorithm
      68             : {
      69             :   public:
      70             :     static constexpr const char *NAME = "maximum";
      71             :     static constexpr const char *DESCRIPTION =
      72             :         "Create a regular grid from scattered points using the maximum value "
      73             :         "in the search ellipse.";
      74             : 
      75           2 :     GDALVectorGridMaximumAlgorithm()
      76           2 :         : GDALVectorGridDataMetricsAbstractAlgorithm(NAME, DESCRIPTION,
      77           2 :                                                      HELP_URL, "maximum")
      78             :     {
      79           2 :     }
      80             : };
      81             : 
      82             : /************************************************************************/
      83             : /*                       GDALVectorGridRangeAlgorithm                   */
      84             : /************************************************************************/
      85             : 
      86             : class GDALVectorGridRangeAlgorithm final
      87             :     : public GDALVectorGridDataMetricsAbstractAlgorithm
      88             : {
      89             :   public:
      90             :     static constexpr const char *NAME = "range";
      91             :     static constexpr const char *DESCRIPTION =
      92             :         "Create a regular grid from scattered points using the difference "
      93             :         "between the minimum and maximum values in the search ellipse.";
      94             : 
      95           2 :     GDALVectorGridRangeAlgorithm()
      96           2 :         : GDALVectorGridDataMetricsAbstractAlgorithm(NAME, DESCRIPTION,
      97           2 :                                                      HELP_URL, "range")
      98             :     {
      99           2 :     }
     100             : };
     101             : 
     102             : /************************************************************************/
     103             : /*                       GDALVectorGridCountAlgorithm                   */
     104             : /************************************************************************/
     105             : 
     106             : class GDALVectorGridCountAlgorithm final
     107             :     : public GDALVectorGridDataMetricsAbstractAlgorithm
     108             : {
     109             :   public:
     110             :     static constexpr const char *NAME = "count";
     111             :     static constexpr const char *DESCRIPTION =
     112             :         "Create a regular grid from scattered points using the number of "
     113             :         "points in the search ellipse.";
     114             : 
     115           2 :     GDALVectorGridCountAlgorithm()
     116           2 :         : GDALVectorGridDataMetricsAbstractAlgorithm(NAME, DESCRIPTION,
     117           2 :                                                      HELP_URL, "count")
     118             :     {
     119           2 :     }
     120             : };
     121             : 
     122             : /************************************************************************/
     123             : /*                 GDALVectorGridAverageDistanceAlgorithm               */
     124             : /************************************************************************/
     125             : 
     126             : class GDALVectorGridAverageDistanceAlgorithm final
     127             :     : public GDALVectorGridDataMetricsAbstractAlgorithm
     128             : {
     129             :   public:
     130             :     static constexpr const char *NAME = "average-distance";
     131             :     static constexpr const char *DESCRIPTION =
     132             :         "Create a regular grid from scattered points using the average "
     133             :         "distance between the grid node (center of the search ellipse) and all "
     134             :         "of the data points in the search ellipse.";
     135             : 
     136           2 :     GDALVectorGridAverageDistanceAlgorithm()
     137           2 :         : GDALVectorGridDataMetricsAbstractAlgorithm(
     138           2 :               NAME, DESCRIPTION, HELP_URL, "average_distance")
     139             :     {
     140           2 :     }
     141             : };
     142             : 
     143             : /************************************************************************/
     144             : /*             GDALVectorGridAverageDistancePointsAlgorithm             */
     145             : /************************************************************************/
     146             : 
     147             : class GDALVectorGridAverageDistancePointsAlgorithm final
     148             :     : public GDALVectorGridDataMetricsAbstractAlgorithm
     149             : {
     150             :   public:
     151             :     static constexpr const char *NAME = "average-distance-points";
     152             :     static constexpr const char *DESCRIPTION =
     153             :         "Create a regular grid from scattered points using the average "
     154             :         "distance between the data points in the search ellipse.";
     155             : 
     156           2 :     GDALVectorGridAverageDistancePointsAlgorithm()
     157           2 :         : GDALVectorGridDataMetricsAbstractAlgorithm(
     158           2 :               NAME, DESCRIPTION, HELP_URL, "average_distance_pts")
     159             :     {
     160           2 :     }
     161             : };
     162             : 
     163             : //! @endcond
     164             : 
     165             : #endif

Generated by: LCOV version 1.14