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-04-29 17:29:47 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             :  * 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             : static const char C_FILE_CODE[] = "C";
      34             : 
      35             : static const TigerFieldInfo rtC_2002_fields[] = {
      36             :     // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet
      37             :     {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
      38             :     {"STATE", 'L', 'N', OFTInteger, 6, 7, 2, 1, 1},
      39             :     {"COUNTY", 'L', 'N', OFTInteger, 8, 10, 3, 1, 1},
      40             :     {"DATAYR", 'L', 'A', OFTString, 11, 14, 4, 1, 1},
      41             :     {"FIPS", 'L', 'N', OFTInteger, 15, 19, 5, 1, 1},
      42             :     {"FIPSCC", 'L', 'A', OFTString, 20, 21, 2, 1, 1},
      43             :     {"PLACEDC", 'L', 'A', OFTString, 22, 22, 1, 1, 1},
      44             :     {"LSADC", 'L', 'A', OFTString, 23, 24, 2, 1, 1},
      45             :     {"ENTITY", 'L', 'A', OFTString, 25, 25, 1, 1, 1},
      46             :     {"MA", 'L', 'N', OFTInteger, 26, 29, 4, 1, 1},
      47             :     {"SD", 'L', 'N', OFTInteger, 30, 34, 5, 1, 1},
      48             :     {"AIANHH", 'L', 'N', OFTInteger, 35, 38, 4, 1, 1},
      49             :     {"VTDTRACT", 'R', 'A', OFTString, 39, 44, 6, 1, 1},
      50             :     {"UAUGA", 'L', 'N', OFTInteger, 45, 49, 5, 1, 1},
      51             :     {"AITSCE", 'L', 'N', OFTInteger, 50, 52, 3, 1, 1},
      52             :     {"RS_C1", 'L', 'N', OFTInteger, 53, 54, 2, 1, 1},
      53             :     {"RS_C2", 'L', 'N', OFTInteger, 55, 62, 8, 1, 1},
      54             :     {"NAME", 'L', 'A', OFTString, 63, 122, 60, 1, 1},
      55             : };
      56             : static const TigerRecordInfo rtC_2002_info = {
      57             :     rtC_2002_fields, sizeof(rtC_2002_fields) / sizeof(TigerFieldInfo), 122};
      58             : 
      59             : static const TigerFieldInfo rtC_2000_Redistricting_fields[] = {
      60             :     // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet
      61             :     {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
      62             :     {"STATE", 'L', 'N', OFTInteger, 6, 7, 2, 1, 1},
      63             :     {"COUNTY", 'L', 'N', OFTInteger, 8, 10, 3, 1, 1},
      64             :     {"FIPSYR", 'L', 'N', OFTString, 11, 14, 4, 1, 1},
      65             :     {"FIPS", 'L', 'N', OFTInteger, 15, 19, 5, 1, 1},
      66             :     {"FIPSCC", 'L', 'A', OFTString, 20, 21, 2, 1, 1},
      67             :     {"PDC", 'L', 'A', OFTString, 22, 22, 1, 1, 1},
      68             :     {"LASAD", 'L', 'A', OFTString, 23, 24, 2, 1, 1},
      69             :     {"ENTITY", 'L', 'A', OFTString, 25, 25, 1, 1, 1},
      70             :     {"MA", 'L', 'N', OFTInteger, 26, 29, 4, 1, 1},
      71             :     {"SD", 'L', 'N', OFTInteger, 30, 34, 5, 1, 1},
      72             :     {"AIR", 'L', 'N', OFTInteger, 35, 38, 4, 1, 1},
      73             :     {"VTD", 'R', 'A', OFTString, 39, 44, 6, 1, 1},
      74             :     {"UA", 'L', 'N', OFTInteger, 45, 49, 5, 1, 1},
      75             :     {"AITSCE", 'L', 'N', OFTInteger, 50, 52, 3, 1, 1},
      76             :     {"NAME", 'L', 'A', OFTString, 53, 112, 66, 1, 1}};
      77             : static const TigerRecordInfo rtC_2000_Redistricting_info = {
      78             :     rtC_2000_Redistricting_fields,
      79             :     sizeof(rtC_2000_Redistricting_fields) / sizeof(TigerFieldInfo), 112};
      80             : 
      81             : static const TigerFieldInfo rtC_fields[] = {
      82             :     // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet
      83             :     {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
      84             :     {"STATE", 'L', 'N', OFTInteger, 6, 7, 2, 1, 1},
      85             :     {"COUNTY", 'L', 'N', OFTInteger, 8, 10, 3, 1, 1},
      86             :     {"FIPSYR", 'L', 'N', OFTString, 11, 12, 4, 1, 1},
      87             :     {"FIPS", 'L', 'N', OFTInteger, 13, 17, 5, 1, 1},
      88             :     {"FIPSCC", 'L', 'A', OFTString, 18, 19, 2, 1, 1},
      89             :     {"PDC", 'L', 'A', OFTString, 20, 20, 1, 1, 1},
      90             :     {"LASAD", 'L', 'A', OFTString, 21, 22, 2, 1, 1},
      91             :     {"ENTITY", 'L', 'A', OFTString, 23, 23, 1, 1, 1},
      92             :     {"MA", 'L', 'N', OFTInteger, 24, 27, 4, 1, 1},
      93             :     {"SD", 'L', 'N', OFTInteger, 28, 32, 5, 1, 1},
      94             :     {"AIR", 'L', 'N', OFTInteger, 33, 36, 4, 1, 1},
      95             :     {"VTD", 'R', 'A', OFTString, 37, 42, 6, 1, 1},
      96             :     {"UA", 'L', 'N', OFTInteger, 43, 46, 4, 1, 1},
      97             :     {"NAME", 'L', 'A', OFTString, 47, 112, 66, 1, 1}};
      98             : static const TigerRecordInfo rtC_info = {
      99             :     rtC_fields, sizeof(rtC_fields) / sizeof(TigerFieldInfo), 112};
     100             : 
     101             : /************************************************************************/
     102             : /*                          TigerEntityNames()                          */
     103             : /************************************************************************/
     104             : 
     105           0 : TigerEntityNames::TigerEntityNames(OGRTigerDataSource *poDSIn,
     106           0 :                                    CPL_UNUSED const char *pszPrototypeModule)
     107           0 :     : TigerFileBase(nullptr, C_FILE_CODE)
     108             : {
     109           0 :     poDS = poDSIn;
     110           0 :     poFeatureDefn = new OGRFeatureDefn("EntityNames");
     111           0 :     poFeatureDefn->Reference();
     112           0 :     poFeatureDefn->SetGeomType(wkbPoint);
     113             : 
     114           0 :     if (poDS->GetVersion() >= TIGER_2002)
     115             :     {
     116           0 :         psRTInfo = &rtC_2002_info;
     117             :     }
     118           0 :     else if (poDS->GetVersion() >= TIGER_2000_Redistricting)
     119             :     {
     120           0 :         psRTInfo = &rtC_2000_Redistricting_info;
     121             :     }
     122             :     else
     123             :     {
     124           0 :         psRTInfo = &rtC_info;
     125             :     }
     126             : 
     127           0 :     AddFieldDefns(psRTInfo, poFeatureDefn);
     128           0 : }

Generated by: LCOV version 1.14