00001 /****************************************************************************** 00002 * $Id: gdaljp2metadata.h,v 1.4 2006/04/07 05:35:25 fwarmerdam Exp $ 00003 * 00004 * Project: GDAL 00005 * Purpose: JP2 Box Reader (and GMLJP2 Interpreter) 00006 * Author: Frank Warmerdam, warmerdam@pobox.com 00007 * 00008 ****************************************************************************** 00009 * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com> 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining a 00012 * copy of this software and associated documentation files (the "Software"), 00013 * to deal in the Software without restriction, including without limitation 00014 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00015 * and/or sell copies of the Software, and to permit persons to whom the 00016 * Software is furnished to do so, subject to the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be included 00019 * in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00022 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00023 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00024 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00025 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00026 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00027 * DEALINGS IN THE SOFTWARE. 00028 ***************************************************************************** 00029 * 00030 * $Log: gdaljp2metadata.h,v $ 00031 * Revision 1.4 2006/04/07 05:35:25 fwarmerdam 00032 * Added ReadAndParse() method, which includes worldfile reading. 00033 * Actually set HaveGeoTransform flag properly. 00034 * 00035 * Revision 1.3 2005/07/05 22:09:00 fwarmerdam 00036 * add preliminary support for MSIG boxes 00037 * 00038 * Revision 1.2 2005/05/05 20:17:15 fwarmerdam 00039 * support dictionary lookups 00040 * 00041 * Revision 1.1 2005/05/03 21:10:59 fwarmerdam 00042 * New 00043 * 00044 */ 00045 00046 #ifndef _JP2READER_H_INCLUDED 00047 #define _JP2READER_H_INCLUDED 00048 00049 #include "cpl_conv.h" 00050 #include "cpl_vsi.h" 00051 #include "gdal.h" 00052 00053 /************************************************************************/ 00054 /* GDALJP2Box */ 00055 /************************************************************************/ 00056 00057 class CPL_DLL GDALJP2Box 00058 { 00059 00060 FILE *fpVSIL; 00061 00062 char szBoxType[5]; 00063 00064 GIntBig nBoxOffset; 00065 GIntBig nBoxLength; 00066 00067 GIntBig nDataOffset; 00068 00069 GByte abyUUID[16]; 00070 00071 public: 00072 GDALJP2Box( FILE * ); 00073 ~GDALJP2Box(); 00074 00075 int SetOffset( GIntBig nNewOffset ); 00076 int ReadBox(); 00077 00078 int ReadFirst(); 00079 int ReadNext(); 00080 00081 int ReadFirstChild( GDALJP2Box *poSuperBox ); 00082 int ReadNextChild( GDALJP2Box *poSuperBox ); 00083 00084 GIntBig GetDataLength(); 00085 const char *GetType() { return szBoxType; } 00086 00087 GByte *ReadBoxData(); 00088 00089 int IsSuperBox(); 00090 00091 int DumpReadable( FILE * ); 00092 00093 FILE *GetFILE() { return fpVSIL; } 00094 00095 const GByte *GetUUID() { return abyUUID; } 00096 }; 00097 00098 /************************************************************************/ 00099 /* GDALJP2Metadata */ 00100 /************************************************************************/ 00101 00102 class CPL_DLL GDALJP2Metadata 00103 00104 { 00105 private: 00106 void CollectGMLData( GDALJP2Box * ); 00107 int GMLSRSLookup( const char *pszURN ); 00108 00109 public: 00110 int bHaveGeoTransform; 00111 double adfGeoTransform[6]; 00112 00113 char *pszProjection; 00114 00115 int nGCPCount; 00116 GDAL_GCP *pasGCPList; 00117 00118 char **papszGMLMetadata; 00119 00120 int nGeoTIFFSize; 00121 GByte *pabyGeoTIFFData; 00122 00123 int nMSIGSize; 00124 GByte *pabyMSIGData; 00125 00126 GDALJP2Metadata(); 00127 ~GDALJP2Metadata(); 00128 00129 int ReadBoxes( FILE * fpVSIL ); 00130 00131 int ParseJP2GeoTIFF(); 00132 int ParseMSIG(); 00133 int ParseGMLCoverageDesc(); 00134 00135 int ReadAndParse( const char *pszFilename ); 00136 }; 00137 00138 #endif /* ndef _JP2READER_H_INCLUDED */ 00139 00140