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 char **GetMetadata(const char *pszDomain = "") override;
75 const char *GetMetadataItem(const char *pszName,
76 const char *pszDomain = "") override;
77
78 private:
79 friend class GDALOrientedRasterBand;
80
81 std::unique_ptr<GDALDataset> m_poSrcDSHolder{};
82 GDALDataset *m_poSrcDS = nullptr;
83 Origin m_eOrigin;
84 CPLStringList m_aosSrcMD{};
85 CPLStringList m_aosSrcMD_EXIF{};
86
87 GDALOrientedDataset(const GDALOrientedDataset &) = delete;
88 GDALOrientedDataset &operator=(const GDALOrientedDataset &) = delete;
89 };
90
92
93 #endif
CPLStringList
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:437
GDALDataset::GetMetadata
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4362
GDALMajorObject::GetMetadataItem
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition: gdalmajorobject.cpp:341
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:348
gdal_priv.h
GDALDataset::GetMetadataDomainList
char ** GetMetadataDomainList() override
Fetch list of metadata domains.
Definition: gdaldataset.cpp:4463