Skip to content

Commit df7ee2d

Browse files
committed
Rename to 'gdal vector concat'
1 parent df3aa95 commit df7ee2d

15 files changed

+92
-88
lines changed

apps/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ add_library(
4646
gdalalg_raster_write.cpp
4747
gdalalg_vector.cpp
4848
gdalalg_vector_info.cpp
49-
gdalalg_vector_cat.cpp
5049
gdalalg_vector_clip.cpp
50+
gdalalg_vector_concat.cpp
5151
gdalalg_vector_convert.cpp
5252
gdalalg_vector_edit.cpp
5353
gdalalg_vector_pipeline.cpp

apps/gdalalg_vector.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include "gdalalgorithm.h"
1414

1515
#include "gdalalg_vector_info.h"
16-
#include "gdalalg_vector_cat.h"
1716
#include "gdalalg_vector_clip.h"
17+
#include "gdalalg_vector_concat.h"
1818
#include "gdalalg_vector_convert.h"
1919
#include "gdalalg_vector_edit.h"
2020
#include "gdalalg_vector_geom.h"
@@ -40,8 +40,8 @@ class GDALVectorAlgorithm final : public GDALAlgorithm
4040
GDALVectorAlgorithm() : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL)
4141
{
4242
RegisterSubAlgorithm<GDALVectorInfoAlgorithm>();
43-
RegisterSubAlgorithm<GDALVectorCatAlgorithmStandalone>();
4443
RegisterSubAlgorithm<GDALVectorClipAlgorithmStandalone>();
44+
RegisterSubAlgorithm<GDALVectorConcatAlgorithmStandalone>();
4545
RegisterSubAlgorithm<GDALVectorConvertAlgorithm>();
4646
RegisterSubAlgorithm<GDALVectorEditAlgorithmStandalone>();
4747
RegisterSubAlgorithm<GDALVectorGridAlgorithm>();

apps/gdalalg_vector_cat.cpp renamed to apps/gdalalg_vector_concat.cpp

+22-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/******************************************************************************
22
*
33
* Project: GDAL
4-
* Purpose: gdal "vector cat" subcommand
4+
* Purpose: gdal "vector concat" subcommand
55
* Author: Even Rouault <even dot rouault at spatialys.com>
66
*
77
******************************************************************************
@@ -10,7 +10,7 @@
1010
* SPDX-License-Identifier: MIT
1111
****************************************************************************/
1212

13-
#include "gdalalg_vector_cat.h"
13+
#include "gdalalg_vector_concat.h"
1414
#include "gdalalg_vector_write.h"
1515

1616
#include "cpl_conv.h"
@@ -32,10 +32,10 @@
3232
#endif
3333

3434
/************************************************************************/
35-
/* GDALVectorCatAlgorithm::GDALVectorCatAlgorithm() */
35+
/* GDALVectorConcatAlgorithm::GDALVectorConcatAlgorithm() */
3636
/************************************************************************/
3737

38-
GDALVectorCatAlgorithm::GDALVectorCatAlgorithm(bool bStandalone)
38+
GDALVectorConcatAlgorithm::GDALVectorConcatAlgorithm(bool bStandalone)
3939
: GDALVectorPipelineStepAlgorithm(NAME, DESCRIPTION, HELP_URL, bStandalone)
4040
{
4141
if (!bStandalone)
@@ -54,7 +54,7 @@ GDALVectorCatAlgorithm::GDALVectorCatAlgorithm(bool bStandalone)
5454
"name the output vector layers (stack mode)"),
5555
&m_layerNameTemplate);
5656
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 "
5858
"source layer, with value determined from "
5959
"'source-layer-field-content'"),
6060
&m_sourceLayerFieldName);
@@ -76,15 +76,15 @@ GDALVectorCatAlgorithm::GDALVectorCatAlgorithm(bool bStandalone)
7676
}
7777

7878
/************************************************************************/
79-
/* GDALVectorCatOutputDatset */
79+
/* GDALVectorConcatOutputDataset */
8080
/************************************************************************/
8181

