fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Image / FileIO / OSGGDALImageFileType.h
blob3ccd276ce6c281afcf8a373c265ce32f570b9764
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGGDALIMAGEFILETYPE_H_
40 #define _OSGGDALIMAGEFILETYPE_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGImageFileIODef.h"
46 #include "OSGImageFileType.h"
48 #include "boost/shared_ptr.hpp"
50 #ifdef OSG_WITH_GDAL
51 #include "gdal_priv.h"
52 #include "ogr_srs_api.h"
53 #endif
55 OSG_BEGIN_NAMESPACE
57 class GDALImageFileType;
59 /*! \ingroup GrpImageFileIOGDAL
60 \ingroup GrpLibOSGImageFileIO
63 class OSG_IMGFILEIO_DLLMAPPING GDALBlockAccessor : public ImageBlockAccessor
66 /*========================== PUBLIC =================================*/
68 public:
70 typedef ImageBlockAccessor Inherited;
72 /*---------------------------------------------------------------------*/
73 /*! \name Destructor */
74 /*! \{ */
76 virtual ~GDALBlockAccessor(void);
78 /*! \} */
79 /*---------------------------------------------------------------------*/
80 /*! \name Read/Write */
81 /*! \{ */
83 virtual bool isOpen(void);
85 /*! \} */
86 /*---------------------------------------------------------------------*/
87 /*! \name Read/Write */
88 /*! \{ */
90 virtual bool readBlockA16(Vec2i vSampleOrigin,
91 Int32 iTextureSize,
92 UInt16 *pTarget,
93 Int32 iTargetSizeBytes);
95 virtual bool readBlockA16(Vec2i vSampleOrigin,
96 Int32 iTextureSize,
97 Int16 *pTarget,
98 Int32 iTargetSizeBytes);
100 /*! \} */
101 /*========================= PROTECTED ===============================*/
103 protected:
105 #ifdef OSG_WITH_GDAL
106 GDALDataset *_pDataset;
107 GDALRasterBand *_pBand;
108 #endif
110 std::vector<Int16> _vI16Buffer;
112 /*---------------------------------------------------------------------*/
113 /*! \name Default Constructor */
114 /*! \{ */
116 GDALBlockAccessor(void);
118 /*! \} */
119 /*---------------------------------------------------------------------*/
120 /*! \name Read/Write */
121 /*! \{ */
123 void open(const Char8 *szFilename);
125 /*! \} */
126 /*---------------------------------------------------------------------*/
127 /*! \name Read/Write */
128 /*! \{ */
130 /*! \} */
131 /*========================== PRIVATE ================================*/
133 private:
135 friend class GDALImageFileType;
137 GDALBlockAccessor(const GDALBlockAccessor &other);
138 void operator =(const GDALBlockAccessor &rhs);
141 /*! \ingroup GrpImageFileIOGDAL
144 typedef boost::shared_ptr<GDALBlockAccessor> GDALBlockAccessorPtr;
146 /*! \brief GDAL File Handler. Used to read/write TIFF files.
147 See \ref PageSystemImage for a detailed description.
149 \ingroup GrpImageFileIOGDAL
150 \ingroup GrpLibOSGImageFileIO
153 class OSG_IMGFILEIO_DLLMAPPING GDALImageFileType : public ImageFileType
155 /*========================== PUBLIC =================================*/
157 public:
159 /*---------------------------------------------------------------------*/
160 /*! \name Destructor */
161 /*! \{ */
163 virtual ~GDALImageFileType(void);
165 /*! \} */
166 /*---------------------------------------------------------------------*/
167 /*! \name Read/Write */
168 /*! \{ */
170 virtual bool read ( Image *pImage,
171 const Char8 *fileName ) ;
173 virtual bool write (const Image *pImage,
174 const Char8 *fileName ) ;
176 virtual bool validateHeader(const Char8 *fileName,
177 bool &implemented);
179 /*! \} */
180 /*---------------------------------------------------------------------*/
181 /*! \name Type */
182 /*! \{ */
184 #if 1
185 virtual ImageBlockAccessorPtr open(const Char8 *fileName);
186 #endif
188 /*! \} */
189 /*========================= PROTECTED ===============================*/
191 protected:
193 /*---------------------------------------------------------------------*/
194 /*! \name Default Constructor */
195 /*! \{ */
197 GDALImageFileType (const Char8 *mimeType,
198 const Char8 *suffixArray[],
199 UInt16 suffixByteCount,
200 UInt32 flags );
202 /*! \} */
203 /*---------------------------------------------------------------------*/
204 /*! \name Copy Op */
205 /*! \{ */
207 GDALImageFileType (const GDALImageFileType &obj);
208 const GDALImageFileType &operator =(const GDALImageFileType &obj);
210 /*! \} */
211 /*========================== PRIVATE ================================*/
213 private:
215 typedef ImageFileType Inherited;
217 static GDALImageFileType _the;
220 typedef GDALImageFileType *GDALImageFileTypeP;
222 OSG_END_NAMESPACE
224 #endif // _OSGGDALIMAGEFILETYPE_H_