LTP GCOV extension - code coverage report
Current view: directory - ogr/ogrsf_frmts/pgeo - ogr_pgeo.h
Test: gdal_filtered.info
Date: 2010-07-12 Instrumented lines: 6
Code covered: 16.7 % Executed lines: 1

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_pgeo.h 17844 2009-10-17 09:40:47Z rouault $
       3                 :  *
       4                 :  * Project:  OpenGIS Simple Features Reference Implementation
       5                 :  * Purpose:  Private definitions for Personal Geodatabase driver.
       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 _OGR_ODBC_H_INCLUDED
      31                 : #define _OGR_ODBC_H_INCLUDED
      32                 : 
      33                 : #include "ogrsf_frmts.h"
      34                 : #include "cpl_odbc.h"
      35                 : #include "cpl_error.h"
      36                 : 
      37                 : #define SHPT_NULL          0
      38                 : 
      39                 : #define SHPT_POINT         1
      40                 : #define SHPT_POINTM       21
      41                 : #define SHPT_POINTZM      11
      42                 : #define SHPT_POINTZ        9
      43                 : 
      44                 : #define SHPT_MULTIPOINT    8
      45                 : #define SHPT_MULTIPOINTM  28
      46                 : #define SHPT_MULTIPOINTZM 18
      47                 : #define SHPT_MULTIPOINTZ  20
      48                 : 
      49                 : #define SHPT_ARC           3
      50                 : #define SHPT_ARCM         23
      51                 : #define SHPT_ARCZM        13
      52                 : #define SHPT_ARCZ         10
      53                 : 
      54                 : #define SHPT_POLYGON       5
      55                 : #define SHPT_POLYGONM     25
      56                 : #define SHPT_POLYGONZM    15
      57                 : #define SHPT_POLYGONZ     19
      58                 : 
      59                 : #define SHPT_MULTIPATCHM  31
      60                 : #define SHPT_MULTIPATCH   32
      61                 : 
      62                 : /************************************************************************/
      63                 : /*                            OGRPGeoLayer                              */
      64                 : /************************************************************************/
      65                 : 
      66                 : class OGRPGeoDataSource;
      67                 :     
      68                 : class OGRPGeoLayer : public OGRLayer
      69                 : {
      70                 :   protected:
      71                 :     OGRFeatureDefn     *poFeatureDefn;
      72                 : 
      73                 :     CPLODBCStatement   *poStmt;
      74                 : 
      75                 :     // Layer spatial reference system, and srid.
      76                 :     OGRSpatialReference *poSRS;
      77                 :     int                 nSRSId;
      78                 : 
      79                 :     int                 iNextShapeId;
      80                 : 
      81                 :     OGRPGeoDataSource    *poDS;
      82                 : 
      83                 :     char                *pszGeomColumn;
      84                 :     char                *pszFIDColumn;
      85                 : 
      86                 :     int                *panFieldOrdinals;
      87                 : 
      88                 :     CPLErr              BuildFeatureDefn( const char *pszLayerName,
      89                 :                                           CPLODBCStatement *poStmt );
      90                 : 
      91               0 :     virtual CPLODBCStatement *  GetStatement() { return poStmt; }
      92                 :     OGRErr              createFromShapeBin( GByte *pabyShape, 
      93                 :                                             OGRGeometry **ppoGeom,
      94                 :                                             int nBytes );
      95                 : 
      96                 :     void                LookupSRID( int );
      97                 : 
      98                 :   public:
      99                 :                         OGRPGeoLayer();
     100                 :     virtual             ~OGRPGeoLayer();
     101                 : 
     102                 :     virtual void        ResetReading();
     103                 :     virtual OGRFeature *GetNextRawFeature();
     104                 :     virtual OGRFeature *GetNextFeature();
     105                 : 
     106                 :     virtual OGRFeature *GetFeature( long nFeatureId );
     107                 :     
     108               0 :     OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
     109                 : 
     110                 :     virtual OGRSpatialReference *GetSpatialRef();
     111                 : 
     112                 :     virtual int         TestCapability( const char * );
     113                 : 
     114                 :     virtual const char *GetFIDColumn();
     115                 :     virtual const char *GetGeometryColumn();
     116                 : };
     117                 : 
     118                 : /************************************************************************/
     119                 : /*                           OGRPGeoTableLayer                            */
     120                 : /************************************************************************/
     121                 : 
     122                 : class OGRPGeoTableLayer : public OGRPGeoLayer
     123                 : {
     124                 :     int                 bUpdateAccess;
     125                 : 
     126                 :     char                *pszQuery;
     127                 : 
     128                 :     void    ClearStatement();
     129                 :     OGRErr              ResetStatement();
     130                 : 
     131                 :     virtual CPLODBCStatement *  GetStatement();
     132                 : 
     133                 :     OGREnvelope         sExtent;
     134                 : 
     135                 :   public:
     136                 :                         OGRPGeoTableLayer( OGRPGeoDataSource * );
     137                 :                         ~OGRPGeoTableLayer();
     138                 : 
     139                 :     CPLErr              Initialize( const char *pszTableName, 
     140                 :                                     const char *pszGeomCol,
     141                 :                                     int nShapeType,
     142                 :                                     double dfExtentLeft,
     143                 :                                     double dfExtentRight,
     144                 :                                     double dfExtentBottom,
     145                 :                                     double dfExtentTop,
     146                 :                                     int nSRID,
     147                 :                                     int bHasZ );
     148                 : 
     149                 :     virtual void        ResetReading();
     150                 :     virtual int         GetFeatureCount( int );
     151                 : 
     152                 :     virtual OGRErr      SetAttributeFilter( const char * );
     153                 :     virtual OGRFeature *GetFeature( long nFeatureId );
     154                 :     
     155                 :     virtual int         TestCapability( const char * );
     156                 : 
     157                 :     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
     158                 : };
     159                 : 
     160                 : /************************************************************************/
     161                 : /*                          OGRPGeoSelectLayer                          */
     162                 : /************************************************************************/
     163                 : 
     164                 : class OGRPGeoSelectLayer : public OGRPGeoLayer
     165                 : {
     166                 :     char                *pszBaseStatement;
     167                 : 
     168                 :     void    ClearStatement();
     169                 :     OGRErr              ResetStatement();
     170                 : 
     171                 :     virtual CPLODBCStatement *  GetStatement();
     172                 : 
     173                 :   public:
     174                 :                         OGRPGeoSelectLayer( OGRPGeoDataSource *, 
     175                 :                                            CPLODBCStatement * );
     176                 :                         ~OGRPGeoSelectLayer();
     177                 : 
     178                 :     virtual void        ResetReading();
     179                 :     virtual int         GetFeatureCount( int );
     180                 : 
     181                 :     virtual OGRFeature *GetFeature( long nFeatureId );
     182                 :     
     183                 :     virtual int         TestCapability( const char * );
     184                 : };
     185                 : 
     186                 : /************************************************************************/
     187                 : /*                           OGRPGeoDataSource                            */
     188                 : /************************************************************************/
     189                 : 
     190                 : class OGRPGeoDataSource : public OGRDataSource
     191                 : {
     192                 :     OGRPGeoLayer        **papoLayers;
     193                 :     int                 nLayers;
     194                 :     
     195                 :     char               *pszName;
     196                 : 
     197                 :     int                 bDSUpdate;
     198                 :     CPLODBCSession      oSession;
     199                 : 
     200                 :   public:
     201                 :                         OGRPGeoDataSource();
     202                 :                         ~OGRPGeoDataSource();
     203                 : 
     204                 :     int                 Open( const char *, int bUpdate, int bTestOpen );
     205                 :     int                 OpenTable( const char *pszTableName, 
     206                 :                                    const char *pszGeomCol,
     207                 :                                    int bUpdate );
     208                 : 
     209               0 :     const char          *GetName() { return pszName; }
     210               0 :     int                 GetLayerCount() { return nLayers; }
     211                 :     OGRLayer            *GetLayer( int );
     212                 : 
     213                 :     int                 TestCapability( const char * );
     214                 : 
     215                 :     virtual OGRLayer *  ExecuteSQL( const char *pszSQLCommand,
     216                 :                                     OGRGeometry *poSpatialFilter,
     217                 :                                     const char *pszDialect );
     218                 :     virtual void        ReleaseResultSet( OGRLayer * poLayer );
     219                 : 
     220                 :     // Internal use
     221               0 :     CPLODBCSession     *GetSession() { return &oSession; }
     222                 : };
     223                 : 
     224                 : /************************************************************************/
     225                 : /*                             OGRPGeoDriver                            */
     226                 : /************************************************************************/
     227                 : 
     228                 : class OGRPGeoDriver : public OGRSFDriver
     229              80 : {
     230                 :     CPLString   osDriverFile;
     231                 : 
     232                 :     bool        InstallMdbDriver();
     233                 :     bool        LibraryExists( const char* pszLibPath );
     234                 :     bool        FindDriverLib();
     235                 :     CPLString   FindDefaultLib(const char* pszLibName);
     236                 : 
     237                 :   public:
     238                 :                 ~OGRPGeoDriver();
     239                 :                 
     240                 :     const char  *GetName();
     241                 :     OGRDataSource *Open( const char *, int );
     242                 : 
     243                 :     int          TestCapability( const char * );
     244                 : };
     245                 : 
     246                 : #endif /* ndef _OGR_PGeo_H_INCLUDED */

Generated by: LTP GCOV extension version 1.5