1 : /******************************************************************************
2 : * $Id: tigeroverunder.cpp 10645 2007-01-18 02:22:39Z warmerdam $
3 : *
4 : * Project: TIGER/Line Translator
5 : * Purpose: Implements TigerOverUnder, providing access to .RTU 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: tigeroverunder.cpp 10645 2007-01-18 02:22:39Z warmerdam $");
34 :
35 : #define FILE_CODE "U"
36 :
37 : static TigerFieldInfo rtU_fields[] = {
38 : // fieldname fmt type OFTType beg end len bDefine bSet bWrite
39 : { "MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0, 0 },
40 : { "FILE", 'L', 'N', OFTInteger, 6, 10, 5, 1, 1, 1 },
41 : { "TZID", 'R', 'N', OFTInteger, 11, 20, 10, 1, 1, 1 },
42 : { "RTSQ", 'R', 'N', OFTInteger, 21, 21, 1, 1, 1, 1 },
43 : { "TLIDOV1", 'R', 'N', OFTInteger, 22, 31, 10, 1, 1, 1 },
44 : { "TLIDOV2", 'R', 'N', OFTInteger, 32, 41, 10, 1, 1, 1 },
45 : { "TLIDUN1", 'R', 'N', OFTInteger, 42, 51, 10, 1, 1, 1 },
46 : { "TLIDUN2", 'R', 'N', OFTInteger, 52, 61, 10, 1, 1, 1 },
47 : { "FRLONG", 'R', 'N', OFTInteger, 62, 71, 10, 1, 1, 1 },
48 : { "FRLAT", 'R', 'N', OFTInteger, 72, 80, 9, 1, 1, 1 },
49 : };
50 : static TigerRecordInfo rtU_info =
51 : {
52 : rtU_fields,
53 : sizeof(rtU_fields) / sizeof(TigerFieldInfo),
54 : 80
55 : };
56 :
57 :
58 : /************************************************************************/
59 : /* TigerOverUnder() */
60 : /************************************************************************/
61 :
62 : TigerOverUnder::TigerOverUnder( OGRTigerDataSource * poDSIn,
63 0 : const char * pszPrototypeModule )
64 0 : : TigerPoint(TRUE)
65 : {
66 0 : OGRFieldDefn oField("",OFTInteger);
67 :
68 0 : poDS = poDSIn;
69 0 : poFeatureDefn = new OGRFeatureDefn( "OverUnder" );
70 0 : poFeatureDefn->Reference();
71 0 : poFeatureDefn->SetGeomType( wkbNone );
72 :
73 0 : psRTUInfo = &rtU_info;
74 :
75 0 : AddFieldDefns( psRTUInfo, poFeatureDefn );
76 :
77 0 : }
78 :
79 : /************************************************************************/
80 0 : TigerOverUnder::~TigerOverUnder()
81 0 : {}
82 :
83 0 : int TigerOverUnder::SetModule( const char * pszModule )
84 : {
85 0 : return TigerPoint::SetModule( pszModule, FILE_CODE );
86 : }
87 :
88 0 : OGRFeature *TigerOverUnder::GetFeature( int nRecordId )
89 : {
90 : return TigerPoint::GetFeature( nRecordId,
91 : psRTUInfo,
92 : 62, 71,
93 0 : 72, 80 );
94 : }
95 :
96 0 : OGRErr TigerOverUnder::CreateFeature( OGRFeature *poFeature )
97 : {
98 : return TigerPoint::CreateFeature( poFeature,
99 : psRTUInfo,
100 : 62,
101 0 : FILE_CODE );
102 : }
|