Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "gdal vector explode-collections" 5 : * Author: Even Rouault <even dot rouault at spatialys.com> 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com> 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef GDALALG_VECTOR_EXPLODE_COLLECTIONS_INCLUDED 14 : #define GDALALG_VECTOR_EXPLODE_COLLECTIONS_INCLUDED 15 : 16 : #include "gdalalg_vector_geom.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALVectorExplodeCollectionsAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALVectorExplodeCollectionsAlgorithm /* non final */ 25 : : public GDALVectorGeomAbstractAlgorithm 26 : { 27 : public: 28 : static constexpr const char *NAME = "explode-collections"; 29 : static constexpr const char *DESCRIPTION = 30 : "Explode geometries of type collection of a vector dataset."; 31 : static constexpr const char *HELP_URL = 32 : "/programs/gdal_vector_explode_collections.html"; 33 : 34 : struct Options : public GDALVectorGeomAbstractAlgorithm::OptionsBase 35 : { 36 : std::string m_type{}; 37 : bool m_skip = false; 38 : 39 : // Computed value from m_type 40 : OGRwkbGeometryType m_eType = wkbUnknown; 41 : }; 42 : 43 : std::unique_ptr<OGRLayerWithTranslateFeature> 44 : CreateAlgLayer(OGRLayer &srcLayer) override; 45 : 46 : explicit GDALVectorExplodeCollectionsAlgorithm(bool standaloneStep = false); 47 : 48 : private: 49 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 50 : 51 : Options m_opts{}; 52 : }; 53 : 54 : /************************************************************************/ 55 : /* GDALVectorExplodeCollectionsAlgorithmStandalone */ 56 : /************************************************************************/ 57 : 58 24 : class GDALVectorExplodeCollectionsAlgorithmStandalone final 59 : : public GDALVectorExplodeCollectionsAlgorithm 60 : { 61 : public: 62 12 : GDALVectorExplodeCollectionsAlgorithmStandalone() 63 12 : : GDALVectorExplodeCollectionsAlgorithm(/* standaloneStep = */ true) 64 : { 65 12 : } 66 : 67 : ~GDALVectorExplodeCollectionsAlgorithmStandalone() override; 68 : }; 69 : 70 : //! @endcond 71 : 72 : #endif /* GDALALG_VECTOR_EXPLODE_COLLECTIONS_INCLUDED */