LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/tiger - tigerpolychainlink.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 12 11 91.7 %
Date: 2011-12-18 Functions: 2 1 50.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: tigerpolychainlink.cpp 22961 2011-08-20 17:09:59Z rouault $
       3                 :  *
       4                 :  * Project:  TIGER/Line Translator
       5                 :  * Purpose:  Implements TigerPolyChainLink, providing access to .RTI 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: tigerpolychainlink.cpp 22961 2011-08-20 17:09:59Z rouault $");
      34                 : 
      35                 : #define FILE_CODE "I"
      36                 : 
      37                 : static const TigerFieldInfo rtI_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                 :   { "TLID",       'R', 'N', OFTInteger,   11,  20,  10,       1,   1,     1 },
      42                 :   { "TZIDS",      'R', 'N', OFTInteger,   21,  30,  10,       1,   1,     1 },
      43                 :   { "TZIDE",      'R', 'N', OFTInteger,   31,  40,  10,       1,   1,     1 },
      44                 :   { "CENIDL",     'L', 'A', OFTString,    41,  45,   5,       1,   1,     1 },
      45                 :   { "POLYIDL",    'R', 'N', OFTInteger,   46,  55,  10,       1,   1,     1 },
      46                 :   { "CENIDR",     'L', 'A', OFTString,    56,  60,   5,       1,   1,     1 },
      47                 :   { "POLYIDR",    'R', 'N', OFTInteger,   61,  70,  10,       1,   1,     1 },
      48                 :   { "SOURCE",     'L', 'A', OFTString,    71,  80,  10,       1,   1,     1 },
      49                 :   { "FTSEG",      'L', 'A', OFTString,    81,  97,  17,       1,   1,     1 },
      50                 :   { "RS_I1",      'L', 'A', OFTString,    98, 107,  10,       1,   1,     1 },
      51                 :   { "RS_I2",      'L', 'A', OFTString,   108, 117,  10,       1,   1,     1 },
      52                 :   { "RS_I3",      'L', 'A', OFTString,   118, 127,  10,       1,   1,     1 },
      53                 : };
      54                 : static const TigerRecordInfo rtI_2002_info =
      55                 :   {
      56                 :     rtI_2002_fields,
      57                 :     sizeof(rtI_2002_fields) / sizeof(TigerFieldInfo),
      58                 :     127
      59                 :   };
      60                 : 
      61                 : static const TigerFieldInfo rtI_fields[] = {
      62                 :   // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet bWrite
      63                 :   { "MODULE",     ' ', ' ', OFTString,     0,   0,   8,       1,   0,     0 },
      64                 :   { "TLID",       'R', 'N', OFTInteger,    6,  15,  10,       1,   1,     1 },
      65                 :   { "FILE",       'L', 'N', OFTString,    16,  20,   5,       1,   1,     1 },
      66                 :   { "STATE",      'L', 'N', OFTInteger,   16,  17,   2,       1,   1,     1 },
      67                 :   { "COUNTY",     'L', 'N', OFTInteger,   18,  20,   3,       1,   1,     1 },
      68                 :   { "RTLINK",     'L', 'A', OFTString,    21,  21,   1,       1,   1,     1 },
      69                 :   { "CENIDL",     'L', 'A', OFTString,    22,  26,   5,       1,   1,     1 },
      70                 :   { "POLYIDL",    'R', 'N', OFTInteger,   27,  36,  10,       1,   1,     1 },
      71                 :   { "CENIDR",     'L', 'A', OFTString,    37,  41,   5,       1,   1,     1 },
      72                 :   { "POLYIDR",    'R', 'N', OFTInteger,   42,  51,  10,       1,   1,     1 }
      73                 : };
      74                 : static const TigerRecordInfo rtI_info =
      75                 :   {
      76                 :     rtI_fields,
      77                 :     sizeof(rtI_fields) / sizeof(TigerFieldInfo),
      78                 :     52
      79                 :   };
      80                 : 
      81                 : 
      82                 : /************************************************************************/
      83                 : /*                         TigerPolyChainLink()                         */
      84                 : /************************************************************************/
      85                 : 
      86               7 : TigerPolyChainLink::TigerPolyChainLink( OGRTigerDataSource * poDSIn,
      87               7 :                                   const char * pszPrototypeModule ) : TigerFileBase(NULL, FILE_CODE)
      88                 : 
      89                 : {
      90               7 :     OGRFieldDefn        oField("",OFTInteger);
      91                 : 
      92               7 :     poDS = poDSIn;
      93               7 :     poFeatureDefn = new OGRFeatureDefn( "PolyChainLink" );
      94               7 :     poFeatureDefn->Reference();
      95               7 :     poFeatureDefn->SetGeomType( wkbNone );
      96                 : 
      97               7 :     if (poDS->GetVersion() >= TIGER_2002) {
      98               7 :       psRTInfo = &rtI_2002_info;
      99                 :     } else {
     100               0 :       psRTInfo = &rtI_info;
     101                 :     }
     102                 : 
     103                 :     /* -------------------------------------------------------------------- */
     104                 :     /*      Fields from type I record.                                      */
     105                 :     /* -------------------------------------------------------------------- */
     106                 : 
     107               7 :     AddFieldDefns( psRTInfo, poFeatureDefn );
     108               7 : }

Generated by: LCOV version 1.7