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