00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef GDAL_JP2READER_H_INCLUDED
00032 #define GDAL_JP2READER_H_INCLUDED
00033
00034 #include "cpl_conv.h"
00035 #include "cpl_vsi.h"
00036 #include "gdal.h"
00037
00038
00039
00040
00041
00042 class CPL_DLL GDALJP2Box
00043 {
00044
00045 VSILFILE *fpVSIL;
00046
00047 char szBoxType[5];
00048
00049 GIntBig nBoxOffset;
00050 GIntBig nBoxLength;
00051
00052 GIntBig nDataOffset;
00053
00054 GByte abyUUID[16];
00055
00056 GByte *pabyData;
00057
00058 public:
00059 GDALJP2Box( VSILFILE * = NULL );
00060 ~GDALJP2Box();
00061
00062 int SetOffset( GIntBig nNewOffset );
00063 int ReadBox();
00064
00065 int ReadFirst();
00066 int ReadNext();
00067
00068 int ReadFirstChild( GDALJP2Box *poSuperBox );
00069 int ReadNextChild( GDALJP2Box *poSuperBox );
00070
00071 GIntBig GetDataLength();
00072 const char *GetType() { return szBoxType; }
00073
00074 GByte *ReadBoxData();
00075
00076 int IsSuperBox();
00077
00078 int DumpReadable( FILE *, int nIndentLevel = 0 );
00079
00080 VSILFILE *GetFILE() { return fpVSIL; }
00081
00082 const GByte *GetUUID() { return abyUUID; }
00083
00084
00085 void SetType( const char * );
00086 void SetWritableData( int nLength, const GByte *pabyData );
00087 const GByte*GetWritableData() { return pabyData; }
00088
00089
00090 static GDALJP2Box *CreateAsocBox( int nCount, GDALJP2Box **papoBoxes );
00091 static GDALJP2Box *CreateLblBox( const char *pszLabel );
00092 static GDALJP2Box *CreateLabelledXMLAssoc( const char *pszLabel,
00093 const char *pszXML );
00094 static GDALJP2Box *CreateUUIDBox( const GByte *pabyUUID,
00095 int nDataSize, GByte *pabyData );
00096 };
00097
00098
00099
00100
00101
00102 typedef struct _GDALJP2GeoTIFFBox GDALJP2GeoTIFFBox;
00103
00104 class CPL_DLL GDALJP2Metadata
00105
00106 {
00107 private:
00108 void CollectGMLData( GDALJP2Box * );
00109 int GMLSRSLookup( const char *pszURN );
00110
00111 int nGeoTIFFBoxesCount;
00112 GDALJP2GeoTIFFBox *pasGeoTIFFBoxes;
00113
00114 int nMSIGSize;
00115 GByte *pabyMSIGData;
00116
00117 public:
00118 char **papszGMLMetadata;
00119
00120 int bHaveGeoTransform;
00121 double adfGeoTransform[6];
00122 int bPixelIsPoint;
00123
00124 char *pszProjection;
00125
00126 int nGCPCount;
00127 GDAL_GCP *pasGCPList;
00128
00129 char **papszMetadata;
00130 char *pszXMPMetadata;
00131
00132 public:
00133 GDALJP2Metadata();
00134 ~GDALJP2Metadata();
00135
00136 int ReadBoxes( VSILFILE * fpVSIL );
00137
00138 int ParseJP2GeoTIFF();
00139 int ParseMSIG();
00140 int ParseGMLCoverageDesc();
00141
00142 int ReadAndParse( const char *pszFilename );
00143
00144
00145 void SetProjection( const char *pszWKT );
00146 void SetGeoTransform( double * );
00147 void SetGCPs( int, const GDAL_GCP * );
00148
00149 GDALJP2Box *CreateJP2GeoTIFF();
00150 GDALJP2Box *CreateGMLJP2( int nXSize, int nYSize );
00151 };
00152
00153 #endif