/src/gdal/apps/gdalalg_vector.cpp
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: GDAL |
4 | | * Purpose: gdal "vector" subcommand |
5 | | * Author: Even Rouault <even dot rouault at spatialys.com> |
6 | | * |
7 | | ****************************************************************************** |
8 | | * Copyright (c) 2024, Even Rouault <even dot rouault at spatialys.com> |
9 | | * |
10 | | * SPDX-License-Identifier: MIT |
11 | | ****************************************************************************/ |
12 | | |
13 | | //! @cond Doxygen_Suppress |
14 | | |
15 | | #include "gdalalg_vector.h" |
16 | | |
17 | | #include "gdalalg_vector_info.h" |
18 | | #include "gdalalg_vector_buffer.h" |
19 | | #include "gdalalg_vector_check_geometry.h" |
20 | | #include "gdalalg_vector_check_coverage.h" |
21 | | #include "gdalalg_vector_clean_coverage.h" |
22 | | #include "gdalalg_vector_clip.h" |
23 | | #include "gdalalg_vector_concat.h" |
24 | | #include "gdalalg_vector_convert.h" |
25 | | #include "gdalalg_vector_edit.h" |
26 | | #include "gdalalg_vector_explode_collections.h" |
27 | | #include "gdalalg_vector_grid.h" |
28 | | #include "gdalalg_vector_index.h" |
29 | | #include "gdalalg_vector_layer_algebra.h" |
30 | | #include "gdalalg_vector_make_point.h" |
31 | | #include "gdalalg_vector_make_valid.h" |
32 | | #include "gdalalg_vector_pipeline.h" |
33 | | #include "gdalalg_vector_rasterize.h" |
34 | | #include "gdalalg_vector_filter.h" |
35 | | #include "gdalalg_vector_partition.h" |
36 | | #include "gdalalg_vector_reproject.h" |
37 | | #include "gdalalg_vector_segmentize.h" |
38 | | #include "gdalalg_vector_select.h" |
39 | | #include "gdalalg_vector_set_field_type.h" |
40 | | #include "gdalalg_vector_set_geom_type.h" |
41 | | #include "gdalalg_vector_simplify.h" |
42 | | #include "gdalalg_vector_simplify_coverage.h" |
43 | | #include "gdalalg_vector_sort.h" |
44 | | #include "gdalalg_vector_sql.h" |
45 | | #include "gdalalg_vector_update.h" |
46 | | #include "gdalalg_vector_swap_xy.h" |
47 | | |
48 | | #include "gdal_priv.h" |
49 | | |
50 | | #ifndef _ |
51 | 0 | #define _(x) (x) |
52 | | #endif |
53 | | |
54 | | /************************************************************************/ |
55 | | /* GDALVectorAlgorithm */ |
56 | | /************************************************************************/ |
57 | | |
58 | | GDALVectorAlgorithm::GDALVectorAlgorithm() |
59 | 0 | : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL) |
60 | 0 | { |
61 | 0 | AddArg("drivers", 0, |
62 | 0 | _("Display vector driver list as JSON document and exit"), |
63 | 0 | &m_drivers); |
64 | |
|
65 | 0 | AddOutputStringArg(&m_output); |
66 | |
|
67 | 0 | RegisterSubAlgorithm<GDALVectorInfoAlgorithmStandalone>(); |
68 | 0 | RegisterSubAlgorithm<GDALVectorBufferAlgorithmStandalone>(); |
69 | 0 | RegisterSubAlgorithm<GDALVectorCheckCoverageAlgorithmStandalone>(); |
70 | 0 | RegisterSubAlgorithm<GDALVectorCheckGeometryAlgorithmStandalone>(); |
71 | 0 | RegisterSubAlgorithm<GDALVectorCleanCoverageAlgorithmStandalone>(); |
72 | 0 | RegisterSubAlgorithm<GDALVectorClipAlgorithmStandalone>(); |
73 | 0 | RegisterSubAlgorithm<GDALVectorConcatAlgorithmStandalone>(); |
74 | 0 | RegisterSubAlgorithm<GDALVectorConvertAlgorithm>(); |
75 | 0 | RegisterSubAlgorithm<GDALVectorEditAlgorithmStandalone>(); |
76 | 0 | RegisterSubAlgorithm<GDALVectorExplodeCollectionsAlgorithmStandalone>(); |
77 | 0 | RegisterSubAlgorithm<GDALVectorGridAlgorithmStandalone>(); |
78 | 0 | RegisterSubAlgorithm<GDALVectorRasterizeAlgorithmStandalone>(); |
79 | 0 | RegisterSubAlgorithm<GDALVectorPipelineAlgorithm>(); |
80 | 0 | RegisterSubAlgorithm<GDALVectorFilterAlgorithmStandalone>(); |
81 | 0 | RegisterSubAlgorithm<GDALVectorIndexAlgorithm>(); |
82 | 0 | RegisterSubAlgorithm<GDALVectorLayerAlgebraAlgorithm>(); |
83 | 0 | RegisterSubAlgorithm<GDALVectorMakePointAlgorithmStandalone>(); |
84 | 0 | RegisterSubAlgorithm<GDALVectorMakeValidAlgorithmStandalone>(); |
85 | 0 | RegisterSubAlgorithm<GDALVectorPartitionAlgorithmStandalone>(); |
86 | 0 | RegisterSubAlgorithm<GDALVectorReprojectAlgorithmStandalone>(); |
87 | 0 | RegisterSubAlgorithm<GDALVectorSegmentizeAlgorithmStandalone>(); |
88 | 0 | RegisterSubAlgorithm<GDALVectorSelectAlgorithmStandalone>(); |
89 | 0 | RegisterSubAlgorithm<GDALVectorSetFieldTypeAlgorithmStandalone>(); |
90 | 0 | RegisterSubAlgorithm<GDALVectorSetGeomTypeAlgorithmStandalone>(); |
91 | 0 | RegisterSubAlgorithm<GDALVectorSimplifyAlgorithmStandalone>(); |
92 | 0 | RegisterSubAlgorithm<GDALVectorSimplifyCoverageAlgorithmStandalone>(); |
93 | 0 | RegisterSubAlgorithm<GDALVectorSortAlgorithmStandalone>(); |
94 | 0 | RegisterSubAlgorithm<GDALVectorSQLAlgorithmStandalone>(); |
95 | 0 | RegisterSubAlgorithm<GDALVectorUpdateAlgorithmStandalone>(); |
96 | 0 | RegisterSubAlgorithm<GDALVectorSwapXYAlgorithmStandalone>(); |
97 | 0 | } |
98 | | |
99 | | bool GDALVectorAlgorithm::RunImpl(GDALProgressFunc, void *) |
100 | 0 | { |
101 | 0 | if (m_drivers) |
102 | 0 | { |
103 | 0 | m_output = GDALPrintDriverList(GDAL_OF_VECTOR, true); |
104 | 0 | return true; |
105 | 0 | } |
106 | 0 | else |
107 | 0 | { |
108 | 0 | CPLError(CE_Failure, CPLE_AppDefined, |
109 | 0 | "The Run() method should not be called directly on the \"gdal " |
110 | 0 | "vector\" program."); |
111 | 0 | return false; |
112 | 0 | } |
113 | 0 | } |
114 | | |
115 | | //! @endcond |