1
1
/* *****************************************************************************
2
2
*
3
3
* Project: GDAL
4
- * Purpose: gdal "vector cat " subcommand
4
+ * Purpose: gdal "vector concat " subcommand
5
5
* Author: Even Rouault <even dot rouault at spatialys.com>
6
6
*
7
7
******************************************************************************
10
10
* SPDX-License-Identifier: MIT
11
11
****************************************************************************/
12
12
13
- #include " gdalalg_vector_cat .h"
13
+ #include " gdalalg_vector_concat .h"
14
14
#include " gdalalg_vector_write.h"
15
15
16
16
#include " cpl_conv.h"
32
32
#endif
33
33
34
34
/* ***********************************************************************/
35
- /* GDALVectorCatAlgorithm::GDALVectorCatAlgorithm() */
35
+ /* GDALVectorConcatAlgorithm::GDALVectorConcatAlgorithm() */
36
36
/* ***********************************************************************/
37
37
38
- GDALVectorCatAlgorithm::GDALVectorCatAlgorithm (bool bStandalone)
38
+ GDALVectorConcatAlgorithm::GDALVectorConcatAlgorithm (bool bStandalone)
39
39
: GDALVectorPipelineStepAlgorithm(NAME, DESCRIPTION, HELP_URL, bStandalone)
40
40
{
41
41
if (!bStandalone)
@@ -54,7 +54,7 @@ GDALVectorCatAlgorithm::GDALVectorCatAlgorithm(bool bStandalone)
54
54
" name the output vector layers (stack mode)" ),
55
55
&m_layerNameTemplate);
56
56
AddArg (" source-layer-field-name" , 0 ,
57
- _ (" Name of the new field to add to contain identification of the "
57
+ _ (" Name of the new field to add to contain identificoncation of the "
58
58
" source layer, with value determined from "
59
59
" 'source-layer-field-content'" ),
60
60
&m_sourceLayerFieldName);
@@ -76,15 +76,15 @@ GDALVectorCatAlgorithm::GDALVectorCatAlgorithm(bool bStandalone)
76
76
}
77
77
78
78
/* ***********************************************************************/
79
- /* GDALVectorCatOutputDatset */
79
+ /* GDALVectorConcatOutputDataset */
80
80
/* ***********************************************************************/
81
81
82
- class GDALVectorCatOutputDatset final : public GDALDataset
82
+ class GDALVectorConcatOutputDataset final : public GDALDataset
83
83
{
84
84
std::vector<std::unique_ptr<OGRLayer>> m_layers{};
85
85
86
86
public:
87
- GDALVectorCatOutputDatset () = default ;
87
+ GDALVectorConcatOutputDataset () = default ;
88
88
89
89
void AddLayer (std::unique_ptr<OGRLayer> layer)
90
90
{
@@ -115,13 +115,14 @@ class GDALVectorCatOutputDatset final : public GDALDataset
115
115
};
116
116
117
117
/* ***********************************************************************/
118
- /* GDALVectorCatRenamedLayer */
118
+ /* GDALVectorConcatRenamedLayer */
119
119
/* ***********************************************************************/
120
120
121
- class GDALVectorCatRenamedLayer final : public OGRLayerDecorator
121
+ class GDALVectorConcatRenamedLayer final : public OGRLayerDecorator
122
122
{
123
123
public:
124
- GDALVectorCatRenamedLayer (OGRLayer *poSrcLayer, const std::string &newName)
124
+ GDALVectorConcatRenamedLayer (OGRLayer *poSrcLayer,
125
+ const std::string &newName)
125
126
: OGRLayerDecorator(poSrcLayer, false ), m_newName(newName)
126
127
{
127
128
}
@@ -172,10 +173,10 @@ static std::string BuildLayerName(const std::string &layerNameTemplate,
172
173
}
173
174
174
175
/* ***********************************************************************/
175
- /* GDALVectorCatAlgorithm ::RunStep() */
176
+ /* GDALVectorConcatAlgorithm ::RunStep() */
176
177
/* ***********************************************************************/
177
178
178
- bool GDALVectorCatAlgorithm ::RunStep (GDALProgressFunc, void *)
179
+ bool GDALVectorConcatAlgorithm ::RunStep (GDALProgressFunc, void *)
179
180
{
180
181
std::unique_ptr<OGRSpatialReference> poSrcCRS;
181
182
if (!m_srsCrs.empty ())
@@ -263,7 +264,7 @@ bool GDALVectorCatAlgorithm::RunStep(GDALProgressFunc, void *)
263
264
m_layerNameTemplate, iDS,
264
265
srcDS.GetDatasetRef ()->GetDescription (), iLayer,
265
266
poLayer->GetName ());
266
- CPLDebugOnly (" gdal_vector_cat " , " %s,%s->%s" ,
267
+ CPLDebugOnly (" gdal_vector_concat " , " %s,%s->%s" ,
267
268
srcDS.GetDatasetRef ()->GetDescription (),
268
269
poLayer->GetName (), outLayerName.c_str ());
269
270
allLayerNames[outLayerName].push_back (std::move (layerDesc));
@@ -273,7 +274,7 @@ bool GDALVectorCatAlgorithm::RunStep(GDALProgressFunc, void *)
273
274
++iDS;
274
275
}
275
276
276
- auto poUnionDS = std::make_unique<GDALVectorCatOutputDatset >();
277
+ auto poUnionDS = std::make_unique<GDALVectorConcatOutputDataset >();
277
278
278
279
bool ret = true ;
279
280
for (const auto &[outLayerName, listOfLayers] : allLayerNames)
@@ -298,8 +299,9 @@ bool GDALVectorCatAlgorithm::RunStep(GDALProgressFunc, void *)
298
299
->GetDescription (),
299
300
listOfLayers[i].iLayer , poSrcLayer->GetName ());
300
301
ret = !newSrcLayerName.empty () && ret;
301
- auto poTmpLayer = std::make_unique<GDALVectorCatRenamedLayer>(
302
- poSrcLayer, newSrcLayerName);
302
+ auto poTmpLayer =
303
+ std::make_unique<GDALVectorConcatRenamedLayer>(
304
+ poSrcLayer, newSrcLayerName);
303
305
m_tempLayersKeeper.push_back (std::move (poTmpLayer));
304
306
papoSrcLayers.get ()[i] = m_tempLayersKeeper.back ().get ();
305
307
}
@@ -365,11 +367,11 @@ bool GDALVectorCatAlgorithm::RunStep(GDALProgressFunc, void *)
365
367
}
366
368
367
369
/* ***********************************************************************/
368
- /* GDALVectorCatAlgorithm ::RunImpl() */
370
+ /* GDALVectorConcatAlgorithm ::RunImpl() */
369
371
/* ***********************************************************************/
370
372
371
- bool GDALVectorCatAlgorithm ::RunImpl (GDALProgressFunc pfnProgress,
372
- void *pProgressData)
373
+ bool GDALVectorConcatAlgorithm ::RunImpl (GDALProgressFunc pfnProgress,
374
+ void *pProgressData)
373
375
{
374
376
if (m_standaloneStep)
375
377
{
0 commit comments