GDAL
gdalalg_vector_limit.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "limit" step of "vector pipeline"
5 * Author: Dan Baston
6 *
7 ******************************************************************************
8 * Copyright (c) 2025, ISciences LLC
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef GDALALG_VECTOR_LIMIT_INCLUDED
14#define GDALALG_VECTOR_LIMIT_INCLUDED
15
16#include "gdalalg_vector_pipeline.h"
17
19
20/************************************************************************/
21/* GDALVectorLimitAlgorithm */
22/************************************************************************/
23
24class GDALVectorLimitAlgorithm /* non final */
25 : public GDALVectorPipelineStepAlgorithm
26{
27 public:
28 static constexpr const char *NAME = "limit";
29 static constexpr const char *DESCRIPTION =
30 "Truncate a vector dataset to no more than a specified number of "
31 "features.";
32 static constexpr const char *HELP_URL =
33 "/programs/gdal_vector_pipeline.html";
34
35 explicit GDALVectorLimitAlgorithm(bool standaloneStep = false);
36
37 private:
38 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
39
40 std::string m_activeLayer{};
41 int m_featureLimit{};
42};
43
45
46#endif /* GDALALG_VECTOR_LIMIT_INCLUDED */