GDAL
gdalalg_vector_grid_data_metrics.h
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
19
20/************************************************************************/
21/* GDALVectorGridDataMetricsAbstractAlgorithm */
22/************************************************************************/
23
24class 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 bool standaloneStep);
36
37 ~GDALVectorGridDataMetricsAbstractAlgorithm() override;
38
39 std::string GetGridAlgorithm() const override;
40
41 private:
42 std::string m_method{};
43};
44
45/************************************************************************/
46/* GDALVectorGridMinimumAlgorithm */
47/************************************************************************/
48
49class GDALVectorGridMinimumAlgorithm /* non final */
50 : public GDALVectorGridDataMetricsAbstractAlgorithm
51{
52 public:
53 static constexpr const char *NAME = "minimum";
54 static constexpr const char *DESCRIPTION =
55 "Create a regular grid from scattered points using the minimum value "
56 "in the search ellipse.";
57
58 explicit GDALVectorGridMinimumAlgorithm(bool standaloneStep = false)
59 : GDALVectorGridDataMetricsAbstractAlgorithm(
60 NAME, DESCRIPTION, HELP_URL, "minimum", standaloneStep)
61 {
62 }
63
64 ~GDALVectorGridMinimumAlgorithm() override;
65};
66
67/************************************************************************/
68/* GDALVectorGridMinimumAlgorithmStandalone */
69/************************************************************************/
70
71class GDALVectorGridMinimumAlgorithmStandalone final
72 : public GDALVectorGridMinimumAlgorithm
73{
74 public:
75 GDALVectorGridMinimumAlgorithmStandalone()
76 : GDALVectorGridMinimumAlgorithm(/* standaloneStep = */ true)
77 {
78 }
79
80 ~GDALVectorGridMinimumAlgorithmStandalone() override;
81};
82
83/************************************************************************/
84/* GDALVectorGridMaximumAlgorithm */
85/************************************************************************/
86
87class GDALVectorGridMaximumAlgorithm /* non final */
88 : public GDALVectorGridDataMetricsAbstractAlgorithm
89{
90 public:
91 static constexpr const char *NAME = "maximum";
92 static constexpr const char *DESCRIPTION =
93 "Create a regular grid from scattered points using the maximum value "
94 "in the search ellipse.";
95
96 explicit GDALVectorGridMaximumAlgorithm(bool standaloneStep = false)
97 : GDALVectorGridDataMetricsAbstractAlgorithm(
98 NAME, DESCRIPTION, HELP_URL, "maximum", standaloneStep)
99 {
100 }
101
102 ~GDALVectorGridMaximumAlgorithm() override;
103};
104
105/************************************************************************/
106/* GDALVectorGridMaximumAlgorithmStandalone */
107/************************************************************************/
108
109class GDALVectorGridMaximumAlgorithmStandalone final
110 : public GDALVectorGridMaximumAlgorithm
111{
112 public:
113 GDALVectorGridMaximumAlgorithmStandalone()
114 : GDALVectorGridMaximumAlgorithm(/* standaloneStep = */ true)
115 {
116 }
117
118 ~GDALVectorGridMaximumAlgorithmStandalone() override;
119};
120
121/************************************************************************/
122/* GDALVectorGridRangeAlgorithm */
123/************************************************************************/
124
125class GDALVectorGridRangeAlgorithm /* non final */
126 : public GDALVectorGridDataMetricsAbstractAlgorithm
127{
128 public:
129 static constexpr const char *NAME = "range";
130 static constexpr const char *DESCRIPTION =
131 "Create a regular grid from scattered points using the difference "
132 "between the minimum and maximum values in the search ellipse.";
133
134 explicit GDALVectorGridRangeAlgorithm(bool standaloneStep = false)
135 : GDALVectorGridDataMetricsAbstractAlgorithm(
136 NAME, DESCRIPTION, HELP_URL, "range", standaloneStep)
137 {
138 }
139
140 ~GDALVectorGridRangeAlgorithm() override;
141};
142
143/************************************************************************/
144/* GDALVectorGridRangeAlgorithmStandalone */
145/************************************************************************/
146
147class GDALVectorGridRangeAlgorithmStandalone final
148 : public GDALVectorGridRangeAlgorithm
149{
150 public:
151 GDALVectorGridRangeAlgorithmStandalone()
152 : GDALVectorGridRangeAlgorithm(/* standaloneStep = */ true)
153 {
154 }
155
156 ~GDALVectorGridRangeAlgorithmStandalone() override;
157};
158
159/************************************************************************/
160/* GDALVectorGridCountAlgorithm */
161/************************************************************************/
162
163class GDALVectorGridCountAlgorithm /* non final */
164 : public GDALVectorGridDataMetricsAbstractAlgorithm
165{
166 public:
167 static constexpr const char *NAME = "count";
168 static constexpr const char *DESCRIPTION =
169 "Create a regular grid from scattered points using the number of "
170 "points in the search ellipse.";
171
172 explicit GDALVectorGridCountAlgorithm(bool standaloneStep = false)
173 : GDALVectorGridDataMetricsAbstractAlgorithm(
174 NAME, DESCRIPTION, HELP_URL, "count", standaloneStep)
175 {
176 }
177
178 ~GDALVectorGridCountAlgorithm() override;
179};
180
181/************************************************************************/
182/* GDALVectorGridCountAlgorithmStandalone */
183/************************************************************************/
184
185class GDALVectorGridCountAlgorithmStandalone final
186 : public GDALVectorGridCountAlgorithm
187{
188 public:
189 GDALVectorGridCountAlgorithmStandalone()
190 : GDALVectorGridCountAlgorithm(/* standaloneStep = */ true)
191 {
192 }
193
194 ~GDALVectorGridCountAlgorithmStandalone() override;
195};
196
197/************************************************************************/
198/* GDALVectorGridAverageDistanceAlgorithm */
199/************************************************************************/
200
201class GDALVectorGridAverageDistanceAlgorithm /* non final */
202 : public GDALVectorGridDataMetricsAbstractAlgorithm
203{
204 public:
205 static constexpr const char *NAME = "average-distance";
206 static constexpr const char *DESCRIPTION =
207 "Create a regular grid from scattered points using the average "
208 "distance between the grid node (center of the search ellipse) and all "
209 "of the data points in the search ellipse.";
210
211 explicit GDALVectorGridAverageDistanceAlgorithm(bool standaloneStep = false)
212 : GDALVectorGridDataMetricsAbstractAlgorithm(
213 NAME, DESCRIPTION, HELP_URL, "average_distance", standaloneStep)
214 {
215 }
216
217 ~GDALVectorGridAverageDistanceAlgorithm() override;
218};
219
220/************************************************************************/
221/* GDALVectorGridAverageDistanceAlgorithmStandalone */
222/************************************************************************/
223
224class GDALVectorGridAverageDistanceAlgorithmStandalone final
225 : public GDALVectorGridAverageDistanceAlgorithm
226{
227 public:
228 GDALVectorGridAverageDistanceAlgorithmStandalone()
229 : GDALVectorGridAverageDistanceAlgorithm(/* standaloneStep = */ true)
230 {
231 }
232
233 ~GDALVectorGridAverageDistanceAlgorithmStandalone() override;
234};
235
236/************************************************************************/
237/* GDALVectorGridAverageDistancePointsAlgorithm */
238/************************************************************************/
239
240class GDALVectorGridAverageDistancePointsAlgorithm /* non final */
241 : public GDALVectorGridDataMetricsAbstractAlgorithm
242{
243 public:
244 static constexpr const char *NAME = "average-distance-points";
245 static constexpr const char *DESCRIPTION =
246 "Create a regular grid from scattered points using the average "
247 "distance between the data points in the search ellipse.";
248
249 explicit GDALVectorGridAverageDistancePointsAlgorithm(
250 bool standaloneStep = false)
251 : GDALVectorGridDataMetricsAbstractAlgorithm(
252 NAME, DESCRIPTION, HELP_URL, "average_distance_pts",
253 standaloneStep)
254 {
255 }
256
257 ~GDALVectorGridAverageDistancePointsAlgorithm() override;
258};
259
260/************************************************************************/
261/* GDALVectorGridAverageDistancePointsAlgorithmStandalone */
262/************************************************************************/
263
264class GDALVectorGridAverageDistancePointsAlgorithmStandalone final
265 : public GDALVectorGridAverageDistancePointsAlgorithm
266{
267 public:
268 GDALVectorGridAverageDistancePointsAlgorithmStandalone()
269 : GDALVectorGridAverageDistancePointsAlgorithm(
270 /* standaloneStep = */ true)
271 {
272 }
273
274 ~GDALVectorGridAverageDistancePointsAlgorithmStandalone() override;
275};
276
278
279#endif