GDAL
gdalorienteddataset.h
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 
35 
36 /************************************************************************/
37 /* GDALOrientedDataset */
38 /************************************************************************/
39 
40 class CPL_DLL GDALOrientedDataset : public GDALDataset
41 {
42  public:
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  char **GetMetadataDomainList() override
71  {
72  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 
93 
94 #endif
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:449
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:503
char ** GetMetadataDomainList() override
Fetch list of metadata domains.
Definition: gdaldataset.cpp:4697
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4593
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition: gdalmajorobject.cpp:341
C++ GDAL entry points.