LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/s57 - ogr_s57.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 6 5 83.3 %
Date: 2012-04-28 Functions: 6 5 83.3 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_s57.h 10645 2007-01-18 02:22:39Z warmerdam $
       3                 :  *
       4                 :  * Project:  S-57 Translator
       5                 :  * Purpose:  Declarations for classes binding S57 support onto OGRLayer,
       6                 :  *           OGRDataSource and OGRDriver.  See also s57.h.
       7                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       8                 :  *
       9                 :  ******************************************************************************
      10                 :  * Copyright (c) 1999, Frank Warmerdam
      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_S57_H_INCLUDED
      32                 : #define _OGR_S57_H_INCLUDED
      33                 : 
      34                 : #include "ogrsf_frmts.h"
      35                 : #include "s57.h"
      36                 : 
      37                 : class OGRS57DataSource;
      38                 : 
      39                 : /************************************************************************/
      40                 : /*                             OGRS57Layer                              */
      41                 : /*                                                                      */
      42                 : /*      Represents all features of a particular S57 object class.       */
      43                 : /************************************************************************/
      44                 : 
      45                 : class OGRS57Layer : public OGRLayer
      46                 : {
      47                 :     OGRS57DataSource   *poDS;
      48                 : 
      49                 :     OGRFeatureDefn     *poFeatureDefn;
      50                 : 
      51                 :     int                 nCurrentModule;
      52                 :     int                 nRCNM;
      53                 :     int                 nOBJL;
      54                 :     int                 nNextFEIndex;
      55                 :     int                 nFeatureCount;
      56                 : 
      57                 :   public:
      58                 :                         OGRS57Layer( OGRS57DataSource * poDS,
      59                 :                                      OGRFeatureDefn *, int nFeatureCount = -1,
      60                 :                                      int nOBJL = -1 );
      61                 :     virtual             ~OGRS57Layer();
      62                 : 
      63                 :     void                ResetReading();
      64                 :     OGRFeature *        GetNextFeature();
      65                 :     OGRFeature *        GetNextUnfilteredFeature();
      66                 :     virtual OGRFeature *GetFeature( long nFeatureId );
      67                 :     
      68                 :     virtual int         GetFeatureCount( int bForce = TRUE );
      69                 :     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
      70                 : 
      71             660 :     OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
      72                 : 
      73                 :     virtual OGRErr      CreateFeature( OGRFeature *poFeature );
      74                 :     int                 TestCapability( const char * );
      75                 : 
      76                 :     virtual OGRSpatialReference *GetSpatialRef();
      77                 : };
      78                 : 
      79                 : /************************************************************************/
      80                 : /*                          OGRS57DataSource                            */
      81                 : /************************************************************************/
      82                 : 
      83                 : class OGRS57DataSource : public OGRDataSource
      84                 : {
      85                 :     char                *pszName;
      86                 : 
      87                 :     int                 nLayers;
      88                 :     OGRS57Layer         **papoLayers;
      89                 : 
      90                 :     OGRSpatialReference *poSpatialRef;
      91                 : 
      92                 :     char                **papszOptions;
      93                 :     
      94                 :     int                 nModules;
      95                 :     S57Reader           **papoModules;
      96                 : 
      97                 :     S57Writer           *poWriter;
      98                 : 
      99                 :     int                 bClassCountSet;
     100                 :     int                 anClassCount[MAX_CLASSES];
     101                 : 
     102                 :     int                 bExtentsSet;
     103                 :     OGREnvelope         oExtents;
     104                 :     
     105                 :   public:
     106                 :                         OGRS57DataSource();
     107                 :                         ~OGRS57DataSource();
     108                 : 
     109                 :     void                SetOptionList( char ** );
     110                 :     const char         *GetOption( const char * );
     111                 :     
     112                 :     int                 Open( const char * pszName, int bTestOpen = FALSE );
     113                 :     int                 Create( const char *pszName, char **papszOptions );
     114                 : 
     115              12 :     const char          *GetName() { return pszName; }
     116             254 :     int                 GetLayerCount() { return nLayers; }
     117                 :     OGRLayer            *GetLayer( int );
     118                 :     void                AddLayer( OGRS57Layer * );
     119                 :     int                 TestCapability( const char * );
     120                 : 
     121              16 :     OGRSpatialReference *GetSpatialRef() { return poSpatialRef; }
     122                 : 
     123              32 :     int                 GetModuleCount() { return nModules; }
     124                 :     S57Reader          *GetModule( int );
     125               0 :     S57Writer          *GetWriter() { return poWriter; }
     126                 : 
     127                 :     OGRErr      GetDSExtent(OGREnvelope *psExtent, int bForce = TRUE);
     128                 : };
     129                 : 
     130                 : /************************************************************************/
     131                 : /*                            OGRS57Driver                              */
     132                 : /************************************************************************/
     133                 : 
     134                 : class OGRS57Driver : public OGRSFDriver
     135                 : {
     136                 :     static S57ClassRegistrar *poRegistrar;
     137                 : 
     138                 :   public:
     139                 :                  OGRS57Driver();
     140                 :                 ~OGRS57Driver();
     141                 :                 
     142                 :     const char *GetName();
     143                 :     OGRDataSource *Open( const char *, int );
     144                 :     virtual OGRDataSource *CreateDataSource( const char *pszName,
     145                 :                                              char ** = NULL );
     146                 :     int                 TestCapability( const char * );
     147                 : 
     148                 :     static S57ClassRegistrar *GetS57Registrar();
     149                 : };
     150                 : 
     151                 : #endif /* ndef _OGR_S57_H_INCLUDED */

Generated by: LCOV version 1.7