/src/gdal/apps/gdalalg_vector_grid_invdistnn.cpp
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: GDAL |
4 | | * Purpose: gdal "vector grid invdistnn" 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_invdistnn.h" |
14 | | |
15 | | #include <limits> |
16 | | |
17 | | //! @cond Doxygen_Suppress |
18 | | |
19 | | #ifndef _ |
20 | 0 | #define _(x) (x) |
21 | | #endif |
22 | | |
23 | | /************************************************************************/ |
24 | | /* GDALVectorGridInvdistNNAlgorithm::GDALVectorGridInvdistNNAlgorithm() */ |
25 | | /************************************************************************/ |
26 | | |
27 | | GDALVectorGridInvdistNNAlgorithm::GDALVectorGridInvdistNNAlgorithm( |
28 | | bool standaloneStep) |
29 | 0 | : GDALVectorGridAbstractAlgorithm(NAME, DESCRIPTION, HELP_URL, |
30 | 0 | standaloneStep) |
31 | 0 | { |
32 | 0 | AddArg("power", 0, _("Weighting power"), &m_power).SetDefault(m_power); |
33 | 0 | AddArg("smoothing", 0, _("Smoothing parameter"), &m_smoothing) |
34 | 0 | .SetDefault(m_smoothing); |
35 | |
|
36 | 0 | AddRadiusArg(); |
37 | 0 | AddMinPointsArg(); |
38 | 0 | m_maxPoints = 12; |
39 | 0 | AddMaxPointsArg(); |
40 | 0 | AddMinMaxPointsPerQuadrantArg(); |
41 | 0 | AddNodataArg(); |
42 | 0 | } |
43 | | |
44 | | /************************************************************************/ |
45 | | /* GDALVectorGridInvdistNNAlgorithm::RunImpl() */ |
46 | | /************************************************************************/ |
47 | | |
48 | | std::string GDALVectorGridInvdistNNAlgorithm::GetGridAlgorithm() const |
49 | 0 | { |
50 | 0 | std::string ret = |
51 | 0 | CPLSPrintf("invdistnn:power=%.17g:smoothing=%.17g:nodata=%.17g", |
52 | 0 | m_power, m_smoothing, m_nodata); |
53 | 0 | ret += CPLSPrintf(":radius=%.17g", m_radius); |
54 | 0 | if (m_minPoints > 0) |
55 | 0 | ret += CPLSPrintf(":min_points=%d", m_minPoints); |
56 | 0 | if (m_maxPoints < std::numeric_limits<int>::max()) |
57 | 0 | ret += CPLSPrintf(":max_points=%d", m_maxPoints); |
58 | 0 | if (m_minPointsPerQuadrant > 0) |
59 | 0 | ret += |
60 | 0 | CPLSPrintf(":min_points_per_quadrant=%d", m_minPointsPerQuadrant); |
61 | 0 | if (m_maxPointsPerQuadrant < std::numeric_limits<int>::max()) |
62 | 0 | ret += |
63 | 0 | CPLSPrintf(":max_points_per_quadrant=%d", m_maxPointsPerQuadrant); |
64 | 0 | return ret; |
65 | 0 | } |
66 | | |
67 | | GDALVectorGridInvdistNNAlgorithmStandalone:: |
68 | 0 | ~GDALVectorGridInvdistNNAlgorithmStandalone() = default; |
69 | | |
70 | | //! @endcond |