LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/pdf - ogr_pdf.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2012-04-28 Functions: 5 4 80.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_pdf.h 24195 2012-04-02 20:05:33Z rouault $
       3                 :  *
       4                 :  * Project:  PDF Translator
       5                 :  * Purpose:  Definition of classes for OGR .pdf driver.
       6                 :  * Author:   Even Rouault, even dot rouault at mines dash paris dot org
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2012, Even Rouault <even dot rouault at mines dash paris dot org>
      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 _OGR_PDF_H_INCLUDED
      31                 : #define _OGR_PDF_H_INCLUDED
      32                 : 
      33                 : #include "ogrsf_frmts.h"
      34                 : 
      35                 : #include "ogr_mem.h"
      36                 : #include "gdal_priv.h"
      37                 : #include "pdfobject.h"
      38                 : 
      39                 : #include <map>
      40                 : #include <stack>
      41                 : 
      42                 : /************************************************************************/
      43                 : /*                             OGRPDFLayer                              */
      44                 : /************************************************************************/
      45                 : 
      46                 : class OGRPDFDataSource;
      47                 : 
      48                 : class OGRPDFLayer : public OGRMemLayer
      49              26 : {
      50                 :     OGRPDFDataSource* poDS;
      51                 :     public:
      52                 :         OGRPDFLayer(OGRPDFDataSource* poDS,
      53                 :                     const char * pszName,
      54                 :                     OGRSpatialReference *poSRS,
      55                 :                     OGRwkbGeometryType eGeomType);
      56                 : 
      57                 :     void                Fill( GDALPDFArray* poArray );
      58                 : 
      59                 :     virtual int                 TestCapability( const char * );
      60                 :     virtual OGRErr              CreateFeature( OGRFeature *poFeature );
      61                 : };
      62                 : 
      63                 : /************************************************************************/
      64                 : /*                           OGRPDFDataSource                           */
      65                 : /************************************************************************/
      66                 : 
      67                 : class OGRPDFDataSource : public OGRDataSource
      68                 : {
      69                 :     char*               pszName;
      70                 :     char**              papszOptions;
      71                 : 
      72                 :     int                 nLayers;
      73                 :     OGRLayer          **papoLayers;
      74                 : 
      75                 :     int                 bWritable;
      76                 :     int                 bModified;
      77                 : 
      78                 :     GDALDataset        *poGDAL_DS;
      79                 :     GDALPDFObject      *poPageObj;
      80                 :     GDALPDFObject      *poCatalogObj;
      81                 :     int                 nXSize;
      82                 :     int                 nYSize;
      83                 :     double              adfGeoTransform[6];
      84                 :     double              dfPageWidth;
      85                 :     double              dfPageHeight;
      86                 :     void                PDFCoordsToSRSCoords(double x, double y,
      87                 :                                              double& X, double &Y);
      88                 : 
      89                 :     std::map<int,OGRGeometry*> oMapMCID;
      90                 :     void                CleanupIntermediateResources();
      91                 : 
      92                 :     std::map<CPLString, int> oMapOperators;
      93                 :     void                InitMapOperators();
      94                 : 
      95                 :     void                ExploreTree(GDALPDFObject* poObj);
      96                 :     void                ExploreContents(GDALPDFObject* poObj, GDALPDFObject* poResources);
      97                 :     int                 UnstackTokens(const CPLString& osToken,
      98                 :                                       std::stack<CPLString>& osTokenStack,
      99                 :                                       double* adfCoords);
     100                 :     void                ParseContent(const char* pszContent,
     101                 :                                      int nMCID,
     102                 :                                      GDALPDFObject* poResources,
     103                 :                                      int bInitBDCStack);
     104                 : 
     105                 :   public:
     106                 :                         OGRPDFDataSource();
     107                 :                         ~OGRPDFDataSource();
     108                 : 
     109                 :     int                 Open( const char * pszName );
     110                 :     int                 Create( const char * pszName, char **papszOptions );
     111                 : 
     112               6 :     virtual const char*         GetName() { return pszName; }
     113                 : 
     114                 :     virtual int                 GetLayerCount();
     115                 :     virtual OGRLayer*           GetLayer( int );
     116                 : 
     117                 :     virtual int                 TestCapability( const char * );
     118                 : 
     119                 :     virtual OGRLayer* CreateLayer( const char * pszLayerName,
     120                 :                                 OGRSpatialReference *poSRS,
     121                 :                                 OGRwkbGeometryType eType,
     122                 :                                 char ** papszOptions );
     123                 : 
     124                 :     virtual OGRErr      SyncToDisk();
     125                 : 
     126             752 :     void                SetModified() { bModified = TRUE; }
     127                 :     OGRGeometry        *GetGeometryFromMCID(int nMCID);
     128                 : };
     129                 : 
     130                 : /************************************************************************/
     131                 : /*                             OGRPDFDriver                              */
     132                 : /************************************************************************/
     133                 : 
     134                 : class OGRPDFDriver : public OGRSFDriver
     135             389 : {
     136                 :   public:
     137                 :                 ~OGRPDFDriver();
     138                 : 
     139                 :     virtual const char*         GetName();
     140                 :     virtual OGRDataSource*      Open( const char *, int );
     141                 :     virtual int                 TestCapability( const char * );
     142                 : 
     143                 :     virtual OGRDataSource *CreateDataSource( const char *pszName,
     144                 :                                              char ** = NULL );
     145                 :     virtual OGRErr DeleteDataSource( const char *pszName );
     146                 : };
     147                 : 
     148                 : 
     149                 : #endif /* ndef _OGR_PDF_H_INCLUDED */

Generated by: LCOV version 1.7