GDAL
gdal_defaultoverviews.h
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
27class GDALDataset;
28class GDALOpenInfo;
29class GDALRasterBand;
30
31class 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 {
121 return papszInitSiblingFiles;
122 }
123
124 private:
125 CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews)
126
127 CPLErr CreateOrOpenOverviewFile(const char *pszBasename,
128 CSLConstList papszOptions);
129};
130
132
133#endif
A set of associated raster bands, usually from one file.
Definition gdal_dataset.h:76
Class for dataset open functions.
Definition gdal_openinfo.h:28
A single raster band (or channel).
Definition gdal_rasterband.h:105
CPLErr
Error category.
Definition cpl_error.h:37
Core portability definitions for CPL.
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition cpl_port.h:936
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1087
Various convenience functions for working with strings and string lists.