Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "gdal vector geom 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_GEOM_EXPLODE_COLLECTIONS_INCLUDED 14 : #define GDALALG_VECTOR_GEOM_EXPLODE_COLLECTIONS_INCLUDED 15 : 16 : #include "gdalalg_vector_geom.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALVectorGeomExplodeCollectionsAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALVectorGeomExplodeCollectionsAlgorithm 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_geom_explode_collections.html"; 33 : 34 74 : static std::vector<std::string> GetAliases() 35 : { 36 74 : return {}; 37 : } 38 : 39 : struct Options : public GDALVectorGeomAbstractAlgorithm::OptionsBase 40 : { 41 : std::string m_type{}; 42 : bool m_skip = false; 43 : 44 : // Computed value from m_type 45 : OGRwkbGeometryType m_eType = wkbUnknown; 46 : }; 47 : 48 : std::unique_ptr<OGRLayerWithTranslateFeature> 49 : CreateAlgLayer(OGRLayer &srcLayer) override; 50 : 51 : explicit GDALVectorGeomExplodeCollectionsAlgorithm(bool standaloneStep); 52 : 53 : private: 54 : bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override; 55 : 56 : Options m_opts{}; 57 : }; 58 : 59 : //! @endcond 60 : 61 : #endif /* GDALALG_VECTOR_GEOM_EXPLODE_COLLECTIONS_INCLUDED */