LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/geomedia - ogr_geomedia.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 6 1 16.7 %
Date: 2011-12-18 Functions: 6 1 16.7 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_geomedia.h 21561 2011-01-23 12:22:58Z rouault $
       3                 :  *
       4                 :  * Project:  OpenGIS Simple Features Reference Implementation
       5                 :  * Purpose:  Private definitions for Geomedia MDB driver.
       6                 :  * Author:   Even Rouault, <even dot rouault at mines dash paris dot org>
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2011, Even Rouault, <even dot rouault at mines dash paris dot org>
      10                 :  * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
      11                 :  *
      12                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      13                 :  * copy of this software and associated documentation files (the "Software"),
      14                 :  * to deal in the Software without restriction, including without limitation
      15                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      16                 :  * and/or sell copies of the Software, and to permit persons to whom the
      17                 :  * Software is furnished to do so, subject to the following conditions:
      18                 :  *
      19                 :  * The above copyright notice and this permission notice shall be included
      20                 :  * in all copies or substantial portions of the Software.
      21                 :  *
      22                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      23                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      24                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      25                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      26                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      27                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      28                 :  * DEALINGS IN THE SOFTWARE.
      29                 :  ****************************************************************************/
      30                 : 
      31                 : #ifndef _OGR_GEOMEDIA_H_INCLUDED
      32                 : #define _OGR_GEOMEDIA_H_INCLUDED
      33                 : 
      34                 : #include "ogrsf_frmts.h"
      35                 : #include "cpl_odbc.h"
      36                 : #include "cpl_error.h"
      37                 : 
      38                 : /************************************************************************/
      39                 : /*                          OGRGeomediaLayer                            */
      40                 : /************************************************************************/
      41                 : 
      42                 : class OGRGeomediaDataSource;
      43                 :     
      44                 : class OGRGeomediaLayer : public OGRLayer
      45                 : {
      46                 :   protected:
      47                 :     OGRFeatureDefn     *poFeatureDefn;
      48                 : 
      49                 :     CPLODBCStatement   *poStmt;
      50                 : 
      51                 :     // Layer spatial reference system, and srid.
      52                 :     OGRSpatialReference *poSRS;
      53                 :     int                 nSRSId;
      54                 : 
      55                 :     int                 iNextShapeId;
      56                 : 
      57                 :     OGRGeomediaDataSource    *poDS;
      58                 : 
      59                 :     char                *pszGeomColumn;
      60                 :     char                *pszFIDColumn;
      61                 : 
      62                 :     int                *panFieldOrdinals;
      63                 : 
      64                 :     CPLErr              BuildFeatureDefn( const char *pszLayerName,
      65                 :                                           CPLODBCStatement *poStmt );
      66                 : 
      67               0 :     virtual CPLODBCStatement *  GetStatement() { return poStmt; }
      68                 : 
      69                 :     void                LookupSRID( int );
      70                 : 
      71                 :   public:
      72                 :                         OGRGeomediaLayer();
      73                 :     virtual             ~OGRGeomediaLayer();
      74                 : 
      75                 :     virtual void        ResetReading();
      76                 :     virtual OGRFeature *GetNextRawFeature();
      77                 :     virtual OGRFeature *GetNextFeature();
      78                 : 
      79                 :     virtual OGRFeature *GetFeature( long nFeatureId );
      80                 :     
      81               0 :     OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
      82                 : 
      83                 :     virtual OGRSpatialReference *GetSpatialRef();
      84                 : 
      85                 :     virtual int         TestCapability( const char * );
      86                 : 
      87                 :     virtual const char *GetFIDColumn();
      88                 :     virtual const char *GetGeometryColumn();
      89                 : };
      90                 : 
      91                 : /************************************************************************/
      92                 : /*                       OGRGeomediaTableLayer                          */
      93                 : /************************************************************************/
      94                 : 
      95                 : class OGRGeomediaTableLayer : public OGRGeomediaLayer
      96                 : {
      97                 :     int                 bUpdateAccess;
      98                 : 
      99                 :     char                *pszQuery;
     100                 : 
     101                 :     void    ClearStatement();
     102                 :     OGRErr              ResetStatement();
     103                 : 
     104                 :     virtual CPLODBCStatement *  GetStatement();
     105                 : 
     106                 :   public:
     107                 :                         OGRGeomediaTableLayer( OGRGeomediaDataSource * );
     108                 :                         ~OGRGeomediaTableLayer();
     109                 : 
     110                 :     CPLErr              Initialize( const char *pszTableName, 
     111                 :                                     const char *pszGeomCol,
     112                 :                                     OGRSpatialReference* poSRS );
     113                 : 
     114                 :     virtual void        ResetReading();
     115                 :     virtual int         GetFeatureCount( int );
     116                 : 
     117                 :     virtual OGRErr      SetAttributeFilter( const char * );
     118                 :     virtual OGRFeature *GetFeature( long nFeatureId );
     119                 :     
     120                 :     virtual int         TestCapability( const char * );
     121                 : };
     122                 : 
     123                 : /************************************************************************/
     124                 : /*                        OGRGeomediaSelectLayer                        */
     125                 : /************************************************************************/
     126                 : 
     127                 : class OGRGeomediaSelectLayer : public OGRGeomediaLayer
     128                 : {
     129                 :     char                *pszBaseStatement;
     130                 : 
     131                 :     void    ClearStatement();
     132                 :     OGRErr              ResetStatement();
     133                 : 
     134                 :     virtual CPLODBCStatement *  GetStatement();
     135                 : 
     136                 :   public:
     137                 :                         OGRGeomediaSelectLayer( OGRGeomediaDataSource *,
     138                 :                                            CPLODBCStatement * );
     139                 :                         ~OGRGeomediaSelectLayer();
     140                 : 
     141                 :     virtual void        ResetReading();
     142                 :     virtual int         GetFeatureCount( int );
     143                 : 
     144                 :     virtual OGRFeature *GetFeature( long nFeatureId );
     145                 :     
     146                 :     virtual int         TestCapability( const char * );
     147                 : };
     148                 : 
     149                 : /************************************************************************/
     150                 : /*                        OGRGeomediaDataSource                         */
     151                 : /************************************************************************/
     152                 : 
     153                 : class OGRGeomediaDataSource : public OGRDataSource
     154                 : {
     155                 :     OGRGeomediaLayer  **papoLayers;
     156                 :     int                 nLayers;
     157                 : 
     158                 :     OGRGeomediaLayer  **papoLayersInvisible;
     159                 :     int                 nLayersWithInvisible;
     160                 : 
     161                 :     char               *pszName;
     162                 : 
     163                 :     int                 bDSUpdate;
     164                 :     CPLODBCSession      oSession;
     165                 : 
     166                 :     CPLString          GetTableNameFromType(const char* pszTableType);
     167                 :     OGRSpatialReference* GetGeomediaSRS(const char* pszGCoordSystemTable,
     168                 :                                         const char* pszGCoordSystemGUID);
     169                 : 
     170                 :   public:
     171                 :                         OGRGeomediaDataSource();
     172                 :                         ~OGRGeomediaDataSource();
     173                 : 
     174                 :     int                 Open( const char *, int bUpdate, int bTestOpen );
     175                 :     int                 OpenTable( const char *pszTableName, 
     176                 :                                    const char *pszGeomCol,
     177                 :                                    int bUpdate );
     178                 : 
     179               0 :     const char          *GetName() { return pszName; }
     180               0 :     int                 GetLayerCount() { return nLayers; }
     181                 :     OGRLayer            *GetLayer( int );
     182                 :     OGRLayer            *GetLayerByName( const char* pszLayerName );
     183                 : 
     184                 :     int                 TestCapability( const char * );
     185                 : 
     186                 :     virtual OGRLayer *  ExecuteSQL( const char *pszSQLCommand,
     187                 :                                     OGRGeometry *poSpatialFilter,
     188                 :                                     const char *pszDialect );
     189                 :     virtual void        ReleaseResultSet( OGRLayer * poLayer );
     190                 : 
     191                 :     // Internal use
     192               0 :     CPLODBCSession     *GetSession() { return &oSession; }
     193                 : };
     194                 : 
     195                 : /************************************************************************/
     196                 : /*                          OGRGeomediaDriver                           */
     197                 : /************************************************************************/
     198                 : 
     199                 : class OGRGeomediaDriver : public OGRSFDriver
     200             178 : {
     201                 :     CPLString   osDriverFile;
     202                 : 
     203                 :     bool        InstallMdbDriver();
     204                 :     bool        LibraryExists( const char* pszLibPath );
     205                 :     bool        FindDriverLib();
     206                 :     CPLString   FindDefaultLib(const char* pszLibName);
     207                 : 
     208                 :   public:
     209                 :                 ~OGRGeomediaDriver();
     210                 :                 
     211                 :     const char  *GetName();
     212                 :     OGRDataSource *Open( const char *, int );
     213                 : 
     214                 :     int          TestCapability( const char * );
     215                 : };
     216                 : 
     217                 : #endif /* ndef _OGR_Geomedia_H_INCLUDED */

Generated by: LCOV version 1.7