- Main Page
- Related Pages
- Classes
- Files

# gdaljp2metadata.h

    00001 /******************************************************************************
    00002  * $Id: gdaljp2metadata.h 22678 2011-07-09 19:47:12Z rouault $
    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 #ifndef GDAL_JP2READER_H_INCLUDED
    00031 #define GDAL_JP2READER_H_INCLUDED
    00032
    00033 #include "cpl_conv.h"
    00034 #include "cpl_vsi.h"
    00035 #include "gdal.h"
    00036
    00037 /************************************************************************/
    00038 /*                              GDALJP2Box                              */
    00039 /************************************************************************/
    00040
    00041 class CPL_DLL GDALJP2Box
    00042 {
    00043
    00044     VSILFILE   *fpVSIL;
    00045
    00046     char        szBoxType[5];
    00047
    00048     GIntBig     nBoxOffset;
    00049     GIntBig     nBoxLength;
    00050
    00051     GIntBig     nDataOffset;
    00052
    00053     GByte       abyUUID[16];
    00054
    00055     GByte      *pabyData;
    00056
    00057 public:
    00058                 GDALJP2Box( VSILFILE * = NULL );
    00059                 ~GDALJP2Box();
    00060
    00061     int         SetOffset( GIntBig nNewOffset );
    00062     int         ReadBox();
    00063
    00064     int         ReadFirst();
    00065     int         ReadNext();
    00066
    00067     int         ReadFirstChild( GDALJP2Box *poSuperBox );
    00068     int         ReadNextChild( GDALJP2Box *poSuperBox );
    00069
    00070     GIntBig     GetDataLength();
    00071     const char *GetType() { return szBoxType; }
    00072
    00073     GByte      *ReadBoxData();
    00074
    00075     int         IsSuperBox();
    00076
    00077     int         DumpReadable( FILE * );
    00078
    00079     VSILFILE   *GetFILE() { return fpVSIL; }
    00080
    00081     const GByte *GetUUID() { return abyUUID; }
    00082
    00083     // write support
    00084     void        SetType( const char * );
    00085     void        SetWritableData( int nLength, const GByte *pabyData );
    00086     const GByte*GetWritableData() { return pabyData; }
    00087
    00088     // factory methods.
    00089     static GDALJP2Box *CreateAsocBox( int nCount, GDALJP2Box **papoBoxes );
    00090     static GDALJP2Box *CreateLblBox( const char *pszLabel );
    00091     static GDALJP2Box *CreateLabelledXMLAssoc( const char *pszLabel,
    00092                                                const char *pszXML );
    00093     static GDALJP2Box *CreateUUIDBox( const GByte *pabyUUID,
    00094                                       int nDataSize, GByte *pabyData );
    00095 };
    00096
    00097 /************************************************************************/
    00098 /*                           GDALJP2Metadata                            */
    00099 /************************************************************************/
    00100
    00101 class CPL_DLL GDALJP2Metadata
    00102
    00103 {
    00104 private:
    00105     void    CollectGMLData( GDALJP2Box * );
    00106     int     GMLSRSLookup( const char *pszURN );
    00107
    00108     int    nGeoTIFFSize;
    00109     GByte  *pabyGeoTIFFData;
    00110
    00111     int    nMSIGSize;
    00112     GByte  *pabyMSIGData;
    00113
    00114 public:
    00115     char  **papszGMLMetadata;
    00116
    00117     int     bHaveGeoTransform;
    00118     double  adfGeoTransform[6];
    00119
    00120     char   *pszProjection;
    00121
    00122     int         nGCPCount;
    00123     GDAL_GCP    *pasGCPList;
    00124
    00125     char  **papszMetadata;
    00126     char   *pszXMPMetadata;
    00127
    00128 public:
    00129             GDALJP2Metadata();
    00130             ~GDALJP2Metadata();
    00131
    00132     int     ReadBoxes( VSILFILE * fpVSIL );
    00133
    00134     int     ParseJP2GeoTIFF();
    00135     int     ParseMSIG();
    00136     int     ParseGMLCoverageDesc();
    00137
    00138     int     ReadAndParse( const char *pszFilename );
    00139
    00140     // Write oriented.
    00141     void    SetProjection( const char *pszWKT );
    00142     void    SetGeoTransform( double * );
    00143     void    SetGCPs( int, const GDAL_GCP * );
    00144
    00145     GDALJP2Box *CreateJP2GeoTIFF();
    00146     GDALJP2Box *CreateGMLJP2( int nXSize, int nYSize );
    00147 };
    00148
    00149 #endif /* ndef GDAL_JP2READER_H_INCLUDED */

Generated for GDAL by 1.5.6.