Line data Source code
1 : /******************************************************************************
2 : *
3 : * Project: TIGER/Line Translator
4 : * Purpose: Implements TigerPIP, providing access to .RTP 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 P_FILE_CODE[] = "P";
17 :
18 : static const TigerFieldInfo rtP_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 : {"POLYID", 'R', 'N', OFTInteger, 16, 25, 10, 1, 1},
24 : {"POLYLONG", 'R', 'N', OFTInteger, 26, 35, 10, 1, 1},
25 : {"POLYLAT", 'R', 'N', OFTInteger, 36, 44, 9, 1, 1},
26 : {"WATER", 'L', 'N', OFTInteger, 45, 45, 1, 1, 1},
27 : };
28 : static const TigerRecordInfo rtP_2002_info = {
29 : rtP_2002_fields, sizeof(rtP_2002_fields) / sizeof(TigerFieldInfo), 45};
30 :
31 : static const TigerFieldInfo rtP_fields[] = {
32 : // fieldname fmt type OFTType beg end len bDefine bSet
33 : {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
34 : {"FILE", 'L', 'N', OFTString, 6, 10, 5, 1, 1},
35 : {"STATE", 'L', 'N', OFTInteger, 6, 7, 2, 1, 1},
36 : {"COUNTY", 'L', 'N', OFTInteger, 8, 10, 3, 1, 1},
37 : {"CENID", 'L', 'A', OFTString, 11, 15, 5, 1, 1},
38 : {"POLYID", 'R', 'N', OFTInteger, 16, 25, 10, 1, 1}};
39 : static const TigerRecordInfo rtP_info = {
40 : rtP_fields, sizeof(rtP_fields) / sizeof(TigerFieldInfo), 44};
41 :
42 : /************************************************************************/
43 : /* TigerPIP() */
44 : /************************************************************************/
45 :
46 0 : TigerPIP::TigerPIP(OGRTigerDataSource *poDSIn,
47 0 : CPL_UNUSED const char *pszPrototypeModule)
48 0 : : TigerPoint(nullptr, P_FILE_CODE)
49 : {
50 0 : poDS = poDSIn;
51 0 : poFeatureDefn = new OGRFeatureDefn("PIP");
52 0 : poFeatureDefn->Reference();
53 0 : poFeatureDefn->SetGeomType(wkbPoint);
54 :
55 0 : if (poDS->GetVersion() >= TIGER_2002)
56 : {
57 0 : psRTInfo = &rtP_2002_info;
58 : }
59 : else
60 : {
61 0 : psRTInfo = &rtP_info;
62 : }
63 0 : AddFieldDefns(psRTInfo, poFeatureDefn);
64 0 : }
65 :
66 0 : OGRFeature *TigerPIP::GetFeature(int nRecordId)
67 : {
68 0 : return TigerPoint::GetFeature(nRecordId, 26, 35, 36, 44);
69 : }
|