/src/gdal/gcore/gdal_defaultoverviews.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Name: gdal_defaultoverviews.h |
4 | | * Project: GDAL Core |
5 | | * Purpose: Declaration of GDALDefaultOverviews class |
6 | | * Author: Frank Warmerdam, warmerdam@pobox.com |
7 | | * |
8 | | ****************************************************************************** |
9 | | * Copyright (c) 1998, Frank Warmerdam |
10 | | * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com> |
11 | | * |
12 | | * SPDX-License-Identifier: MIT |
13 | | ****************************************************************************/ |
14 | | |
15 | | #ifndef GDALDEFAULTOVERVIEWS_H_INCLUDED |
16 | | #define GDALDEFAULTOVERVIEWS_H_INCLUDED |
17 | | |
18 | | #include "cpl_port.h" |
19 | | #include "cpl_progress.h" |
20 | | #include "cpl_string.h" |
21 | | |
22 | | /* ******************************************************************** */ |
23 | | /* GDALDefaultOverviews */ |
24 | | /* ******************************************************************** */ |
25 | | |
26 | | //! @cond Doxygen_Suppress |
27 | | class GDALDataset; |
28 | | class GDALOpenInfo; |
29 | | class GDALRasterBand; |
30 | | |
31 | | class CPL_DLL GDALDefaultOverviews |
32 | | { |
33 | | friend class GDALDataset; |
34 | | |
35 | | GDALDataset *poDS; |
36 | | GDALDataset *poODS; |
37 | | |
38 | | CPLString osOvrFilename{}; |
39 | | |
40 | | bool bOvrIsAux; |
41 | | |
42 | | bool bCheckedForMask; |
43 | | bool bOwnMaskDS; |
44 | | GDALDataset *poMaskDS; |
45 | | |
46 | | // For "overview datasets" we record base level info so we can |
47 | | // find our way back to get overview masks. |
48 | | GDALDataset *poBaseDS; |
49 | | |
50 | | // Stuff for deferred initialize/overviewscans. |
51 | | bool bCheckedForOverviews; |
52 | | void OverviewScan(); |
53 | | char *pszInitName; |
54 | | bool bInitNameIsOVR; |
55 | | char **papszInitSiblingFiles; |
56 | | |
57 | | public: |
58 | | GDALDefaultOverviews(); |
59 | | ~GDALDefaultOverviews(); |
60 | | |
61 | | void Initialize(GDALDataset *poDSIn, const char *pszName = nullptr, |
62 | | CSLConstList papszSiblingFiles = nullptr, |
63 | | bool bNameIsOVR = false); |
64 | | |
65 | | void Initialize(GDALDataset *poDSIn, GDALOpenInfo *poOpenInfo, |
66 | | const char *pszName = nullptr, |
67 | | bool bTransferSiblingFilesIfLoaded = true); |
68 | | |
69 | | void TransferSiblingFiles(char **papszSiblingFiles); |
70 | | |
71 | | int IsInitialized(); |
72 | | |
73 | | int CloseDependentDatasets(); |
74 | | |
75 | | // Overview Related |
76 | | |
77 | | int GetOverviewCount(int nBand); |
78 | | GDALRasterBand *GetOverview(int nBand, int iOverview); |
79 | | |
80 | | CPLErr BuildOverviews(const char *pszBasename, const char *pszResampling, |
81 | | int nOverviews, const int *panOverviewList, |
82 | | int nBands, const int *panBandList, |
83 | | GDALProgressFunc pfnProgress, void *pProgressData, |
84 | | CSLConstList papszOptions); |
85 | | |
86 | | CPLErr BuildOverviewsSubDataset(const char *pszPhysicalFile, |
87 | | const char *pszResampling, int nOverviews, |
88 | | const int *panOverviewList, int nBands, |
89 | | const int *panBandList, |
90 | | GDALProgressFunc pfnProgress, |
91 | | void *pProgressData, |
92 | | CSLConstList papszOptions); |
93 | | |
94 | | CPLErr BuildOverviewsMask(const char *pszResampling, int nOverviews, |
95 | | const int *panOverviewList, |
96 | | GDALProgressFunc pfnProgress, void *pProgressData, |
97 | | CSLConstList papszOptions); |
98 | | |
99 | | static bool CheckSrcOverviewsConsistencyWithBase( |
100 | | GDALDataset *poFullResDS, |
101 | | const std::vector<GDALDataset *> &apoSrcOvrDS); |
102 | | |
103 | | CPLErr AddOverviews(const char *pszBasename, |
104 | | const std::vector<GDALDataset *> &apoSrcOvrDS, |
105 | | GDALProgressFunc pfnProgress, void *pProgressData, |
106 | | CSLConstList papszOptions); |
107 | | |
108 | | CPLErr CleanOverviews(); |
109 | | |
110 | | // Mask Related |
111 | | |
112 | | CPLErr CreateMaskBand(int nFlags, int nBand = -1); |
113 | | GDALRasterBand *GetMaskBand(int nBand); |
114 | | int GetMaskFlags(int nBand); |
115 | | |
116 | | int HaveMaskFile(char **papszSiblings = nullptr, |
117 | | const char *pszBasename = nullptr); |
118 | | |
119 | | CSLConstList GetSiblingFiles() const |
120 | 0 | { |
121 | 0 | return papszInitSiblingFiles; |
122 | 0 | } |
123 | | |
124 | | private: |
125 | | CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews) |
126 | | |
127 | | CPLErr CreateOrOpenOverviewFile(const char *pszBasename, |
128 | | CSLConstList papszOptions); |
129 | | }; |
130 | | |
131 | | //! @endcond |
132 | | |
133 | | #endif |