Line data Source code
1 : /******************************************************************************
2 : *
3 : * Project: TIGER/Line Translator
4 : * Purpose: Implements TigerPolyChainLink, providing access to .RTI 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 I_FILE_CODE[] = "I";
17 :
18 : static const TigerFieldInfo rtI_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 : {"TLID", 'R', 'N', OFTInteger, 11, 20, 10, 1, 1},
23 : {"TZIDS", 'R', 'N', OFTInteger, 21, 30, 10, 1, 1},
24 : {"TZIDE", 'R', 'N', OFTInteger, 31, 40, 10, 1, 1},
25 : {"CENIDL", 'L', 'A', OFTString, 41, 45, 5, 1, 1},
26 : {"POLYIDL", 'R', 'N', OFTInteger, 46, 55, 10, 1, 1},
27 : {"CENIDR", 'L', 'A', OFTString, 56, 60, 5, 1, 1},
28 : {"POLYIDR", 'R', 'N', OFTInteger, 61, 70, 10, 1, 1},
29 : {"SOURCE", 'L', 'A', OFTString, 71, 80, 10, 1, 1},
30 : {"FTSEG", 'L', 'A', OFTString, 81, 97, 17, 1, 1},
31 : {"RS_I1", 'L', 'A', OFTString, 98, 107, 10, 1, 1},
32 : {"RS_I2", 'L', 'A', OFTString, 108, 117, 10, 1, 1},
33 : {"RS_I3", 'L', 'A', OFTString, 118, 127, 10, 1, 1},
34 : };
35 : static const TigerRecordInfo rtI_2002_info = {
36 : rtI_2002_fields, sizeof(rtI_2002_fields) / sizeof(TigerFieldInfo), 127};
37 :
38 : static const TigerFieldInfo rtI_fields[] = {
39 : // fieldname fmt type OFTType beg end len bDefine bSet
40 : {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
41 : {"TLID", 'R', 'N', OFTInteger, 6, 15, 10, 1, 1},
42 : {"FILE", 'L', 'N', OFTString, 16, 20, 5, 1, 1},
43 : {"STATE", 'L', 'N', OFTInteger, 16, 17, 2, 1, 1},
44 : {"COUNTY", 'L', 'N', OFTInteger, 18, 20, 3, 1, 1},
45 : {"RTLINK", 'L', 'A', OFTString, 21, 21, 1, 1, 1},
46 : {"CENIDL", 'L', 'A', OFTString, 22, 26, 5, 1, 1},
47 : {"POLYIDL", 'R', 'N', OFTInteger, 27, 36, 10, 1, 1},
48 : {"CENIDR", 'L', 'A', OFTString, 37, 41, 5, 1, 1},
49 : {"POLYIDR", 'R', 'N', OFTInteger, 42, 51, 10, 1, 1}};
50 : static const TigerRecordInfo rtI_info = {
51 : rtI_fields, sizeof(rtI_fields) / sizeof(TigerFieldInfo), 52};
52 :
53 : /************************************************************************/
54 : /* TigerPolyChainLink() */
55 : /************************************************************************/
56 :
57 0 : TigerPolyChainLink::TigerPolyChainLink(
58 0 : OGRTigerDataSource *poDSIn, CPL_UNUSED const char *pszPrototypeModule)
59 0 : : TigerFileBase(nullptr, I_FILE_CODE)
60 : {
61 0 : OGRFieldDefn oField("", OFTInteger);
62 :
63 0 : poDS = poDSIn;
64 0 : poFeatureDefn = new OGRFeatureDefn("PolyChainLink");
65 0 : poFeatureDefn->Reference();
66 0 : poFeatureDefn->SetGeomType(wkbNone);
67 :
68 0 : if (poDS->GetVersion() >= TIGER_2002)
69 : {
70 0 : psRTInfo = &rtI_2002_info;
71 : }
72 : else
73 : {
74 0 : psRTInfo = &rtI_info;
75 : }
76 :
77 : /* -------------------------------------------------------------------- */
78 : /* Fields from type I record. */
79 : /* -------------------------------------------------------------------- */
80 :
81 0 : AddFieldDefns(psRTInfo, poFeatureDefn);
82 0 : }
|