Line data Source code
1 : /******************************************************************************
2 : *
3 : * Project: TIGER/Line Translator
4 : * Purpose: Implements TigerPolygonEconomic, providing access to .RTE files.
5 : * Author: Mark Phillips, mbp@geomtech.com
6 : *
7 : ******************************************************************************
8 : * Copyright (c) 2002, Frank Warmerdam, Mark Phillips
9 : *
10 : * Permission is hereby granted, free of charge, to any person obtaining a
11 : * copy of this software and associated documentation files (the "Software"),
12 : * to deal in the Software without restriction, including without limitation
13 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 : * and/or sell copies of the Software, and to permit persons to whom the
15 : * Software is furnished to do so, subject to the following conditions:
16 : *
17 : * The above copyright notice and this permission notice shall be included
18 : * in all copies or substantial portions of the Software.
19 : *
20 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 : * DEALINGS IN THE SOFTWARE.
27 : ****************************************************************************/
28 :
29 : #include "ogr_tiger.h"
30 : #include "cpl_conv.h"
31 :
32 : static const char FILE_CODE[] = "E";
33 :
34 : /* I think this was the expected RTE format, but was never deployed, leaving
35 : it in the code in case I am missing something.
36 :
37 : static TigerFieldInfo rtE_fields[] = {
38 : // fieldname fmt type OFTType beg end len bDefine bSet
39 : { "MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0 },
40 : { "FILE", 'L', 'N', OFTInteger, 6, 10, 5, 1, 1 },
41 : { "CENID", 'L', 'A', OFTString, 11, 15, 5, 1, 1 },
42 : { "POLYID", 'R', 'N', OFTInteger, 16, 25, 10, 1, 1 },
43 : { "STATEEC", 'L', 'N', OFTInteger, 26, 27, 2, 1, 1 },
44 : { "COUNTYEC", 'L', 'N', OFTInteger, 28, 30, 3, 1, 1 },
45 : { "CONCITEC", 'L', 'N', OFTInteger, 31, 35, 5, 1, 1 },
46 : { "COUSUBEC", 'L', 'N', OFTInteger, 36, 40, 5, 1, 1 },
47 : { "PLACEEC", 'L', 'N', OFTInteger, 41, 45, 5, 1, 1 },
48 : { "AIANHHFPEC", 'L', 'N', OFTInteger, 46, 50, 5, 1, 1 },
49 : { "AIANHHEC", 'L', 'N', OFTInteger, 51, 54, 4, 1, 1 },
50 : { "AIAHHTLIEC", 'L', 'A', OFTString, 55, 55, 1, 1, 1 },
51 : { "RS_E1", 'L', 'A', OFTString, 56, 73, 18, 1, 1 }
52 : };
53 : */
54 :
55 : static const TigerFieldInfo rtE_fields[] = {
56 : // fieldname fmt type OFTType beg end len bDefine bSet
57 : {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
58 : {"FILE", 'L', 'N', OFTInteger, 6, 10, 5, 1, 1},
59 : {"CENID", 'L', 'A', OFTString, 11, 15, 5, 1, 1},
60 : {"POLYID", 'R', 'N', OFTInteger, 16, 25, 10, 1, 1},
61 : {"STATEEC", 'L', 'N', OFTInteger, 26, 27, 2, 1, 1},
62 : {"COUNTYEC", 'L', 'N', OFTInteger, 28, 30, 3, 1, 1},
63 : {"RS_E1", 'L', 'A', OFTString, 31, 35, 5, 1, 1},
64 : {"RS_E2", 'L', 'A', OFTString, 36, 40, 5, 1, 1},
65 : {"PLACEEC", 'L', 'N', OFTInteger, 41, 45, 5, 1, 1},
66 : {"RS-E3", 'L', 'A', OFTString, 46, 50, 5, 1, 1},
67 : {"RS-E4", 'L', 'A', OFTString, 51, 54, 4, 1, 1},
68 : {"RS-E5", 'L', 'A', OFTString, 55, 55, 1, 1, 1},
69 : {"COMMREGEC", 'L', 'N', OFTInteger, 56, 56, 1, 1, 1},
70 : {"RS_E6", 'L', 'A', OFTString, 57, 73, 17, 1, 1}};
71 : static const TigerRecordInfo rtE_info = {
72 : rtE_fields, sizeof(rtE_fields) / sizeof(TigerFieldInfo), 73};
73 :
74 : /************************************************************************/
75 : /* TigerPolygonEconomic() */
76 : /************************************************************************/
77 :
78 0 : TigerPolygonEconomic::TigerPolygonEconomic(
79 0 : OGRTigerDataSource *poDSIn, CPL_UNUSED const char *pszPrototypeModule)
80 0 : : TigerFileBase(&rtE_info, FILE_CODE)
81 : {
82 0 : poDS = poDSIn;
83 0 : poFeatureDefn = new OGRFeatureDefn("PolygonEconomic");
84 0 : poFeatureDefn->Reference();
85 0 : poFeatureDefn->SetGeomType(wkbNone);
86 :
87 : /* -------------------------------------------------------------------- */
88 : /* Fields from type E record. */
89 : /* -------------------------------------------------------------------- */
90 :
91 0 : AddFieldDefns(psRTInfo, poFeatureDefn);
92 0 : }
|