82-
class GDALVectorCatOutputDatset final : public GDALDataset
82+
class GDALVectorConcatOutputDataset final : public GDALDataset
8383
{
8484
std::vector<std::unique_ptr<OGRLayer>> m_layers{};
8585

8686
public:
87-
GDALVectorCatOutputDatset() = default;
87+
GDALVectorConcatOutputDataset() = default;
8888

8989
void AddLayer(std::unique_ptr<OGRLayer> layer)
9090
{
@@ -115,13 +115,14 @@ class GDALVectorCatOutputDatset final : public GDALDataset
115115
};
116116

117117
/************************************************************************/
118-
/* GDALVectorCatRenamedLayer */
118+
/* GDALVectorConcatRenamedLayer */
119119
/************************************************************************/
120120

121-
class GDALVectorCatRenamedLayer final : public OGRLayerDecorator
121+
class GDALVectorConcatRenamedLayer final : public OGRLayerDecorator
122122
{
123123
public:
124-
GDALVectorCatRenamedLayer(OGRLayer *poSrcLayer, const std::string &newName)
124+
GDALVectorConcatRenamedLayer(OGRLayer *poSrcLayer,
125+
const std::string &newName)
125126
: OGRLayerDecorator(poSrcLayer, false), m_newName(newName)
126127
{
127128
}
@@ -172,10 +173,10 @@ static std::string BuildLayerName(const std::string &layerNameTemplate,
172173
}
173174

174175
/************************************************************************/
175-
/* GDALVectorCatAlgorithm::RunStep() */
176+
/* GDALVectorConcatAlgorithm::RunStep() */
176177
/************************************************************************/
177178

178-
bool GDALVectorCatAlgorithm::RunStep(GDALProgressFunc, void *)
179+
bool GDALVectorConcatAlgorithm::RunStep(GDALProgressFunc, void *)
179180
{
180181
std::unique_ptr<OGRSpatialReference> poSrcCRS;
181182
if (!m_srsCrs.empty())
@@ -263,7 +264,7 @@ bool GDALVectorCatAlgorithm::RunStep(GDALProgressFunc, void *)
263264
m_layerNameTemplate, iDS,
264265
srcDS.GetDatasetRef()->GetDescription(), iLayer,
265266
poLayer->GetName());
266-
CPLDebugOnly("gdal_vector_cat", "%s,%s->%s",
267+
CPLDebugOnly("gdal_vector_concat", "%s,%s->%s",
267268
srcDS.GetDatasetRef()->GetDescription(),
268269
poLayer->GetName(), outLayerName.c_str());
269270
allLayerNames[outLayerName].push_back(std::move(layerDesc));
@@ -273,7 +274,7 @@ bool GDALVectorCatAlgorithm::RunStep(GDALProgressFunc, void *)
273274
++iDS;
274275
}
275276

276-
auto poUnionDS = std::make_unique<GDALVectorCatOutputDatset>();
277+
auto poUnionDS = std::make_unique<GDALVectorConcatOutputDataset>();
277278

278279
bool ret = true;
279280
for (const auto &[outLayerName, listOfLayers] : allLayerNames)
@@ -298,8 +299,9 @@ bool GDALVectorCatAlgorithm::RunStep(GDALProgressFunc, void *)
298299
->GetDescription(),
299300
listOfLayers[i].iLayer, poSrcLayer->GetName());
300301
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);
303305
m_tempLayersKeeper.push_back(std::move(poTmpLayer));
304306
papoSrcLayers.get()[i] = m_tempLayersKeeper.back().get();
305307
}
@@ -365,11 +367,11 @@ bool GDALVectorCatAlgorithm::RunStep(GDALProgressFunc, void *)
365367
}
366368

367369
/************************************************************************/
368-
/* GDALVectorCatAlgorithm::RunImpl() */
370+
/* GDALVectorConcatAlgorithm::RunImpl() */
369371
/************************************************************************/
370372

