LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/htf - ogr_htf.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 10 10 100.0 %
Date: 2011-12-18 Functions: 11 10 90.9 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_htf.h 20996 2010-10-28 18:38:15Z rouault $
       3                 :  *
       4                 :  * Project:  HTF Translator
       5                 :  * Purpose:  Definition of classes for OGR .htf driver.
       6                 :  * Author:   Even Rouault, even dot rouault at mines dash paris dot org
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2010, 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_HTF_H_INCLUDED
      31                 : #define _OGR_HTF_H_INCLUDED
      32                 : 
      33                 : #include "ogrsf_frmts.h"
      34                 : 
      35                 : #include <vector>
      36                 : 
      37                 : /************************************************************************/
      38                 : /*                             OGRHTFLayer                              */
      39                 : /************************************************************************/
      40                 : 
      41                 : class OGRHTFLayer : public OGRLayer
      42                 : {
      43                 : protected:
      44                 :     OGRFeatureDefn*    poFeatureDefn;
      45                 :     OGRSpatialReference *poSRS;
      46                 : 
      47                 :     VSILFILE*          fpHTF;
      48                 :     int                bEOF;
      49                 : 
      50                 :     int                nNextFID;
      51                 : 
      52                 :     virtual OGRFeature *       GetNextRawFeature() = 0;
      53                 : 
      54                 :     int                bHasExtent;
      55                 :     double             dfMinX;
      56                 :     double             dfMinY;
      57                 :     double             dfMaxX;
      58                 :     double             dfMaxY;
      59                 : 
      60                 :   public:
      61                 :                         OGRHTFLayer(const char* pszFilename, int nZone, int bIsNorth);
      62                 :                         ~OGRHTFLayer();
      63                 : 
      64                 : 
      65                 :     virtual void                ResetReading();
      66                 :     virtual OGRFeature *        GetNextFeature();
      67                 : 
      68              95 :     virtual OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
      69                 : 
      70                 :     virtual int                 TestCapability( const char * );
      71                 : 
      72               2 :     virtual OGRSpatialReference *GetSpatialRef() { return poSRS; }
      73                 : 
      74                 :     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
      75                 :     void    SetExtent(double dfMinX, double dfMinY, double dfMaxX, double dfMaxY);
      76                 : 
      77                 : };
      78                 : 
      79                 : /************************************************************************/
      80                 : /*                      OGRHTFPolygonLayer                              */
      81                 : /************************************************************************/
      82                 : 
      83                 : class OGRHTFPolygonLayer : public OGRHTFLayer
      84               6 : {
      85                 : protected:
      86                 :     virtual OGRFeature *       GetNextRawFeature();
      87                 : 
      88                 :   public:
      89                 :                         OGRHTFPolygonLayer(const char* pszFilename, int nZone, int bIsNorth);
      90                 : 
      91                 :     virtual void                ResetReading();
      92                 : };
      93                 : 
      94                 : /************************************************************************/
      95                 : /*                      OGRHTFSoundingLayer                             */
      96                 : /************************************************************************/
      97                 : 
      98                 : class OGRHTFSoundingLayer : public OGRHTFLayer
      99                 : {
     100                 : private:
     101                 :     int                        bHasFPK;
     102                 :     int                        nFieldsPresent;
     103                 :     int                       *panFieldPresence;
     104                 :     int                        nEastingIndex, nNorthingIndex;
     105                 :     int                        nTotalSoundings;
     106                 : 
     107                 : protected:
     108                 :     virtual OGRFeature *       GetNextRawFeature();
     109                 : 
     110                 :   public:
     111                 :                         OGRHTFSoundingLayer(const char* pszFilename, int nZone, int bIsNorth, int nTotalSoundings);
     112                 :                        ~OGRHTFSoundingLayer();
     113                 : 
     114                 :     virtual void                ResetReading();
     115                 : 
     116                 :     virtual int                 TestCapability( const char * );
     117                 : 
     118                 :     virtual int                 GetFeatureCount(int bForce = TRUE);
     119                 : };
     120                 : 
     121                 : /************************************************************************/
     122                 : /*                          OGRHTFMetadataLayer                         */
     123                 : /************************************************************************/
     124                 : 
     125                 : class OGRHTFMetadataLayer : public OGRLayer
     126                 : {
     127                 : protected:
     128                 :     OGRFeatureDefn        *poFeatureDefn;
     129                 :     OGRFeature            *poFeature;
     130                 :     std::vector<CPLString> aosMD;
     131                 : 
     132                 :     int                nNextFID;
     133                 : 
     134                 :   public:
     135                 :                         OGRHTFMetadataLayer(std::vector<CPLString> aosMD);
     136                 :                         ~OGRHTFMetadataLayer();
     137                 : 
     138                 : 
     139              23 :     virtual void                ResetReading() { nNextFID = 0; }
     140                 :     virtual OGRFeature *        GetNextFeature();
     141                 : 
     142             114 :     virtual OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
     143                 : 
     144               4 :     virtual int                 TestCapability( const char * ) { return FALSE; }
     145                 : 
     146               1 :     virtual OGRSpatialReference *GetSpatialRef() { return NULL; }
     147                 : };
     148                 : 
     149                 : /************************************************************************/
     150                 : /*                           OGRHTFDataSource                           */
     151                 : /************************************************************************/
     152                 : 
     153                 : class OGRHTFDataSource : public OGRDataSource
     154                 : {
     155                 :     char*               pszName;
     156                 : 
     157                 :     OGRHTFLayer**       papoLayers;
     158                 :     int                 nLayers;
     159                 :     OGRLayer           *poMetadataLayer;
     160                 : 
     161                 :   public:
     162                 :                         OGRHTFDataSource();
     163                 :                         ~OGRHTFDataSource();
     164                 : 
     165                 :     int                 Open( const char * pszFilename,
     166                 :                               int bUpdate );
     167                 : 
     168               3 :     virtual const char*         GetName() { return pszName; }
     169                 : 
     170               4 :     virtual int                 GetLayerCount() { return nLayers; }
     171                 :     virtual OGRLayer*           GetLayer( int );
     172                 :     virtual OGRLayer*           GetLayerByName( const char* pszLayerName );
     173                 : 
     174                 :     virtual int                 TestCapability( const char * );
     175                 : };
     176                 : 
     177                 : /************************************************************************/
     178                 : /*                             OGRHTFDriver                             */
     179                 : /************************************************************************/
     180                 : 
     181                 : class OGRHTFDriver : public OGRSFDriver
     182             178 : {
     183                 :   public:
     184                 :                 ~OGRHTFDriver();
     185                 : 
     186                 :     virtual const char*         GetName();
     187                 :     virtual OGRDataSource*      Open( const char *, int );
     188                 :     virtual int                 TestCapability( const char * );
     189                 : };
     190                 : 
     191                 : 
     192                 : #endif /* ndef _OGR_HTF_H_INCLUDED */

Generated by: LCOV version 1.7