Line data Source code
1 : /******************************************************************************
2 : *
3 : * Project: TIGER/Line Translator
4 : * Purpose: Implements TigerFeatureIds, providing access to .RT5 files.
5 : * Author: Frank Warmerdam, warmerdam@pobox.com
6 : *
7 : ******************************************************************************
8 : * Copyright (c) 1999, Frank Warmerdam
9 : *
10 : * SPDX-License-Identifier: MIT
11 : ****************************************************************************/
12 :
13 : #include "ogr_tiger.h"
14 : #include "cpl_conv.h"
15 :
16 : static const char FILE_CODE[] = "5";
17 :
18 : static const TigerFieldInfo rt5_2002_fields[] = {
19 : // fieldname fmt type OFTType beg end len bDefine bSet
20 : {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
21 : {"FILE", 'L', 'N', OFTInteger, 6, 10, 5, 1, 1},
22 : {"FEAT", 'R', 'N', OFTInteger, 11, 18, 8, 1, 1},
23 : {"FEDIRP", 'L', 'A', OFTString, 19, 20, 2, 1, 1},
24 : {"FENAME", 'L', 'A', OFTString, 21, 50, 30, 1, 1},
25 : {"FETYPE", 'L', 'A', OFTString, 51, 54, 4, 1, 1},
26 : {"FEDIRS", 'L', 'A', OFTString, 55, 56, 2, 1, 1},
27 : };
28 : static const TigerRecordInfo rt5_2002_info = {
29 : rt5_2002_fields, sizeof(rt5_2002_fields) / sizeof(TigerFieldInfo), 56};
30 :
31 : static const TigerFieldInfo rt5_fields[] = {
32 : // fieldname fmt type OFTType beg end len bDefine bSet
33 : {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
34 : {"FILE", 'L', 'N', OFTString, 2, 6, 5, 1, 1},
35 : {"STATE", 'L', 'N', OFTInteger, 2, 3, 2, 1, 1},
36 : {"COUNTY", 'L', 'N', OFTInteger, 4, 6, 3, 1, 1},
37 : {"FEAT", 'R', 'N', OFTInteger, 7, 14, 8, 1, 1},
38 : {"FEDIRP", 'L', 'A', OFTString, 15, 16, 2, 1, 1},
39 : {"FENAME", 'L', 'A', OFTString, 17, 46, 30, 1, 1},
40 : {"FETYPE", 'L', 'A', OFTString, 47, 50, 4, 1, 1},
41 : {"FEDIRS", 'L', 'A', OFTString, 51, 52, 2, 1, 1}};
42 :
43 : static const TigerRecordInfo rt5_info = {
44 : rt5_fields, sizeof(rt5_fields) / sizeof(TigerFieldInfo), 52};
45 :
46 : /************************************************************************/
47 : /* TigerFeatureIds() */
48 : /************************************************************************/
49 :
50 0 : TigerFeatureIds::TigerFeatureIds(OGRTigerDataSource *poDSIn,
51 0 : CPL_UNUSED const char *pszPrototypeModule)
52 0 : : TigerFileBase(nullptr, FILE_CODE)
53 : {
54 0 : poDS = poDSIn;
55 0 : poFeatureDefn = new OGRFeatureDefn("FeatureIds");
56 0 : poFeatureDefn->Reference();
57 0 : poFeatureDefn->SetGeomType(wkbNone);
58 :
59 0 : if (poDS->GetVersion() >= TIGER_2002)
60 : {
61 0 : psRTInfo = &rt5_2002_info;
62 : }
63 : else
64 : {
65 0 : psRTInfo = &rt5_info;
66 : }
67 :
68 0 : AddFieldDefns(psRTInfo, poFeatureDefn);
69 0 : }
|