LCOV - code coverage report
Current view: directory - gcore - gdaljp2metadata.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2010-01-09 Functions: 4 4 100.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: gdaljp2metadata.h 11873 2007-08-11 17:37:43Z mloskot $
       3                 :  *
       4                 :  * Project:  GDAL 
       5                 :  * Purpose:  JP2 Box Reader (and GMLJP2 Interpreter)
       6                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
      10                 :  *
      11                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      12                 :  * copy of this software and associated documentation files (the "Software"),
      13                 :  * to deal in the Software without restriction, including without limitation
      14                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15                 :  * and/or sell copies of the Software, and to permit persons to whom the
      16                 :  * Software is furnished to do so, subject to the following conditions:
      17                 :  *
      18                 :  * The above copyright notice and this permission notice shall be included
      19                 :  * in all copies or substantial portions of the Software.
      20                 :  *
      21                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27                 :  * DEALINGS IN THE SOFTWARE.
      28                 :  ****************************************************************************/
      29                 : 
      30                 : #ifndef GDAL_JP2READER_H_INCLUDED
      31                 : #define GDAL_JP2READER_H_INCLUDED
      32                 : 
      33                 : #include "cpl_conv.h"
      34                 : #include "cpl_vsi.h"
      35                 : #include "gdal.h"
      36                 : 
      37                 : /************************************************************************/
      38                 : /*                              GDALJP2Box                              */
      39                 : /************************************************************************/
      40                 : 
      41                 : class CPL_DLL GDALJP2Box
      42                 : {
      43                 : 
      44                 :     FILE        *fpVSIL;
      45                 : 
      46                 :     char        szBoxType[5];
      47                 : 
      48                 :     GIntBig     nBoxOffset;
      49                 :     GIntBig     nBoxLength;
      50                 : 
      51                 :     GIntBig     nDataOffset;
      52                 : 
      53                 :     GByte       abyUUID[16];
      54                 : 
      55                 :     GByte      *pabyData;
      56                 : 
      57                 : public:
      58                 :                 GDALJP2Box( FILE * = NULL );
      59                 :                 ~GDALJP2Box();
      60                 : 
      61                 :     int         SetOffset( GIntBig nNewOffset );
      62                 :     int         ReadBox();
      63                 : 
      64                 :     int         ReadFirst();
      65                 :     int         ReadNext();
      66                 : 
      67                 :     int         ReadFirstChild( GDALJP2Box *poSuperBox );
      68                 :     int         ReadNextChild( GDALJP2Box *poSuperBox );
      69                 : 
      70                 :     GIntBig     GetDataLength();
      71            1644 :     const char *GetType() { return szBoxType; }
      72                 :     
      73                 :     GByte      *ReadBoxData();
      74                 : 
      75                 :     int         IsSuperBox();
      76                 : 
      77                 :     int         DumpReadable( FILE * );
      78                 : 
      79              34 :     FILE        *GetFILE() { return fpVSIL; }
      80                 : 
      81              62 :     const GByte *GetUUID() { return abyUUID; }
      82                 : 
      83                 :     // write support
      84                 :     void        SetType( const char * );
      85                 :     void        SetWritableData( int nLength, const GByte *pabyData );
      86              32 :     const GByte*GetWritableData() { return pabyData; }
      87                 : 
      88                 :     // factory methods.
      89                 :     static GDALJP2Box *CreateAsocBox( int nCount, GDALJP2Box **papoBoxes );
      90                 :     static GDALJP2Box *CreateLblBox( const char *pszLabel );
      91                 :     static GDALJP2Box *CreateLabelledXMLAssoc( const char *pszLabel,
      92                 :                                                const char *pszXML );
      93                 :     static GDALJP2Box *CreateUUIDBox( const GByte *pabyUUID, 
      94                 :                                       int nDataSize, GByte *pabyData );
      95                 : };
      96                 : 
      97                 : /************************************************************************/
      98                 : /*                           GDALJP2Metadata                            */
      99                 : /************************************************************************/
     100                 : 
     101                 : class CPL_DLL GDALJP2Metadata
     102                 : 
     103                 : {
     104                 : private:
     105                 :     void    CollectGMLData( GDALJP2Box * );
     106                 :     int     GMLSRSLookup( const char *pszURN );
     107                 : 
     108                 :     int    nGeoTIFFSize;
     109                 :     GByte  *pabyGeoTIFFData;
     110                 : 
     111                 :     int    nMSIGSize;
     112                 :     GByte  *pabyMSIGData;
     113                 : 
     114                 : public:
     115                 :     char   **papszGMLMetadata;
     116                 :     
     117                 :     int     bHaveGeoTransform;
     118                 :     double  adfGeoTransform[6];
     119                 : 
     120                 :     char    *pszProjection;
     121                 : 
     122                 :     int         nGCPCount;
     123                 :     GDAL_GCP    *pasGCPList;
     124                 : 
     125                 : public:
     126                 :             GDALJP2Metadata();
     127                 :             ~GDALJP2Metadata();
     128                 : 
     129                 :     int     ReadBoxes( FILE * fpVSIL );
     130                 : 
     131                 :     int     ParseJP2GeoTIFF();
     132                 :     int     ParseMSIG();
     133                 :     int     ParseGMLCoverageDesc();
     134                 : 
     135                 :     int     ReadAndParse( const char *pszFilename );
     136                 : 
     137                 :     // Write oriented. 
     138                 :     void    SetProjection( const char *pszWKT );
     139                 :     void    SetGeoTransform( double * );
     140                 :     void    SetGCPs( int, const GDAL_GCP * );
     141                 :     
     142                 :     GDALJP2Box *CreateJP2GeoTIFF();
     143                 :     GDALJP2Box *CreateGMLJP2( int nXSize, int nYSize );
     144                 : };
     145                 : 
     146                 : #endif /* ndef GDAL_JP2READER_H_INCLUDED */

Generated by: LCOV version 1.7