1 : /******************************************************************************
2 : * $Id: rasterlitedataset.h 24674 2012-07-10 20:41:35Z rouault $
3 : *
4 : * Project: GDAL Rasterlite driver
5 : * Purpose: Implement GDAL Rasterlite support using OGR SQLite driver
6 : * Author: Even Rouault, <even dot rouault at mines dash paris dot org>
7 : *
8 : **********************************************************************
9 : * Copyright (c) 2009, Even Rouault, <even dot rouault at mines dash paris dot org>
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #ifndef RASTERLITE_DATASET_INCLUDED
31 : #define RASTERLITE_DATASET_INCLUDED
32 :
33 : #include "gdal_pam.h"
34 :
35 : char** RasterliteGetTileDriverOptions(char** papszOptions);
36 :
37 : class RasterliteBand;
38 :
39 : /************************************************************************/
40 : /* ==================================================================== */
41 : /* RasterliteDataset */
42 : /* ==================================================================== */
43 : /************************************************************************/
44 :
45 : class RasterliteDataset : public GDALPamDataset
46 : {
47 : friend class RasterliteBand;
48 :
49 : public:
50 : RasterliteDataset();
51 : RasterliteDataset(RasterliteDataset* poMainDS, int nLevel);
52 :
53 : virtual ~RasterliteDataset();
54 :
55 : virtual char **GetMetadata( const char *pszDomain );
56 : virtual const char *GetMetadataItem( const char *pszName,
57 : const char *pszDomain );
58 : virtual CPLErr GetGeoTransform( double* padfGeoTransform );
59 : virtual const char* GetProjectionRef();
60 :
61 : virtual char** GetFileList();
62 :
63 : virtual CPLErr IBuildOverviews( const char * pszResampling,
64 : int nOverviews, int * panOverviewList,
65 : int nBands, int * panBandList,
66 : GDALProgressFunc pfnProgress, void * pProgressData );
67 :
68 : static GDALDataset *Open( GDALOpenInfo * );
69 : static int Identify( GDALOpenInfo * );
70 :
71 : protected:
72 : virtual int CloseDependentDatasets();
73 :
74 : private:
75 :
76 : int bMustFree;
77 : RasterliteDataset* poMainDS;
78 : int nLevel;
79 :
80 : char** papszMetadata;
81 : char** papszImageStructure;
82 : char** papszSubDatasets;
83 :
84 : int nResolutions;
85 : double* padfXResolutions, *padfYResolutions;
86 : RasterliteDataset** papoOverviews;
87 : int nLimitOvrCount;
88 :
89 : int bValidGeoTransform;
90 : double adfGeoTransform[6];
91 : char* pszSRS;
92 :
93 : GDALColorTable* poCT;
94 :
95 : CPLString osTableName;
96 : CPLString osFileName;
97 :
98 : int bCheckForExistingOverview;
99 : CPLString osOvrFileName;
100 :
101 : OGRDataSourceH hDS;
102 :
103 : void AddSubDataset( const char* pszDSName);
104 : int GetBlockParams(OGRLayerH hRasterLyr, int nLevel, int* pnBands,
105 : GDALDataType* peDataType,
106 : int* pnBlockXSize, int* pnBlockYSize);
107 : CPLErr CleanOverviews();
108 : CPLErr CleanOverviewLevel(int nOvrFactor);
109 : CPLErr ReloadOverviews();
110 : CPLErr CreateOverviewLevel(const char * pszResampling,
111 : int nOvrFactor,
112 : char** papszOptions,
113 : GDALProgressFunc pfnProgress,
114 : void * pProgressData);
115 : };
116 :
117 : /************************************************************************/
118 : /* ==================================================================== */
119 : /* RasterliteBand */
120 : /* ==================================================================== */
121 : /************************************************************************/
122 :
123 : class RasterliteBand: public GDALPamRasterBand
124 64 : {
125 : friend class RasterliteDataset;
126 :
127 : public:
128 : RasterliteBand( RasterliteDataset* poDS, int nBand,
129 : GDALDataType eDataType,
130 : int nBlockXSize, int nBlockYSize);
131 :
132 : virtual GDALColorInterp GetColorInterpretation();
133 : virtual GDALColorTable* GetColorTable();
134 :
135 : virtual int GetOverviewCount();
136 : virtual GDALRasterBand* GetOverview(int nLevel);
137 :
138 : virtual CPLErr IReadBlock( int, int, void * );
139 : };
140 :
141 : GDALDataset *
142 : RasterliteCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
143 : int bStrict, char ** papszOptions,
144 : GDALProgressFunc pfnProgress, void * pProgressData );
145 :
146 : CPLErr RasterliteDelete(const char* pszFilename);
147 :
148 : #endif // RASTERLITE_DATASET_INCLUDED
|