Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "select" step of "vector pipeline" 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 : #ifndef GDALALG_VECTOR_SELECT_INCLUDED 14 : #define GDALALG_VECTOR_SELECT_INCLUDED 15 : 16 : #include "gdalalg_vector_pipeline.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALVectorSelectAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALVectorSelectAlgorithm /* non final */ 25 : : public GDALVectorPipelineStepAlgorithm 26 : { 27 : public: 28 : static constexpr const char *NAME = "select"; 29 : static constexpr const char *DESCRIPTION = 30 : "Select a subset of fields from a vector dataset."; 31 : static constexpr const char *HELP_URL = "/programs/gdal_vector_select.html"; 32 : 33 314 : static std::vector<std::string> GetAliases() 34 : { 35 314 : return {}; 36 : } 37 : 38 : explicit GDALVectorSelectAlgorithm(bool standaloneStep = false); 39 : 40 : private: 41 : bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override; 42 : 43 : std::string m_activeLayer{}; 44 : std::vector<std::string> m_fields{}; 45 : bool m_ignoreMissingFields = false; 46 : bool m_exclude = false; 47 : }; 48 : 49 : /************************************************************************/ 50 : /* GDALVectorSelectAlgorithmStandalone */ 51 : /************************************************************************/ 52 : 53 : class GDALVectorSelectAlgorithmStandalone final 54 : : public GDALVectorSelectAlgorithm 55 : { 56 : public: 57 10 : GDALVectorSelectAlgorithmStandalone() 58 10 : : GDALVectorSelectAlgorithm(/* standaloneStep = */ true) 59 : { 60 10 : } 61 : }; 62 : 63 : //! @endcond 64 : 65 : #endif /* GDALALG_VECTOR_SELECT_INCLUDED */