371-
bool GDALVectorCatAlgorithm::RunImpl(GDALProgressFunc pfnProgress,
372-
void *pProgressData)
373+
bool GDALVectorConcatAlgorithm::RunImpl(GDALProgressFunc pfnProgress,
374+
void *pProgressData)
373375
{
374376
if (m_standaloneStep)
375377
{

apps/gdalalg_vector_cat.h renamed to apps/gdalalg_vector_concat.h

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/******************************************************************************
22
*
33
* Project: GDAL
4-
* Purpose: gdal "vector cat" subcommand
4+
* Purpose: gdal "vector concat" subcommand
55
* Author: Even Rouault <even dot rouault at spatialys.com>
66
*
77
******************************************************************************
@@ -10,8 +10,8 @@
1010
* SPDX-License-Identifier: MIT
1111
****************************************************************************/
1212

13-
#ifndef GDALALG_VECTOR_CAT_INCLUDED
14-
#define GDALALG_VECTOR_CAT_INCLUDED
13+
#ifndef GDALALG_VECTOR_CONCAT_INCLUDED
14+
#define GDALALG_VECTOR_CONCAT_INCLUDED
1515

1616
#include "gdalalg_vector_pipeline.h"
1717

@@ -20,18 +20,18 @@
2020
//! @cond Doxygen_Suppress
2121

2222
/************************************************************************/
23-
/* GDALVectorCatAlgorithm */
23+
/* GDALVectorConcatAlgorithm */
2424
/************************************************************************/
2525

26-
class GDALVectorCatAlgorithm /* non final */
26+
class GDALVectorConcatAlgorithm /* non final */
2727
: public GDALVectorPipelineStepAlgorithm
2828
{
2929
public:
30-
static constexpr const char *NAME = "cat";
30+
static constexpr const char *NAME = "concat";
3131
static constexpr const char *DESCRIPTION = "Concatenate vector datasets.";
32-
static constexpr const char *HELP_URL = "/programs/gdal_vector_cat.html";
32+
static constexpr const char *HELP_URL = "/programs/gdal_vector_concat.html";
3333

34-
explicit GDALVectorCatAlgorithm(bool bStandalone = false);
34+
explicit GDALVectorConcatAlgorithm(bool bStandalone = false);
3535

3636
private:
3737
bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override;
@@ -49,14 +49,15 @@ class GDALVectorCatAlgorithm /* non final */
4949
};
5050

5151
/************************************************************************/
52-
/* GDALVectorCatAlgorithmStandalone */
52+
/* GDALVectorConcatAlgorithmStandalone */
5353
/************************************************************************/
5454

55-
class GDALVectorCatAlgorithmStandalone final : public GDALVectorCatAlgorithm
55+
class GDALVectorConcatAlgorithmStandalone final
56+
: public GDALVectorConcatAlgorithm
5657
{
5758
public:
58-
GDALVectorCatAlgorithmStandalone()
59-
: GDALVectorCatAlgorithm(/* standaloneStep = */ true)
59+
GDALVectorConcatAlgorithmStandalone()
60+
: GDALVectorConcatAlgorithm(/* standaloneStep = */ true)
6061
{
6162
}
6263
};

apps/gdalalg_vector_pipeline.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
****************************************************************************/
1212

1313
#include "gdalalg_vector_pipeline.h"
14-
#include "gdalalg_vector_cat.h"
1514
#include "gdalalg_vector_read.h"
1615
#include "gdalalg_vector_clip.h"
16+
#include "gdalalg_vector_concat.h"
1717
#include "gdalalg_vector_edit.h"
1818
#include "gdalalg_vector_filter.h"
1919
#include "gdalalg_vector_geom.h"
@@ -68,7 +68,7 @@ void GDALVectorPipelineStepAlgorithm::AddInputArgs(bool hiddenForCLI)
6868
/* positionalAndRequired = */ !hiddenForCLI)
6969
.SetMinCount(1)
7070
.SetMaxCount((GetName() == GDALVectorPipelineAlgorithm::NAME ||
71-
GetName() == GDALVectorCatAlgorithm::NAME)
71+
GetName() == GDALVectorConcatAlgorithm::NAME)
7272
? INT_MAX
7373
: 1)
7474
.SetHiddenForCLI(hiddenForCLI);
@@ -111,7 +111,7 @@ void GDALVectorPipelineStepAlgorithm::AddOutputArgs(
111111
.SetDefault(false)
112112
.SetHiddenForCLI(hiddenForCLI);
113113
if (GetName() != GDALVectorSQLAlgorithm::NAME &&
114-
GetName() != GDALVectorCatAlgorithm::NAME)
114+
GetName() != GDALVectorConcatAlgorithm::NAME)
115115
{
116116
AddArg("output-layer", shortNameOutputLayerAllowed ? 'l' : 0,
117117
_("Output layer name"), &m_outputLayerName)
@@ -250,7 +250,7 @@ GDALVectorPipelineAlgorithm::GDALVectorPipelineAlgorithm()
250250
/* shortNameOutputLayerAllowed=*/false);
251251

