- Main Page
- Classes
- Files
- Related Pages

- File List
- File Members

# gdaljp2metadata.h

    00001 /******************************************************************************
    00002  * $Id: gdaljp2metadata.h,v 1.6 2006/06/22 20:28:09 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.6  2006/06/22 20:28:09  fwarmerdam
    00032  * capture xml boxes on the main pass through the file
    00033  *
    00034  * Revision 1.5  2006/06/22 01:33:40  fwarmerdam
    00035  * added support for preparing writable gml and geotiff boxes
    00036  *
    00037  * Revision 1.4  2006/04/07 05:35:25  fwarmerdam
    00038  * Added ReadAndParse() method, which includes worldfile reading.
    00039  * Actually set HaveGeoTransform flag properly.
    00040  *
    00041  * Revision 1.3  2005/07/05 22:09:00  fwarmerdam
    00042  * add preliminary support for MSIG boxes
    00043  *
    00044  * Revision 1.2  2005/05/05 20:17:15  fwarmerdam
    00045  * support dictionary lookups
    00046  *
    00047  * Revision 1.1  2005/05/03 21:10:59  fwarmerdam
    00048  * New
    00049  *
    00050  */
    00051
    00052 #ifndef _JP2READER_H_INCLUDED
    00053 #define _JP2READER_H_INCLUDED
    00054
    00055 #include "cpl_conv.h"
    00056 #include "cpl_vsi.h"
    00057 #include "gdal.h"
    00058
    00059 /************************************************************************/
    00060 /*                              GDALJP2Box                              */
    00061 /************************************************************************/
    00062
    00063 class CPL_DLL GDALJP2Box
    00064 {
    00065
    00066     FILE        *fpVSIL;
    00067
    00068     char        szBoxType[5];
    00069
    00070     GIntBig     nBoxOffset;
    00071     GIntBig     nBoxLength;
    00072
    00073     GIntBig     nDataOffset;
    00074
    00075     GByte       abyUUID[16];
    00076
    00077     GByte      *pabyData;
    00078
    00079 public:
    00080                 GDALJP2Box( FILE * = NULL );
    00081                 ~GDALJP2Box();
    00082
    00083     int         SetOffset( GIntBig nNewOffset );
    00084     int         ReadBox();
    00085
    00086     int         ReadFirst();
    00087     int         ReadNext();
    00088
    00089     int         ReadFirstChild( GDALJP2Box *poSuperBox );
    00090     int         ReadNextChild( GDALJP2Box *poSuperBox );
    00091
    00092     GIntBig     GetDataLength();
    00093     const char *GetType() { return szBoxType; }
    00094
    00095     GByte      *ReadBoxData();
    00096
    00097     int         IsSuperBox();
    00098
    00099     int         DumpReadable( FILE * );
    00100
    00101     FILE        *GetFILE() { return fpVSIL; }
    00102
    00103     const GByte *GetUUID() { return abyUUID; }
    00104
    00105     // write support
    00106     void        SetType( const char * );
    00107     void        SetWritableData( int nLength, const GByte *pabyData );
    00108     const GByte*GetWritableData() { return pabyData; }
    00109
    00110     // factory methods.
    00111     static GDALJP2Box *CreateAsocBox( int nCount, GDALJP2Box **papoBoxes );
    00112     static GDALJP2Box *CreateLblBox( const char *pszLabel );
    00113     static GDALJP2Box *CreateLabelledXMLAssoc( const char *pszLabel,
    00114                                                const char *pszXML );
    00115     static GDALJP2Box *CreateUUIDBox( const GByte *pabyUUID,
    00116                                       int nDataSize, GByte *pabyData );
    00117 };
    00118
    00119 /************************************************************************/
    00120 /*                           GDALJP2Metadata                            */
    00121 /************************************************************************/
    00122
    00123 class CPL_DLL GDALJP2Metadata
    00124
    00125 {
    00126 private:
    00127     void    CollectGMLData( GDALJP2Box * );
    00128     int     GMLSRSLookup( const char *pszURN );
    00129
    00130     int    nGeoTIFFSize;
    00131     GByte  *pabyGeoTIFFData;
    00132
    00133     int    nMSIGSize;
    00134     GByte  *pabyMSIGData;
    00135
    00136 public:
    00137     char   **papszGMLMetadata;
    00138
    00139     int     bHaveGeoTransform;
    00140     double  adfGeoTransform[6];
    00141
    00142     char    *pszProjection;
    00143
    00144     int         nGCPCount;
    00145     GDAL_GCP    *pasGCPList;
    00146
    00147 public:
    00148             GDALJP2Metadata();
    00149             ~GDALJP2Metadata();
    00150
    00151     int     ReadBoxes( FILE * fpVSIL );
    00152
    00153     int     ParseJP2GeoTIFF();
    00154     int     ParseMSIG();
    00155     int     ParseGMLCoverageDesc();
    00156
    00157     int     ReadAndParse( const char *pszFilename );
    00158
    00159     // Write oriented.
    00160     void    SetProjection( const char *pszWKT );
    00161     void    SetGeoTransform( double * );
    00162     void    SetGCPs( int, const GDAL_GCP * );
    00163
    00164     GDALJP2Box *CreateJP2GeoTIFF();
    00165     GDALJP2Box *CreateGMLJP2( int nXSize, int nYSize );
    00166 };
    00167
    00168
    00169
    00170 #endif /* ndef _JP2READER_H_INCLUDED */
    00171
    00172

Generated for GDAL by 1.5.1.