Line data Source code
1 : /******************************************************************************
2 : *
3 : * Project: TIGER/Line Translator
4 : * Purpose: Implements TigerTLIDRange, providing access to .RTR files.
5 : * Author: Frank Warmerdam, warmerda@home.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 R_FILE_CODE[] = "R";
17 :
18 : static const TigerFieldInfo rtR_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 : {"CENID", 'L', 'A', OFTString, 11, 15, 5, 1, 1},
23 : {"TLMAXID", 'R', 'N', OFTInteger, 16, 25, 10, 1, 1},
24 : {"TLMINID", 'R', 'N', OFTInteger, 26, 35, 10, 1, 1},
25 : {"TLIGHID", 'R', 'N', OFTInteger, 36, 45, 10, 1, 1},
26 : {"TZMAXID", 'R', 'N', OFTInteger, 46, 55, 10, 1, 1},
27 : {"TZMINID", 'R', 'N', OFTInteger, 56, 65, 10, 1, 1},
28 : {"TZHIGHID", 'R', 'N', OFTInteger, 66, 75, 10, 1, 1},
29 : {"FILLER", 'L', 'A', OFTString, 76, 76, 1, 1, 1},
30 : };
31 : static const TigerRecordInfo rtR_2002_info = {
32 : rtR_2002_fields, sizeof(rtR_2002_fields) / sizeof(TigerFieldInfo), 76};
33 :
34 : static const TigerFieldInfo rtR_fields[] = {
35 : // fieldname fmt type OFTType beg end len bDefine bSet
36 : {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
37 : {"FILE", 'L', 'N', OFTString, 6, 10, 5, 1, 1},
38 : {"STATE", 'L', 'N', OFTInteger, 6, 7, 2, 1, 1},
39 : {"COUNTY", 'L', 'N', OFTInteger, 8, 10, 3, 1, 1},
40 : {"CENID", 'L', 'A', OFTString, 11, 15, 5, 1, 1},
41 : {"MAXID", 'R', 'N', OFTInteger, 16, 25, 10, 1, 1},
42 : {"MINID", 'R', 'N', OFTInteger, 26, 35, 10, 1, 1},
43 : {"HIGHID", 'R', 'N', OFTInteger, 36, 45, 10, 1, 1}};
44 :
45 : static const TigerRecordInfo rtR_info = {
46 : rtR_fields, sizeof(rtR_fields) / sizeof(TigerFieldInfo), 46};
47 :
48 : /************************************************************************/
49 : /* TigerTLIDRange() */
50 : /************************************************************************/
51 :
52 0 : TigerTLIDRange::TigerTLIDRange(OGRTigerDataSource *poDSIn,
53 0 : CPL_UNUSED const char *pszPrototypeModule)
54 0 : : TigerFileBase(nullptr, R_FILE_CODE)
55 : {
56 0 : poDS = poDSIn;
57 0 : poFeatureDefn = new OGRFeatureDefn("TLIDRange");
58 0 : poFeatureDefn->Reference();
59 0 : poFeatureDefn->SetGeomType(wkbNone);
60 :
61 0 : if (poDS->GetVersion() >= TIGER_2002)
62 : {
63 0 : psRTInfo = &rtR_2002_info;
64 : }
65 : else
66 : {
67 0 : psRTInfo = &rtR_info;
68 : }
69 :
70 : /* -------------------------------------------------------------------- */
71 : /* Fields from type R record. */
72 : /* -------------------------------------------------------------------- */
73 :
74 0 : AddFieldDefns(psRTInfo, poFeatureDefn);
75 0 : }
|