252252
m_stepRegistry.Register<GDALVectorReadAlgorithm>();
253-
m_stepRegistry.Register<GDALVectorCatAlgorithm>();
253+
m_stepRegistry.Register<GDALVectorConcatAlgorithm>();
254254
m_stepRegistry.Register<GDALVectorWriteAlgorithm>();
255255
m_stepRegistry.Register<GDALVectorClipAlgorithm>();
256256
m_stepRegistry.Register<GDALVectorEditAlgorithm>();
@@ -462,22 +462,22 @@ bool GDALVectorPipelineAlgorithm::ParseCommandLineArguments(
462462
}
463463

464464
if (steps.front().alg->GetName() != GDALVectorReadAlgorithm::NAME &&
465-
steps.front().alg->GetName() != GDALVectorCatAlgorithm::NAME)
465+
steps.front().alg->GetName() != GDALVectorConcatAlgorithm::NAME)
466466
{
467467
ReportError(
468468
CE_Failure, CPLE_AppDefined, "First step should be '%s' or '%s'",
469-
GDALVectorReadAlgorithm::NAME, GDALVectorCatAlgorithm::NAME);
469+
GDALVectorReadAlgorithm::NAME, GDALVectorConcatAlgorithm::NAME);
470470
return false;
471471
}
472472
for (size_t i = 1; i < steps.size() - 1; ++i)
473473
{
474474
if (steps[i].alg->GetName() == GDALVectorReadAlgorithm::NAME ||
475-
steps[i].alg->GetName() == GDALVectorCatAlgorithm::NAME)
475+
steps[i].alg->GetName() == GDALVectorConcatAlgorithm::NAME)
476476
{
477477
ReportError(CE_Failure, CPLE_AppDefined,
478478
"Only first step can be '%s' or '%s'",
479479
GDALVectorReadAlgorithm::NAME,
480-
GDALVectorCatAlgorithm::NAME);
480+
GDALVectorConcatAlgorithm::NAME);
481481
return false;
482482
}
483483
}
@@ -599,7 +599,7 @@ std::string GDALVectorPipelineAlgorithm::GetUsageForCLI(
599599
if (shortUsage)
600600
return ret;
601601

602-
ret += "\n<PIPELINE> is of the form: read|cat [READ-OPTIONS] "
602+
ret += "\n<PIPELINE> is of the form: read|concat [READ-OPTIONS] "
603603
"( ! <STEP-NAME> [STEP-OPTIONS] )* ! write [WRITE-OPTIONS]\n";
604604

605605
if (m_helpDocCategory == "main")
@@ -632,7 +632,7 @@ std::string GDALVectorPipelineAlgorithm::GetUsageForCLI(
632632
ret += alg->GetUsageForCLI(shortUsage, stepUsageOptions);
633633
}
634634
{
635-
const auto name = GDALVectorCatAlgorithm::NAME;
635+
const auto name = GDALVectorConcatAlgorithm::NAME;
636636
ret += '\n';
637637
auto alg = GetStepAlg(name);
638638
assert(alg);
@@ -642,7 +642,7 @@ std::string GDALVectorPipelineAlgorithm::GetUsageForCLI(
642642
for (const std::string &name : m_stepRegistry.GetNames())
643643
{
644644
if (name != GDALVectorReadAlgorithm::NAME &&
645-
name != GDALVectorCatAlgorithm::NAME &&
645+
name != GDALVectorConcatAlgorithm::NAME &&
646646
name != GDALVectorWriteAlgorithm::NAME)
647647
{
648648
ret += '\n';

apps/gdalalg_vector_pipeline.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class GDALVectorPipelineStepAlgorithm /* non final */ : public GDALAlgorithm
3838

3939
friend class GDALVectorPipelineAlgorithm;
4040
friend class GDALAbstractPipelineAlgorithm<GDALVectorPipelineStepAlgorithm>;
41-
friend class GDALVectorCatAlgorithm;
41+
friend class GDALVectorConcatAlgorithm;
4242

4343
virtual bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) = 0;
4444

0 commit comments

Comments
 (0)