GDAL
gdaljp2metadata.h
1 /******************************************************************************
2  * $Id: gdaljp2metadata.h 22678 2011-07-09 19:47:12Z rouault $
3  *
4  * Project: GDAL
5  * Purpose: JP2 Box Reader (and GMLJP2 Interpreter)
6  * Author: Frank Warmerdam, warmerdam@pobox.com
7  *
8  ******************************************************************************
9  * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
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 GDAL_JP2READER_H_INCLUDED
31 #define GDAL_JP2READER_H_INCLUDED
32 
33 #include "cpl_conv.h"
34 #include "cpl_vsi.h"
35 #include "gdal.h"
36 
37 /************************************************************************/
38 /* GDALJP2Box */
39 /************************************************************************/
40 
41 class CPL_DLL GDALJP2Box
42 {
43 
44  VSILFILE *fpVSIL;
45 
46  char szBoxType[5];
47 
48  GIntBig nBoxOffset;
49  GIntBig nBoxLength;
50 
51  GIntBig nDataOffset;
52 
53  GByte abyUUID[16];
54 
55  GByte *pabyData;
56 
57 public:
58  GDALJP2Box( VSILFILE * = NULL );
59  ~GDALJP2Box();
60 
61  int SetOffset( GIntBig nNewOffset );
62  int ReadBox();
63 
64  int ReadFirst();
65  int ReadNext();
66 
67  int ReadFirstChild( GDALJP2Box *poSuperBox );
68  int ReadNextChild( GDALJP2Box *poSuperBox );
69 
70  GIntBig GetDataLength();
71  const char *GetType() { return szBoxType; }
72 
73  GByte *ReadBoxData();
74 
75  int IsSuperBox();
76 
77  int DumpReadable( FILE * );
78 
79  VSILFILE *GetFILE() { return fpVSIL; }
80 
81  const GByte *GetUUID() { return abyUUID; }
82 
83  // write support
84  void SetType( const char * );
85  void SetWritableData( int nLength, const GByte *pabyData );
86  const GByte*GetWritableData() { return pabyData; }
87 
88  // factory methods.
89  static GDALJP2Box *CreateAsocBox( int nCount, GDALJP2Box **papoBoxes );
90  static GDALJP2Box *CreateLblBox( const char *pszLabel );
91  static GDALJP2Box *CreateLabelledXMLAssoc( const char *pszLabel,
92  const char *pszXML );
93  static GDALJP2Box *CreateUUIDBox( const GByte *pabyUUID,
94  int nDataSize, GByte *pabyData );
95 };
96 
97 /************************************************************************/
98 /* GDALJP2Metadata */
99 /************************************************************************/
100 
101 class CPL_DLL GDALJP2Metadata
102 
103 {
104 private:
105  void CollectGMLData( GDALJP2Box * );
106  int GMLSRSLookup( const char *pszURN );
107 
108  int nGeoTIFFSize;
109  GByte *pabyGeoTIFFData;
110 
111  int nMSIGSize;
112  GByte *pabyMSIGData;
113 
114 public:
115  char **papszGMLMetadata;
116 
117  int bHaveGeoTransform;
118  double adfGeoTransform[6];
119 
120  char *pszProjection;
121 
122  int nGCPCount;
123  GDAL_GCP *pasGCPList;
124 
125  char **papszMetadata;
126  char *pszXMPMetadata;
127 
128 public:
129  GDALJP2Metadata();
130  ~GDALJP2Metadata();
131 
132  int ReadBoxes( VSILFILE * fpVSIL );
133 
134  int ParseJP2GeoTIFF();
135  int ParseMSIG();
136  int ParseGMLCoverageDesc();
137 
138  int ReadAndParse( const char *pszFilename );
139 
140  // Write oriented.
141  void SetProjection( const char *pszWKT );
142  void SetGeoTransform( double * );
143  void SetGCPs( int, const GDAL_GCP * );
144 
145  GDALJP2Box *CreateJP2GeoTIFF();
146  GDALJP2Box *CreateGMLJP2( int nXSize, int nYSize );
147 };
148 
149 #endif /* ndef GDAL_JP2READER_H_INCLUDED */

Generated for GDAL by doxygen 1.8.1.1.