GDAL
gdaljp2metadata.h
1 /******************************************************************************
2  * $Id: gdaljp2metadata.h 27181 2014-04-14 19:32:33Z 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  * Copyright (c) 2010-2013, Even Rouault <even dot rouault at mines-paris dot org>
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included
20  * in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  ****************************************************************************/
30 
31 #ifndef GDAL_JP2READER_H_INCLUDED
32 #define GDAL_JP2READER_H_INCLUDED
33 
34 #include "cpl_conv.h"
35 #include "cpl_vsi.h"
36 #include "gdal.h"
37 
38 /************************************************************************/
39 /* GDALJP2Box */
40 /************************************************************************/
41 
42 class CPL_DLL GDALJP2Box
43 {
44 
45  VSILFILE *fpVSIL;
46 
47  char szBoxType[5];
48 
49  GIntBig nBoxOffset;
50  GIntBig nBoxLength;
51 
52  GIntBig nDataOffset;
53 
54  GByte abyUUID[16];
55 
56  GByte *pabyData;
57 
58 public:
59  GDALJP2Box( VSILFILE * = NULL );
60  ~GDALJP2Box();
61 
62  int SetOffset( GIntBig nNewOffset );
63  int ReadBox();
64 
65  int ReadFirst();
66  int ReadNext();
67 
68  int ReadFirstChild( GDALJP2Box *poSuperBox );
69  int ReadNextChild( GDALJP2Box *poSuperBox );
70 
71  GIntBig GetDataLength();
72  const char *GetType() { return szBoxType; }
73 
74  GByte *ReadBoxData();
75 
76  int IsSuperBox();
77 
78  int DumpReadable( FILE *, int nIndentLevel = 0 );
79 
80  VSILFILE *GetFILE() { return fpVSIL; }
81 
82  const GByte *GetUUID() { return abyUUID; }
83 
84  // write support
85  void SetType( const char * );
86  void SetWritableData( int nLength, const GByte *pabyData );
87  const GByte*GetWritableData() { return pabyData; }
88 
89  // factory methods.
90  static GDALJP2Box *CreateAsocBox( int nCount, GDALJP2Box **papoBoxes );
91  static GDALJP2Box *CreateLblBox( const char *pszLabel );
92  static GDALJP2Box *CreateLabelledXMLAssoc( const char *pszLabel,
93  const char *pszXML );
94  static GDALJP2Box *CreateUUIDBox( const GByte *pabyUUID,
95  int nDataSize, GByte *pabyData );
96 };
97 
98 /************************************************************************/
99 /* GDALJP2Metadata */
100 /************************************************************************/
101 
102 typedef struct _GDALJP2GeoTIFFBox GDALJP2GeoTIFFBox;
103 
104 class CPL_DLL GDALJP2Metadata
105 
106 {
107 private:
108  void CollectGMLData( GDALJP2Box * );
109  int GMLSRSLookup( const char *pszURN );
110 
111  int nGeoTIFFBoxesCount;
112  GDALJP2GeoTIFFBox *pasGeoTIFFBoxes;
113 
114  int nMSIGSize;
115  GByte *pabyMSIGData;
116 
117 public:
118  char **papszGMLMetadata;
119 
120  int bHaveGeoTransform;
121  double adfGeoTransform[6];
122  int bPixelIsPoint;
123 
124  char *pszProjection;
125 
126  int nGCPCount;
127  GDAL_GCP *pasGCPList;
128 
129  char **papszMetadata;
130  char *pszXMPMetadata;
131 
132 public:
133  GDALJP2Metadata();
134  ~GDALJP2Metadata();
135 
136  int ReadBoxes( VSILFILE * fpVSIL );
137 
138  int ParseJP2GeoTIFF();
139  int ParseMSIG();
140  int ParseGMLCoverageDesc();
141 
142  int ReadAndParse( const char *pszFilename );
143 
144  // Write oriented.
145  void SetProjection( const char *pszWKT );
146  void SetGeoTransform( double * );
147  void SetGCPs( int, const GDAL_GCP * );
148 
149  GDALJP2Box *CreateJP2GeoTIFF();
150  GDALJP2Box *CreateGMLJP2( int nXSize, int nYSize );
151 };
152 
153 #endif /* ndef GDAL_JP2READER_H_INCLUDED */
Standard C Covers.
Public (C callable) GDAL entry points.
Various convenience functions for CPL.
Definition: gdaljp2metadata.h:104
Definition: gdaljp2metadata.h:42
Ground Control Point.
Definition: gdal.h:255

Generated for GDAL by doxygen 1.8.11.