/src/gdal/apps/gdalalg_vector_grid_nearest.cpp
Line | Count | Source |
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 | | GDALVectorGridNearestAlgorithm::GDALVectorGridNearestAlgorithm( |
24 | | bool standaloneStep) |
25 | 0 | : GDALVectorGridAbstractAlgorithm(NAME, DESCRIPTION, HELP_URL, |
26 | 0 | standaloneStep) |
27 | 0 | { |
28 | 0 | AddRadiusArg(); |
29 | 0 | AddRadius1AndRadius2Arg(); |
30 | 0 | AddAngleArg(); |
31 | 0 | AddNodataArg(); |
32 | 0 | } |
33 | | |
34 | | /************************************************************************/ |
35 | | /* GDALVectorGridNearestAlgorithm::RunImpl() */ |
36 | | /************************************************************************/ |
37 | | |
38 | | std::string GDALVectorGridNearestAlgorithm::GetGridAlgorithm() const |
39 | 0 | { |
40 | 0 | std::string ret = |
41 | 0 | CPLSPrintf("nearest:angle=%.17g:nodata=%.17g", m_angle, m_nodata); |
42 | 0 | if (m_radius > 0) |
43 | 0 | { |
44 | 0 | ret += CPLSPrintf(":radius=%.17g", m_radius); |
45 | 0 | } |
46 | 0 | else |
47 | 0 | { |
48 | 0 | if (m_radius1 > 0) |
49 | 0 | ret += CPLSPrintf(":radius1=%.17g", m_radius1); |
50 | 0 | if (m_radius2 > 0) |
51 | 0 | ret += CPLSPrintf(":radius2=%.17g", m_radius2); |
52 | 0 | } |
53 | 0 | return ret; |
54 | 0 | } |
55 | | |
56 | | GDALVectorGridNearestAlgorithmStandalone:: |
57 | 0 | ~GDALVectorGridNearestAlgorithmStandalone() = default; |
58 | | |
59 | | //! @endcond |