00001 /****************************************************************************** 00002 * $Id: gdaljp2metadata.h,v 1.3 2005/07/05 22:09:00 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.3 2005/07/05 22:09:00 fwarmerdam 00032 * add preliminary support for MSIG boxes 00033 * 00034 * Revision 1.2 2005/05/05 20:17:15 fwarmerdam 00035 * support dictionary lookups 00036 * 00037 * Revision 1.1 2005/05/03 21:10:59 fwarmerdam 00038 * New 00039 * 00040 */ 00041 00042 #ifndef _JP2READER_H_INCLUDED 00043 #define _JP2READER_H_INCLUDED 00044 00045 #include "cpl_conv.h" 00046 #include "cpl_vsi.h" 00047 #include "gdal.h" 00048 00049 /************************************************************************/ 00050 /* GDALJP2Box */ 00051 /************************************************************************/ 00052 00053 class CPL_DLL GDALJP2Box 00054 { 00055 00056 FILE *fpVSIL; 00057 00058 char szBoxType[5]; 00059 00060 GIntBig nBoxOffset; 00061 GIntBig nBoxLength; 00062 00063 GIntBig nDataOffset; 00064 00065 GByte abyUUID[16]; 00066 00067 public: 00068 GDALJP2Box( FILE * ); 00069 ~GDALJP2Box(); 00070 00071 int SetOffset( GIntBig nNewOffset ); 00072 int ReadBox(); 00073 00074 int ReadFirst(); 00075 int ReadNext(); 00076 00077 int ReadFirstChild( GDALJP2Box *poSuperBox ); 00078 int ReadNextChild( GDALJP2Box *poSuperBox ); 00079 00080 GIntBig GetDataLength(); 00081 const char *GetType() { return szBoxType; } 00082 00083 GByte *ReadBoxData(); 00084 00085 int IsSuperBox(); 00086 00087 int DumpReadable( FILE * ); 00088 00089 FILE *GetFILE() { return fpVSIL; } 00090 00091 const GByte *GetUUID() { return abyUUID; } 00092 }; 00093 00094 /************************************************************************/ 00095 /* GDALJP2Metadata */ 00096 /************************************************************************/ 00097 00098 class CPL_DLL GDALJP2Metadata 00099 00100 { 00101 private: 00102 void CollectGMLData( GDALJP2Box * ); 00103 int GMLSRSLookup( const char *pszURN ); 00104 00105 public: 00106 int bHaveGeoTransform; 00107 double adfGeoTransform[6]; 00108 00109 char *pszProjection; 00110 00111 int nGCPCount; 00112 GDAL_GCP *pasGCPList; 00113 00114 char **papszGMLMetadata; 00115 00116 int nGeoTIFFSize; 00117 GByte *pabyGeoTIFFData; 00118 00119 int nMSIGSize; 00120 GByte *pabyMSIGData; 00121 00122 GDALJP2Metadata(); 00123 ~GDALJP2Metadata(); 00124 00125 int ReadBoxes( FILE * fpVSIL ); 00126 00127 int ParseJP2GeoTIFF(); 00128 int ParseMSIG(); 00129 int ParseGMLCoverageDesc(); 00130 }; 00131 00132 #endif /* ndef _JP2READER_H_INCLUDED */ 00133 00134