Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: gdal "raster overview delete" subcommand 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 : #include "gdalalg_raster_overview_delete.h" 14 : 15 : #include "gdal_priv.h" 16 : 17 : //! @cond Doxygen_Suppress 18 : 19 : #ifndef _ 20 : #define _(x) (x) 21 : #endif 22 : 23 : /************************************************************************/ 24 : /* GDALRasterOverviewAlgorithmDelete() */ 25 : /************************************************************************/ 26 : 27 4 : GDALRasterOverviewAlgorithmDelete::GDALRasterOverviewAlgorithmDelete() 28 4 : : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL) 29 : { 30 4 : AddProgressArg(); 31 4 : AddOpenOptionsArg(&m_openOptions); 32 : AddArg("dataset", 0, _("Dataset (in-place updated, unless --read-only)"), 33 8 : &m_dataset, GDAL_OF_RASTER | GDAL_OF_UPDATE) 34 4 : .SetPositional() 35 4 : .SetRequired(); 36 8 : AddArg("external", 0, _("Delete external overviews"), &m_readOnly) 37 8 : .AddHiddenAlias("ro") 38 4 : .AddHiddenAlias(GDAL_ARG_NAME_READ_ONLY); 39 4 : } 40 : 41 : /************************************************************************/ 42 : /* GDALRasterOverviewAlgorithmDelete::RunImpl() */ 43 : /************************************************************************/ 44 : 45 2 : bool GDALRasterOverviewAlgorithmDelete::RunImpl(GDALProgressFunc pfnProgress, 46 : void *pProgressData) 47 : { 48 2 : auto poDS = m_dataset.GetDatasetRef(); 49 2 : CPLAssert(poDS); 50 : 51 2 : return GDALBuildOverviews(GDALDataset::ToHandle(poDS), "NONE", 0, nullptr, 52 : 0, nullptr, pfnProgress, 53 2 : pProgressData) == CE_None; 54 : } 55 : 56 : //! @endcond