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

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_segy.h 23268 2011-10-22 09:50:46Z rouault $
       3                 :  *
       4                 :  * Project:  SEG-Y Translator
       5                 :  * Purpose:  Definition of classes for OGR SEG-Y 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, DAMSEGYS 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_SEGY_H_INCLUDED
      31                 : #define _OGR_SEGY_H_INCLUDED
      32                 : 
      33                 : #include "ogrsf_frmts.h"
      34                 : 
      35                 : GInt16 SEGYReadMSBInt16(const GByte* pabyVal);
      36                 : GInt32 SEGYReadMSBInt32(const GByte* pabyVal);
      37                 : 
      38                 : typedef struct
      39                 : {
      40                 :     int nJobIdNumber;
      41                 :     int nLineNumber;
      42                 :     int nReelNumber;
      43                 :     int nDataTracesPerEnsemble;
      44                 :     int nAuxTracesPerEnsemble;
      45                 :     int nSampleInterval;
      46                 :     int nSampleIntervalOriginal;
      47                 :     int nSamplesPerDataTrace;
      48                 :     int nSamplesPerDataTraceOriginal;
      49                 :     int nDataSampleType;
      50                 :     int nEnsembleFold;
      51                 :     int nTraceSortingCode;
      52                 :     int nVerticalSumCode;
      53                 :     int nSweepFrequencyAtStart;
      54                 :     int nSweepFrequencyAtEnd;
      55                 :     int nSweepLength;
      56                 :     int nSweepType;
      57                 :     int nTraceNumberOfSweepChannel;
      58                 :     int nSweepTraceTaperLengthAtStart;
      59                 :     int nSweepTraceTaperLengthAtEnd;
      60                 :     int nTaperType;
      61                 :     int nCorrelated;
      62                 :     int nBinaryGainRecovered;
      63                 :     int nAmplitudeRecoveryMethod;
      64                 :     int nMeasurementSystem;
      65                 :     int nImpulseSignalPolarity;
      66                 :     int nVibratoryPolaryCode;
      67                 :     int nSEGYRevisionNumber;
      68                 :     double dfSEGYRevisionNumber;
      69                 :     int nFixedLengthTraceFlag;
      70                 :     int nNumberOfExtendedTextualFileHeader;
      71                 : } SEGYBinaryFileHeader;
      72                 : 
      73                 : /************************************************************************/
      74                 : /*                          OGRSEGYLayer                                */
      75                 : /************************************************************************/
      76                 : 
      77                 : class OGRSEGYLayer: public OGRLayer
      78                 : {
      79                 :     OGRSpatialReference* poSRS;
      80                 :     OGRFeatureDefn*    poFeatureDefn;
      81                 :     int                bEOF;
      82                 :     int                nNextFID;
      83                 :     VSILFILE*          fp;
      84                 : 
      85                 :     SEGYBinaryFileHeader sBFH;
      86                 :     int                nDataSize;
      87                 : 
      88                 :     OGRFeature *       GetNextRawFeature();
      89                 : 
      90                 :   public:
      91                 :                         OGRSEGYLayer(const char* pszFilename,
      92                 :                                      VSILFILE* fp,
      93                 :                                      SEGYBinaryFileHeader* psBFH);
      94                 :                         ~OGRSEGYLayer();
      95                 : 
      96                 :     virtual OGRFeature *        GetNextFeature();
      97                 : 
      98                 :     virtual void                ResetReading();
      99                 : 
     100               1 :     virtual OGRSpatialReference *GetSpatialRef() { return poSRS; }
     101                 : 
     102               2 :     virtual OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
     103                 : 
     104               1 :     virtual int                 TestCapability( const char * ) { return FALSE; }
     105                 : };
     106                 : 
     107                 : /************************************************************************/
     108                 : /*                        OGRSEGYHeaderLayer                            */
     109                 : /************************************************************************/
     110                 : 
     111                 : class OGRSEGYHeaderLayer: public OGRLayer
     112                 : {
     113                 :     OGRFeatureDefn*    poFeatureDefn;
     114                 :     int                bEOF;
     115                 : 
     116                 :     SEGYBinaryFileHeader sBFH;
     117                 :     char*                pszHeaderText;
     118                 : 
     119                 :     OGRFeature *       GetNextRawFeature();
     120                 : 
     121                 :   public:
     122                 :                         OGRSEGYHeaderLayer(const char* pszLayerName,
     123                 :                                            SEGYBinaryFileHeader* psBFH,
     124                 :                                            char* pszHeaderText);
     125                 :                         ~OGRSEGYHeaderLayer();
     126                 : 
     127                 :     virtual OGRFeature *        GetNextFeature();
     128                 : 
     129                 :     virtual void                ResetReading();
     130                 : 
     131               1 :     virtual OGRSpatialReference *GetSpatialRef() { return NULL; }
     132                 : 
     133               2 :     virtual OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
     134                 : 
     135               1 :     virtual int                 TestCapability( const char * ) { return FALSE; }
     136                 : };
     137                 : 
     138                 : /************************************************************************/
     139                 : /*                          OGRSEGYDataSource                           */
     140                 : /************************************************************************/
     141                 : 
     142                 : class OGRSEGYDataSource : public OGRDataSource
     143                 : {
     144                 :     char*               pszName;
     145                 : 
     146                 :     OGRLayer**          papoLayers;
     147                 :     int                 nLayers;
     148                 : 
     149                 :   public:
     150                 :                         OGRSEGYDataSource();
     151                 :                         ~OGRSEGYDataSource();
     152                 : 
     153                 :     int                 Open( const char * pszFilename,
     154                 :                               int bUpdate );
     155                 : 
     156               1 :     virtual const char*         GetName() { return pszName; }
     157                 : 
     158               1 :     virtual int                 GetLayerCount() { return nLayers; }
     159                 :     virtual OGRLayer*           GetLayer( int );
     160                 : 
     161                 :     virtual int                 TestCapability( const char * );
     162                 : };
     163                 : 
     164                 : /************************************************************************/
     165                 : /*                            OGRSEGYDriver                             */
     166                 : /************************************************************************/
     167                 : 
     168                 : class OGRSEGYDriver : public OGRSFDriver
     169             178 : {
     170                 :   public:
     171                 :                 ~OGRSEGYDriver();
     172                 : 
     173                 :     virtual const char*         GetName();
     174                 :     virtual OGRDataSource*      Open( const char *, int );
     175                 :     virtual int                 TestCapability( const char * );
     176                 : };
     177                 : 
     178                 : 
     179                 : #endif /* ndef _OGR_SEGY_H_INCLUDED */

Generated by: LCOV version 1.7