1 /******************************************************************************
2  * $Id: pcrasterdataset.h 29187 2015-05-13 14:20:13Z kdejong $
3  *
4  * Project:  PCRaster Integration
5  * Purpose:  PCRaster CSF 2.0 raster file driver declarations.
6  * Author:   Kor de Jong, Oliver Schmitz
7  *
8  ******************************************************************************
9  * Copyright (c) PCRaster owners
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 INCLUDED_PCRASTERDATASET
31 #define INCLUDED_PCRASTERDATASET
32 
33 // Library headers.
34 #ifndef INCLUDED_GDAL_PAM
35 #include "gdal_pam.h"
36 #define INCLUDED_GDAL_PAM
37 #endif
38 
39 // PCRaster library headers.
40 #ifndef INCLUDED_CSF
41 #include "csf.h"
42 #define INCLUDED_CSF
43 #endif
44 
45 // Module headers.
46 
47 // namespace {
48   // PCRasterDataset declarations.
49 // }
50 namespace gdal {
51   class PCRasterDatasetTest;
52 }
53 
54 
55 
56 // namespace {
57 
58 
59 
60 //! This class specialises the GDALDataset class for PCRaster datasets.
61 /*!
62   PCRaster raster datasets are currently formatted by the CSF 2.0 data format.
63   A PCRasterDataset consists of one band.
64 
65   More info about PCRaster can be found at http://www.pcraster.nl and
66   http://pcraster.geog.uu.nl
67 
68   Additional documentation about this driver can be found in
69   frmts/frmts_various.html of the GDAL source code distribution.
70 */
71 class PCRasterDataset: public GDALPamDataset
72 {
73 
74   friend class gdal::PCRasterDatasetTest;
75 
76 public:
77 
78   static GDALDataset* open             (GDALOpenInfo* info);
79 
80   static GDALDataset* create           (const char* filename,
81                                         int nr_cols,
82                                         int nr_rows,
83                                         int nrBands,
84                                         GDALDataType gdalType,
85                                         char** papszParmList);
86 
87   static GDALDataset* createCopy       (char const* filename,
88                                         GDALDataset* source,
89                                         int strict,
90                                         char** options,
91                                         GDALProgressFunc progress,
92                                         void* progressData);
93 
94 private:
95 
96   //! CSF map structure.
97   MAP*             d_map;
98 
99   //! Left coordinate of raster.
100   double           d_west;
101 
102   //! Top coordinate of raster.
103   double           d_north;
104 
105   //! Cell size.
106   double           d_cellSize;
107 
108   //! Cell representation.
109   CSF_CR           d_cellRepresentation;
110 
111   //! Value scale.
112   CSF_VS           d_valueScale;
113 
114   //! No data value.
115   double           d_defaultNoDataValue;
116 
117   bool             d_location_changed;
118 
119   //! Assignment operator. NOT IMPLEMENTED.
120   PCRasterDataset& operator=           (const PCRasterDataset&);
121 
122   //! Copy constructor. NOT IMPLEMENTED.
123                    PCRasterDataset     (const PCRasterDataset&);
124 
125 public:
126 
127   //----------------------------------------------------------------------------
128   // CREATORS
129   //----------------------------------------------------------------------------
130 
131                    PCRasterDataset     (MAP* map);
132 
133   /* virtual */    ~PCRasterDataset    ();
134 
135   //----------------------------------------------------------------------------
136   // MANIPULATORS
137   //----------------------------------------------------------------------------
138 
139   CPLErr           SetGeoTransform     (double* transform);
140 
141   //----------------------------------------------------------------------------
142   // ACCESSORS
143   //----------------------------------------------------------------------------
144 
145   MAP*             map                 () const;
146 
147   CPLErr           GetGeoTransform     (double* transform);
148 
149   CSF_CR           cellRepresentation  () const;
150 
151   CSF_VS           valueScale          () const;
152 
153   double           defaultNoDataValue  () const;
154 
155   bool             location_changed    () const;
156 
157 };
158 
159 
160 
161 //------------------------------------------------------------------------------
162 // INLINE FUNCTIONS
163 //------------------------------------------------------------------------------
164 
165 
166 
167 //------------------------------------------------------------------------------
168 // FREE OPERATORS
169 //------------------------------------------------------------------------------
170 
171 
172 
173 //------------------------------------------------------------------------------
174 // FREE FUNCTIONS
175 //------------------------------------------------------------------------------
176 
177 
178 
179 // } // namespace
180 
181 #endif
182