LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/vrt - ogr_vrt.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: ogr_vrt.h 17729 2009-10-02 17:23:59Z warmerdam $
       3                 :  *
       4                 :  * Project:  OpenGIS Simple Features Reference Implementation
       5                 :  * Purpose:  Private definitions for OGR/VRT driver.
       6                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2003, 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_VRT_H_INCLUDED
      31                 : #define _OGR_VRT_H_INCLUDED
      32                 : 
      33                 : #include <vector>
      34                 : #include "ogrsf_frmts.h"
      35                 : #include "cpl_error.h"
      36                 : #include "cpl_minixml.h"
      37                 : 
      38                 : typedef enum { 
      39                 :     VGS_None,
      40                 :     VGS_Direct,
      41                 :     VGS_PointFromColumns, 
      42                 :     VGS_WKT, 
      43                 :     VGS_WKB,
      44                 :     VGS_Shape
      45                 : } OGRVRTGeometryStyle;
      46                 : 
      47                 : /************************************************************************/
      48                 : /*                            OGRVRTLayer                                */
      49                 : /************************************************************************/
      50                 : 
      51                 : class OGRVRTLayer : public OGRLayer
      52                 : {
      53                 :   protected:
      54                 :     OGRFeatureDefn      *poFeatureDefn;
      55                 : 
      56                 :     OGRDataSource       *poSrcDS;
      57                 :     OGRLayer            *poSrcLayer;
      58                 :     int                 bNeedReset;
      59                 :     int                 bSrcLayerFromSQL;
      60                 :     int                 bSrcDSShared;
      61                 :     int                 bAttrFilterPassThrough;
      62                 : 
      63                 :     // Layer spatial reference system, and srid.
      64                 :     OGRSpatialReference *poSRS;
      65                 : 
      66                 :     char                *pszAttrFilter;
      67                 : 
      68                 :     int                 bSrcClip;
      69                 :     OGRGeometry         *poSrcRegion;
      70                 : 
      71                 :     int                 iFIDField; // -1 means pass through. 
      72                 :     int                 iStyleField; // -1 means pass through.
      73                 : 
      74                 :     // Geometry interpretation related.
      75                 :     OGRVRTGeometryStyle eGeometryType;
      76                 :     
      77                 :     int                 iGeomField; 
      78                 : 
      79                 :                         // VGS_PointFromColumn
      80                 :     int                 iGeomXField, iGeomYField, iGeomZField;
      81                 : 
      82                 :     int                 bUseSpatialSubquery;
      83                 : 
      84                 :     // Attribute Mapping
      85                 :     std::vector<int>    anSrcField;
      86                 :     std::vector<int>    abDirectCopy;
      87                 : 
      88                 :     int                 bUpdate;
      89                 : 
      90                 :     OGRFeature         *TranslateFeature( OGRFeature*& , int bUseSrcRegion );
      91                 :     OGRErr              createFromShapeBin( GByte *, OGRGeometry **, int );
      92                 :     
      93                 :     OGRFeature         *TranslateVRTFeatureToSrcFeature( OGRFeature* poVRTFeature);
      94                 : 
      95                 :     int                 ResetSourceReading();
      96                 : 
      97                 :   public:
      98                 :                         OGRVRTLayer();
      99                 :     virtual             ~OGRVRTLayer();
     100                 : 
     101                 :     virtual int         Initialize( CPLXMLNode *psLTree, 
     102                 :                                     const char *pszVRTDirectory,
     103                 :                                     int bUpdate);
     104                 : 
     105                 :     virtual void        ResetReading();
     106                 :     virtual OGRFeature *GetNextFeature();
     107                 : 
     108                 :     virtual OGRFeature *GetFeature( long nFeatureId );
     109                 : 
     110                 :     virtual OGRErr      SetNextByIndex( long nIndex );
     111                 : 
     112              62 :     virtual OGRFeatureDefn *GetLayerDefn() { return poFeatureDefn; }
     113                 : 
     114                 :     virtual OGRSpatialReference *GetSpatialRef();
     115                 : 
     116                 :     virtual int         GetFeatureCount( int );
     117                 : 
     118                 :     virtual OGRErr      SetAttributeFilter( const char * );
     119                 : 
     120                 :     virtual int         TestCapability( const char * );
     121                 : 
     122                 :     virtual OGRErr      GetExtent( OGREnvelope *psExtent, int bForce );
     123                 : 
     124                 :     virtual void        SetSpatialFilter( OGRGeometry * poGeomIn );
     125                 : 
     126                 :     virtual OGRErr      CreateFeature( OGRFeature* poFeature );
     127                 : 
     128                 :     virtual OGRErr      SetFeature( OGRFeature* poFeature );
     129                 : 
     130                 :     virtual OGRErr      DeleteFeature( long nFID );
     131                 : };
     132                 : 
     133                 : /************************************************************************/
     134                 : /*                           OGRVRTDataSource                            */
     135                 : /************************************************************************/
     136                 : 
     137                 : class OGRVRTDataSource : public OGRDataSource
     138                 : {
     139                 :     OGRVRTLayer        **papoLayers;
     140                 :     int                 nLayers;
     141                 :     
     142                 :     char               *pszName;
     143                 : 
     144                 :   public:
     145                 :                         OGRVRTDataSource();
     146                 :                         ~OGRVRTDataSource();
     147                 : 
     148                 :     int                 Initialize( CPLXMLNode *psXML, const char *pszName,
     149                 :                                     int bUpdate );
     150                 : 
     151              13 :     const char          *GetName() { return pszName; }
     152              37 :     int                 GetLayerCount() { return nLayers; }
     153                 :     OGRLayer            *GetLayer( int );
     154                 : 
     155                 :     int                 TestCapability( const char * );
     156                 : };
     157                 : 
     158                 : /************************************************************************/
     159                 : /*                             OGRVRTDriver                             */
     160                 : /************************************************************************/
     161                 : 
     162                 : class OGRVRTDriver : public OGRSFDriver
     163              64 : {
     164                 :   public:
     165                 :                 ~OGRVRTDriver();
     166                 :                 
     167                 :     const char *GetName();
     168                 :     OGRDataSource *Open( const char *, int );
     169                 :     int         TestCapability( const char * );
     170                 : };
     171                 : 
     172                 : 
     173                 : #endif /* ndef _OGR_VRT_H_INCLUDED */
     174                 : 
     175                 : 

Generated by: LCOV version 1.7