Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: gdal "raster info" subcommand 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_RASTER_INFO_INCLUDED 14 : #define GDALALG_RASTER_INFO_INCLUDED 15 : 16 : #include "gdalalgorithm.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALRasterInfoAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALRasterInfoAlgorithm final : public GDALAlgorithm 25 : { 26 : public: 27 : static constexpr const char *NAME = "info"; 28 : static constexpr const char *DESCRIPTION = 29 : "Return information on a raster dataset."; 30 : static constexpr const char *HELP_URL = "/programs/gdal_raster_info.html"; 31 : 32 : explicit GDALRasterInfoAlgorithm(bool openForMixedRasterVector = false); 33 : 34 21 : GDALDataset *GetDatasetRef() 35 : { 36 21 : return m_dataset.GetDatasetRef(); 37 : } 38 : 39 1 : void SetDataset(GDALDataset *poDS) 40 : { 41 1 : auto arg = GetArg(GDAL_ARG_NAME_INPUT); 42 1 : if (arg) 43 : { 44 1 : arg->Set(poDS); 45 1 : arg->SetSkipIfAlreadySet(); 46 : } 47 1 : } 48 : 49 : private: 50 : bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override; 51 : 52 : std::string m_format{}; 53 : bool m_minMax = false; 54 : bool m_stats = false; 55 : bool m_approxStats = false; 56 : bool m_hist = false; 57 : bool m_noGCP = false; 58 : bool m_noMD = false; 59 : bool m_noCT = false; 60 : bool m_noFL = false; 61 : bool m_noMask = false; 62 : bool m_noNodata = false; 63 : bool m_checksum = false; 64 : bool m_listMDD = false; 65 : bool m_stdout = false; 66 : std::string m_mdd{}; 67 : int m_subDS = 0; 68 : GDALArgDatasetValue m_dataset{}; 69 : std::vector<std::string> m_openOptions{}; 70 : std::vector<std::string> m_inputFormats{}; 71 : std::string m_output{}; 72 : }; 73 : 74 : //! @endcond 75 : 76 : #endif