LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/tiger - tigerentitynames.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 0 14 0.0 %
Date: 2024-11-21 22:18:42 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  TIGER/Line Translator
       4             :  * Purpose:  Implements TigerEntityNames, providing access to .RTC files.
       5             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 1999, Frank Warmerdam
       9             :  * Copyright (c) 2011, Even Rouault <even dot rouault at spatialys.com>
      10             :  *
      11             :  * SPDX-License-Identifier: MIT
      12             :  ****************************************************************************/
      13             : 
      14             : #include "ogr_tiger.h"
      15             : #include "cpl_conv.h"
      16             : 
      17             : static const char C_FILE_CODE[] = "C";
      18             : 
      19             : static const TigerFieldInfo rtC_2002_fields[] = {
      20             :     // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet
      21             :     {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
      22             :     {"STATE", 'L', 'N', OFTInteger, 6, 7, 2, 1, 1},
      23             :     {"COUNTY", 'L', 'N', OFTInteger, 8, 10, 3, 1, 1},
      24             :     {"DATAYR", 'L', 'A', OFTString, 11, 14, 4, 1, 1},
      25             :     {"FIPS", 'L', 'N', OFTInteger, 15, 19, 5, 1, 1},
      26             :     {"FIPSCC", 'L', 'A', OFTString, 20, 21, 2, 1, 1},
      27             :     {"PLACEDC", 'L', 'A', OFTString, 22, 22, 1, 1, 1},
      28             :     {"LSADC", 'L', 'A', OFTString, 23, 24, 2, 1, 1},
      29             :     {"ENTITY", 'L', 'A', OFTString, 25, 25, 1, 1, 1},
      30             :     {"MA", 'L', 'N', OFTInteger, 26, 29, 4, 1, 1},
      31             :     {"SD", 'L', 'N', OFTInteger, 30, 34, 5, 1, 1},
      32             :     {"AIANHH", 'L', 'N', OFTInteger, 35, 38, 4, 1, 1},
      33             :     {"VTDTRACT", 'R', 'A', OFTString, 39, 44, 6, 1, 1},
      34             :     {"UAUGA", 'L', 'N', OFTInteger, 45, 49, 5, 1, 1},
      35             :     {"AITSCE", 'L', 'N', OFTInteger, 50, 52, 3, 1, 1},
      36             :     {"RS_C1", 'L', 'N', OFTInteger, 53, 54, 2, 1, 1},
      37             :     {"RS_C2", 'L', 'N', OFTInteger, 55, 62, 8, 1, 1},
      38             :     {"NAME", 'L', 'A', OFTString, 63, 122, 60, 1, 1},
      39             : };
      40             : static const TigerRecordInfo rtC_2002_info = {
      41             :     rtC_2002_fields, sizeof(rtC_2002_fields) / sizeof(TigerFieldInfo), 122};
      42             : 
      43             : static const TigerFieldInfo rtC_2000_Redistricting_fields[] = {
      44             :     // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet
      45             :     {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
      46             :     {"STATE", 'L', 'N', OFTInteger, 6, 7, 2, 1, 1},
      47             :     {"COUNTY", 'L', 'N', OFTInteger, 8, 10, 3, 1, 1},
      48             :     {"FIPSYR", 'L', 'N', OFTString, 11, 14, 4, 1, 1},
      49             :     {"FIPS", 'L', 'N', OFTInteger, 15, 19, 5, 1, 1},
      50             :     {"FIPSCC", 'L', 'A', OFTString, 20, 21, 2, 1, 1},
      51             :     {"PDC", 'L', 'A', OFTString, 22, 22, 1, 1, 1},
      52             :     {"LASAD", 'L', 'A', OFTString, 23, 24, 2, 1, 1},
      53             :     {"ENTITY", 'L', 'A', OFTString, 25, 25, 1, 1, 1},
      54             :     {"MA", 'L', 'N', OFTInteger, 26, 29, 4, 1, 1},
      55             :     {"SD", 'L', 'N', OFTInteger, 30, 34, 5, 1, 1},
      56             :     {"AIR", 'L', 'N', OFTInteger, 35, 38, 4, 1, 1},
      57             :     {"VTD", 'R', 'A', OFTString, 39, 44, 6, 1, 1},
      58             :     {"UA", 'L', 'N', OFTInteger, 45, 49, 5, 1, 1},
      59             :     {"AITSCE", 'L', 'N', OFTInteger, 50, 52, 3, 1, 1},
      60             :     {"NAME", 'L', 'A', OFTString, 53, 112, 66, 1, 1}};
      61             : static const TigerRecordInfo rtC_2000_Redistricting_info = {
      62             :     rtC_2000_Redistricting_fields,
      63             :     sizeof(rtC_2000_Redistricting_fields) / sizeof(TigerFieldInfo), 112};
      64             : 
      65             : static const TigerFieldInfo rtC_fields[] = {
      66             :     // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet
      67             :     {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
      68             :     {"STATE", 'L', 'N', OFTInteger, 6, 7, 2, 1, 1},
      69             :     {"COUNTY", 'L', 'N', OFTInteger, 8, 10, 3, 1, 1},
      70             :     {"FIPSYR", 'L', 'N', OFTString, 11, 12, 4, 1, 1},
      71             :     {"FIPS", 'L', 'N', OFTInteger, 13, 17, 5, 1, 1},
      72             :     {"FIPSCC", 'L', 'A', OFTString, 18, 19, 2, 1, 1},
      73             :     {"PDC", 'L', 'A', OFTString, 20, 20, 1, 1, 1},
      74             :     {"LASAD", 'L', 'A', OFTString, 21, 22, 2, 1, 1},
      75             :     {"ENTITY", 'L', 'A', OFTString, 23, 23, 1, 1, 1},
      76             :     {"MA", 'L', 'N', OFTInteger, 24, 27, 4, 1, 1},
      77             :     {"SD", 'L', 'N', OFTInteger, 28, 32, 5, 1, 1},
      78             :     {"AIR", 'L', 'N', OFTInteger, 33, 36, 4, 1, 1},
      79             :     {"VTD", 'R', 'A', OFTString, 37, 42, 6, 1, 1},
      80             :     {"UA", 'L', 'N', OFTInteger, 43, 46, 4, 1, 1},
      81             :     {"NAME", 'L', 'A', OFTString, 47, 112, 66, 1, 1}};
      82             : static const TigerRecordInfo rtC_info = {
      83             :     rtC_fields, sizeof(rtC_fields) / sizeof(TigerFieldInfo), 112};
      84             : 
      85             : /************************************************************************/
      86             : /*                          TigerEntityNames()                          */
      87             : /************************************************************************/
      88             : 
      89           0 : TigerEntityNames::TigerEntityNames(OGRTigerDataSource *poDSIn,
      90           0 :                                    CPL_UNUSED const char *pszPrototypeModule)
      91           0 :     : TigerFileBase(nullptr, C_FILE_CODE)
      92             : {
      93           0 :     poDS = poDSIn;
      94           0 :     poFeatureDefn = new OGRFeatureDefn("EntityNames");
      95           0 :     poFeatureDefn->Reference();
      96           0 :     poFeatureDefn->SetGeomType(wkbPoint);
      97             : 
      98           0 :     if (poDS->GetVersion() >= TIGER_2002)
      99             :     {
     100           0 :         psRTInfo = &rtC_2002_info;
     101             :     }
     102           0 :     else if (poDS->GetVersion() >= TIGER_2000_Redistricting)
     103             :     {
     104           0 :         psRTInfo = &rtC_2000_Redistricting_info;
     105             :     }
     106             :     else
     107             :     {
     108           0 :         psRTInfo = &rtC_info;
     109             :     }
     110             : 
     111           0 :     AddFieldDefns(psRTInfo, poFeatureDefn);
     112           0 : }

Generated by: LCOV version 1.14