- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

# gdaljp2metadata.h

    00001 /******************************************************************************
    00002  * $Id: gdaljp2metadata.h 27181 2014-04-14 19:32:33Z 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  * Copyright (c) 2010-2013, Even Rouault <even dot rouault at mines-paris dot org>
    00011  *
    00012  * Permission is hereby granted, free of charge, to any person obtaining a
    00013  * copy of this software and associated documentation files (the "Software"),
    00014  * to deal in the Software without restriction, including without limitation
    00015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00016  * and/or sell copies of the Software, and to permit persons to whom the
    00017  * Software is furnished to do so, subject to the following conditions:
    00018  *
    00019  * The above copyright notice and this permission notice shall be included
    00020  * in all copies or substantial portions of the Software.
    00021  *
    00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00023  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00024  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    00025  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00026  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00027  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00028  * DEALINGS IN THE SOFTWARE.
    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 /*                              GDALJP2Box                              */
    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     // write support
    00085     void        SetType( const char * );
    00086     void        SetWritableData( int nLength, const GByte *pabyData );
    00087     const GByte*GetWritableData() { return pabyData; }
    00088
    00089     // factory methods.
    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 /*                           GDALJP2Metadata                            */
    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     // Write oriented.
    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 /* ndef GDAL_JP2READER_H_INCLUDED */

Generated for GDAL by 1.7.1.