LTP GCOV extension - code coverage report
Current view: directory - ogr/ogrsf_frmts/tiger - tigerpip.cpp
Test: gdal_filtered.info
Date: 2010-07-12 Instrumented lines: 19
Code covered: 0.0 % Executed lines: 0

       1                 : /******************************************************************************
       2                 :  * $Id: tigerpip.cpp 10645 2007-01-18 02:22:39Z warmerdam $
       3                 :  *
       4                 :  * Project:  TIGER/Line Translator
       5                 :  * Purpose:  Implements TigerPIP, providing access to .RTP files.
       6                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 1999, Frank Warmerdam
      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                 : #include "ogr_tiger.h"
      31                 : #include "cpl_conv.h"
      32                 : 
      33                 : CPL_CVSID("$Id: tigerpip.cpp 10645 2007-01-18 02:22:39Z warmerdam $");
      34                 : 
      35                 : #define FILE_CODE "P"
      36                 : 
      37                 : static TigerFieldInfo rtP_2002_fields[] = {
      38                 :   // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet bWrite
      39                 :   { "MODULE",     ' ', ' ', OFTString,     0,   0,   8,       1,   0,     0 },
      40                 :   { "FILE",       'L', 'N', OFTInteger,    6,  10,   5,       1,   1,     1 },
      41                 :   { "CENID",      'L', 'A', OFTString,    11,  15,   5,       1,   1,     1 },
      42                 :   { "POLYID",     'R', 'N', OFTInteger,   16,  25,  10,       1,   1,     1 },
      43                 :   { "POLYLONG",   'R', 'N', OFTInteger,   26,  35,  10,       1,   1,     1 },
      44                 :   { "POLYLAT",    'R', 'N', OFTInteger,   36,  44,   9,       1,   1,     1 },
      45                 :   { "WATER",      'L', 'N', OFTInteger,   45,  45,   1,       1,   1,     1 },
      46                 : };
      47                 : static TigerRecordInfo rtP_2002_info =
      48                 :   {
      49                 :     rtP_2002_fields,
      50                 :     sizeof(rtP_2002_fields) / sizeof(TigerFieldInfo),
      51                 :     45
      52                 :   };
      53                 : 
      54                 : static TigerFieldInfo rtP_fields[] = {
      55                 :   // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet bWrite
      56                 :   { "MODULE",     ' ', ' ', OFTString,     0,   0,   8,       1,   0,     0 },
      57                 :   { "FILE",       'L', 'N', OFTString,     6,  10,   5,       1,   1,     1 },
      58                 :   { "STATE",      'L', 'N', OFTInteger,    6,   7,   2,       1,   1,     1 },
      59                 :   { "COUNTY",     'L', 'N', OFTInteger,    8,  10,   3,       1,   1,     1 },
      60                 :   { "CENID",      'L', 'A', OFTString,    11,  15,   5,       1,   1,     1 },
      61                 :   { "POLYID",     'R', 'N', OFTInteger,   16,  25,  10,       1,   1,     1 }
      62                 : };
      63                 : static TigerRecordInfo rtP_info =
      64                 :   {
      65                 :     rtP_fields,
      66                 :     sizeof(rtP_fields) / sizeof(TigerFieldInfo),
      67                 :     44
      68                 :   };
      69                 : 
      70                 : 
      71                 : /************************************************************************/
      72                 : /*                              TigerPIP()                              */
      73                 : /************************************************************************/
      74                 : 
      75                 : TigerPIP::TigerPIP( OGRTigerDataSource * poDSIn,
      76               0 :                             const char * pszPrototypeModule ) 
      77               0 :   : TigerPoint(TRUE)
      78                 : {
      79               0 :     poDS = poDSIn;
      80               0 :     poFeatureDefn = new OGRFeatureDefn( "PIP" );
      81               0 :     poFeatureDefn->Reference();
      82               0 :     poFeatureDefn->SetGeomType( wkbPoint );
      83                 : 
      84               0 :     if (poDS->GetVersion() >= TIGER_2002) {
      85               0 :         psRTPInfo = &rtP_2002_info;
      86                 :     } else {
      87               0 :         psRTPInfo = &rtP_info;
      88                 :     }
      89               0 :     AddFieldDefns( psRTPInfo, poFeatureDefn );
      90               0 : }
      91                 : 
      92               0 : TigerPIP::~TigerPIP()
      93               0 : {}
      94                 : 
      95               0 : int TigerPIP::SetModule( const char * pszModule )
      96                 : {
      97               0 :   return TigerPoint::SetModule( pszModule, FILE_CODE );
      98                 : }
      99                 : 
     100               0 : OGRFeature *TigerPIP::GetFeature( int nRecordId )
     101                 : {
     102                 :   return TigerPoint::GetFeature( nRecordId,
     103                 :                                  psRTPInfo,
     104                 :                                  26, 35,
     105               0 :                                  36, 44 );
     106                 : }
     107                 : 
     108               0 : OGRErr TigerPIP::CreateFeature( OGRFeature *poFeature )
     109                 : {
     110                 :   return TigerPoint::CreateFeature( poFeature, 
     111                 :                                     psRTPInfo,
     112                 :                                     26,
     113               0 :                                     FILE_CODE );
     114                 : }
     115                 : 

Generated by: LTP GCOV extension version 1.5