LCOV - code coverage report
Current view: top level - gcore - gdalorienteddataset.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 0 2 0.0 %
Date: 2024-05-03 15:49:35 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /**********************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  Dataset that modifies the orientation of an underlying dataset
       5             :  * Author:   Even Rouault, <even dot rouault at spatialys dot com>
       6             :  *
       7             :  **********************************************************************
       8             :  * Copyright (c) 2022, Even Rouault, <even dot rouault at spatialys dot com>
       9             :  *
      10             :  * Permission is hereby granted, free of charge, to any person obtaining a
      11             :  * copy of this software and associated documentation files (the "Software"),
      12             :  * to deal in the Software without restriction, including without limitation
      13             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      14             :  * and/or sell copies of the Software, and to permit persons to whom the
      15             :  * Software is furnished to do so, subject to the following conditions:
      16             :  *
      17             :  * The above copyright notice and this permission notice shall be included
      18             :  * in all copies or substantial portions of the Software.
      19             :  *
      20             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      21             :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      22             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
      23             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      24             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      25             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      26             :  * DEALINGS IN THE SOFTWARE.
      27             :  ****************************************************************************/
      28             : 
      29             : #ifndef GDAL_ORIENTED_DATASET_H
      30             : #define GDAL_ORIENTED_DATASET_H
      31             : 
      32             : #include "gdal_priv.h"
      33             : 
      34             : //! @cond Doxygen_Suppress
      35             : 
      36             : /************************************************************************/
      37             : /*                         GDALOrientedDataset                          */
      38             : /************************************************************************/
      39             : 
      40             : class CPL_DLL GDALOrientedDataset : public GDALDataset
      41             : {
      42             :   public:
      43             :     /** Origin of the source dataset.
      44             :      *
      45             :      * Defines of the point at (row, col) = (0, 0) in the source dataset
      46             :      * should be interpreted to generate the dataset taking into account
      47             :      * this orientation.
      48             :      *
      49             :      * Numeric values are the same as in TIFF and EXIF Orientation tags.
      50             :      *
      51             :      * See http://sylvana.net/jpegcrop/exif_orientation.html for clear
      52             :      * explanations.
      53             :      */
      54             :     enum class Origin
      55             :     {
      56             :         TOP_LEFT = 1,  /* row 0 top, col 0 lhs */
      57             :         TOP_RIGHT = 2, /* row 0 top, col 0 rhs */
      58             :         BOT_RIGHT = 3, /* row 0 bottom, col 0 rhs */
      59             :         BOT_LEFT = 4,  /* row 0 bottom, col 0 lhs */
      60             :         LEFT_TOP = 5,  /* row 0 lhs, col 0 top */
      61             :         RIGHT_TOP = 6, /* row 0 rhs, col 0 top */
      62             :         RIGHT_BOT = 7, /* row 0 rhs, col 0 bottom */
      63             :         LEFT_BOT = 8,  /* row 0 lhs, col 0 bottom */
      64             :     };
      65             : 
      66             :     GDALOrientedDataset(GDALDataset *poSrcDataset, Origin eOrigin);
      67             :     GDALOrientedDataset(std::unique_ptr<GDALDataset> &&poSrcDataset,
      68             :                         Origin eOrigin);
      69             : 
      70           0 :     char **GetMetadataDomainList() override
      71             :     {
      72           0 :         return m_poSrcDS->GetMetadataDomainList();
      73             :     }
      74             : 
      75             :     char **GetMetadata(const char *pszDomain = "") override;
      76             :     const char *GetMetadataItem(const char *pszName,
      77             :                                 const char *pszDomain = "") override;
      78             : 
      79             :   private:
      80             :     friend class GDALOrientedRasterBand;
      81             : 
      82             :     std::unique_ptr<GDALDataset> m_poSrcDSHolder{};
      83             :     GDALDataset *m_poSrcDS = nullptr;
      84             :     Origin m_eOrigin;
      85             :     CPLStringList m_aosSrcMD{};
      86             :     CPLStringList m_aosSrcMD_EXIF{};
      87             : 
      88             :     GDALOrientedDataset(const GDALOrientedDataset &) = delete;
      89             :     GDALOrientedDataset &operator=(const GDALOrientedDataset &) = delete;
      90             : };
      91             : 
      92             : //! @endcond
      93             : 
      94             : #endif

Generated by: LCOV version 1.14