LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/segukooa - ogr_segukooa.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 9 7 77.8 %
Date: 2012-12-26 Functions: 12 8 66.7 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_segukooa.h 23220 2011-10-11 21:50:55Z rouault $
       3                 :  *
       4                 :  * Project:  SEG-P1 / UKOOA P1-90 Translator
       5                 :  * Purpose:  Definition of classes for OGR SEG-P1 / UKOOA P1-90 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                 :  *
      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, DAMSEGUKOOAS 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_SEGUKOOA_H_INCLUDED
      31                 : #define _OGR_SEGUKOOA_H_INCLUDED
      32                 : 
      33                 : #include "ogrsf_frmts.h"
      34                 : 
      35                 : /************************************************************************/
      36                 : /*                        OGRSEGUKOOABaseLayer                          */
      37                 : /************************************************************************/
      38                 : 
      39                 : class OGRSEGUKOOABaseLayer : public OGRLayer
      40              24 : {
      41                 :   protected:
      42                 :     OGRFeatureDefn*    poFeatureDefn;
      43                 :     int                bEOF;
      44                 :     int                nNextFID;
      45                 : 
      46                 :     virtual OGRFeature *       GetNextRawFeature() = 0;
      47                 : 
      48                 :   public:
      49                 :     virtual OGRFeature *        GetNextFeature();
      50                 : 
      51               4 :     virtual OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
      52                 : 
      53               0 :     virtual int                 TestCapability( const char * ) { return FALSE; }
      54                 : };
      55                 : 
      56                 : /************************************************************************/
      57                 : /*                          OGRUKOOAP190Layer                           */
      58                 : /************************************************************************/
      59                 : 
      60                 : class OGRUKOOAP190Layer : public OGRSEGUKOOABaseLayer
      61                 : {
      62                 :     OGRSpatialReference* poSRS;
      63                 : 
      64                 :     VSILFILE*          fp;
      65                 : 
      66                 :     int                bUseEastingNorthingAsGeometry;
      67                 :     int                nYear;
      68                 :     void               ParseHeaders();
      69                 : 
      70                 :   protected:
      71                 :     OGRFeature *       GetNextRawFeature();
      72                 : 
      73                 :   public:
      74                 :                         OGRUKOOAP190Layer(const char* pszFilename,
      75                 :                                          VSILFILE* fp);
      76                 :                         ~OGRUKOOAP190Layer();
      77                 : 
      78                 : 
      79                 :     virtual void                ResetReading();
      80                 : 
      81               4 :     virtual OGRSpatialReference *GetSpatialRef() { return poSRS; }
      82                 : 
      83                 : };
      84                 : 
      85                 : /************************************************************************/
      86                 : /*                        OGRSEGUKOOALineLayer                          */
      87                 : /************************************************************************/
      88                 : 
      89                 : class OGRSEGUKOOALineLayer : public OGRSEGUKOOABaseLayer
      90                 : {
      91                 :     OGRLayer          *poBaseLayer;
      92                 :     OGRFeature        *poNextBaseFeature;
      93                 : 
      94                 :   protected:
      95                 :     OGRFeature *       GetNextRawFeature();
      96                 : 
      97                 :   public:
      98                 :                         OGRSEGUKOOALineLayer(const char* pszFilename,
      99                 :                                              OGRLayer *poBaseLayer);
     100                 :                         ~OGRSEGUKOOALineLayer();
     101                 : 
     102                 :     virtual void                ResetReading();
     103                 : 
     104               0 :     virtual OGRSpatialReference *GetSpatialRef() { return poBaseLayer->GetSpatialRef(); }
     105                 : };
     106                 : 
     107                 : 
     108                 : /************************************************************************/
     109                 : /*                         OGRSEGP1Layer                                */
     110                 : /************************************************************************/
     111                 : 
     112                 : class OGRSEGP1Layer: public OGRSEGUKOOABaseLayer
     113                 : {
     114                 :     OGRSpatialReference* poSRS;
     115                 : 
     116                 :     VSILFILE*          fp;
     117                 :     int                nLatitudeCol;
     118                 : 
     119                 :     int                bUseEastingNorthingAsGeometry;
     120                 : 
     121                 :   protected:
     122                 :     OGRFeature *       GetNextRawFeature();
     123                 : 
     124                 :   public:
     125                 :                         OGRSEGP1Layer(const char* pszFilename,
     126                 :                                       VSILFILE* fp,
     127                 :                                       int nLatitudeCol);
     128                 :                         ~OGRSEGP1Layer();
     129                 : 
     130                 :     virtual void                ResetReading();
     131                 : 
     132               2 :     virtual OGRSpatialReference *GetSpatialRef() { return poSRS; }
     133                 : 
     134                 : public:
     135                 :     static char* ExpandTabs(const char* pszLine);
     136                 :     static int   DetectLatitudeColumn(const char* pzLine);
     137                 : };
     138                 : 
     139                 : /************************************************************************/
     140                 : /*                         OGRSEGUKOOADataSource                        */
     141                 : /************************************************************************/
     142                 : 
     143                 : class OGRSEGUKOOADataSource : public OGRDataSource
     144                 : {
     145                 :     char*               pszName;
     146                 : 
     147                 :     OGRLayer**          papoLayers;
     148                 :     int                 nLayers;
     149                 : 
     150                 :   public:
     151                 :                         OGRSEGUKOOADataSource();
     152                 :                         ~OGRSEGUKOOADataSource();
     153                 : 
     154                 :     int                 Open( const char * pszFilename,
     155                 :                               int bUpdate );
     156                 : 
     157               4 :     virtual const char*         GetName() { return pszName; }
     158                 : 
     159               4 :     virtual int                 GetLayerCount() { return nLayers; }
     160                 :     virtual OGRLayer*           GetLayer( int );
     161                 : 
     162                 :     virtual int                 TestCapability( const char * );
     163                 : };
     164                 : 
     165                 : /************************************************************************/
     166                 : /*                          OGRSEGUKOOADriver                           */
     167                 : /************************************************************************/
     168                 : 
     169                 : class OGRSEGUKOOADriver : public OGRSFDriver
     170             226 : {
     171                 :   public:
     172                 :                 ~OGRSEGUKOOADriver();
     173                 : 
     174                 :     virtual const char*         GetName();
     175                 :     virtual OGRDataSource*      Open( const char *, int );
     176                 :     virtual int                 TestCapability( const char * );
     177                 : };
     178                 : 
     179                 : 
     180                 : #endif /* ndef _OGR_SEGUKOOA_H_INCLUDED */

Generated by: LCOV version 1.7